$(function(){

    // PLACEHOLDER
	$(".placeholder").focus(function(){
    	if ($(this).attr('title') == $(this).attr('value')){
    		$(this).attr('value','');
		}
	}).blur(function(){
		if ($(this).attr('value') == ''){
			$(this).attr('value',$(this).attr('title'));
		}
	});
	
	// MAPA DO SITE
	$(".rodape_mapa").click(function(){
		obj = $("#mapaSiteContainer");
		
		if (obj.css('display') == 'none'){
			obj.slideDown("slow");
			$.scrollTo("#fimRodape", 800);
			return (false);
		}
		else {
			obj.slideUp("slow");
			$.scrollTo("#fimRodape", 800);
			return (false);
		}
	}).mouseover(function(){
		$(this).css('cursor','pointer');
	})

        

        $("#menuProdutos").hover(
            function () {
                $("#menuProdutos").css('display','block');
        },
            function () {
                $("#menuProdutos").css('display','none');
        });
        

	
});

function atendimento(root_path) {
	window.open(root_path+"/atendimento/index/", "Atendimento", "status=no, width=500, height=500");
}

function validaNews(frm){
	if ((frm.email.value.length < 1) || (frm.email.value == 'Digite seu email...') || (frm.email.value == 'Digite seu email')){
		alert("Preencha seu E-mail.");
		frm.email.focus();
		return (false);
	}
	return (true);
}

function Produtos(action){
	if (action == 'hide'){
		$("#menuProdutos").css("display","none");
	}
	else {
		total = $(window).width();
		total = total - 450;
		total = parseInt(total / 2);
		
		$("#menuProdutos").css("display",'block');
		$("#menuProdutos").css("left",total+'px');
		
		// MENU DE PRODUTOS TOPO
		$("#nivel1 a").mouseover(function(){
			cod = $(this).attr('rel');
			$("#nivel2 ul").css('display','none');
                        $("#nivel3 ul").css('display','none');
			$("#nivel2 #sub_"+cod).css('display','block');
			
			$(this).parent().parent().find('a').removeClass('on');
			$(this).addClass('on');
			
			return (false);
		});
		
		$("#nivel2 a").mouseover(function(){
			cod = $(this).attr('rel');
			$("#nivel3 ul").css('display','none');
			$("#nivel3 #sub_"+cod).css('display','block');
			
			$(this).parent().parent().find('a').removeClass('on');
			$(this).addClass('on');
			
			return (false);
		});
		
	}
	return (false);
}