//***********
// MOUSE OVER
//***********
function Swap(id,image){
 document.getElementById(id).src = image;
}

/****
POPUP
*****/
function OpenPopup(arq, width, height, scroll){    
 var URL = arq 
 var W = width 
 var H = height 
 var S = scroll 
 var Wpopupsize =(W/2); 
 var Hpopupsize =(H/2); 
 var CenterPopUpX = (screen.width/2)-(Wpopupsize); 
 var CenterPopUpY = (screen.height/2)-(Hpopupsize); 
 var pos = "left="+CenterPopUpX+",top="+CenterPopUpY; 
 var desktop = window.open( ""+URL, "_blank", "width="+W+",height="+H+",toolbar=no,location=no,status=no,menubar=no,scrollbars="+S+",resizable=no,"+pos); 
} 
/*********
FIM: POPUP
**********/

/**********
PULA CAMPOS
***********/
function ContaTexto(CampoMsg,CampoContador, TamMax){
	if (CampoMsg.value.length > TamMax)
		CampoMsg.value = CampoMsg.value.substring(0, TamMax);
	else
		CampoContador.value = TamMax - CampoMsg.value.length;
}

function exibeValor(nomeCampo, lenCampo, controle){
 if ((nomeCampo.value.length == lenCampo) && (checarTabulacao)){	
 var i=0;
  for (i=0; i<document.forms[0].elements.length; i++){
   if (document.forms[0].elements[i].name == nomeCampo.name){
  while ((i+1) < document.forms[0].elements.length){
   if (document.forms[0].elements[i+1].type != "hidden"){
    document.forms[0].elements[i+1].focus();
  break;}i++;}
  checarTabulacao=false;
  break;
}}}}

function stopTabCheck(nomeCampo){
 checarTabulacao=false;
}

function startTabCheck(){
 checarTabulacao=true;
}
/***************
FIM: PULA CAMPOS
****************/

/*******
PRODUTOS
********/
function AFL(sId){ 
 var num;
 num = setInterval(function(){
 var sDiv = document.getElementById(sId);
 if(sDiv.style.display == "none"){
  sDiv.style.display = "block";
 }else{
  sDiv.style.display = "none";
 }
 clearInterval(num);
 }
 ,100)
}
function AL(sId){ 
 var num;
 num = setInterval(function(){
 var sDiv = document.getElementById(sId);
 sDiv.style.display = "block";
 clearInterval(num);
 }
 ,100)
}

function FL(sId){ 
 var num;
 num = setInterval(function(){
 var sDiv = document.getElementById(sId);
 sDiv.style.display = "none";
 clearInterval(num);
 }
 ,100)
}
/************
FIM: PRODUTOS
*************/

/************
VALIDA EMAILS
*************/
function email_valido(email) {
	var formato_errado = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
	var formato_certo = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
	var errado = new RegExp(formato_errado);
	var certo = new RegExp(formato_certo);
	return (!errado.test(email) && certo.test(email))
}
/*****************
FIM: VALIDA EMAILS
******************/
	

