$(document).ready(function(){

  //SHOW CALCULATOR	
  $("#showCalc, #showCalc2").click(function(){
	  $('html, body').animate({scrollTop: '0px'}, 300);
	  $("#calcdrag").delay(800).fadeIn(200);	
  });
  
  //CLOSE CALCULATOR	
  $("#close").click(function() {
	  $("#calcdrag").hide().css({'top':50,'left':50});
  });
    
  //BOX DICAS
  $(".openboxdicas").click(function(){		
	  var titulo = $(this).attr("title");
	  $("#mcs1_container #tituloser").html(titulo);		
	  $("#mcs1_container").fadeIn(200);		
  });
  $("#mcs1_container #closebox").click(function(){
	  $("#mcs1_container").hide();
  });
  
  //BOX SERVICOS
  $(".openboxserv").click(function(){
	  var titulo = $(this).attr("title");
	  $("#mcs2_container #tituloser").html(titulo);		
	  $("#mcs2_container").fadeIn(200);
  });
  $("#mcs2_container #closebox").click(function(){
	  $("#mcs2_container").hide();
  });	

  //BOX OFERTAS
  $(".openboxofertas").click(function(id){
	  var titulo = $(this).attr("title");
	  var img = $(this).attr("name");
	  $("#mcs3_container #imgofertas").html("<img src='imagens/ofertas/g"+img+"' />");
	  $("#mcs3_container #tituloser").html(titulo);
	  $("#mcs3_container").fadeIn(200);
  });
  $("#mcs3_container #closebox").click(function(){
	  $("#mcs3_container").hide();
  });

  //CONTROLA INPUTS FOCUS
  $(".custominp input[type=text], .custominp textarea").focus(function(){
	  $(this).css({'background-color': '#FFFFCC','color':'#000'});
  }).focusout(function(){
	  $(this).css({'background-color': '#F7F7F7','color':'#B7B7B7'});
  });  
		
});

//SHOW INFO PROFISSIONAIS
function showinfoclick(x){
	  $(".showinfo"+x).toggle();
}

//SHOW INPUT HINT
function showResult(str){	
	document.getElementById("livesearch").style.display="block";
	
	if (str.length==0){
		document.getElementById("livesearch").style.display="none";
		document.getElementById("livesearch").innerHTML="";		
		return;
	}
	
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById("livesearch").innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","livesearch.php?q="+str,true);
	xmlhttp.send();
}
