/**
 * @author Matheus
 */

jQuery.noConflict();

jQuery(document).ready(function(){




var busca;
	
	jQuery("#buscar").focus(function () {
		if (busca != 1) {
			this.value="";
			busca = 1;
		}
    });
	
	jQuery("#ok").click(function () {
		   	jQuery("#conteudo").fadeOut("slow", function() {
				jQuery("#conteudo").load("resultado_produtos.php?produto="+jQuery("#buscar").val()+"&lng="+jQuery("#lingua_site").val(), function() {
					jQuery("#conteudo").fadeIn("slow");
				});
			});
    });





//jQuery.ga.load("UA-11567825-1");
	jQuery("#tudo").fadeIn("slow", function() {
		if (jQuery("#dados_blog").val() == "") {
			//jQuery("#conteudo").load("home.php?lng="+);
			jQuery("#conteudo").load("home.php?lng="+jQuery("#lingua_site").val());
		} else {
			jQuery("#conteudo").load("produto.php"+jQuery("#dados_blog").val());
		}
		jQuery("#logo").animate({
            	width: "170px"
       		 }, "slow");
		jQuery("#efeito_menu").animate({
            marginLeft: "-10px"
        }, function() {
			jQuery("#efeito_menu").animate({
            	marginLeft: "0px"
       		 }, 300);
		});
	});
	
	jQuery("#logo, .botao_menu, .sub, .subsub, #ok").mouseover(function(){
        jQuery(this).css({ "cursor":"pointer"});
    });
	
	jQuery("#logo").click(function(){
		jQuery("#conteudo").fadeOut("slow", function() {
			jQuery("#conteudo").empty();
			jQuery("#caminho").empty();
			jQuery("#conteudo").load("home.php?lng="+jQuery("#lingua_site1").val(), function() {
				jQuery("#conteudo").fadeIn("slow");
				jQuery(".subsubmenu").animate({
					height: 1
				}, "slow");
			});
		});
        jQuery("#submenu").animate({
            height: "1"
        });
    });    
	
	jQuery("#botao_empresa").click(function(){
		jQuery("#conteudo").fadeOut("slow", function() {
			jQuery("#conteudo").empty();
			jQuery("#caminho").empty();
			jQuery("#caminho").load('caminhos.php?caminho=empresa');
			jQuery("#conteudo").load("empresa.php?lng="+jQuery("#lingua_site").val(), function() {
				jQuery("#conteudo").fadeIn("slow");
				jQuery(".subsubmenu").animate({
					height: 1
				}, "slow");
			});
		});
        jQuery("#submenu").animate({
            height: "1"
        });
    });  
	
    jQuery("#botao_produtos").click(function(){
		tamanho_submenu_final = tamanho_submenu*20;
		var tamanho_submenu_final2 = tamanho_submenu_final+10;
   
            jQuery("#submenu").animate({
                height: tamanho_submenu_final2
            }, "slow").animate({
                height: tamanho_submenu_final
            }, "fast");
        
    });  
	
	jQuery("#botao_midia").click(function(){
		jQuery("#conteudo").fadeOut("slow", function() {
			jQuery("#conteudo").empty();
			jQuery("#caminho").empty();
			jQuery("#caminho").load('caminhos.php?caminho=midia');
			jQuery("#conteudo").load("noticias.php?lng="+jQuery("#lingua_site").val(), function() {
					jQuery("#conteudo").fadeIn("slow");
					jQuery(".subsubmenu").animate({
						height: 1
					}, "slow");
				});
		});
        jQuery("#submenu").animate({
            height: "1"
        });
    });
	
	jQuery("#botao_revendas").click(function(){
		jQuery("#conteudo").fadeOut("slow", function() {
			jQuery("#conteudo").empty();
			jQuery("#caminho").empty();
			jQuery("#caminho").load('caminhos.php?caminho=revendas');
			jQuery("#conteudo").load("revendas.php?lng="+jQuery("#lingua_site").val(), function() {
				jQuery("#conteudo").fadeIn("slow");
				jQuery(".subsubmenu").animate({
					height: 1
				}, "slow");
			});
		});
        jQuery("#submenu").animate({
            height: "1"
        });
    });	
	
	jQuery("#botao_contato").click(function(){
		jQuery("#conteudo").fadeOut("slow", function() {
			jQuery("#conteudo").empty();
			jQuery("#caminho").empty();
			jQuery("#caminho").load('caminhos.php?caminho=contato');
			jQuery("#conteudo").load("contato.php?lng="+jQuery("#lingua_site").val(), function() {
				jQuery("#conteudo").fadeIn("slow");
				jQuery(".subsubmenu").animate({
					height: 1
				}, "slow");
			});
		});
        jQuery("#submenu").animate({
            height: "1"
        });
    });	
	
	});

function efeito_in(submenu) {
	submenu = "#"+submenu;
	if (parseInt(jQuery(submenu).css('marginLeft')) == 250) {
	jQuery(submenu).animate({
        marginLeft: "-7"
    });
	}
}

function efeito_out(submenu) {
	submenu = "#"+submenu;
	jQuery(submenu).animate({
        marginLeft: "250"
    });
}

function efeito_subsub(submenu) {
	subsubmenu = submenu.split('|||||');
	var divsubsub = '#'+subsubmenu[0];
	tamanho_subsubmenu_final = subsubmenu[1]*20;
	jQuery(".subsubmenu").animate({
		height: 1
	}, "slow");
	jQuery(divsubsub).animate({
		height: tamanho_subsubmenu_final
	}, "slow");
	tamanho_submenu_final3 = (subsubmenu[1]*18)+(tamanho_submenu*20);
	var tamanho_submenu_final4 = tamanho_submenu_final3+10;
    jQuery("#submenu").animate({
        height: tamanho_submenu_final4
    }, "slow");
}

function efeito_in2(subsubmenu) {
	subsubmenu = "#"+subsubmenu;
	if (parseInt(jQuery(subsubmenu).css('marginLeft')) == 250) {
	jQuery(subsubmenu).animate({
        marginLeft: "-7"
    });
	}
}

function efeito_out2(subsubmenu) {
	subsubmenu = "#"+subsubmenu;
	jQuery(subsubmenu).animate({
        marginLeft: "250"
    });
}

function clique_subsub(secao, lingua) {
	jQuery("#caminho").empty();
	jQuery("#caminho").load('caminhos.php?caminho=produtos&secao='+secao);
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("produtos.php?secao="+secao+"&lng="+lingua, function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}

function clique_subsub2(secao, lingua) {
	jQuery("#caminho").empty();
	jQuery("#caminho").load('caminhos.php?caminho=produtos&secao='+secao);
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("produtos_grillex.php?secao="+secao+"&lng="+lingua, function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}

function clique_produtos(produto) {
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("produto.php"+produto+"&lng="+jQuery("#lingua_site").val(), function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}

function produ(produto1) {
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("produto.php"+produto1+"&lng="+jQuery("#lingua_site").val(), function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}

function descricao(produto2) {
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("produto.php"+produto2+"&lng="+jQuery("#lingua_site").val(), function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}

function caracteristica(produto3) {
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("produto.php"+produto3+"&lng="+jQuery("#lingua_site").val(), function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}

function detalhes(produto4) {
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("produto.php"+produto4+"&lng="+jQuery("#lingua_site").val(), function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}

function mais_midia(noticia) {
	jQuery("#conteudo").fadeOut("slow", function() {
		jQuery("#conteudo").load("noticias.php?cont="+noticia+"&lng="+jQuery("#lingua_site").val(), function() {
			jQuery("#conteudo").fadeIn("slow");
		});
	});
}
