
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}



  function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
  window.open(theURL,winName,features);
}



function FormataCPF(Campo,teclapres){
	var tecla=teclapres.keyCode;
	var sCaracteres="0123456789";
	var sCaracter=String.fromCharCode(event.keyCode);
	var vr=new String(Campo.value);
	vr=vr.replace(".","");
	vr=vr.replace(".","");
	vr=vr.replace("-","");
	tam=vr.length+1;
	if(tecla !=9 && tecla !=8){
		if(sCaracteres.indexOf(sCaracter)==-1){
			event.returnValue=false;
			return;
		}
		if(tam>3 && tam<7)
			Campo.value=vr.substr(0,3)+'.'+vr.substr(3,tam);
		if(tam>=7 && tam <10)
			Campo.value=vr.substr(0,3)+'.'+vr.substr(3,3)+'.'+vr.substr(6,tam-6);
		if(tam>=10 && tam<12)
			Campo.value=vr.substr(0,3)+'.'+vr.substr(3,3)+'.'+vr.substr(6,3)+'-'+vr.substr(9,tam-9);
	}
}



function FormataCNPJ(Campo,teclapres){
	var tecla=teclapres.keyCode;
	var sCaracteres="0123456789";
	var sCaracter=String.fromCharCode(event.keyCode);
	if(sCaracteres.indexOf(sCaracter)==-1){
		event.returnValue=false;
		return;
	}
	if(event.keyCode==37 || event.keyCode==39 || event.keyCode==16 || event.keyCode==36 || event.keyCode==35){
		event.returnValue=false;
		return;
	}
	var vr=new String(Campo.value);
	vr=vr.replace(".","");
	vr=vr.replace(".","");
	vr=vr.replace("/","");
	vr=vr.replace("-","");
	tam=vr.length+1 ;
	if(tecla !=9 && tecla !=8){
		if(tam>2 && tam<6)
			Campo.value=vr.substr(0,2)+'.'+vr.substr(2,tam);
		if(tam>=6 && tam<9)
			Campo.value=vr.substr(0,2)+'.'+vr.substr(2,3)+'.'+vr.substr(5,tam-5);
		if(tam>=9 && tam<13)
			Campo.value=vr.substr(0,2)+'.'+vr.substr(2,3)+'.'+vr.substr(5,3)+'/'+vr.substr(8,tam-8);
		if(tam>=13 && tam<15)
			Campo.value=vr.substr(0,2)+'.'+vr.substr(2,3)+'.'+vr.substr(5,3)+'/'+vr.substr(8,4)+'-'+vr.substr(12,tam-12);
	}
}
var NUM_DIGITOS_CNPJ=14;
var NUM_DIGITOS_CPF =11;
String.prototype.lpad=function(pSize,pCharPad){
	var str=this;
	var dif=pSize-str.length;
	var ch=String(pCharPad).charAt(0);
	for(;dif>0;dif--)str=ch+str;
	return(str);
}
String.prototype.trim=function(){
	return this.replace(/^\s*/,"").replace(/\s*$/,"");
}




function soNumero(objeto){
	var keypress=event.keyCode;
	var campo=eval(objeto);
	var caracteres='01234567890';
	if((caracteres.indexOf(String.fromCharCode(keypress))!=-1))
		event.returnValue=true;
	else 
		event.returnValue=false;
}



function digitaData(Campo,teclapres){
	var tecla=teclapres.keyCode;
	vr=Campo.value;
	vr=vr.replace(".","");
	vr=vr.replace("/","");
	vr=vr.replace("/","");
	tam=vr.length+1;

	if(tecla !=9 && tecla !=8){
		if(tam>2 && tam<5)
			Campo.value=vr.substr(0,tam-2)+'/'+vr.substr(tam-2,tam);
		if(tam>=5 && tam<=10)
			Campo.value=vr.substr(0,2)+'/'+vr.substr(2,2)+'/'+vr.substr(4,4);}
}

function doCheck3(boleto)    // Verificar o preenchimento

