// JavaScript Document
$(window).load(function() {
	
	$('.hover').hover(function(){
		$(this).fadeTo(250, 0);
	}, function() {
		$(this).fadeTo(250, 1);
	});
	
	$('#noticias p').hover(function(){
		$(this).fadeTo(0, 0.5);
	}, function() {
		$(this).fadeTo(0, 1);
	});
	
	$('#noticias p').click(function(){
		$(this).fadeTo(0, 1);
	});
	
	$('.btn').hover( function(){
		$(this).css({"color":"#747474","background-image":"url(http://www.pesqueirapioneira.com.br/wp-content/themes/pioneira/images/BtnH.png)"});
	},
	function(){
		$(this).css({"color":"#A09F9F","background-image":"url(http://www.pesqueirapioneira.com.br/wp-content/themes/pioneira/images/Btn.png)"});
	});
	
	$(".btn.receitas").click(function () {
		$(".noticiasbox").stop().animate({right:'-650px'},{queue:false,duration:500});
	});
	$(".receitas .btn.voltar").click(function () {
		$(".noticiasbox").stop().animate({right:'0px'},{queue:false,duration:500});
	});
	
	$('.menuitem').hover(function(){
		$(".menubtn", this).stop().animate({top:'0px'},{queue:false,duration:300});
		$(".arrow", this).stop().animate({top:'-24px'},{queue:false,duration:200});
		$(".plus", this).stop().animate({bottom:'-1px'},{queue:false,duration:300});
		$("h3", this).stop().animate({bottom:'-7px'},{queue:false,duration:300});
		$("h4", this).stop().animate({bottom:'-3px'},{queue:false,duration:300});
	}, function() {
		$(".menubtn", this).stop().animate({top:'179px'},{queue:false,duration:300});
		$(".arrow", this).stop().animate({top:'-1px'},{queue:false,duration:300});
		$(".plus", this).stop().animate({bottom:'-24px'},{queue:false,duration:200});
		$("h3", this).stop().animate({bottom:'-120px'},{queue:false,duration:300});
		$("h4", this).stop().animate({bottom:'-116px'},{queue:false,duration:300});
	});
	
	$('.on').hover(function(){
		$(this).fadeTo(250, 1);
	}, function() {
		$(this).fadeTo(250, 0.75);
	});
	
	$(".highlight").click(function () {
		$(".hbig",this).slideToggle(500);
		$(".hsmall",this).slideToggle(500);
		setTimeout(function () {
		myScroll.refresh();
	}, 500);
	});
	
	$('.thumb').hover(function(){
		$(this).fadeTo(250, 1);
	}, function() {
		$(this).fadeTo(250, 0.75);
	});
	
	$('.produtoitem').hover(function(){
		$(this).fadeTo(250, 1);
	}, function() {
		$(this).fadeTo(250, 0.75);
	});
	
	$(".btn.outras").click(function () {
		$(".toggle_other").slideToggle(500);
	});
	
	$('.other .btn').hover(function(){
		$(".block", this).fadeTo(500, 1);
	}, function() {
		$(".block", this).fadeOut("slow", function () {
			$(".block", this).css({display:"none"});
		});
	});
	
	$('#mercado .btn').hover(function(){
		$(".block", this).fadeTo(500, 1);
	}, function() {
		$(".block", this).fadeOut("slow", function () {
			$(".block", this).css({display:"none"});
		});
	});
	
	$('.embarcacoes').hover(function(){
		$(this).fadeTo(250, 0.75);
	}, function() {
		$(this).fadeTo(250, 1);
	});
	
	$(".toggle").click(function () {
		$(".block",this).slideToggle(500);
		setTimeout(function () {
		myScroll.refresh();
	}, 500);
	});
	
	last=".befluentes";
	
	$('.efluentes').hover(function(){
		if (last==".befluentes") {
		}
		else {
			$(last).slideToggle(500);
			$(".befluentes").slideToggle(500);
			last=".befluentes";
		}
	}, function() {
	});
	
	$('.coleta').hover(function(){
		if (last==".bcoleta") {
		}
		else {
			$(last).slideToggle(500);
			$(".bcoleta").slideToggle(500);
			last=".bcoleta";
		}
	}, function() {
	});
	
	$('.destinacao').hover(function(){
		if (last==".bdestinacao") {
		}
		else {
			$(last).slideToggle(500);
			$(".bdestinacao").slideToggle(500);
			last=".bdestinacao";
		}
	}, function() {
	});
	
	$('.edambiental').hover(function(){
		if (last==".bambiental") {
		}
		else {
			$(last).slideToggle(500);
			$(".bambiental").slideToggle(500);
			last=".bambiental";
		}
	}, function() {
	});
	
	$(".btrabalhe").click(function () {
		$(".formbox").stop().animate({right:'-650px'},{queue:false,duration:500});
	});
	
	$(".bcontato").click(function () {
		$(".formbox").stop().animate({right:'0px'},{queue:false,duration:500});
	});
	
	$(".novidades").click(function () {
		$('html, body').animate({ scrollTop: $("#noticias").offset().top }, 750);
		myScroll.scrollToElement('#noticias', 750);
	});
	
	$(".pioneira").click(function () {
		$('html, body').animate({ scrollTop: $("#pioneira").offset().top }, 750);
		myScroll.scrollToElement('#pioneira', 750);
	});
	
	$(".produtos").click(function () {
		$('html, body').animate({ scrollTop: $("#produtos").offset().top }, 750);
		myScroll.scrollToElement('#produtos', 750);
	});
	
	$(".mercado").click(function () {
		$('html, body').animate({ scrollTop: $("#mercado").offset().top }, 750);
		myScroll.scrollToElement('#mercado', 750);
	});
	
	$(".captura").click(function () {
		$('html, body').animate({ scrollTop: $("#captura").offset().top }, 750);
		myScroll.scrollToElement('#captura', 750);
	});
	
	$(".qualidade").click(function () {
		$('html, body').animate({ scrollTop: $("#qualidade").offset().top }, 750);
		myScroll.scrollToElement('#qualidade', 750)
	});
	
	$(".ambiente").click(function () {
		$('html, body').animate({ scrollTop: $("#ambiente").offset().top }, 750);
		myScroll.scrollToElement('#ambiente', 750);
	});
	
	$(".contato").click(function () {
		$('html, body').animate({ scrollTop: $("#contato").offset().top }, 750);
		myScroll.scrollToElement('#contato', 750);
	});
	
	$("#noticias .downbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#home").offset().top }, 750);
		myScroll.scrollToElement('#home', 750);
	});
	
	$("#pioneira .downbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#produtos").offset().top }, 750);
		myScroll.scrollToElement('#produtos', 750);
	});
	
	$("#produtos .downbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#mercado").offset().top }, 750);
		myScroll.scrollToElement('#mercado', 750);
	});
	
	$("#mercado .downbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#captura").offset().top }, 750);
		myScroll.scrollToElement('#captura', 750);
	});
	
	$("#captura .downbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#qualidade").offset().top }, 750);
		myScroll.scrollToElement('#qualidade', 750);
	});
	
	$("#qualidade .downbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#ambiente").offset().top }, 750);
		myScroll.scrollToElement('#ambiente', 750);
	});
	
	$("#ambiente .downbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#contato").offset().top }, 750);
		myScroll.scrollToElement('#contato', 750);
	});
	
	$("#contato .upbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#ambiente").offset().top }, 750);
		myScroll.scrollToElement('#ambiente', 750);
	});
	
	$("#ambiente .upbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#qualidade").offset().top }, 750);
		myScroll.scrollToElement('#qualidade', 750);
	});
	
	$("#qualidade .upbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#captura").offset().top }, 750);
		myScroll.scrollToElement('#captura', 750);
	});
	
	$("#captura .upbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#mercado").offset().top }, 750);
		myScroll.scrollToElement('#mercado', 750);
	});
	$("#mercado .upbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#produtos").offset().top }, 750);
		myScroll.scrollToElement('#produtos', 750);
	});
	
	$("#produtos .upbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#pioneira").offset().top }, 750);
		myScroll.scrollToElement('#pioneira', 750);
	});
	
	$("#pioneira .upbtn").click(function () {
		$('html, body').animate({ scrollTop: $("#home").offset().top }, 750);
		myScroll.scrollToElement('#home', 750);
	});
	
	$(".homebtn").click(function () {
		$('html, body').animate({ scrollTop: $("#home").offset().top }, 750);
		myScroll.scrollToElement('#home', 750);
	});
	
	$(".internationalbtn").hover(function () {
		$('.btn.pt').stop().animate({right:'0px'},{queue:false,duration:250});
		$('.btn.sp').stop().animate({right:'0px'},{queue:false,duration:500});
		$('.btn.en').stop().animate({right:'0px'},{queue:false,duration:750});
		$('.btn.tesp').stop().animate({right:'0px'},{queue:false,duration:250});
		$('.btn.ting').stop().animate({right:'0px'},{queue:false,duration:500});
	}, function() {
		$('.btn.pt').stop().animate({right:'-90px'},{queue:false,duration:250});
		$('.btn.sp').stop().animate({right:'-90px'},{queue:false,duration:500});
		$('.btn.en').stop().animate({right:'-90px'},{queue:false,duration:750});
		$('.btn.tesp').stop().animate({right:'-90px'},{queue:false,duration:250});
		$('.btn.ting').stop().animate({right:'-90px'},{queue:false,duration:500});
	});
	
	$('.btn.pt,.btn.sp,.btn.en,.btn.tesp,.btn.ting').click(function () {
		$('.btn.pt').stop().animate({right:'-90px'},{queue:false,duration:250});
		$('.btn.sp').stop().animate({right:'-90px'},{queue:false,duration:500});
		$('.btn.en').stop().animate({right:'-90px'},{queue:false,duration:750});
		$('.btn.tesp').stop().animate({right:'-90px'},{queue:false,duration:250});
		$('.btn.ting').stop().animate({right:'-90px'},{queue:false,duration:500});
	});
	
	$("#pioneirabrand").click(function () {
		$('html, body').animate({ scrollTop: $("#home").offset().top }, 750);
	});
	
	$("#mobilehome #pioneirabrand").click(function () {
		myScroll.scrollToElement('#home', 750);
	});
	
	$("#pioneiratop").click(function () {
		$('html, body').animate({ scrollTop: $("#home").offset().top }, 750);
		myScroll.scrollToElement('#home', 750);
	});
	
	$('#desktop .send').hover(function(){
		$(".grey", this).fadeTo(250, 0.1);
	}, function() {
		$(".grey", this).fadeTo(250, 0);
	});
	
	$('#menu li').hover(function(){
		$(".grey", this).fadeTo(250, 0.1);
	}, function() {
		$(".grey", this).fadeTo(250, 0);
	});
	
	$('#fast-menu li').hover(function(){
		$(".grey", this).fadeTo(250, 0.1);
	}, function() {
		$(".grey", this).fadeTo(250, 0);
	});
	
	$('#timeline .bullet').hover(function(){
		$(".glow", this).fadeTo(500, 1);
		$(".block", this).fadeTo(500, 1);
	}, function() {
		$(".glow", this).fadeTo(500, 0);
		$(".block", this).fadeOut("slow", function () {
			$(".block", this).css({display:"none"});
		});
	});
	
	lasts=".block.inteiro";
	$(".salef.inteiro").click(function () {
		if (lasts==".block.inteiro") {
			$(".block.inteiro").slideToggle(500);
		}
		else {
			$(lasts).slideToggle(500);
			$(".block.inteiro").slideToggle(500);
		}
	});
	
});

$(document).ready(function() {
	
	$(".thumb a").fancybox({
		'overlayOpacity' : '0.5',
		'padding' : '0',
		'hideOnContentClick' : true,
		'overlayColor' : '#000',
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'titlePosition' : 'over',
		'speedIn' : 350, 
		'speedOut' : 350,
		'showCloseButton' : false
	});
	
});
