// 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='allowFullScreen' value='true' />"+
	 "<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(id) {
	 cpf = document.getElementById(id).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.getElementById(id).focus();
		   return false;
   } else {
		   return true;   
   }

}

//**************************************************************************************************************************************
//validacao CNPJ
 function validaCNPJ(id) {
	 CNPJ = document.getElementById(id).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.getElementById(id).focus();
		   return false;
   //} else {
	//	   alert("CNPJ valido!");
   }
   return true;
}
function validaCNPJIngles(id) {
	 CNPJ = document.getElementById(id).value;
	 erro = new String;
	 if (CNPJ.length < 14) erro += "You must fill correctly the CNPJ number! "; 
	 //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 += "The validation of CNPJ support only numbers! "; 
   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.getElementById(id).focus();
		   return false;
   //} else {
	//	   alert("CNPJ valido!");
   }
   return true;
}
function validaCNPJEspanhol(id) {
	 CNPJ = document.getElementById(id).value;
	 erro = new String;
	 if (CNPJ.length < 14) erro += "Debe usted rellenar correcto el 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 += "La verificación del CNPJ sólo admite 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.getElementById(id).focus();
		   return false;
   //} else {
	//	   alert("CNPJ valido!");
   }
   return true;
}

//**************************************************************************************************************************************

// valdiar e-mail
function validaMAIL(id) {
	if (document.getElementById(id).value == "") {
		alert("O campo e-mail não foi preenchido");
		document.getElementById(id).focus();
		return false;
	} else {
		prim = document.getElementById(id).value.indexOf("@")
		if(prim < 2) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".") < 1) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(" ") != -1) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".@") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("@.") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".com.br.") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("/") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("[") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("]") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("(") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(")") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("..") > 0) {
			alert("O e-mail informado não esta correto.");
			document.getElementById(id).focus();
			return false;
		}
	}
	return true;
}
function validaMAILIngles(id) {
	if (document.getElementById(id).value == "") {
		alert("The space e-mail must be filled out!");
		document.getElementById(id).focus();
		return false;
	} else {
		prim = document.getElementById(id).value.indexOf("@")
		if(prim < 2) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("@",prim + 1) != -1) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".") < 1) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(" ") != -1) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".@") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("@.") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".com.br.") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("/") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("[") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("]") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("(") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(")") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("..") > 0) {
			alert("The e-mail is not completed correctly.");
			document.getElementById(id).focus();
			return false;
		}
	}
	return true;
}
function validaMAILEspanhol(id) {
	if (document.getElementById(id).value == "") {
		alert("El campo correo electrónico debe ser rellenado!");
		document.getElementById(id).focus();
		return false;
	} else {
		prim = document.getElementById(id).value.indexOf("@")
		if(prim < 2) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("@",prim + 1) != -1) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".") < 1) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(" ") != -1) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".@") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("@.") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(".com.br.") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("/") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("[") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("]") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("(") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf(")") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
		if(document.getElementById(id).value.indexOf("..") > 0) {
			alert("El correo electrónico no se completa correctamente.");
			document.getElementById(id).focus();
			return false;
		}
	}
	return true;
}
//**************************************************************************************************************************************

// validar números
function validaNumero(id) {
	var digits="0123456789"
	var temp
	var campo = document.getElementById(id).title;
	
	for (var i=0;i<document.getElementById(id).value.length;i++) {
		temp=document.getElementById(id).value.substring(i,i+1)
		if (digits.indexOf(temp)==-1) {
			alert("O campo " + campo + " deve ser preenchido apenas com números!")
			document.getElementById(id).focus();
			return false;
		}
	}
}
function validaNumeroIngles(id) {
	var digits="0123456789"
	var temp
	var campo = document.getElementById(id).title;
	
	for (var i=0;i<document.getElementById(id).value.length;i++) {
		temp=document.getElementById(id).value.substring(i,i+1)
		if (digits.indexOf(temp)==-1) {
			alert("The space " + campo + " must be filled out only with numbers!")
			document.getElementById(id).focus();
			return false;
		}
	}
}
function validaNumeroEspanhol(id) {
	var digits="0123456789"
	var temp
	var campo = document.getElementById(id).title;
	
	for (var i=0;i<document.getElementById(id).value.length;i++) {
		temp=document.getElementById(id).value.substring(i,i+1)
		if (digits.indexOf(temp)==-1) {
			alert("El campo " + campo + " debe ser rellenado sólo con números!")
			document.getElementById(id).focus();
			return false;
		}
	}
}
//**************************************************************************************************************************************


<!--
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; }
}
//--


// Validação de campos do form de contato
function ValidaCampos(form){
	if(form.nome.value==""){
		alert("Preencha o campo NOME!");
		form.nome.focus(); 
		return false; 
	}
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value))
	{ }
	else
	{  
		alert("Preencha o campo E-MAIL corretamente!");
		form.email.focus();
		return (false);
	}
	
	if(form.telefone.value==""){ 
		alert("Preencha o campo TELEFONE!"); 
		form.telefone.focus(); 
		return false; 
	} 

	if(form.cidade.value==""){ 
		alert("Preencha o campo CIDADE!"); 
		form.cidade.focus(); 
		return false; 
	} 
	
	if(form.estado.value=="selecione"){ 
		alert("Preencha o campo ESTADO!");
		form.estado.focus(); 
		return false; 
	} 
	
	if(form.mensagem.value==""){ 
		alert("Preencha o campo MENSAGEM!"); 
		form.mensagem.focus(); 
		return false; 
	} 

return true; 
}

// Validação de campos do form do seja nosso parceiro
function ValidaCampos2(form){
	if(form.nome.value==""){
		alert("Preencha o campo NOME!");
		form.nome.focus(); 
		return false; 
	}
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value))
	{ }
	else
	{  
		alert("Preencha o campo E-MAIL corretamente!");
		form.email.focus();
		return (false);
	}
	
	if(form.telefone.value==""){ 
		alert("Preencha o campo TELEFONE!"); 
		form.telefone.focus(); 
		return false; 
	} 
	
	if(form.endereco.value==""){ 
		alert("Preencha o campo ENDEREÇO!"); 
		form.endereco.focus(); 
		return false; 
	} 
	
	if(form.numero.value==""){ 
		alert("Preencha o campo NÚMERO!"); 
		form.numero.focus(); 
		return false; 
	} 
	
	if(form.bairro.value==""){ 
		alert("Preencha o campo BAIRRO!"); 
		form.bairro.focus(); 
		return false; 
	} 
	
	if(form.cep.value==""){ 
		alert("Preencha o campo CEP!"); 
		form.cep.focus(); 
		return false; 
	} 

	if(form.cidade.value==""){ 
		alert("Preencha o campo CIDADE!"); 
		form.cidade.focus(); 
		return false; 
	} 
	
	if(form.estado.value=="selecione"){ 
		alert("Preencha o campo ESTADO!");
		form.estado.focus(); 
		return false; 
	} 
	
	if(form.profissao.value==""){ 
		alert("Preencha o campo PROFISSÃO!");
		form.profissao.focus(); 
		return false; 
	} 
	
	if(form.datanascimento.value==""){ 
		alert("Preencha o campo DATA DE NASCIMENTO!");
		form.datanascimento.focus(); 
		return false; 
	} 
		
	if(form.observacoes.value==""){ 
		alert("Preencha o campo OBSERVAÇÕES!"); 
		form.observacoes.focus(); 
		return false; 
	} 

return true; 
}

// Permite digitar apenas números no campo
function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;
    if((tecla > 47 && tecla < 58)) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }
}