{

 if (document.boleto.ano.value == ""){
alert("Digite sua data de nascimento completa!");
document.boleto.ano.focus();
return false
}
 
 if (!checkVazio(boleto.login,"Campo Identidade Vazio")){
document.boleto.login.focus();
return false
}
 
  
if(!checkVazio(boleto.senha,"Campo CPF/CNPJ Vazio"))
           return false


    	return true
}

function doCheck2(t_senha_webmail)    // Verificar o preenchimento

{



 if (document.t_senha_webmail.form_user.value == "@marinter.com.br"){
alert("Digite seu E-mail completo");
document.t_senha_webmail.form_user.focus();
return false
}
 


 if (!checkVazio(t_senha_webmail.form_user,"Campo E-Mail Vazio")){
document.t_senha_webmail.form_user.value = "@marinter.com.br";
return false
}
 
  
var email=document.t_senha_webmail.form_user.value;
 if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1)
        { alert("Por favor digite seu E-Mail corretamente.");
        document.t_senha_webmail.form_user.value = "@marinter.com.br";
        document.t_senha_webmail.form_user.focus();  
       	return false
		}

if(!checkVazio(t_senha_webmail.form_pw,"Campo Senha Vazio"))
           return false

if(!checkVazio(t_senha_webmail.form_newpw1,"Campo Nova Senha Vazio"))
           return false

if(!checkVazio(t_senha_webmail.form_newpw2,"Campo Confirmação de Senha Vazio"))
           return false

if ((document.t_senha_webmail.form_newpw1.value) != (document.t_senha_webmail.form_newpw2.value)){
alert("O campo Nova Senha e Confirmação da Senha \n Devem ser iguais!");
document.t_senha_webmail.form_newpw1.value = ""
document.t_senha_webmail.form_newpw2.value = ""
document.t_senha_webmail.form_newpw1.focus();
return false
}

var string=document.t_senha_webmail.form_user.value;
posicao = string.indexOf('@', 0)
document.t_senha_webmail.form_user.value = email.substring(0,posicao)


    	return true
}




function doCheck(webmail)    // Verificar o preenchimento

{



 if (document.webmail.login_username.value == "@marinter.com.br"){
alert("Digite seu E-mail completo");
document.webmail.login_username.focus();
return false
}
 


 if (!checkVazio(webmail.login_username,"Campo E-Mail Vazio")){
document.webmail.login_username.value = "@marinter.com.br";
return false
}
 
  
var email=document.webmail.login_username.value;
 if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1)
        { alert("Por favor digite seu E-Mail corretamente.");
        document.webmail.login_username.value = "@marinter.com.br";
        document.webmail.login_username.focus();  
       	return false
		}

if(!checkVazio(webmail.secretkey,"Campo Senha Vazio"))
           return false

var string=document.webmail.login_username.value;
posicao = string.indexOf('@', 0)
document.webmail.login_username.value = email.substring(0,posicao)




    	return true
}


function doCheck_spam(spam)    // Verificar o preenchimento

{



 if (document.spam.login2.value == "@marinter.com.br"){
alert("Digite seu E-mail completo");
document.spam.login2.focus();
return false
}
 


 if (!checkVazio(spam.login2,"Campo E-Mail Vazio")){
document.spam.login_username.value = "@marinter.com.br";
return false
}
 
  
var email=document.spam.login2.value;
 if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1)
        { alert("Por favor digite seu E-Mail corretamente.");
        document.spam.login2.value = "@marinter.com.br";
        document.spam.login2.focus();  
       	return false
		}

if(!checkVazio(spam.senha2,"Campo Senha Vazio"))
           return false

var string=document.spam.login2.value;
posicao = string.indexOf('@', 0)
document.spam.login2.value = email.substring(0,posicao)




    	return true
}


function checkVazio(pCampo,pMsg)
{
	if (pCampo.value == "")
	{
		alert(pMsg);
		pCampo.focus();
		return false
	}
	return true
}

