/* >>> Strings e Máscaras para os campos do valida_tecla<<<*/
numeros   = "0123456789";
emails    = "abcdefghijklmnopqrstuvwxyz_.0123456789";
alfa      = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
alfabeto  = "ãõêâîôûabcdefghijklmnopqrstuvwxyz. ÃÕÂÊÎÛÔABCDEFGHIJKLMNOPQRSTUVWXYZ"
telefones = "()- 0123456789";
letras	  = "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ"

datas     = "  /  /    ";
emailsc   = "@";
barra     = "/";
moeda     = ",";
horas     = "  :  ";
ceps	  = "     -   "
cnpj      = "  .   .   /    -  "
fone	  = "(  )    -    "
/* >>> Fim  <<<*/


function valida_email(campo) {
  if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(campo.value))) {
    alert("Favor informar um email válido.");
	campo.focus();
	return (false);
  }
}

function valida_tecla(obj,str,strone,mask) {
  code = (window.Event) ? event.which : event.keyCode;
  mykey=String.fromCharCode(code);
  if(code==8 || code==9 || code==13) return true;
  if ( ( ( str.indexOf(mykey)==-1 & strone.indexOf(mykey)==-1 ) || 
         ( obj.value.indexOf(mykey)!=-1 & strone.indexOf(mykey)!=-1) )) return false; 
  else {
    tam=obj.value.length;
    submask=mask.substr(tam,mask.length-tam);
    while (submask.indexOf(' ')!=-1 && submask.indexOf(' ')!=0) {
      obj.value=obj.value+submask.charAt(0);
      tam++;
      submask=mask.substr(tam,mask.length-tam);
    }
    if(obj.value.length<mask.length || mask.length==0) return true; 
    else {
      if(obj.value.length>mask.length) obj.value=obj.value.substr(0,mask.length);
      return false;
    }
  }
}


/*--------------------------------------------------------------------------------------------------------------------------------------*/

	function writeFlash(url_root, width, height, bgcolor, version, name) {
		if (version == null || version == ''){
			version = '7,0,0,0';
		}
		document.writeln("<object name='"+name+"' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'");
		document.writeln(" codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+"' ");
		document.writeln(" width='"+width+"' height='"+height+"'> ");
		document.writeln("<param name='movie' value='"+url_root+"'>");
		document.writeln("<param name='quality' value='high'>");
		document.writeln("<param name='menu' value='false'>");
		document.writeln("<param name='bgcolor' value='#"+bgcolor+"'>");
		if (bgcolor == null || bgcolor == 'FFFFFF'){
			document.writeln("<param name='wmode' value='transparent'>");
		}
		document.writeln("<embed src='"+url_root+"' ");
		if (bgcolor == null || bgcolor == 'FFFFFF'){
			document.writeln(" wmode='transparent' ");
		}
		
		document.writeln(" quality='high' bgcolor='#"+bgcolor+"'  width='"+width+"' height='"+height+"' ");
		document.writeln(" type='application/x-shockwave-flash' ");
		document.writeln(" pluginspage='http://www.macromedia.com/shockwav/download/index.cgi?P1_Prod_Version=ShockwaveFlash'");
		document.writeln(" menu='false'>");
		document.writeln("</embed></object>");
	}