$('document').ready(function(){
	
	//function player(){
		$(".player .carregando").hide();
		//01
		function tela01(){
			$(".player .img01a").animate({
				opacity: "1",
				left: "-=50px"
				}, 1000 );
			
			$(".player .img01b").animate({
				opacity: '1',
				left: '-=50px'
				}, 600, function() {
					$(".player .img01d").animate({
					opacity: '1',
					top: '-=20px'
					}, 600 );
			});
			
			$(".player .img01c").animate({
				opacity: '1'
				}, 1000, function() {
					$(".player .tit01a").animate({
					opacity: '1',
					top: '-=20px'
					}, 400 );
					
					$(".player .tit01b").animate({
					opacity: '1',
					top: '-=20px'
					}, 600, function() {
					
						$(".player #tela01 .navegacao").animate({
						opacity: '1',
						top: '-=20px'
						}, 600 );
					});
			});
		}
		//
		
		//02
		function tela02(){
			$(".player .img02a").animate({
			opacity: '1'
			}, 800, function() {
				$(".player .tit02a").animate({
				opacity: '1',
				top: '-=20px'
				}, 400 );
				
				$(".player .tit02b").animate({
				opacity: '1',
				top: '-=20px'
				}, 600, function() {
				
					$(".player #tela02 .navegacao").animate({
					opacity: '1',
					top: '-=20px'
					}, 600 );
				});
			});
		}		
		//
		
		//03
		function tela03(){
			$(".player .img03a").animate({
			opacity: '1'
			}, 800, function() {
				$(".player .tit03a").animate({
				opacity: '1',
				top: '-=20px'
				}, 400 );
				
				$(".player .tit03b").animate({
				opacity: '1',
				top: '-=20px'
				}, 600, function() {
				
					$(".player #tela03 .navegacao").animate({
					opacity: '1',
					top: '-=20px'
					}, 600 );
				});
			});
		}
		//
		
		//04
		function tela04(){
			$(".player .img04a").animate({
			opacity: '1',
			left: '-=50px'
			}, 400, function() {
				$(".player .img04b").animate({
					opacity: '1',
					top: "-=20px"
					}, 600, function() {					
						$(".player .tit04a").animate({
						opacity: '1',
						top: '-=20px'
						}, 400 );
						
						$(".player .tit04b").animate({
						opacity: '1',
						top: '-=20px'
						}, 600, function() {
						
							$(".player #tela04 .navegacao").animate({
							opacity: '1',
							top: '-=20px'
							}, 600 );
						});					
				});
			});
		}
		//
		
		//05
		function tela05(){
			$(".player .img05a").animate({
			top: '+=126px'
			}, 400, function() {
				$(".player .img05b").animate({
					opacity: '1',
					top: "78px"
					}, 600, function() {					
						$(".player .img05c").animate({
						opacity: '1'
						}, 400 );
						
						$(".player .tit05a").animate({
						opacity: '1',
						top: '-=20px'
						}, 400);
						
						$(".player .tit05b").animate({
						opacity: '1',
						top: '-=20px'
						}, 600, function() {
					
							$(".player #tela05 .navegacao").animate({
							opacity: '1',
							top: '-=20px'
							}, 600 );
						});							
				});
			});
		}
		//
		
		//06
		function tela06(){
			$(".player .img06a").animate({
				opacity: "1",
				left: "-=50px"
				}, 600 );
			
			$(".player .img06b").animate({
				opacity: '1',
				left: '-=50px'
				}, 800, function() {					
					$(".player .tit06a").animate({
						opacity: '1',
						top: '-=20px'
						}, 400 );
						
						$(".player .tit06b").animate({
						opacity: '1',
						top: '-=20px'
						}, 600, function() {
						
							$(".player #tela06 .navegacao").animate({
							opacity: '1',
							top: '-=20px'
							}, 600 );
						});
					});
				$(".player .img06c").animate({
					opacity: '1'
					}, 600 );
		}
		//
		
		//07
		function tela07(){
			$(".player .img07a").animate({
			opacity: '1'
			}, 800, function() {
				$(".player .tit07a").animate({
				opacity: '1',
				top: '-=20px'
				}, 400 );
				
				$(".player .tit07b").animate({
				opacity: '1',
				top: '-=20px'
				}, 600, function() {
				
					$(".player #tela07 .navegacao").animate({
					opacity: '1',
					top: '-=20px'
					}, 600 );
				});
			});
		}
		//
		
		//08
		function tela08(){
			$(".player .img08a").animate({
			opacity: '1'
			}, 800, function() {
				$(".player .tit08a").animate({
				opacity: '1',
				top: '-=20px'
				}, 400 );
				
				$(".player .tit08b").animate({
				opacity: '1',
				top: '-=20px'
				}, 600, function() {
				
					$(".player #tela08 .navegacao").animate({
					opacity: '1',
					top: '-=20px'
					}, 600 );
				});
			});
		}
		//
		
		//08
		function tela09(){
			$(".player .img09a").animate({
			opacity: '1'
			}, 800, function() {
				$(".player .tit09a").animate({
				opacity: '1',
				top: '-=20px'
				}, 400 );
				
				$(".player .tit09b").animate({
				opacity: '1',
				top: '-=20px'
				}, 600, function() {
				
					$(".player #tela09 .navegacao").animate({
					opacity: '1',
					top: '-=20px'
					}, 600 );
				});
			});
		}
		//
		
		//reset
		function telasresets(){
			$(".player img").css({opacity: "0", left: "", top: ""});
			$(".player .img01d").css({opacity: "0", left: "", top: ""});
			$(".player a").css({opacity: "0", left: "", top: ""});
			$(".player a img").css({opacity: "1"});
			$(".player .navegacao").css({opacity: "0", top: ""});
			$(".player .img05a").css({opacity: ""});
		}
		//
		
		//Navegacao
		$(".player .proximo").click(function(){
			id = $(this).attr("lang");			
			$(this).parent().parent().animate({left: "-=930px"}, 600, function() {
				$(this).hide();
				$(this).css("left", "0px");
				$("#"+id).show();
				
				//start
				if(id=="tela01"){tela01();}
				if(id=="tela02"){tela02();}
				if(id=="tela03"){tela03();}
				if(id=="tela04"){tela04();}
				if(id=="tela05"){tela05();}
				if(id=="tela06"){tela06();}
				if(id=="tela07"){tela07();}
				if(id=="tela08"){tela08();}
				if(id=="tela09"){tela09();}
				
				//reset
				telasresets();

			});
			
		});
		
		$(".player .anterior").click(function(){											  
			id = $(this).attr("lang");			
			$(this).parent().parent().animate({left: "+=930px"}, 600, function() {
				$(this).hide();
				$(this).css("left", "0px");
				$("#"+id).show();
				
				//start
				if(id=="tela01"){tela01();}
				if(id=="tela02"){tela02();}
				if(id=="tela03"){tela03();}
				if(id=="tela04"){tela04();}
				if(id=="tela05"){tela05();}
				if(id=="tela06"){tela06();}
				if(id=="tela07"){tela07();}
				if(id=="tela08"){tela08();}
				if(id=="tela09"){tela09();}
				
				//reset
				telasresets();
				
			});
		});
		
		tela01();
	//}
	
	$(".menu-behavioral li").click(function(){
		id = $(this).attr("lang");
		$(".texto span").hide();
		$("#"+id).show();
		$(".menu-behavioral li").removeClass("selecionado");
		$(this).addClass("selecionado")
	});
	
	$(".menu-email li").click(function(){
		id = $(this).attr("lang");
		$(".texto span").hide();
		$("#"+id).show();
		$(".menu-email li").removeClass("selecionado");
		$(this).addClass("selecionado")
	});
	
	$(".logos li").click(function(){
		id = $(this).attr("lang");
		$(".texto div").hide();
		$(".texto div.logos").show();
		$(".texto div.area").show();
		$("#"+id).show();
		$(".logos li").removeClass("selecionado")
		$(this).addClass("selecionado")
	});
	
	$(".logos .proximo").click(function(){										
		if($(".logos .area ul").css("margin-left")!="-960px"){
			$(".logos .area ul").animate({marginLeft: "-=30px"}, 300);
		}
	});
	
	$(".logos .anterior").click(function(){
		if($(".logos .area ul").css("margin-left")!="0pt" && $(".logos .area ul").css("margin-left")!="0px"){
			$(".logos .area ul").animate({marginLeft: "+=30px"}, 300);
		}
	});
	
	$('input[type=text][title]').bind('focus', function (event) {
		if ($(this).val() == $(this).attr('title')){
			$(this).val('');
		}
	}).bind('blur', function (event) {
		if ($(this).val() == ''){
			$(this).val($(this).attr('title'));
		}
	});
	
	$('.menu li').hover(function(){
		$(this).children('div').show();
	}, function(){
		$(this).children('div').hide();
	});
	
	/*Menu*/
	$('.accordion .pri').click(function(){
		$('.accordion .pri').removeClass('active');
		$(this).addClass('active');
	});
	
	jQuery.fn.initMenu = function() {
		return this.each(function(){
		var theMenu = $(this).get(0);
		$('.acitem', this).hide();
		$('li.expand > .acitem', this).show();
		$('li.expand > .acitem', this).prev().addClass('active');
		$('li a', this).click(
		function(e) {
		e.stopImmediatePropagation();
		var theElement = $(this).next();
		var parent = this.parentNode.parentNode;
		if($(parent).hasClass('noaccordion')) {
		if(theElement[0] === undefined) {
		window.location.href = this.href;
		}
		$(theElement).slideToggle('normal', function() {
		if ($(this).is(':visible')) {
		$(this).prev().addClass('active');
		}
		else {
		$(this).prev().removeClass('active');
		}
		});
		return false;
		}
		else {
		if(theElement.hasClass('acitem') && theElement.is(':visible')) {
		if($(parent).hasClass('collapsible')) {
		$('.acitem:visible', parent).first().slideUp('normal',
		function() {
		$(this).prev().removeClass('active');
		}
		);
		return false;
		}
		return false;
		}
		if(theElement.hasClass('acitem') && !theElement.is(':visible')) {
		$('.acitem:visible', parent).first().slideUp('normal', function() {
		$(this).prev().removeClass('active');
		});
		theElement.slideDown('normal', function() {
		//$(this).prev().addClass('active');
		});
		return false;
		}
		}
		}
		);
		});
	};
	$('.accordion').initMenu();

	$(".banner ul li").click(function(){
		$(".banner ul li").removeClass("on");
		$(this).addClass("on");
		
		if($(this).html()=="1"){
			$(".banner .fase").animate({
				left: 0,
			  }, 800 );
		}else if($(this).html()=="2"){
			$(".banner .fase").animate({
				left: -930,
			  }, 800 );
		}else if($(this).html()=="3"){
			$(".banner .fase").animate({
				left: -1860,
			  }, 800 );
		}else if($(this).html()=="4"){
			$(".banner .fase").animate({
				left: -2790,
			  }, 800 );
		}
	});
	
	function muda(){
		
		if($(".banner ul li.on").html()=="1"){
			$(".banner ul li").removeClass("on");
			$(".banner ul li#2").addClass("on");
			
			$(".banner .fase").animate({
				left: -930,
			  }, 800 );
			
		}else if($(".banner ul li.on").html()=="2"){
			$(".banner ul li").removeClass("on");
			$(".banner ul li#3").addClass("on");
			
			$(".banner .fase").animate({
				left: -1860,
			  }, 800 );
			
		}else if($(".banner ul li.on").html()=="3"){
			$(".banner ul li").removeClass("on");
			$(".banner ul li#4").addClass("on");
			
			$(".banner .fase").animate({
				left: -2790,
			  }, 800 );
			
		}else if($(".banner ul li.on").html()=="4"){
			$(".banner ul li").removeClass("on");
			$(".banner ul li#1").addClass("on");
			
			$(".banner .fase").animate({
				left: 0,
			  }, 800 );
			
		}	
	}
	
	setInterval(muda,13000);
	
});

