function Paylean(pAction){

	if(pAction=='Show'){
		$("#Paylean").fadeIn('slow');
		$("#BackgroundBlue").fadeIn('slow');
	}else{
		$("#Paylean").fadeOut('slow');
		$("#BackgroundBlue").fadeOut('slow');
	}
}

function MiniSiteAves2(pAction){

	if(pAction=='Show'){
		$("#MiniSiteAves2").fadeIn('slow');
		$("#BackgroundBlue").fadeIn('slow');
	}else{
		$("#MiniSiteAves2").fadeOut('slow');
		$("#BackgroundBlue").fadeOut('slow');
	}
}

function Lactotropin(pAction){

	if(pAction=='Show'){
		$("#Lactotropin").fadeIn('slow');
		$("#BackgroundBlue").fadeIn('slow');
	}else{
		$("#Lactotropin").fadeOut('slow');
		$("#BackgroundBlue").fadeOut('slow');
	}
}

function HTS(pAction){

	if(pAction=='Show'){
		$("#HTS").fadeIn('slow');
		$("#BackgroundBlue").fadeIn('slow');
	}else{
		$("#HTS").fadeOut('slow');
		$("#BackgroundBlue").fadeOut('slow');
	}
}

function SMV(pAction){

	if(pAction=='Show'){
		$("#SMV").fadeIn('slow');
		$("#BackgroundBlue").fadeIn('slow');
	}else{
		$("#SMV").fadeOut('slow');
		$("#BackgroundBlue").fadeOut('slow');
	}
}

function resultadoEnquete(pAction){

	if(pAction=='Show'){
		$("#resultado_enquete").fadeIn('slow');
		$("#BackgroundBlue").fadeIn('slow');
	}else{
		$("#resultado_enquete").fadeOut('slow');
		$("#BackgroundBlue").fadeOut('slow');
	}
}   



 jQuery(document).ready(function() {

    if ($("#imgBusca")){

        $("#imgBusca").click(function(){
            window.location = '/resultadobusca/?busca=' + $("#busca").val();
        });
    } 
    if ($("#busca")){
    $("#busca").keypress(function(e){
            if (e.which == 13){
            
                window.location = '/resultadobusca/?busca=' + $("#busca").val();
            }
            
        });
     }

    if ($("#BackgroundBlue")){
         $("#BackgroundBlue").animate({opacity: 0.8}, 1500);              
    }
    if($("#enviar_email")){
         $("#enviar_email").click(function() {
              $("#div_enviar").show("slow");
              $("#BackgroundBlue").show("fast");
         });
    }
    if($("#fechar_email")){
         $("#fechar_email").click(function() {
               $("#div_enviar").hide("slow");
               $("#BackgroundBlue").hide("fast");
         });
    }
    if($("#img_enviar_email")){
         $("#img_enviar_email").click(function() {
              $("#div_enviar").show("slow");
              $("#BackgroundBlue").show("fast");
         });
    }
    if($("#imprimir")){
         $("#imprimir").click(function() {
             window.open ("/template/imprimir.aspx","mywindow"); 
         });
    }

    if($("#rss_o_que_e")){
        
        $("#rss_o_que_e").click(function(){
              $("#div_rss_o_que_e").show("slow");
              $("#BackgroundBlue").show("fast");
        });        
    }
    if($("#rss_fechar")){
        
        $("#rss_fechar").click(function(){
              $("#div_rss_o_que_e").hide("slow");
              $("#BackgroundBlue").hide("fast");
        });        
    }




});

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 validaData(str){

var objRegExp = /^(?=\d)(?:(?!(?:(?:0?[5-9]|1[0-4])(?:\.|-|\/)10(?:\.|-|\/)(?:1582))|(?:(?:0?[3-9]|1[0-3])(?:\.|-|\/)0?9(?:\.|-|\/)(?:1752)))(31(?!(?:\.|-|\/)(?:0?[2469]|11))|30(?!(?:\.|-|\/)0?2)|(?:29(?:(?!(?:\.|-|\/)0?2(?:\.|-|\/))|(?=\D0?2\D(?:(?!000[04]|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00))(?:(?:(?:\d\d)(?:[02468][048]|[13579][26])(?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC))))))|2[0-8]|1\d|0?[1-9])([-.\/])(1[012]|(?:0?[1-9]))\2((?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?:$|(?=\x20\d)\x20)))\d{4}(?:\x20BC)?))?$/;
 
  //check to see if in correct format
  if(!objRegExp.test(str))
    return false; //doesn't match pattern, bad date
  else{
    return true;
  }

}



function trocaCorLinha(v_objeto,v_nova_cor){
	v_objeto.style.backgroundColor=v_nova_cor;
}



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}