$(window).load(function(){

    if( $("#footer2").length> 0) {
	  
	   var tam = $(".central").height();
	   
	   if($(".mytabs").length == 0) {
	     $(".central").height(tam+150);
	   }else{
	     $(".central").height(tam-100);
	   }
	
	}

    //rodape
    $("#multiservicos").toggle(function(){
	
	    $(".rodape div").animate({
		 height: '100'
		 }, 500);
		 
		$("#footer2").animate({
		 height: '134'
		 }, 500);
	
	}, function() {
        
	   $(".rodape div").animate({
		 height: '0'
	   }, 500);
	   
	   $("#footer2").animate({
		 height: '30'
		 }, 500);
		
    });
	
	//carrossel
	var cyrcleOptions = {
	    	fx: 'scrollLeft',
			speed: 'slow',
			timeout: 6000,
			pager:  '#controle'
			/*cleartypeNoBg : 'true'  */
	};
	
	if($('.slideshow').length > 0) {
	  $('.slideshow').cycle(cyrcleOptions);
	}
	

	//buscar
	var valor = $('#search').val();
	
	$('#search').focus(function(){
			     if($('#search').val() == valor)
				 $('#search').val("");
			  });
			  
	$('#search').blur(function(){
			     if($('#search').val() == "")
				 $('#search').val(valor);
	});
	

	//menu
	$("#supermenu li a").hover(function(){
	
	  local = $(this).attr("rel");
	  
	  $(".lista").each(function(){
		     $(this).css({"display":"none"});
	  });
	  
	  if(local != "") {
		 $("#"+local).css({"display":"block"});
	  }
	  
	});
	
	$(".lista").mouseleave(function(){
	   
	   var myid = $(this).attr('id');
	   
	   $("#"+myid).css({"display":"none"});
	
	});
	
	$("#content").mouseleave(function(){
	     $(".lista").each(function(){
		     $(this).css({"display":"none"});
	     });
	});
	

		// When a link is clicked
		$("li a.tab").click(function () {

			// switch all tabs off
			$(".active").removeClass("active");
			
			// switch this tab on
			$(this).addClass("active");
			
			var indice = $("li a.tab").index($(this));
			
			// slide all content up
			$(".textos").slideUp();
			$(".banners").slideUp();
			
		
			$(".textos").eq(indice).slideDown();
			$(".banners").eq(indice).slideDown();
		  
		});

	
		$("a.thumb").colorbox();
		
		$("#produtoGG img").css({'cursor':'pointer'});
	
	    $("#espe").click(function(){
		      
			  var imagem = $("#produtoGG img").attr('src');
			  
		      $.colorbox({href:imagem});
		});
 


});
