/*link.click*/
	jQuery(function($) {
		
		$('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability
		
		$('ul.gallery_demo').galleria({
			history   : true, // activates the history object for bookmarking, back-button etc.
			clickNext : true, // helper for making the image clickable
			insert    : '#main_image', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
					image.css('display','none').fadeIn(1000);
				}
				caption.css('display','none').fadeIn(1000);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				image.attr('title','Next image >>');
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
				)
			}
		});
	});
/*link.vip*/
function formata_data(x,tecla){
        separador="/"; // Você pode definir o separador. Ex: "/" ou "-" ou "."        
        tecla=tecla.keyCode; // Identifica a tecla, caso seja backspace
        valor=x.value.split(''); // Pega o valor do campo e transforma cada caractere em uma string
        formatado=""; // Variável para carregar formatação temporariamente
        i=0; // variável de controle
        while(i<valor.length){ // Loop para cada caractere do campo
            caractere=valor[i]; // Seleciona um caractere para ser formatado
            numeros=/^\d+$/; // Variavel contendo números positivos
                // Verifica se é número ou "barra"
            if(numeros.test(caractere) || caractere==separador){ formatado+=String(caractere);}
                // Verifica se precisa de barra, se a tecla for backspace, então a barra não é adicionada
                // Se for para adicionar barra, aumenta ++ variável de controle "i" para pular a barra adicionada
            if((formatado.length==2 || formatado.length==5) && tecla!=8){formatado+=separador; i++;}
                
            i++; // Se houver, passa para o próximo caractere
        }
        x.value=formatado; // Atribui o valor formatado ao campo
    }
function isEmpty(pStrText){
   var   len = pStrText.length;
   var pos;
   var vStrnewtext = "";

   for (pos=0; pos<len; pos++){
      if (pStrText.substring(pos, (pos+1)) != " "){
         vStrnewtext = vStrnewtext + pStrText.substring(pos, (pos+1));
      }
   }

   if (vStrnewtext.length > 0)
      return false;
   else
      return true;
}
function isNumber(numero){
   var CaractereInvalido = false;

   for (i=0; i < numero.length; i++){
      var Caractere = numero.charAt(i);
      if(Caractere != "." && Caractere != "," && Caractere != "-"){
         if (isNaN(parseInt(Caractere))) CaractereInvalido = true;
      }
   }
   return !CaractereInvalido;
} 
function checkMail(text){
    var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    if(typeof(text) == "string"){
        if(er.test(text)){ return true; }
    }else if(typeof(text) == "object"){
        if(er.test(text.value)){
                    return true;
                }
    }else{
        return false;
        }
}
function checkForm(){
   if(isEmpty(document.logincad.nome.value)){
      alert("Por favor preencha seu nome");
      document.logincad.nome.focus();
      return false;
   }

   if(isEmpty(document.logincad.nascimento.value)){
      alert("Por favor preencha sua data de nascimento");
      document.logincad.nascimento.focus();
      return false;
   }

   if(isEmpty(document.logincad.cidade.value)){
      alert("Por favor preencha sua cidade");
      document.logincad.cidade.focus();
      return false;
   }

   if(isEmpty(document.logincad.bairro.value)){
      alert("Por favor preencha seu bairro");
      document.logincad.bairro.focus();
      return false;
   }

   if(!checkMail(document.logincad.email.value)){
      alert("Por favor informe um endereço de e-mail válido");
      document.logincad.email.focus();
      return false;
   }

   if(isEmpty(document.logincad.senha.value)){
      alert("Por favor preencha sua senha");
      document.logincad.senha.focus();
      return false;
   }
   
   return true;
}
function confirmSubmit()
{
var agree=confirm("Confirma seu cadastrao como Usuário VIP?");
if (agree)
	return true ;
else
	return false ;
}