// writeObj : embed,object ±â¼ú
function CompilaFlash(arq,largura,altura) {
    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+largura+"' height='"+ altura +"' id='flash' align='middle' VIEWASTEXT>"+
	 "<param name='allowScriptAccess' value='always' />"+
	 "<param name='movie' value='"+ arq +"' />"+
	 "<param name='quality' value='high' />"+
	 "<param name='wmode' value='transparent' />"+
	 "<param name='menu' value='false' />"+
	 "<embed src='"+ arq +"' quality='high' wmode='transparent' menu='false' width='"+largura+"' height='"+ altura +"' name='flash' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>");
}
//-------------------------------------------------------------------------------------------------------------
// funcao escrever titulos
if(typeof sIFR == "function") {
	sIFR.replaceElement(named({sSelector:"h1", sFlashSrc:"swf/sifr-tradegothic.swf", sColor:"#CC3300", sLinkColor:"#CC3300", sBgColor:"#CC3300", sHoverColor:"#CC3300", sWmode:"transparent"}));
};
//var fo = new FlashObject("swf/sifr-tradegothic.swf", "fotester", "300", "300", "8", "#CC3300");
//fo.write("sIFR");

//fim funcao titulos
//-------------------------------------------------------------------------------------------------------------
function MoveVerde(obj){
	obj.style.backgroundColor = '#00BD7B';
}
function MoveAmarelo(obj){
	obj.style.backgroundColor = '#FFD947';
}
function Mout(obj, cor){
	obj.style.backgroundColor = cor;
}
function mostraL(nome) {
	if(document.all[nome].style.display=="none"){
	document.all[nome].style.display = "";
	}else{
	document.all[nome].style.display = "none";}
}

//abre pop up
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

//sem letras
	function SemLetras(){
		if ((window.event.keyCode < 48) | (window.event.keyCode > 57)){
			window.event.keyCode = 0
		}
	}

//pula de campo
	function Pula(f){
		if(f.value.length==f.maxLength){
		for(var i=0;i<f.form.length;i++){
			if(f.form[i]==f){f.form[i+1].focus();break}
			}
		}
	}

//**************************************************************************************************************************************
//validacao CPF
function validaCPF() {
		 cpf = document.form.cpf.value;
		 erro = new String;
		 if (cpf.length == null)erro += "São necessários 11 digitos para verificação do CPF! "; 
		 if (cpf.length < 11)erro += "São necessários 11 digitos para verificação do CPF! "; 
		 var nonNumbers = /\D/;
		 if (nonNumbers.test(cpf)) erro += "A verificação de CPF suporta apenas números! "; 
		 if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999"){
				 erro += "Número de CPF inválido!"
	   }
	   var a = [];
	   var b = new Number;
	   var c = 11;
	   for (i=0; i<11; i++){
			   a[i] = cpf.charAt(i);
			   if (i < 9) b += (a[i] * --c);
	   }
	   if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
	   b = 0;
	   c = 11;
	   for (y=0; y<10; y++) b += (a[y] * c--); 
	   if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
	   if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10])){
				 erro += "Número de CPF inválido!"
	   }
	   if (erro.length > 0){
			   alert(erro);
			   document.form.cpf.value="";
			   document.form.cpf.focus();
			   return false;
	   }

	   return true;
	   

}
//**************************************************************************************************************************************
//validacao CNPJ
 function validaCNPJ() {
		 CNPJ = document.form.cnpj.value;
		 erro = new String;
		 if (CNPJ.length < 14) erro += "É necessario preencher corretamente o número do CNPJ! "; 
		 //if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
		 //if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! ";
		 //}
		 //substituir os caracteres que não são números
	   if(document.layers && parseInt(navigator.appVersion) == 4){
			   x = CNPJ.substring(0,2);
			   x += CNPJ. substring (3,6);
			   x += CNPJ. substring (7,10);
			   x += CNPJ. substring (11,15);
			   x += CNPJ. substring (16,18);
			   CNPJ = x; 
	   } else {
			   CNPJ = CNPJ. replace (".","");
			   CNPJ = CNPJ. replace (".","");
			   CNPJ = CNPJ. replace ("-","");
			   CNPJ = CNPJ. replace ("/","");
	   }
	   var nonNumbers = /\D/;
	   if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! "; 
	   var a = [];
	   var b = new Number;
	   var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
	   for (i=0; i<12; i++){
			   a[i] = CNPJ.charAt(i);
			   b += a[i] * c[i+1];
}
	   if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
	   b = 0;
	   for (y=0; y<13; y++) {
			   b += (a[y] * c[y]); 
	   }
	   if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
	   if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
			   erro +="CNPJ inválido!";
	   }
	   if (erro.length > 0){
			   alert(erro);
			   document.form.cnpj.value="";
			   document.form.cnpj.focus();
			   return false;
	   //} else {
		//	   alert("CNPJ valido!");
	   }
	   return true;
}

//**************************************************************************************************************************************
<!--
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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->

