// JavaScript Document 


$(document).ready(function() {
	$('.sub-menu li:last-child').css('background', 'url(http://www.telmart.com.br/nvsite/wp-content/themes/telmart-theme/img/submenu_bot.png)','height','36px' );
	
	$(".menu li a").hover(function() { //When trigger is clicked...
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find(".sub-menu").slideDown("normal").show(); //Drop down the subnav on click
		$(this).parent().hover(function() {
		}, function(){
			$(this).find(".sub-menu").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});
	
	});	
		
	$("#quad1").hover(function() {
		$(this).animate( { 
		
			width:140,
			marginLeft: -20,
			marginTop: -20

		}, 150);
		
	}, function() {
		$(this).stop().animate( { 
		
			width:102,
			marginLeft: 0,
			marginTop: 0

		}, 300);
	});
	
	$("#quad2").hover(function() {
		$(this).animate( { 
		
			width:140,
			marginLeft: -20,
			marginTop: -20

		}, 150);
		
	}, function() {
		$(this).stop().animate( { 
		
			width:102,
			marginLeft: 0,
			marginTop: 0

		}, 300);
	});
	
	$("#quad3").hover(function() {
		$(this).animate( { 
		
			width:140,
			marginLeft: -20,
			marginTop: -20

		}, 150);

	}, function() {
		$(this).stop().animate( { 
		
			width:102,
			marginLeft: 0,
			marginTop: 0

		}, 300);
	});
	
	$("#quad4").hover(function() {
		$(this).animate( { 
		
			width:140,
			marginLeft: -20,
			marginTop: -20

		}, 150);
		
	}, function() {
		$(this).stop().animate( { 
		
			width:102,
			marginLeft: 0,
			marginTop: 0

		}, 300);
		

	});
	
	$("#quad5").hover(function() {
		$(this).animate( { 
		
			width:140,
			marginLeft: -20,
			marginTop: -20

		}, 150);

	}, function() {
		$(this).stop().animate( { 
		
			width:102,
			marginLeft: 0,
			marginTop: 0

		}, 300);
	});

});


function animeol() {

		$('#quad1').animate( { 
		
			width:140,
			marginLeft: -20,
			marginTop: -20

		}, 100)
		.animate( { 
		
			width:102,
			marginLeft: 0,
			marginTop: 0

		}, 150 ,function() {
			$('#quad2').animate( { 
		
				width:140,
				marginLeft: -20,
				marginTop: -20
	
			}, 100)
			.animate( { 
			
				width:102,
				marginLeft: 0,
				marginTop: 0
	
			}, 125 , function() {
				$('#quad3').animate( { 
		
					width:140,
					marginLeft: -20,
					marginTop: -20
		
				}, 100)
				.animate( { 
				
					width:102,
					marginLeft: 0,
					marginTop: 0
		
				}, 100 , function() {
					$('#quad4').animate( { 
			
						width:140,
						marginLeft: -20,
						marginTop: -20
			
					}, 100)
					.animate( { 
					
						width:102,
						marginLeft: 0,
						marginTop: 0
			
					}, 75 , function() {
						$('#quad5').animate( { 
		
							width:140,
							marginLeft: -20,
							marginTop: -20
				
						}, 100)
						.animate( { 
						
							width:102,
							marginLeft: 0,
							marginTop: 0
				
						}, 50);
						
					});
					
				});
				
			});
		});
		
		

}
	

function resImg () {
	
	 
	 /* if (alt_jan>600) { 
		  $(".bghome").css("bottom","0px");
	   } else {
		   $(".bghome").css("bottom", (alt_jan-700)+"px");
	   };*/
	   
	   
	   
	  if (window.innerWidth) { var larg_jan = window.innerWidth;
	  } else { var larg_jan = document.documentElement.clientWidth; };
	  if (window.innerHeight) { var alt_jan = window.innerHeight;
	  } else { var alt_jan = document.documentElement.clientHeight; };
	  
	  var bordasl = larg_jan-998;
	  var bordal = bordasl/2;
	 
	 
	  if (larg_jan>=998) { 	 
		  
		 
		  if (alt_jan<=700) {
		   		$(".conteudo_cont").css("left", (bordal+212)+"px");
				$(".conteudo_cont").css("width", (769+bordal)+"px");
				$(".conteudo_cont").css("height", "720px");
		  } else {
			    $(".conteudo_cont").css("width", (751+bordal)+"px");
				$(".conteudo_cont").css("left", (bordal+247)+"px");
				$(".conteudo_cont").css("height", (alt_jan-40)+"px");
		  }
	   
	  } else {

		  if (alt_jan<=768) {
			  $(".conteudo_cont").css("left", "230px");
			  $(".conteudo_cont").css("height", "769px");
		  } else {
			  $(".conteudo_cont").css("left", "230px");
			 $(".conteudo_cont").css("height", "100%");
		  }
	  };
	  
	  
	  $(".cct_cont").css("height", (alt_jan-380)+"px").jScrollPane({
		showArrows: true,
		verticalArrowPositions: 'os',
		horizontalArrowPositions: 'os'
   
      });

};

/*
$(function() {    
	var zIndexNumber = 1000;    
	$('div, .menu').each(function() { 
			$(this).css('zIndex', zIndexNumber);        
			zIndexNumber -= 10;
			
	});
}); 
*/

jQuery(document).ready(function () {
   //add class active for the first image of slideshow
  // $("#slideshow img:first").addClass("active");
    //call the slideshow for every 5 seconds
  //  setInterval("slideshow()", 5000);
	
	setInterval("animeol()", 12000);
	


});

/*
function slideshow() {
  var $active = $("#slideshow .active");
  var $next = ($("#slideshow .active").next().length > 0) ? $("#slideshow .active").next() : $("#slideshow img:first");
  $active.fadeOut('fast', function(){
	   $active.removeClass("active");
	   $next.fadeIn('fast').addClass("active");
  });
}
*/

function enviardados(){
	
	if(document.formcont.nome.value=="")
	{
	alert( "Preencha campo NOME corretamente!" );
	document.formcont.nome.focus();
	return false;
	}
	
	if( document.formcont.email.value=="" || document.formcont.email.value.indexOf('@')==-1 || document.formcont.email.value.indexOf('.')==-1 )
	{
	alert( "Preencha campo E-MAIL corretamente!" );
	document.formcont.email.focus();
	return false;
	}
	
	if (document.formcont.mensagem.value=="")
	{
	alert( "Preencha o campo MENSAGEM!" );
	document.formcont.mensagem.focus();
	return false;
	}
	
    alert("Seu email foi enviado com sucesso!");	
	return true;
	

}

