jQuery(document).ready(function() {

	jQuery("a[rel^='prettyPhoto']").prettyPhoto();
	
	// TVOncoville
	jQuery('.ultimo-video li').hide();
	jQuery('.ultimo-video li').eq(0).fadeIn();
	jQuery('#thumb-videos li').eq(0).addClass('ativo');
	jQuery('#thumb-videos li').click(function() {
		jQuery('#thumb-videos li').removeClass('ativo');
		jQuery(this).addClass('ativo');
		var id = parseInt(jQuery(this).attr('id'));
		jQuery('.ultimo-video li').hide();
		jQuery('.ultimo-video #'+id).fadeIn();
	});
	
	jQuery("#search-box-header").focus(function() {
		var valor = jQuery(this).val();
		if (valor == 'Digite aqui a sua busca' || valor == '')
		jQuery(this).val('');
	});
				
	jQuery("#search-box-header").blur(function() {
		var valor = jQuery(this).val();
		if (valor == 'Digite aqui a sua busca' || valor == '')
		jQuery(this).val('Digite aqui a sua busca');
	});
	
	jQuery("#newsbox").focus(function() {
		var valor = jQuery(this).val();
		if (valor == 'Digite aqui o seu email' || valor == '')
		jQuery(this).val('');
	});
				
	jQuery("#newsbox").blur(function() {
		var valor = jQuery(this).val();
		if (valor == 'Digite aqui o seu email' || valor == '')
		jQuery(this).val('Digite aqui o seu email');
	});
	
	
	
	jQuery(".wpcf7-text").focus(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui o seu nome' || valor == '')
		jQuery(this).val('');
	});
				
	jQuery(".wpcf7-text").blur(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui o seu nome' || valor == '')
		jQuery(this).val('digite aqui o seu nome');
	});
	
	jQuery(".wpcf7-text").focus(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui o seu email' || valor == '')
		jQuery(this).val('');
	});
				
	jQuery(".wpcf7-text").blur(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui o seu email' || valor == '')
		jQuery(this).val('digite aqui o seu email');
	});
		
	jQuery(".wpcf7-text").focus(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui o seu assunto' || valor == '')
		jQuery(this).val('');
	});
				
	jQuery(".wpcf7-text").blur(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui o seu assunto' || valor == '')
		jQuery(this).val('digite aqui o seu assunto');
	});

	jQuery(".mensagem").focus(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui a sua mensagem' || valor == '')
		jQuery(this).val('');
	});
				
	jQuery(".mensagem").blur(function() {
		var valor = jQuery(this).val();
		if (valor == 'digite aqui a sua mensagem' || valor == '')
		jQuery(this).val('digite aqui a sua mensagem');
	});
	
	/**
	 * Encapsula as strings em tags <span> no menu de dicas
	 */

	var str = [
		"aos Pacientes",
		"Profissionais de Saúde",
		"Vida Saudável",
		"Contra o Câncer"
	];

	jQuery(".menu-dicas li a").each(function() {
		var e = jQuery(this);
        for (i in str) {
			e.html(e.html().replace(str[i], '<span>'+str[i]+'</span>'));
		}
	});
	
	//Destaque home
		jQuery('.boxgrid.slideright').hover(function(){
			$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
		}, function() {
			jQuery(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
		});

		jQuery('.boxgrid.caption').hover(function(){
			jQuery(".cover", this).stop().animate({top:'120px'},{queue:false,duration:160});
		}, function() {
			jQuery(".cover", this).stop().animate({top:'140px'},{queue:false,duration:160});
		});

	jQuery('ul.menu li').hover(
		function(){
			jQuery(this).children().slideDown(1500);
		}, function (){
			jQuery(this).children('ul').stop(true,true).slideUp(1500);
		});
	});
