$(document).ready(function() {
	var divmulher = $('div#mulher');
	var contleft = $('div#conteudowrapper div#conteudoleft');
	var submenuleft = $('div#submenu-left');
	var conteudo = $('div#conteudowrapper div#conteudo');
	var submenu = $('ul#submenu-modelos');
	
	function onResize() {
		// Coloco a altura do divmulher em 100% - top do divmulher
		// dessa forma a mulher nunca fica cortada antes da página
		// acabar.
		var height = Math.max($(window).height(), $(document).height());
		var width = $(window).width();
		divmulher.height(height - divmulher.position().top);
		
		if(conteudo.hasClass('mini')) {
			contleft.width((width - 820)/2);
			contleft.height(conteudo.height());
		} else {
			contleft.width((width - conteudo.width())/2);
			contleft.height(conteudo.height());
		}
		
		submenuleft.width((width - 225)/2);
	};
	
	$(window).resize(onResize);
	
	onResize();
	$('#submenu-right li a').mouseenter(function() {
		$(this).css({background: '#bab8b8', color: '#FFFFFF'});
	}).mouseleave(function() {
		$(this).removeAttr('style');
	});
	var submenu = $('#submenu-modelos');
	var ativo = $('a#modelos').hasClass('ativo');
	
	if(ativo==true) {
		submenu.css({opacity:1});
		submenu.height(40);
	} else {
		submenu.fadeOut();
			$('#menu #modelos,#submenu-right div').mouseenter(function() {
			submenu.css({opacity: 1});
			submenu.stop().animate({height: 40}, 250);
		}).mouseleave(function() {
				submenu.stop().fadeOut(function() {submenu.height(0);});
		});

	}
	$('#menu #modelos').click(function(e) {
		e.preventDefault();
		ativo = true;
	});

	

});
