$(function()
{
	var IE6 = false /*@cc_on || @_jscript_version <= 5.7 @*/;
	
	$(".n1").each(function(){ 
			var el = $('#' + $(this).attr('id') + ' ul:eq(0)');
			var $int;
			
			$(this).hover(function(){ 
					el.show();
			}, function(){ 
					el.hide();
			});
			
			$('li', this).hover(function(){
					$('ul', this).show();
			}, function(){ 
					$('ul', this).hide();
			});
	
	}); 
	
	if(IE6){
		//$(".opcaosub").css({"margin":"0", "padding":"0"});
		$(".opcaosub").mouseover(function(){
			$(this).css({"background-color":"#333"});
			$('a:eq(0)',this).css({"color":"yellow"});
		});
		$(".opcaosub").mouseout(function(){
			$(this).css({"background-color":""});
			$('a:eq(0)',this).css({"color":"white"});
		});
		$(".menu ul").each(function(){ 
			$('li:last',this).css({border:'none'});
		});
	}
	//////////////////////////////////
});

function carregaEstados(){
	$.post('../includes/getEstados.php.htm', '', function(retorno){
		$("#slctEstados").html(retorno);
	});
}
function carregaCidades(uf){
	$.post('../includes/getCidades.php.htm', {uf:uf}, function(retorno){
		$("#slctCidades").html(retorno);
	});
}

function insereFlash(filename,name,largura,altura){
			AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', largura,
			'height', altura,
			'src', 'a',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'a',
			'bgcolor', '#ffffff',
			'name', 'a',
			'menu', 'true',
			'allowScriptAccess','sameDomain',
			'movie', filename,
			'salign', ''); //end AC code
	
}

function vFormFaleConosco(){
	$("#msg").show();
	$("#msg").html("Enviando...");
		
	$err	 	= "";
	$enviarPara = $("#enviarPara").val();
	$nome		= $("#txtnome").val();
	$email		= $("#txtemail").val();
	$telefone	= $("#txttelefone").val();
	$mensagem	= $("#txtmensagem").val();
	
	
	if($nome==""){
		$err += "- Informe seu nome <br>";
	}
	
	if($email==""){
		$err += "- Informe seu email <br>";
	}
	
	if($mensagem==""){
		$err += "- Digite a mensagem <br>";
	}
	
	if($err!=""){
		$("#msg").html("<div style='color:red; font-size:11px'><b>Erro(s) encontrado(s):</b> <br><br>" + $err + "</div>");
		posicionaRodape();
	}else{
		$.post("faleconosco_enviaremail.php",$("#faleConosco").serialize(),
			function(retorno){
				if(retorno=="1"){
					$("#msg").html("<div style='color:#57a01d; font-size:11px; font-weight:bold'>Mensagem enviada com sucesso!</div>");
					posicionaRodape();
					$("#faleConosco")[0].reset();
				}else{
					$("#msg").html("<div style='color:red; font-size:11px; font-weight:bold'>Erro ao enviar a mensagem!</div>");
					posicionaRodape();
				}
			}
		);
	}
	return false;
}

function posicionaRodape(){
	altura = parseInt($(".box").height()+$(".box").offset().top+20);
	if(altura<600){
		altura = 610;

		$(".box")
		.css({"height":520})
		.show();
	}
	
	
	
	$("#rodape")
	.css({"top":altura,"display":"block"})
	.show();
	
}

$(document).ready(function(){
	//$("#rodape").show();
});
