
function slide2(){
	$('.banner').empty().append('<div class="loader"></div>').load('slide3.html', function(){
		$('.loader').fadeOut();
		$('#celulite').animate({left:145, width:'show', height:'show'},500,'easeOutBack');
		$('#reju').animate({ width:'show', height:'show'},800,'easeOutBack');
		$('#flacidez').animate({bottom:15, width:'show', height:'show'},800, 'easeOutBack');	
		setTimeout("slide1()",10000);
	})
}
/*
function slide2(){
	
	$('.banner').empty().append('<div class="loader"></div>').load('slide2.html', function(){
		$('.loader').fadeOut();
		if (jQuery.support.opacity){
			$('#antera').animate({right:20, opacity:'show'},500,'easeOutBack');
		} else {
			$('#antera').slideDown().animate({right:20},500, 'easeOutBack');
		}
		$('#olho').animate({width:'show', height:'show'},800,'easeOutBack');
		
	if (jQuery.support.opacity){		
		$('#aparelho').animate({bottom:15, opacity:'show'},800, 'easeOutBack');	
	} else {
		$('#aparelho').animate({bottom:15, width:'show', height:'show'},800, 'easeOutBack');	
	}
		
		if (jQuery.support.opacity){
			$('#baseline').delay(300).animate({bottom:60, opacity:'show'},500);
		} else {
			$('#baseline').delay(300).slideDown().animate({bottom:60},500, 'easeOutBack');		
		}
	
	setTimeout("slide1()",10000);
			
	})
}*/

function slide1(){
	
  	$('.banner img').fadeOut('slow');

	$('.banner').empty().append('<div class="loader"></div>').load('slide1.html', function(){
	
		$('.loader').fadeOut();
		if (jQuery.support.opacity){
			$('#titulo').animate({top:180, opacity:'show'},500, 'easeOutBack');
		} else {
			$('#titulo').slideDown().animate({top:180},500);
		}
			
		$('#aparelho1, #aparelho2').animate({width:'show', height:'show'},800,'easeOutBack');
		
		if (jQuery.support.opacity){
			$('#texto').delay(300).animate({bottom:60, opacity:'show'},500);
		} else {
			$('#texto').delay(300).slideDown().animate({bottom:60},500);		
		}

	setTimeout("slide2()",10000);		
		
	});		

} 


$(function(){
	
var cache = [];
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }	
  
jQuery.preLoadImages("img/animacao/hertix/hertix-bg.png","img/animacao/hertix/reju.png","img/animacao/hertix/celulite.png","img/animacao/hertix/flacidez.png","/img/animacao/aparelho1.png", "/img/animacao/aparelho2.png", "/img/animacao/siberian.png", "/img/animacao/texto.png");  
	
	$('.banner').empty().append('<div class="loader"></div>');
	setTimeout("slide1()",5000);

	$('#slider').tinycarousel({display:2});	
	
	$('#busca').fadeTo('slow',0.7);
	
	$('#busca').hover(function(){
		$(this).stop().fadeTo('normal', 1);
	}, function(){
		$(this).stop().fadeTo('slow', 0.5);
	})
	
$('.menu-sup li').hover(function(){
	$(this).children('ul').slideDown();
}, function(){
	$(this).children('ul').hide();
})
	
  //tabela imc
	$("table.imc tbody tr:odd").addClass("odd");
	$("table.imc tbody tr:even").addClass("even");	
	
	
	$('.peeling img').hover(function(){
		this.src = this.src.replace("pre","pos");					 
	 }, function(){
		this.src = this.src.replace("pos","pre");					 
	 })	
	
	
 $('input, textarea').focus(function(){
    if ($(this).val()===$(this).attr('placeholder'))
    {
     $(this).val('');
    }
   });    
	
 $('li ul li a').css('color','#fff');
	
	
//------------------------FORMULÁRIO	
  
  $('input, textarea, input[type=search]').blur(function(){
    if ($(this).val()==='')
    {
     $(this).val($(this).attr('placeholder'));
    }
   }); 	
	
$('#form_avaliacao').submit(function(){
	if (email == ''){
		alert("Preencha um e-mail.");	
	}
	return false;
})
	
$('#form-contato').submit(function(){
		var nome = $("#nome").val();
		var email = $("#email").val();
		var telefone = $("#telefone").val();
		var msg= $("#msg").val();
		if (nome!='' & email!='' & msg!='')
		{
			$('.loading').show();
			$('form')[1].reset();
			$('#form-contato').fadeTo("slow", 0.5);					
			$.post("envia_contato.php",{nome: nome, email:email, msg:msg, telefone:telefone},
				function(retorno){
					$('.loading').fadeOut();
					$('#resposta').html(retorno).delay(4000).fadeOut();;
					$('#form-contato').fadeTo("slow", 1);					
			}) 
		}else{
					alert("Existem campos incompletos no formulário. Favor preencher todos.");
					return false;
		}
		return false;
})

})



//-------------------------------FUNÇÕES RAW JS
  function initialize() {
    var latlng = new google.maps.LatLng(-27.636300,-52.271030);
    var myOptions = {
      zoom: 16,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("mapa"), myOptions);
    
    var marker = new google.maps.Marker({
      position: latlng,
      map: map,
      title: 'Clínica Rigo',
      icon: 'img/marker.png'
    });   
   }


	function somente_numero(campo)
	{
		var digits="0123456789."
		var campo_temp 
		for (var i=0;i<campo.value.length;i++)
		{
			campo_temp=campo.value.substring(i,i+1) 
			if (digits.indexOf(campo_temp)==-1)
			{
				campo.value = campo.value.substring(0,i);
			}
		}
	}
	
	function calcula_IMC()
	{
		var peso = document.calculo.peso.value;
		var altura = document.calculo.altura.value;
		if (peso =='' || peso==0){
			alert('Entre com o valor do peso.');
			peso.focus();
			return false;
		}
		
		if (altura =='' || altura==0){
			alert('Entre com o valor da altura.');
			altura.focus()
			return false;
		}
	}	




