function calcHeight()
{
	//find the height of the internal page
	var the_height=document.getElementById('capa').contentWindow.document.body.scrollHeight;
	//alert('the_height - '+the_height);
	//change the height of the iframe
	document.getElementById('capa').style.height=the_height;
}
function ajustaTamanhoIframe(nome, nomeDivIframe, nomeDivIframeSecundaria)
{
	var1=nome;
	var2=nomeDivIframe;
	var3=nomeDivIframeSecundaria;
	setTimeout("ajustaTamanhoIframeGenerico(var1, var2, var3)",500);
	//ajustaTamanhoPainelControle();
}

function ajustaTamanhoIframeGenerico(nome, nomeDivIframe, nomeDivIframeSecundaria)
{
		iframe = parent.document.getElementById(nome);
		//alert(iframe);
		//alert('nomeDivIframe - '+nomeDivIframe+' | nomeDivIframeSecundaria - '+nomeDivIframeSecundaria);
		if ( iframe.contentDocument ) { // DOM
		//alert('1');
			if (iframe.contentDocument.getElementById(nomeDivIframe)!=null)
			{
			//alert('1.1');
			    div = iframe.contentDocument.getElementById(nomeDivIframe);
			}
			else
			{
			//alert('1.2');
				if (iframe.contentDocument.getElementById(nomeDivIframeSecundaria)!=null)
				{
			//alert('1.3');
					div = iframe.contentDocument.getElementById(nomeDivIframeSecundaria);
				}
			}
		    
		} else if ( iframe.contentWindow ) { // IE win
		//alert('2');
			if (iframe.contentWindow.document.getElementById(nomeDivIframe)!=null)
			{
			    div = iframe.contentWindow.document.getElementById(nomeDivIframe);
			}
			else
			{
				if (iframe.contentWindow.document.getElementById(nomeDivIframeSecundaria)!=null)
				{
					div = iframe.contentWindow.document.getElementById(nomeDivIframeSecundaria);
				}
			}
		  //  div = iframe.contentWindow.document.getElementById(nomeDivIframe);
		}
/*
		if (nomeDivIframe=='conteudo')
		{
			alert(iframe.offsetHeight);
		 	alert(iframe.contentWindow.document.body.scrollHeight);
		 	alert(div.offsetHeight);
		 //	alert(div.contentWindow.document.body.scrollHeight);
		 }
	*/	
	    iframe.style.height =div.offsetHeight+10;
}

function ajustaTamanhoDivGenerico(nome, nomeDivTamanhoVaria, nomeDivPai)
{
		iframe = parent.document.getElementById(nome);
		//alert(iframe);
		//alert('nomeDivIframe - '+nomeDivIframe+' | nomeDivIframeSecundaria - '+nomeDivIframeSecundaria);
		if ( iframe.contentDocument ) { // DOM
		//alert('1');
			if (iframe.contentDocument.getElementById(nomeDivTamanhoVaria)!=null)
			{
			//alert('1.1');
			    divVaria = iframe.contentDocument.getElementById(nomeDivTamanhoVaria);
			    divPai = iframe.contentDocument.getElementById(nomeDivPai);
			}
		    
		} else if ( iframe.contentWindow ) { // IE win
		//alert('2');
			if (iframe.contentWindow.document.getElementById(nomeDivTamanhoVaria)!=null)
			{
			    divVaria = iframe.contentWindow.document.getElementById(nomeDivTamanhoVaria);
			    divPai = iframe.contentWindow.document.getElementById(nomeDivPai);
			}
		  //  div = iframe.contentWindow.document.getElementById(nomeDivIframe);
		}
/*
		if (nomeDivIframe=='conteudo')
		{
			alert(iframe.offsetHeight);
		 	alert(iframe.contentWindow.document.body.scrollHeight);
		 	alert(div.offsetHeight);
		 //	alert(div.contentWindow.document.body.scrollHeight);
		 }
	*/	
		alert('divPai.offsetHeight - '+divPai.offsetHeight);
		alert('divVaria.offsetHeight - '+divVaria.offsetHeight);
		//alert(divVaria.contentWindow.document.body.scrollHeight);
	    divPai.height+=divVaria.offsetHeight;
}

function ajustaTamanhoPainelControleIframe()
{
	setTimeout("ajustaTamanhoPainelControle();",1);
	//ajustaTamanhoPainelControle();
}
function ajustaTamanhoPainelControle()
{
	ajustaTamanhoPainelControle(false);
}
function ajustaTamanhoPainelControle(editorHtml)
{
	var capa='';
	var formCapa='';
	var colunamenuinterna='';
	var iframe=0;
	
	if (document.getElementById("capa")!=null)
	{
	
		capa = document.getElementById("capa");
		formCapa = document.formCapa;
		colunamenuinterna = document.getElementById("colunamenuinterna");
		//alert('aqui1');
	}
	
	else
	{
		if (parent.document.getElementById("capa")!=null)
		{
			capa = parent.document.getElementById("capa");
			formCapa = parent.document.formCapa;
			colunamenuinterna = parent.document.getElementById("colunamenuinterna");
			//alert('aqui2');
			iframe=1;
		}
		else
		{
			capa = parent.parent.document.getElementById("capa");
			formCapa = parent.parent.document.formCapa;
			colunamenuinterna = parent.parent.document.getElementById("colunamenuinterna");
			iframe=1;
			//alert('aqui3');
			//alert('aqui');
		}
	}
	
	var alturaMiolo=0,alturaMenu=0,altura=0;alturaMenuOriginal=formCapa.tamanhoMenuOriginal.value;
	capa.height = 0;
	alturaMiolo =  capa.contentWindow.document.body.scrollHeight;
	//parent.document.getElementById("capa").offsetHeight;
	alturaMenu = colunamenuinterna.offsetHeight;
//	alert(testaVersaoBrowser());
/*
	if (testaVersaoBrowser()=='firefox')
	{
		if(document.body != null){
			alturaMenu = document.body.scrollHeight-100;
		}else{
			alturaMenu = parent.document.body.scrollHeight-100;
		}
	}
	*/
	//alert(document.body.scrollHeight+'aop colunamenuinterna = '+document.getElementById("colunamenuinterna").offsetHeight  +' | altura - '+altura+' | alturaMiolo - '+alturaMiolo+' | alturaMenu - '+alturaMenu+' altuura menu -'+document.getElementById("colunamenuinterna").offsetHeight+' | tam menu original - '+alturaMenuOriginal);
	if (alturaMiolo>alturaMenu)
	{
		altura = alturaMiolo;
		//alert('1');
	}
	else
	{
		if ((alturaMiolo < alturaMenu) && (alturaMenu<alturaMenuOriginal))
		{
			altura = alturaMenuOriginal;
		//alert('2');
		}
		else
		{
			altura = alturaMenu;
		//alert('3');
		}
	}
	if (editorHtml==true)
	{
		if (alturaMenu<alturaMenuOriginal && alturaMenuOriginal>alturaMiolo)
		{
			altura = alturaMenuOriginal;
		}
	}
	
//	alert('alturaMiolo - '+alturaMiolo+' | alturaMenu - '+alturaMenu+' | alturaMenuOriginal - '+alturaMenuOriginal+' | altura - '+altura);
	
	//if (alturaMenu)
	//menuinterna
	//alert(document.body.scrollHeight+'aop colunamenuinterna = '+document.getElementById("colunamenuinterna").offsetHeight  +' | altura - '+altura+' | alturaMiolo - '+alturaMiolo+' | alturaMenu - '+alturaMenu+' altuura menu -'+document.getElementById("colunamenuinterna").offsetHeight+' | tam menu original - '+alturaMenuOriginal);
	//document.getElementById( "colunamenuinterna" ).style.heigh = 'auto';
	//alert(iframe);
	var alturaFrame=0,frame;
	//alert('sda');
	if (iframe==1)
	{
		//alert('iframeinterno - '+document.getElementById("iframeinterno"));
		//alert('parent.iframeinterno - '+parent.document.getElementById("iframeinterno"));
		if (document.getElementById("iframeinterno")!=null)
		{
			frame = document.getElementById("iframeinterno");
			//alert('iframeinterno');
		}
		else
		{
			if (parent.document.getElementById("iframeinterno")!=null)
			{
				frame = parent.document.getElementById("iframeinterno");
				//alert('parent.iframeinterno');
			}
		}
		/*
		var iframeEl = capa;
		if ( iframeEl.contentDocument ) { // DOM
		    var form = iframeEl.contentDocument.getElementById('iframeinterno');
		    
		} else if ( iframeEl.contentWindow ) { // IE win
		    var form = iframeEl.contentWindow.document.getElementById('iframeinterno');
		}
		if ( form.contentDocument ) { // DOM
		    alert("form.contentDocument.height - "+form.contentDocument.body.scrollHeight);
		    
		} else if ( form.contentWindow ) { // IE win
		    alert("form.contentWindow.document.body.scrollHeight - "+form.contentWindow.document.body.scrollHeight );
		}		
		*/
		if (frame!=null)
		{
			//alert(frame.offsetHeight);
			//alert(frame.offsetHeight);
			//alert('frame.style.height - '+frame.style.height);
			//alert(frame.contentWindow.document.body.scrollHeight);
			alturaFrame = frame.contentWindow.document.body.scrollHeight;
			frame.height=alturaFrame;
			if (altura<alturaFrame)
			{
				altura=alturaFrame+alturaMiolo;
			}
		}
		//alert('1');
		//parent.colunamenuinterna.style.height = altura+'px';
		//parent.capa.height = altura+'px';
	}
			//alert('/altura - '+altura+'/alturaFrame - '+alturaFrame+'/(altura+alturaFrame) - '+(altura+alturaFrame));
			//alert('/altura - '+altura);
			//alert('alturaMiolo - '+alturaMiolo+' | alturaMenu - '+alturaMenu+' | alturaMenuOriginal - '+alturaMenuOriginal+' | altura - '+altura);
	colunamenuinterna.style.height = (altura)+'px';
	capa.height = (altura)+'px';
}
function ajustaTamanhoPainelControleInterno(editorHtml)
{
	var capa='';
	var formCapa='';
	var colunamenuinterna='';
	if (document.getElementById("capa")!=null)
	{
	
		capa = document.getElementById("capa");
		formCapa = document.formCapa;
		colunamenuinterna = document.getElementById("colunamenuinterna");
		
	}

	else
	{
		capa = parent.document.getElementById("capa");
		formCapa = parent.document.formCapa;
		colunamenuinterna = parent.document.getElementById("colunamenuinterna");
	}
	
	var alturaMiolo=0,alturaMenu=0,altura=0;alturaMenuOriginal=formCapa.tamanhoMenuOriginal.value;
	capa.height = 0;
	alturaMiolo =  capa.contentWindow.document.body.scrollHeight;
	//parent.document.getElementById("capa").offsetHeight;
	alturaMenu = colunamenuinterna.offsetHeight;
//	alert(testaVersaoBrowser());
	if (testaVersaoBrowser()=='firefox')
	{
		alturaMenu = document.body.scrollHeight-100;
	}
	//alert(document.body.scrollHeight+'aop colunamenuinterna = '+document.getElementById("colunamenuinterna").offsetHeight  +' | altura - '+altura+' | alturaMiolo - '+alturaMiolo+' | alturaMenu - '+alturaMenu+' altuura menu -'+document.getElementById("colunamenuinterna").offsetHeight+' | tam menu original - '+alturaMenuOriginal);
	if (alturaMiolo>alturaMenu)
	{
		altura = alturaMiolo;
		//alert('1');
	}
	else
	{
		if ((alturaMiolo < alturaMenu) && (alturaMenu<alturaMenuOriginal))
		{
			altura = alturaMenuOriginal;
		//alert('2');
		}
		else
		{
			altura = alturaMenu;
		//alert('3');
		}
	}
	if (editorHtml==true)
	{
		if (alturaMenu<alturaMenuOriginal && alturaMenuOriginal>alturaMiolo)
		{
			altura = alturaMenuOriginal;
		}
	}
	
//	alert('alturaMiolo - '+alturaMiolo+' | alturaMenu - '+alturaMenu+' | alturaMenuOriginal - '+alturaMenuOriginal+' | altura - '+altura);
	
	//if (alturaMenu)
	//menuinterna
	//alert(document.body.scrollHeight+'aop colunamenuinterna = '+document.getElementById("colunamenuinterna").offsetHeight  +' | altura - '+altura+' | alturaMiolo - '+alturaMiolo+' | alturaMenu - '+alturaMenu+' altuura menu -'+document.getElementById("colunamenuinterna").offsetHeight+' | tam menu original - '+alturaMenuOriginal);
	//document.getElementById( "colunamenuinterna" ).style.heigh = 'auto';
	colunamenuinterna.style.height = altura+'px';
	capa.height = altura+'px';
}


function ajustaAlturaIframe(nomeFrame)
{
	//find the height of the internal page
	var the_height= document.getElementById(nomeFrame).contentWindow.document.body.scrollHeight;
	//change the height of the iframe
	//alert(the_height);
	//alert(nomeFrame);
	document.getElementById(nomeFrame).height= the_height;
	//alert(document.getElementById(nomeFrame).height);
	
}
function testando(nomeFrame)
{
	//find the height of the internal page
	var the_height= parent.document.getElementById(nomeFrame).contentWindow.document.body.scrollHeight;
	return the_height;
	
}

function retornarAlturaIframe(nomeFrame)
{
	//find the height of the internal page
	
	var the_height= document.getElementById(nomeFrame).contentWindow.document.body.scrollHeight;
	if(testaVersaoBrowser() == 'firefox'){
		the_height = the_height-20;
	}
	return the_height;
	
}

function testaVersaoBrowser()
{
<!-- 
if(window.XMLHttpRequest)
{
if(window.ActiveXObject)
{
return 'ie7';
}
else
{
return 'firefox';
// Opera, Safari, Firefox
}
}
else
{
return 'ie6';
//IE 6 and below
}
}


function retornaUltimoCaracterDigitado (texto){
var ret='';
if (texto.length>0)
{
	ret=texto.substring((texto.length-1),texto.length);
}
//alert("texto - "+texto+ "ret - "+ret);
return ret;
}


function Mascara (formato, event, objeto){
//var KeyID = event.charCode+' : '+event.keyCode+' : '+String.fromCharCode(event.keyCode)+" opa ="+String.fromCharCode(event.charCode ? event.charCode : event.keyCode);; 
//alert(KeyID);


var charCode = (event.charCode) ? event.charCode : event.keyCode;
//alert("charCode - "+charCode+" String.fromCharCode(charCode) - "+String.fromCharCode(charCode));
var carac = String.fromCharCode(charCode);
campo = eval (objeto);
//alert(campo.value);
// cep
if (formato=='cep'){
separador1 = '.'; 
conjunto1 = 2;
separador2 = '-';
conjunto2 = 6;
//alert('carac - '+carac+' / separador1 - '+separador1);
if ((campo.value.length == conjunto1) && (carac!=separador1))
  {
  campo.value = campo.value + separador1;
  }
if ((campo.value.length == conjunto2)  && (carac!=separador2))
{
	campo.value = campo.value + separador2;
}
if (campo.value.length==10)
  {
	 // alert(campo.value.length);
  	campo.value=campo.value.substring(0,(campo.value.length-1));
  }
}
//alert(formato+' tam = '+campo.value.length+' cpf = '+document.formpedido.tipo.value);
 // cnpj
if (formato=='cnpj'){
separador1 = '.'; 
separador2 = '-'; 
separador3 = '/'; 
conjunto1 = 2;
conjunto2 = 6;
conjunto3 = 10;
conjunto4 = 15;
if ((campo.value.length == conjunto1) && (carac!=separador1))
  {
  campo.value = campo.value + separador1;
  }
if ((campo.value.length == conjunto2) && (carac!=separador1))
  {
  campo.value = campo.value + separador1;
  }
if ((campo.value.length == conjunto3) && (carac!=separador3))
  {
  campo.value = campo.value + separador3;
  }
if ((campo.value.length == conjunto4) && (carac!=separador2))
  {
  campo.value = campo.value + separador2;
  }
  if (campo.value.length==18)
  {
	 // alert(campo.value.length);
  	campo.value=campo.value.substring(0,(campo.value.length-1));
  }
}
// cpf
if (formato=='cpf'){
separador1 = '.'; 
separador2 = '-'; 
conjunto1 = 3;
conjunto2 = 7;
conjunto3 = 11;
if ((campo.value.length == conjunto1) && (carac!=separador1))
  {
  campo.value = campo.value + separador1;
  }
if ((campo.value.length == conjunto2) && (carac!=separador1))
  {
  campo.value = campo.value + separador1;
  }
if ((campo.value.length == conjunto3) && (carac!=separador2))
  {
  campo.value = campo.value + separador2;
  }
  
  if (campo.value.length==14)
  {
	 // alert(campo.value.length);
  	campo.value=campo.value.substring(0,(campo.value.length-1));
  }
}
//alert(campo.value);

// nascimento
if (formato=='nascimento'){
separador = '/'; 
conjunto1 = 2;
conjunto2 = 5;
if (campo.value.length == conjunto1)
  {
  campo.value = campo.value + separador;
  }
if (campo.value.length == conjunto2)
  {
  campo.value = campo.value + separador;
  }
}

// telefone
if (formato=='telefone'){
separador1 = '(';
separador2 = ')';
separador3 = '-';
conjunto1 = 0;
conjunto2 = 4;
conjunto3 = 9;
if ((campo.value.length == conjunto1) && (carac!=separador1)){
campo.value = campo.value + separador1;
}
if ((campo.value.length == conjunto2) && (carac!=separador2)){
campo.value = campo.value + separador2;
}
if ((campo.value.length == conjunto3) && (carac!=separador3)){
campo.value = campo.value + separador3;
}
}


}



var n;
var p,sel;
var p1;
function ValidatePhone(){
p=p1.value
if(p.length==2){
//d10=p.indexOf('(')
pp=p;
d4=p.indexOf('(')
d5=p.indexOf(')')
if(d4==-1){
pp="("+pp;
}
if(d5==-1){
pp=pp+")";
}
//pp="("+pp+")";
sel.value="";
sel.value=pp;
}
if(p.length>2){
d1=p.indexOf('(')
d2=p.indexOf(')')
if(d2==-1){
l30=p.length;
p30=p.substring(0,4);
//alert(p30);
p30=p30+")"
p31=p.substring(4,l30);
pp=p30+p31;
//alert(p31);
sel.value="";
sel.value=pp;
}
}
if(p.length>5){
p11=p.substring(d1+1,d2);
if(p11.length>3){
p12=p11;
l12=p12.length;
l15=p.length
//l12=l12-3
p13=p11.substring(0,3);
p14=p11.substring(3,l12);
p15=p.substring(d2+1,l15);
sel.value="";
pp="("+p13+")"+p14+p15;
sel.value=pp;
//obj1.value="";
//obj1.value=pp;
}
l16=p.length;
p16=p.substring(d2+1,l16);
l17=p16.length;
if(l17>3&&p16.indexOf('-')==-1){
p17=p.substring(d2+1,d2+5);
p18=p.substring(d2+5,l16);
p19=p.substring(0,d2+1);
//alert(p19);
pp=p19+p17+"-"+p18;
sel.value="";
sel.value=pp;
//obj1.value="";
//obj1.value=pp;
}
}
//}
setTimeout(ValidatePhone,100)
}
function ValidaTelefone(m){
n=m.name;
sel=m;
//p1=document.forms[0].elements[n]
p1=m
ValidatePhone()
}
function testphone(obj1){
p=obj1.value
//alert(p)
p=p.replace("(","")
p=p.replace(")","")
p=p.replace("-","")
p=p.replace("-","")
//alert(isNaN(p))
if(isNaN(p)==true){
alert("Verifique o número do telefone");
return false;
}
}
// End -->

function mudarFoco(obj1, obj2Foco)
{
p=obj1.value;
//alert(obj1.value+' tam '+p.length+' obj2Foco '+obj2Foco.value);

if (p.length==5)
{
	obj2Foco.focus();
}

}

function Ajusta_Data(input, evnt){
 //Ajusta máscara de Data e só permite digitação de números
 	if (input.value.length == 2 || input.value.length == 5){
 		if(navigator.appName.indexOf('Microsoft') != -1){
 			input.value += "/";
 		}else{
 			if(evnt.keyCode == 0){
 				input.value += "/";
 			}
 		}
 	}
 //Chama a função Bloqueia_Caracteres para só permitir a digitação de números
 	return Bloqueia_Caracteres(evnt);
 }
 
 function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
 
 
function Bloqueia_Caracteres(evnt){
 //Função permite digitação de números
 	if (navigator.appName.indexOf('Microsoft') != -1){
// alert(evnt.keyCode);
 		if (evnt.keyCode < 48 || evnt.keyCode > 57){
 			return false
 		}
 	}else{
 //alert(evnt.charCode);
 		if ((evnt.charCode < 48 || evnt.charCode > 57) && evnt.keyCode == 0){
 			return false
 		}
 	}
 }


	function Verifica_Cep(cep, obrigatorio){
 //Se o parâmetro obrigatório for igual à zero, significa que elepode estar vazio, caso contrário, não
 	var cep    = document.getElementById(cep);
 	var strcep = cep.value;
 	if((obrigatorio == 1) || (obrigatorio == 0 && strcep != "")){
 		if (strcep.length != 9){
 			alert("CEP informado inválido.");
 			cep.focus();
 			return false
 		}else{
 			if (strcep.indexOf("-") != 5){
 				alert("Formato de CEP informado inválido.");
 				cep.focus();
 				return false
 			}else{
 				if (isNaN(strcep.replace("-","0"))){
 					alert("CEP informado inválido.");
 					cep.focus();
 					return false
 				}
 			}
 		}
 	}	  
 }



function fabrewin()//paginaPagamentoVisa),paginaAguarde)
{

	if (testaVersaoBrowser()=='ie7')
	{
		//alert(this.location);
		setTimeout("this.location='http://www.mogoo.com.br'","3000");
	}
	var retorno;
//	alert('aqui1');
	window.name="loja";
	if(navigator.appName.indexOf("Netscape") != -1)
	{
//	alert('aqui');
	  window.open("", "mpg_popup","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,screenX=0,screenY=0,left=0,top=0,width=765,height=440");
	}
	else
	{
//	alert('aqui2');
	   window.open("", "mpg_popup","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=440");
	}
	
//		window.location=paginaAguarde;
		return true;
}

var ie=document.all;
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var x,y;
var dobj;

function movemouse(e)
{
  if (isdrag)
  {
    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
    return false;
  }
}

function selectmouse(e)
{
  var fobj       = nn6 ? e.target : event.srcElement;
  var topelement = nn6 ? "HTML" : "BODY";
  while (fobj.tagName != topelement && fobj.className != "dragme")
  {
    fobj = nn6 ? fobj.parentNode : fobj.parentElement;
  }

  if (fobj.className=="dragme")
  {
    isdrag = true;
    dobj = fobj;
    tx = parseInt(dobj.style.left+0);
    ty = parseInt(dobj.style.top+0);
    x = nn6 ? e.clientX : event.clientX;
    y = nn6 ? e.clientY : event.clientY;
    document.onmousemove=movemouse;
    return false;
  }

}

document.onmousedown=selectmouse;
document.onmouseup=new Function("isdrag=false");

function printField() 
{

	var estacocivil;
	var grauinstrucao;
	var uf;
	var iTrabalhando;

	var opcaocargo1 = document.form.opcaocargo1.value;
	var tituloopcaocargo1 = opcaocargo1.split("*");
	
	var opcaocargo2 = document.form.opcaocargo2.value;
	var tituloopcaocargo2 = opcaocargo2.split("*");
	
	var opcaocargo3 = document.form.opcaocargo3.value;
	var tituloopcaocargo3 = opcaocargo3.split("*");
	
		
	switch (document.form.estadocivil.value){
        case '1': estacocivil = 'Solteiro(a)' ;break;
        case '2': estacocivil = 'Casado(a)' ;break;
		case '3': estacocivil = 'Desquitado(a)' ;break;
		case '4': estacocivil = 'Divorciado(a)' ;break;
		case '5': estacocivil = 'Viúvo(a)' ;break;
		case '6': estacocivil = 'Outros' ;break;
		default: estacocivil = 'Nenhum' ;break;
	}
	
	
	switch (document.form.grauinstrucao.value){
		case '1': grauinstrucao = 'DOUTORADO';break;
		case '2': grauinstrucao = 'MESTRADO';break;
		case '3': grauinstrucao = 'MBA';break;
		case '4': grauinstrucao = '2o. Grau Técnico';break;
		case '5': grauinstrucao = 'ESPECIALIZACAO';break;
		case '6': grauinstrucao = 'SUPERIOR COMPLETO';break;
		case '7': grauinstrucao = 'SUPERIOR INCOMPLETO';break;
		case '8': grauinstrucao = '2 GRAU COMPLETO';break;
		case '9': grauinstrucao = '2 GRAU INCOMPLETO';break;
		case '10': grauinstrucao = '1 GRAU COMPLETO';break;
		case '11': grauinstrucao = '5 A 8 SERIE COMPLETO';break;
		case '12': grauinstrucao = '5 A 8 SERIE INCOMPLETO';break;
		case '13': grauinstrucao = 'ATE 4 SERIE COMPLETA';break;
		case '14': grauinstrucao = 'ANALFABETO';break;
		default: grauinstrucao = 'Nenhum' ;break;
	}
	
	switch (document.form.grauha1.value){
		case '1': grauha1 = 'DOUTORADO';break;
		case '2': grauha1 = 'MESTRADO';break;
		case '3': grauha1 = 'MBA';break;
		case '4': grauha1 = '2o. Grau Técnico';break;
		case '5': grauha1 = 'ESPECIALIZACAO';break;
		case '6': grauha1 = 'SUPERIOR COMPLETO';break;
		case '7': grauha1 = 'SUPERIOR INCOMPLETO';break;
		case '8': grauha1 = '2 GRAU COMPLETO';break;
		case '9': grauha1 = '2 GRAU INCOMPLETO';break;
		case '10': grauha1 = '1 GRAU COMPLETO';break;
		case '11': grauha1 = '5 A 8 SERIE COMPLETO';break;
		case '12': grauha1 = '5 A 8 SERIE INCOMPLETO';break;
		case '13': grauha1 = 'ATE 4 SERIE COMPLETA';break;
		case '14': grauha1 = 'ANALFABETO';break;
		default: grauha1 = 'Nenhum' ;break;
	}

	switch (document.form.grauha2.value){
		case '1': grauha2 = 'DOUTORADO';break;
		case '2': grauha2 = 'MESTRADO';break;
		case '3': grauha2 = 'MBA';break;
		case '4': grauha2 = '2o. Grau Técnico';break;
		case '5': grauha2 = 'ESPECIALIZACAO';break;
		case '6': grauha2 = 'SUPERIOR COMPLETO';break;
		case '7': grauha2 = 'SUPERIOR INCOMPLETO';break;
		case '8': grauha2 = '2 GRAU COMPLETO';break;
		case '9': grauha2 = '2 GRAU INCOMPLETO';break;
		case '10': grauha2 = '1 GRAU COMPLETO';break;
		case '11': grauha2 = '5 A 8 SERIE COMPLETO';break;
		case '12': grauha2 = '5 A 8 SERIE INCOMPLETO';break;
		case '13': grauha2 = 'ATE 4 SERIE COMPLETA';break;
		case '14': grauha2 = 'ANALFABETO';break;
		default: grauha2 = 'Nenhum' ;break;
	}
	
	switch (document.form.grauha3.value){
		case '1': grauha3 = 'DOUTORADO';break;
		case '2': grauha3 = 'MESTRADO';break;
		case '3': grauha3 = 'MBA';break;
		case '4': grauha3 = '2o. Grau Técnico';break;
		case '5': grauha3 = 'ESPECIALIZACAO';break;
		case '6': grauha3 = 'SUPERIOR COMPLETO';break;
		case '7': grauha3 = 'SUPERIOR INCOMPLETO';break;
		case '8': grauha3 = '2 GRAU COMPLETO';break;
		case '9': grauha3 = '2 GRAU INCOMPLETO';break;
		case '10': grauha3 = '1 GRAU COMPLETO';break;
		case '11': grauha3 = '5 A 8 SERIE COMPLETO';break;
		case '12': grauha3 = '5 A 8 SERIE INCOMPLETO';break;
		case '13': grauha3 = 'ATE 4 SERIE COMPLETA';break;
		case '14': grauha3 = 'ANALFABETO';break;
		default: grauha3 = 'Nenhum' ;break;
	}

      
	switch (document.form.uf.value){
		case '1' : uf = 'Acre';break;
		case '2' : uf = 'Alagoas';break;
		case '3' : uf = 'Amapa';break;
		case '4' : uf = 'Amazonas';break;
		case '5' : uf = 'Bahia';break;
		case '6' : uf = 'Ceará';break;
		case '7' : uf = 'Distrito Federal';break;
		case '8' : uf = 'Espírito Santo';break;
		case '9' : uf = 'Goiás';break;
		case '10' : uf = 'Maranhão';break;
		case '11' : uf = 'Mato Grosso';break;
		case '12' : uf = 'Mato Grosso do Sul';break; 
		case '13' : uf = 'Minas Gerais';break;
		case '14' : uf = 'Pará';break;
		case '15' : uf = 'Paraíba';break;
		case '16' : uf = 'Paraná';break; 
		case '17' : uf = 'Pernambuco';break;
		case '18' : uf = 'Piauí';break; 
		case '19' : uf = 'Rio de Janeiro';break;
		case '20' : uf = 'Rio Grande do Norte';break;
		case '21' : uf = 'Rio Grande do Sul';break; 
		case '22' : uf = 'Rondônia';break;
		case '23' : uf = 'Roraima';break; 
		case '24' : uf = 'Santa Catarina';break;
		case '25' : uf = 'São Paulo';break;
		case '26' : uf = 'Sergipe';break;
		case '27' : uf = 'Tocantins';break; 
		default: uf = 'Nenhum' ;break;
	}
	
	switch (document.form.iTrabalhando.value){
		case '1' : iTrabalhando = 'Sim';break;
		case '2' : iTrabalhando = 'Não';break;
		default: iTrabalhando = 'Nenhum' ;break;	
	}
	
      
      
	
	    pWin = window.open('','pWin','width=700, height=700, location=yes, scrollbars=yes , menubar=yes, rollscroll=yes, toolbar=yes');
	    pWin.document.open();
	    pWin.document.write('<html><head></head><body>');
		pWin.document.write('<style type=text/css >');
		pWin.document.write('<!--');

		pWin.document.write('.TitConteudo {');
		pWin.document.write('	font-size: 12px;');
		pWin.document.write('	font-weight: bold;');
		pWin.document.write('	color: #FF0000;');
		pWin.document.write('}');

		pWin.document.write('.titulo {');
		pWin.document.write('	font-size: 16px;');
		pWin.document.write('	font-weight: bold;');
		pWin.document.write('	color: #CC0000;');
		pWin.document.write('	margin: 15px 0px 0px 0px; ');
		pWin.document.write('	padding: 0px;');
		pWin.document.write('}');

		pWin.document.write('.detalhe {');
		pWin.document.write('	font-size: 12px;');
		pWin.document.write('	color: #000000;');
		pWin.document.write('	padding: 0px;');
		pWin.document.write('	margin: 0px;');
		pWin.document.write('}');

		pWin.document.write('.LinkNoticia {');
		pWin.document.write('	font-size: 12px;');
		pWin.document.write('	color: #006600;');
		pWin.document.write('	padding: 0px;');
		pWin.document.write('	margin: 0px;');
		pWin.document.write('}');
		
		pWin.document.write('-->');
		pWin.document.write('</style>');
		
		pWin.document.write('<p class=titulo>Banco de Currículos</p>');
		pWin.document.write('<table  border=0 cellpadding=0 cellspacing=0>');
		pWin.document.write('<tr>');
		pWin.document.write('<td height=20></td>');
		pWin.document.write('</tr>');
		pWin.document.write('</table>');
	
		
//titulo	   
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td width=0>&nbsp;</td>');
   	    pWin.document.write('<td class=TitConteudo>Informações gerais</td>');
   	    pWin.document.write('<td width=39>&nbsp;</td></tr></table>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=10><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');

//nome
   	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Nome:  </span></TD></TR> ');
   	    pWin.document.write('<TR><TD width=75%> '+ document.form.nome.value +'</TD></TR></TBODY></TABLE>');
   	   
	   
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//nascimento , sexo
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0><TBODY><TR bgColor=#f0f0f0>');
		pWin.document.write('<TD width=85%><span class=LinkNoticia>Data Nascimento</span> </TD>');
		pWin.document.write('<TD width=75%><span class=LinkNoticia>Sexo</span></TD></TR>');
		pWin.document.write('<TR><TD width=75%>'+ document.form.nascimento.value + '</TD>');
		pWin.document.write('<TD width=75%>'+ document.form.sexo.value +'</TD></TR></TBODY></TABLE>');
		
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//cpf
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1  border=0><TBODY><TR>');
		pWin.document.write(' <TD width=75%><span class=LinkNoticia>CPF : </span><TR>');
		pWin.document.write('<TD width=75%>'+ document.form.cpf.value +' </TD></TR></TBODY></TABLE>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//estado civil , grau de instrucao
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0><TBODY><TR bgColor=#f0f0f0>');
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Estado Civil</span> </TD>');
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Grau de instrução</span></TD></TR>');
	    pWin.document.write('<TR><TD width=75%> '+ estacocivil +'</TD>');
	    pWin.document.write('<TD width=75%>'+ grauinstrucao +'</TD></TR></TBODY></TABLE>');		

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//endereco , complemento
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1  border=0><TBODY>');
	    pWin.document.write('<TR><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Endereço</span></TD>');
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Complemento</span></TD></TR>');
	    pWin.document.write('<TR><TD width=75%>'+ document.form.endereco.value +'</TD>');
	    pWin.document.write('<TD width=75%>'+ document.form.complemento.value +'</TD></TR></TBODY></TABLE>');		

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');
		
		
//bairro , cep
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0><TBODY>');
	    pWin.document.write('<TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Bairro</span></TD>');
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>CEP</span></TD></TR>');
	    pWin.document.write('<TR><TD width=75%>'+ document.form.bairro.value +'</TD>');
	    pWin.document.write('<TD width=75%>'+ document.form.cep.value +' </TD></TR></TBODY></TABLE>');		

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//municipio , uf		
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0><TBODY>');
	    pWin.document.write('<TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Cidade</span></TD>');
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Estado</span></TD></TR>');
	    pWin.document.write('<TR><TD width=75%>'+ document.form.municipio.value +'</TD>');
	    pWin.document.write('<TD width=75%>'+ uf +'</TD></TR></TBODY></TABLE>');		

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


// telefone res , cel , com
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0><TBODY><TR bgColor=#f0f0f0>');
	    pWin.document.write('<TD width=33%><span class=LinkNoticia>Fone Celular</span></TD>');
	    pWin.document.write('<TD width=33%><span class=LinkNoticia>Fone Comercial</span></TD>');
	    pWin.document.write('<TD width=33%><span class=LinkNoticia>Fone Residencial</span></TD></TR>');
	    pWin.document.write('<TR><TD width=33%>'+ document.form.telcel.value +' </TD>');
	    pWin.document.write('<TD width=33%>'+ document.form.telcom.value +' </TD>');
		pWin.document.write('<TD width=33%>'+ document.form.telres.value +' </TD></TR></TBODY></TABLE>');
		
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=10><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//E-mail
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1  border=0><TBODY><TR>');
		pWin.document.write(' <TD width=75%><span class=LinkNoticia>E-mail  </span><TR>');
		pWin.document.write('<TD width=75%>'+ document.form.email.value +' </TD></TR></TBODY></TABLE>');
		

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=15><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//titulo	   
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td width=10>&nbsp;</td>');
   	    pWin.document.write('<td class=TitConteudo>Dados profissionais</td>');
   	    pWin.document.write('<td width=39>&nbsp;</td></tr></table>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=10><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


// trabalhando , ultimo salario , minimo salario		
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 <TBODY>');
	    pWin.document.write('<TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Trabalhando Atualmente?</span></TD>');
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Último Salário</span></TD>');		
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Mínimo Aceitável</span></TD></TR>');		
	    pWin.document.write('<TR><TD width=75%>'+ iTrabalhando +'</TD>');
		pWin.document.write('<TD width=75%>'+ document.form.ultimosalario.value +'</TD>');
	    pWin.document.write('<TD width=75%>'+ document.form.minimosalario.value +'</TD></TR></TBODY></TABLE>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//area de interesse principal
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia> Área de Interesse Principal</span></TD>');		
	    pWin.document.write('<TD>&nbsp;</TD></TR><TR><TD colSpan=2>'+ tituloopcaocargo1[1] +'</TD></TR></TBODY></TABLE>');
		
		
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//area de interesse Secundário
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia> Área de Interesse Secundário</span></TD>');
	    pWin.document.write('<TD>&nbsp;</TD></TR><TR><TD colSpan=2>'+ tituloopcaocargo2[1] +'</TD></TR></TBODY></TABLE>');
		
		
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//area de interesse Terciária
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia> Área de Interesse Terciária</span></TD>');
	    pWin.document.write('<TD>&nbsp;</TD></TR><TR><TD colSpan=2>'+ tituloopcaocargo3[1] +'</TD></TR></TBODY></TABLE>');
		
		
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//Objetivo
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD><span class=LinkNoticia>Objetivo Profissional</span></TD></TR>');		
	    pWin.document.write('<TR><TD>'+ document.form.perfil.value +'</TD></TR></TBODY></TABLE>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=10><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//titulo	   
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td width=10>&nbsp;</td>');
   	    pWin.document.write('<td class=TitConteudo>Experiência profissional</td>');
   	    pWin.document.write('<td width=39>&nbsp;</td></tr></table>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=10><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//empresa1 , cargo1
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Nome da Empresa</span></TD>');		
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Cargo</span></TD></TR>');
		pWin.document.write('<TR><TD width=75%>'+ document.form.empresae1.value +'</TD>');		
	    pWin.document.write('<TD width=75%>'+ document.form.cargoe1.value +'</TD></TR></TBODY></TABLE>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//data inicio1 , data fim1
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Data de Início</span></TD>');
	    pWin.document.write('<TD width=75%><span class=LinkNoticia>Data de Término</span></TD></TR>');		
	    pWin.document.write('<TR><TD width=75%>'+ document.form.datainie1.value +'</TD>');
		pWin.document.write('<TD width=75%>'+ document.form.datafime1.value +'</TD></TR></TBODY></TABLE>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//cidadee1
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1  border=0><TBODY><TR>');
		pWin.document.write(' <TD width=75%><span class=LinkNoticia>Cidade  </span><TR>');
		pWin.document.write('<TD width=75%>'+ document.form.cidadee1.value +' </TD></TR></TBODY></TABLE>');


//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=10><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//Principais atividades
		pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1  border=0><TBODY><TR>');
		pWin.document.write(' <TD width=75%><span class=LinkNoticia>Principais atividades  </span><TR>');
		pWin.document.write('<TD width=75%>'+ document.form.atividadese1.value +' </TD></TR></TBODY></TABLE>');
		
		
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=15><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//titulo	   
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td width=10>&nbsp;</td>');
   	    pWin.document.write('<td class=TitConteudo>Histórico acadêmico</td>');
   	    pWin.document.write('<td width=39>&nbsp;</td></tr></table>');

//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=10><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//instituicao , grau de instrução
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');		
	    pWin.document.write('<TBODY><TR><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Nome da Instituição</span></TD><TD>&nbsp;</TD></TR>');
		pWin.document.write('<TR><TD colSpan=2>'+ document.form.instituicaoha1.value +'</TD></TR></TBODY></TABLE><BR>');
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');		
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Curso</span></TD>');
		pWin.document.write('<TD width=75%><span class=LinkNoticia>Grau Alcançado</span> </TD></TR>');
	    pWin.document.write('<TR><TD width=75%>'+ document.form.cursoha1.value +'</TD><TD width=75%>'+ grauha1 +'</TD></TR></TBODY></TABLE>');		
	   	   
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//ano termino1
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Ano de término </span></TD></TR>');
	    pWin.document.write('<TR><TD width=75%> '+ document.form.anoterminoha1.value +'</TD></TR>');		
	    pWin.document.write('<TR><TD width=75%></TD><TD width=75%></TD></TR></TBODY></TABLE>');
	   	   
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//instituicao2 , grau de instrução2
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');		
	    pWin.document.write('<TBODY><TR><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Nome da Instituição</span></TD><TD>&nbsp;</TD></TR>');
		pWin.document.write('<TR><TD colSpan=2>'+ document.form.instituicaoha2.value +'</TD></TR></TBODY></TABLE><BR>');
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');		
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Curso</span></TD>');
		pWin.document.write('<TD width=75%><span class=LinkNoticia>Grau Alcançado</span> </TD></TR>');
	    pWin.document.write('<TR><TD width=75%>'+ document.form.cursoha2.value +'</TD><TD width=75%>'+ grauha2 +'</TD></TR></TBODY></TABLE>');		
	   	   
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//ano termino2
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Ano de término </span></TD></TR>');
	    pWin.document.write('<TR><TD width=75%> '+ document.form.anoterminoha2.value +'</TD></TR>');		
	    pWin.document.write('<TR><TD width=75%></TD><TD width=75%></TD></TR></TBODY></TABLE>');
	   	   
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//instituicao3 , grau de instrução3
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');		
	    pWin.document.write('<TBODY><TR><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Nome da Instituição</span></TD><TD>&nbsp;</TD></TR>');
		pWin.document.write('<TR><TD colSpan=2>'+ document.form.instituicaoha3.value +'</TD></TR></TBODY></TABLE><BR>');
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');		
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75% bgColor=#f0f0f0><span class=LinkNoticia>Curso</span></TD>');
		pWin.document.write('<TD width=75%><span class=LinkNoticia>Grau Alcançado</span> </TD></TR>');
	    pWin.document.write('<TR><TD width=75%>'+ document.form.cursoha3.value +'</TD><TD width=75%>'+ grauha3 +'</TD></TR></TBODY></TABLE>');		
	   	   
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//ano termino2
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR bgColor=#f0f0f0><TD width=75%><span class=LinkNoticia>Ano de término </span></TD></TR>');
	    pWin.document.write('<TR><TD width=75%> '+ document.form.anoterminoha3.value +'</TD></TR>');		
	    pWin.document.write('<TR><TD width=75%></TD><TD width=75%></TD></TR></TBODY></TABLE>');
	   	   
//shin
	    pWin.document.write('<table  border=0 cellspacing=0 cellpadding=0><tr><td height=5><img src=imagens/shim.gif width=1 height=1></td></tr> </table>');


//outras info
	    pWin.document.write('<TABLE class=mssansserif3 cellSpacing=2 cellPadding=1 border=0>');
	    pWin.document.write('<TBODY><TR><TD ><span class=LinkNoticia>Cite outros cursos realizados que considera, importante para o seu desenvolvimento profissional</span></TD></TR>');
	    pWin.document.write('<TR><TD > '+ document.form.outrasinfo.value +' </TD></TR>');		
	    pWin.document.write('<TR><TD vAlign=top colSpan=2></TD></TR></TBODY></TABLE>');
			   
	   pWin.document.write('</body></html>');
	   pWin.print();
	   pWin.document.close();
	   pWin.close();
}
















































function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(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; }
}


  function acessaPagina(link)
  {
  location=link;
  }
function setaDadosEntrega()
{
	document.formpedido.cep_entrega.value=document.formpedido.cep.value;
	document.formpedido.endereco_entrega.value=document.formpedido.endereco.value;
	document.formpedido.bairro_entrega.value=document.formpedido.bairro.value;
	document.formpedido.municipio_entrega.value=document.formpedido.municipio.value;
	document.formpedido.complemento_entrega.value=document.formpedido.complemento.value;
	//alert('uf - '+document.formpedido.uf.value);
	setaOptionSelected('uf_entrega',document.formpedido.uf.value);
}
function setaOptionSelected(select,valor)
{
//alert('valor - '+valor);
for (var idx=0;idx<document.getElementById(select).options.length;idx++) 
{
	if (document.getElementById(select).options[idx].value==valor)
	{
	//alert('valor indice - '+document.getElementById(select).options[idx].value);
		 document.getElementById(select).selectedIndex=idx;
		
	}
}

}

function CalcularFreteNovo(urlAtiva){
	if (urlAtiva)
	{
		if (document.formFrete.cepDestino.value!='')
		{
			   document.formFrete.action = "http://www.correios.com.br/encomendas/precos/calculo.cfm";
			   document.formFrete.target = "iframeCalculaFrete";        
			   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
			   document.formFrete.submit();
		}
		else
		{
			alert('Informe o CEP para a entrega !');	
		}
	}
	else
	{
	   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
	   alert("No momento o sistema de valoração do frete está indisponível. Assim sendo não será embutido o valor do frete a sua compra. Após a conclusão do pedido nosso pessoal entrará em contato para o acerto do valor pendente referente ao frete");	
	}
}
function CalcularFrete(){
		//alert("aqiio");
		//alert(document.formFrete.cepDestino.value);
		if (document.formFrete.cepDestino.value!='')
		{
		
			   document.formFrete.action = "http://www.correios.com.br/encomendas/precos/calculo.cfm";
			   document.formFrete.target = "iframeCalculaFrete";        
			   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
			   document.formFrete.submit();
		
		}
		else
		{
			alert('Informe o CEP para a entrega !');	
		}
}

function CalcularFreteWait(urlAtiva,servico){
//alert(urlAtiva+servico);
setTimeout("CalcularFreteNovo(true,'40215')",2000);

}

function CalcularFreteWait2Campos(urlAtiva,servico,tempo){
//alert("1"+urlAtiva+servico+tempo);
setTimeout("CalcularFrete2Campos("+urlAtiva+",'"+servico+"')",tempo);

}
function CalcularFreteTransportadoraWait(urlAtiva,tempo){
//alert("1"+urlAtiva+servico+tempo);
setTimeout("CalcularFreteTransportadora()",tempo);

}

function CalcularFrete1Wait2Campos(urlAtiva,servico){
//alert("1"+urlAtiva+servico);
setTimeout("CalcularFrete2Campos(true,'40010')",2000);

}
function CalcularFrete2Wait2Campos(urlAtiva,servico){
//alert("2"+urlAtiva+servico);
setTimeout("CalcularFrete2Campos("+urlAtiva+",'"+servico+"')",4000);

}

function MostraLinhasCalculando()
{

document.getElementById("calculando").style.visibility = 'visible';
}
function MostraLinhasErroFrete()
{

document.getElementById("erro_frete").style.visibility = 'visible';
}

function EscondeLinhasCalculandoWait(){
//alert("2"+urlAtiva+servico);
setTimeout("EscondeLinhasCalculando()",20000);

}

function EscondeLinhasCalculando()
{
document.getElementById("calculando").style.visibility = "hidden";
}

function DeletaLinhaTabela()
{
document.getElementById("tabela").style.visibility = "visible";
var table=document.getElementById('tabela');
for(var i = table.rows.length - 1; i > 0; i--) 
         table.deleteRow(i); 
table=document.getElementById('erro_frete');
for(var i = table.rows.length - 1; i > 0; i--) 
         table.deleteRow(i); 
}

function CalculaFrete(Param1, Param2)
{

if (document.formFrete.cepDestino1.value!='' && document.formFrete.cepDestino2.value!='')
{
DeletaLinhaTabela();
MostraLinhasCalculando();
CalcularFreteTransportadora();
CalcularFreteWait2Campos(Param1,'40010',2000);
CalcularFreteWait2Campos(Param2,'40215',5000);
EscondeLinhasCalculandoWait();
MostraLinhasErroFrete();
}
else
{
alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
}
}


function CalculaFrete3OLD(sedex, sedexacobrar, sedex10, pac, transportadora, fretegratis, outraformapagamento, precofixo, iIdProprietario)
{
//40010 - SEDEX
//40045 - SEDEX a Cobrar										
//40215 - SEDEX 10
//41106 - PAC
//40290 - SEDEX HOJE
//81019 - e-SEDEX
//44105 - MALOTE
	alert('111 sedex - '+sedex+'| sedexacobrar - '+sedexacobrar+'| sedex10 - '+sedex10+'| pac - '+pac);

	calculou=false;
	if(fretegratis == false || outraformapagamento == true){
		if(fretegratis == true){
			CalcularFreteGratis();
		}
		if(precofixo == false){
			calculou=true;
			if (transportadora)
			{
				CalcularFreteTransportadoraWait(2000);
			}
			if (sedex)
			{	
				CalcularFreteWait2Campos(sedex,'40010',5000);
			}
			if (sedex10)
			{	
				CalcularFreteWait2Campos(sedex10,'40215',9000);
			}
			if (pac)
			{	
				CalcularFreteWait2Campos(pac,'41106',13000);
			}
			if (sedexacobrar)
			{	
				servidorAjax.retornarEstadoSedexCobrar(document.formFrete.cepDestino1.value+document.formFrete.cepDestino2.value,iIdProprietario,
						function sedexcobrar(valor){
							sedexacobrar = valor;
							if(sedexacobrar == true){
								CalcularFreteWait2Campos(sedexacobrar,'40045',16000);				
							}
						});
			}
		}else{
			if(fretegratis == false){
				CalcularPrecoFixo();
			}else{
				calculou=true;
				if (transportadora)
				{
					CalcularFreteTransportadoraWait();
				}
				if (sedex)
				{	
					CalcularFreteWait2Campos(sedex,'40010',2000);
				}
				if (sedex10)
				{	
					CalcularFreteWait2Campos(sedex10,'40215',7000);
				}
				if (pac)
				{	
					CalcularFreteWait2Campos(pac,'41106',11000);
				}
				if (sedexacobrar)
				{	
					servidorAjax.retornarEstadoSedexCobrar(document.formFrete.cepDestino1.value+document.formFrete.cepDestino2.value,iIdProprietario,
							function sedexcobrar(valor){
								sedexacobrar = valor;
								if(sedexacobrar == true){
									CalcularFreteWait2Campos(sedexacobrar,'40045',15000);				
								}
							});
				}
			}
		}
	}else{
		CalcularFreteGratis();
	}
	if (calculou)
	{
		var func_call = 'verificaSeCalculouFrete('+sedex+','+sedexacobrar+','+sedex10+','+pac+');';
		//setTimeout("verificaSeCalculouFrete()",18000);
		setTimeout(func_call,20000);
		EscondeLinhasCalculandoWait();
	}
	MostraLinhasErroFrete();
	document.formcarrinho.CepDestino1.value = document.formFrete.cepDestino1.value;
	document.formcarrinho.CepDestino2.value = document.formFrete.cepDestino2.value;

}
function CalculaFrete3(sedex, sedexacobrar, sedex10, pac, transportadora, fretegratis, outraformapagamento, precofixo, iIdProprietario)
{
//40010 - SEDEX
//40045 - SEDEX a Cobrar										
//40215 - SEDEX 10
//41106 - PAC
//40290 - SEDEX HOJE
//81019 - e-SEDEX
//44105 - MALOTE
	//alert('calcula frete 3 nova sedex - '+sedex+'| sedexacobrar - '+sedexacobrar+'| sedex10 - '+sedex10+'| pac - '+pac);

	calculou=false;
	if(fretegratis){
		CalcularFreteGratis();
	}
	if (transportadora)
	{
		CalcularFreteTransportadoraWait(2000);
	}
	if (sedex)
	{	
		CalcularFreteWait2Campos(sedex,'40010',5000);
		calculou=true;
	}
	if (sedex10)
	{	
		CalcularFreteWait2Campos(sedex10,'40215',9000);
		calculou=true;
	}
	if (pac)
	{	
		CalcularFreteWait2Campos(pac,'41106',13000);
		calculou=true;
	}
	if (sedexacobrar)
	{	
		servidorAjax.retornarEstadoSedexCobrar(document.formFrete.cepDestino1.value+document.formFrete.cepDestino2.value,iIdProprietario,
				function sedexcobrar(valor){
					sedexacobrar = valor;
					if(sedexacobrar == true){
						CalcularFreteWait2Campos(sedexacobrar,'40045',16000);				
					}
				});
		calculou=true;
	}
	if(precofixo){
		CalcularPrecoFixo();
	}
	//alert('cakc - '+calculou);
	if (calculou)
	{
		var func_call = 'verificaSeCalculouFrete('+sedex+','+sedexacobrar+','+sedex10+','+pac+');';
		//setTimeout("verificaSeCalculouFrete()",18000);
		setTimeout(func_call,20000);
		EscondeLinhasCalculandoWait();
	}
	else
	{
		EscondeLinhasCalculando()
	}
	
	MostraLinhasErroFrete();
	document.formcarrinho.CepDestino1.value = document.formFrete.cepDestino1.value;
	document.formcarrinho.CepDestino2.value = document.formFrete.cepDestino2.value;

}

function verificaSeCalculouFrete(sedex, sedexacobrar, sedex10, pac)
{
	//alert('sedex - '+sedex+'| sedexacobrar - '+sedexacobrar+'| sedex10 - '+sedex10+'| pac - '+pac);
	deuErro=false;
	//alert('sexed = '+document.getElementById('SEDEX'));
	if (sedex)
	{
		if (document.getElementById('SEDEX')==null)
		{
			CalcularFreteWait2Campos(true,'40010',2000);
			deuErro=true;
			//alert('1');
		}
	}
	if (sedex10)
	{
		if (document.getElementById('SEDEX_10')==null)
		{
			CalcularFreteWait2Campos(true,'40215',2000);
			deuErro=true;
			//alert('2');
		}
	}
	if (pac)
	{
		if (document.getElementById('PAC')==null)
		{
			CalcularFreteWait2Campos(true,'41106',2000);
			deuErro=true;
			//alert('3');
		}
	}
	if (sedexacobrar)
	{
		if (document.getElementById('SEDEX_A_COBRAR')==null)
		{
			servidorAjax.retornarEstadoSedexCobrar(document.formFrete.cepDestino1.value+document.formFrete.cepDestino2.value,document.formFrete.iIdProprietario.value,
						function sedexcobrar(valor){
							sedexacobrar = valor;
							if(sedexacobrar == true){
								CalcularFreteWait2Campos(sedexacobrar,'40045',2000);				
							}
						});
			deuErro=true;
			//alert('4');
		}
	}
	//alert('deu erro - '+deuErro)
	if (deuErro)
	{
		var func_call = 'verificaSeCalculouFrete('+sedex+','+sedexacobrar+','+sedex10+','+pac+');';
		//setTimeout("verificaSeCalculouFrete()",18000);
		setTimeout(func_call,2000);
	}
}


function CalculaFrete1(sedex, sedexacobrar, sedex10, pac, transportadora, fretegratis, outraformaenvio, precofixo, iIdProprietario, peso)
{
//alert('CalculaFrete1');
if (document.formFrete.cepDestino1.value!='' && document.formFrete.cepDestino2.value!='')
{
	document.formFrete.cepDestino.value = document.formFrete.cepDestino1.value+document.formFrete.cepDestino2.value;
	document.formpedido.cepDestino.value = document.formFrete.cepDestino1.value+document.formFrete.cepDestino2.value;
	DeletaLinhaTabela();
	MostraLinhasCalculando();
	
	//alert('fretegratis1 - '+fretegratis)
	if(fretegratis == true){
		//VERIFICA SE O ESTADO POSSUI FRETE GRATIS
		servidorAjax.retornarEstadoFreteGratis(document.formFrete.cepDestino1.value+document.formFrete.cepDestino2.value,iIdProprietario,
		function fretegratis1(valor){
			fretegratis = valor;
			//alert('fretegratis2 - '+fretegratis);
			//alert('outraformaenvio - '+outraformaenvio);
			if(fretegratis == false){
				document.formFrete.peso.value = peso;
			}
			else // se eh permitido o frete gratis...
			{
				if (outraformaenvio == false) // se nao pode ser utilizada outra forma de pagamento alem do frete gratis isso eh tratado nesse bloco de código 
				{
					sedex=false; sedexacobrar=false; sedex10=false; pac=false; transportadora=false;  outraformapagamento=false; precofixo=false;
				}
			}
			CalculaFrete3(sedex, sedexacobrar, sedex10, pac, transportadora, fretegratis, outraformaenvio, precofixo, iIdProprietario);
		});
	}else{
		//alert('ELSE fretegratis');
		CalculaFrete3(sedex, sedexacobrar, sedex10, pac, transportadora, fretegratis, outraformaenvio, precofixo, iIdProprietario);
	}
}
else
{
alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
}

}


function float2moeda(num) {

   x = 0;

   if(num<0) {
      num = Math.abs(num);
      x = 1;
   }
   
   if(isNaN(num)) num = "0";
      cents = Math.floor((num*100+0.5)%100);

   num = Math.floor((num*100+0.5)/100).toString();

   if(cents < 10) cents = "0" + cents;
      for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
         num = num.substring(0,num.length-(4*i+3))+'.'
               +num.substring(num.length-(4*i+3));
   ret = num + ',' + cents;
   if (x == 1) ret = '-' + ret;return ret;
 }

function moeda2float(moeda){

   moeda = moeda.replace(".","");

   moeda = moeda.replace(",",".");

   return parseFloat(moeda);

}

function alteraPrecoTotal(valor){
	var precoTotal = parseFloat(document.getElementById("preco_total").name);
	var taxa = parseFloat(document.getElementById("taxafrete").value);
	document.getElementById("preco_total").value = float2moeda(precoTotal+parseFloat(valor)+taxa);
}

function CalculaFrete2(sedex, sedexacobrar, sedex10, pac, transportadora)
{
//40010 - SEDEX
//40045 - SEDEX a Cobrar										
//40215 - SEDEX 10
//41106 - PAC
//40290 - SEDEX HOJE
//81019 - e-SEDEX
//44105 - MALOTE
if (document.formFrete.cepDestino1.value!='' && document.formFrete.cepDestino2.value!='')
{

DeletaLinhaTabela();
MostraLinhasCalculando();
CalcularFreteTransportadora();
CalcularFreteWait2Campos(sedex,'40010',2000);
CalcularFreteWait2Campos(sedexacobrar,'40045',5000);
CalcularFreteWait2Campos(sedex10,'40215',8000);
CalcularFreteWait2Campos(pac,'41106',11000);
EscondeLinhasCalculandoWait();
MostraLinhasErroFrete();
document.formcarrinho.CepDestino1.value = document.formFrete.cepDestino1.value;
document.formcarrinho.CepDestino2.value = document.formFrete.cepDestino2.value;
}
else
{
alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
}
}



function CalcularFreteNovoServico(urlAtiva,servico){

	if (urlAtiva)
	{
		if (document.formFrete.cepDestino.value!='')
		{
			   document.formFrete.action = "http://www.correios.com.br/encomendas/precos/calculo.cfm";
			   document.formFrete.target = "iframeCalculaFrete";        
			   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
			   document.formpedido.servico.value = servico;    
			   document.formFrete.servico.value = servico;    
			   document.formFrete.submit();
		}
		else
		{
			alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
		}
	}
	else
	{		
	   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
	   document.formpedido.valfrete.value = 0;
	   document.getElementById("valorfrete").innerHTML = 'Indisponível !\n\n';
	   alert("No momento o sistema de valoração do frete está indisponível. Assim sendo não será embutido o valor do frete a sua compra. Após a conclusão do pedido nosso pessoal entrará em contato para o acerto do valor pendente referente ao frete");	
	}
}

function CalcularFrete2Campos(urlAtiva,servico){
	//alert('urlAtiva - '+urlAtiva);
   document.formFrete.cepDestino.value = document.formFrete.cepDestino1.value+"-"+document.formFrete.cepDestino2.value;        

	if (urlAtiva)
	{
		if (document.formFrete.cepDestino1.value!='' && document.formFrete.cepDestino2.value!='')
		{
			   	
			   document.formFrete.action = "http://www.correios.com.br/encomendas/precos/calculo.cfm";
			   document.formFrete.target = "iframeCalculaFrete";        
			   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
			   document.formpedido.servico.value = servico;    
			   document.formFrete.servico.value = servico;
			   document.formFrete.submit();
			//   alert("depois do submit");
		}
		else
		{
			alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
		}
	}
	else
	{
	   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
	   document.formpedido.valfrete.value = 0;
	   //document.getElementById("valorfrete").innerHTML = 'Indisponível !\n\n';
	   //alert("No momento o sistema de valoração do frete está indisponível. Assim sendo não será embutido o valor do frete a sua compra. Após a conclusão do pedido nosso pessoal entrará em contato para o acerto do valor pendente referente ao frete");	
	}
}

function CalcularFreteTransportadoraWait(){
//alert(urlAtiva+servico);
//alert("vai transp");
setTimeout("CalcularFreteTransportadora('nada')",2000);

}


function CalcularFreteTransportadora(valor){
//alert("vai transp11");

   document.formFrete.cepDestino.value = document.formFrete.cepDestino1.value+"-"+document.formFrete.cepDestino2.value;        
	document.formFrete.TotalGeral.value =document.formcarrinho.TotalGeral.value;
//alert("vai transp22");
		if (document.formFrete.cepDestino1.value!='' && document.formFrete.cepDestino2.value!='')
		{
	//		alert("vai transp33")  ; 	
								//			calculo_frete_transportadora.jsp
			   document.formFrete.action = "calculo_frete_transportadora.jsp";
		//	   alert("vai transp43")  ; 	
			   document.formFrete.target = "iframeCalculaFrete";        
			//   alert("vai transp53")  ; 	
			   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
			  // alert("vai transp63")  ; 	
			 //  document.formpedido.servico.value = servico;    
			  // alert("vai transp73")  ; 	
			 //  document.formFrete.servico.value = servico;    
			  // alert("vai transp83")  ; 	
			   document.formFrete.submit();
			  // alert("depois do submit");
		}
		else
		{
			alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
		}
}
function CalcularFreteGratis(valor){

   document.formFrete.cepDestino.value = document.formFrete.cepDestino1.value+"-"+document.formFrete.cepDestino2.value;        
	document.formFrete.TotalGeral.value =document.formcarrinho.TotalGeral.value;
		if (document.formFrete.cepDestino1.value!='' && document.formFrete.cepDestino2.value!='')
		{
			   document.formFrete.action = "calculo_frete_gratis.jsp";
			   document.formFrete.target = "iframeCalculaFrete";        
			   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
			   document.formFrete.submit();
		}
		else
		{
			alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
		}
}
function CalcularPrecoFixo(valor){

   document.formFrete.cepDestino.value = document.formFrete.cepDestino1.value+"-"+document.formFrete.cepDestino2.value;        
	document.formFrete.TotalGeral.value =document.formcarrinho.TotalGeral.value;
		if (document.formFrete.cepDestino1.value!='' && document.formFrete.cepDestino2.value!='')
		{
			   document.formFrete.action = "calculo_preco_fixo.jsp";
			   document.formFrete.target = "iframeCalculaFrete";        
			   document.formpedido.cepDestino.value = document.formFrete.cepDestino.value;        
			   document.formFrete.submit();
		}
		else
		{
			alert('Informe o CEP para a entrega preenchendo os 2 campos!');	
		}
}

//Chama flash no site (correção do IE)
function exibeFash(swf, width, height, wmode, cache)
{
noCache = cache || cache == undefined ? "" : "?" + new Date();
if (wmode == undefined)
{
wmode="opaque";
}

monta_swf = "";
monta_swf += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\""+ width +"\" height=\""+ height +"\" title=\"\">";
monta_swf += "<param name=\"movie\" value=\""+ swf + noCache +"\" />";
monta_swf += "<param name=\"quality\" value=\"high\" />";
monta_swf += "<param name=\"menu\" value=\"0\" />";
monta_swf += "<param name=\"wmode\" value=\""+ wmode +"\" />";
monta_swf += "<embed src=\""+ swf + noCache +"\" quality=\"high\" wmode=\""+ wmode +"\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+ width +"\" height=\""+ height +"\"></embed>";
monta_swf += "</object>";
document.write(monta_swf);
}

function textCounter(campo, countcampo, maxlimit)
{ //Esta função que irá contar, mostrar e restringir o tamanho do campo 
         if (campo.value.length > maxlimit) 
		 { //se passar do limite não deixará entrar o caracter 
             
			  campo.value = campo.value.substring(0,maxlimit); 
         } 
          else { //aqui, enquanto não se chegar ao limite, a cada caracter inserido ele reduzira -1 da contagem 
                
				countcampo.value = maxlimit - campo.value.length; 
         } 
}


function AbreVideo(idTemplate,nomeArquivo)
{
    if(parseInt(Player.versionInfo) >= 9)
        {
            Player.openPlayer("http://www.webpack.com.br/templates/"+idTemplate+"/videos/"+nomeArquivo);
        }
        else
        {
            Player.uiMode = "full";
            Player.height = 350;
            Player.width = 350;
            Player.URL = "http://www.webpack.com.br/templates/"+idTemplate+"/videos/"+nomeArquivo;
        }
}



function DesabilitaFormaDePagamento(nomeForm, formaPagamento)
{
	//alert(nomeForm);
	form = document.getElementById(nomeForm);
	//alert(formaPagamento);
	//alert(form);
	for (i=0;i<form.length;i++)
	{	
		//alert(form.elements[i].id+' cond = '+form.elements[i].id.indexOf('condicao_')+' chec = '+form.elements[i].checked);
		
		if(form.elements[i].type == 'radio') 
		{
			if (form.elements[i].id.indexOf('_'+formaPagamento) >-1)
			{
				form.elements[i].disabled=false;
			}
			else
			{
				if (form.elements[i].id.indexOf('condicao_')>-1)
				{
					form.elements[i].disabled=true;
				}
			}
			//alert(form.elements[i].id);
		}
	}
	//
	
}


function PegaValorRadioSelecionado(nomeForm,nomeRadio)
{
	//alert(nomeForm);
	form = document.getElementById(nomeForm);
	for (i=0;i<form.length;i++)
	{	
		if(form.elements[i].type == 'radio' && form.elements[i].name!='undefined') 
		{
				if(form.elements[i].name==nomeRadio) 
				{
					if (form.elements[i].checked)
					{
						valor = form.elements[i].value;
						break;
					}
				}
		}
	}
	//alert(valor);
	return valor;
}


function ConfirmarSorteioQuestoes( redirecionar ){
				
	var erros= 0;
	var checado='';
	var radio = 0 ; 
	var checkbox = 0 ;
	controleChecado=true;
	var nome='';
	for (i=0;i<document.formPesquisa.length;i++)
	{	
		contador=0;
		if(document.formPesquisa.elements[i].type == 'radio' && document.formPesquisa.elements[i].name!='undefined') 
		{
			nome = document.formPesquisa.elements[i].name;
			temUmChecado=false; 
			for (j=0;j<document.formPesquisa.length;j++)
			{
				if(document.formPesquisa.elements[j].name==nome) 
				{
					if (document.formPesquisa.elements[j].checked)
					{
						temUmChecado=true;
					}
					contador++;
				}
			}
			if (!temUmChecado)
			{
				controleChecado=false;
			}
		}
		i=i+contador;
    }
    if (controleChecado)
    {
    	if ( MM_validateForm(document.formSorteioCad.field_Nome.value,'Nome','R',document.formSorteioCad.field_Email.value,'E-Mail','R') )
		    {

				document.formSorteioCad.submit();
			}
		document.formPesquisa.submit();
		location = redirecionar;
	}
	else
	{
		alert('Você deve selecionar pelo menos uma das alternativas da enquete');
	}
		
}

function ConfirmarFalecom()
{
	if ( MM_validateForm(formFaleCom.pergunta.value,'Pergunta','R',formFaleCom.email.value,'E-Mail','R') )
	{
		ajaxpage('falecom_visualizar.jsp?email='+formFaleCom.email.value+'&Categoria='+formFaleCom.Categoria.value+'&idUser='+formFaleCom.idEmpresaSubmit.value+'&idEmpresaSubmit='+formFaleCom.idEmpresaSubmit.value+'&pergunta='+formFaleCom.pergunta.value+'&idEmpresa='+formFaleCom.idEmpresaSubmit.value,'zona');
//		ajaxAnywhere.getAJAX('?include=falecom_visualizar.jsp?email='+formFaleCom.email.value+'&Categoria='+formFaleCom.Categoria.value+'&idUser='+formFaleCom.idEmpresaSubmit.value+'&idEmpresaSubmit='+formFaleCom.idEmpresaSubmit.value+'&pergunta='+formFaleCom.pergunta.value+'&idEmpresa='+formFaleCom.idEmpresaSubmit.value,'zona');

//		document.formFaleCom.submit();
	}
}



function ConfirmarBoletim()
{
	if ( MM_validateForm(document.formBoletimCad.field_Nome.value,'Nome','R',document.formBoletimCad.field_CPF.value,'CPF','R',document.formBoletimCad.field_Email.value,'e-mail','R') )
	{
			document.formBoletimCad.submit();
	}
}

function ConfirmarBoletimWinterPlay()
{
	if ( MM_validateForm(document.formBoletimCad.field_Nome.value,'Nome','R',document.formBoletimCad.field_Email.value,'e-mail','R') )
	{
			document.formBoletimCad.submit();
	}
}

function ConfirmarBoletim2()
{
	if ( MM_validateForm(document.formBoletimCad.field_Nome.value,'Nome','R',document.formBoletimCad.field_Email.value,'e-mail','R') )
	{
			document.formBoletimCad.submit();
	}
}

function ConfirmarBoletimDataNascimento()
{
	if ( MM_validateForm(document.formBoletimCad.field_Nome.value,'Nome','R',document.formBoletimCad.field_Email.value,'e-mail','R',document.formBoletimCad.field_DataNascimento.value,'Data de nascimento','isData') )
	{
			document.formBoletimCad.completaCadastro.value='N';
			document.formBoletimCad.submit();
	}
}

function LimpaDado(dado)
{

dado=dado.replace(".","");
dado=dado.replace("/","").replace("-","").replace(".","");
//alert(dado);
return dado;
}

function VerificaTipoPessoa(tipo,valor)
{

if ((valor.length==14)&&(tipo=="cpf"))
{
	document.write("checked");
}
else
{
	if ((valor.length==18)&&(tipo=="cnpj"))
	{
		document.write("checked");
	}
}

}

function SetaTipoPessoa(tipo)
{
 if (tipo=='cpf')
 {
  document.formpedido.tipo.value='cpf';
  document.formpedido.nometipo.value='CPF: (*)';
 }
 else
 {
	 if (tipo=='cnpj')
	 {
	  document.formpedido.tipo.value='cnpj';
	  document.formpedido.nometipo.value='CNPJ: (*)';
	 }
	 else
	 {
	  document.formpedido.tipo.value='cpf';
	  document.formpedido.nometipo.value='CPF: (*)';
	 }

 }
// alert(document.formpedido.tipo.value);
// alert(document.formpedido.nometipo.value);
}

function ConfirmarPedido()
{
var erros="";
//alert("1 "+erros.length);
erros= MM_validateFormReturn(document.formpedido.nome.value,'Nome','R',document.formpedido.cpf.value,'CPF','R',document.formpedido.nascimento.value,'Data de nascimento','isData',document.formpedido.endereco.value,'Endereço','R',document.formpedido.complemento.value,'Complemento','R',document.formpedido.municipio.value,'Município','R',document.formpedido.uf.value,'Estado','R',document.formpedido.pais.value,'País','R',document.formpedido.cep.value,'CEP','R',document.formpedido.email.value,'e-mail','R') ;
//alert("2 "+erros.length);	
//if (! FF_DataValidaReturn(document.formpedido.nascimento.value,document.formpedido.nascimento))
//alert("3 "+erros.length);
erros+="\n"+FF_DataValidaReturn(document.formpedido.nascimento.value,document.formpedido.nascimento);
//alert("4 "+erros.length);
//alert(document.formpedido.tipo.value);

//alert(erros.length);
	//	alert(erros);
	if (erros.length==1)
	{	
		document.formpedido.submit();
	}
	else
	{
		alert(erros);
	}
}

function ConfirmarPedidoCompleto()
{
var erros="";
//alert("1 "+erros.length);
erros= MM_validateFormReturn(document.formpedido.nome.value,'Nome','R',document.formpedido.cpf.value,'CNPJ','R',document.formpedido.nascimento.value,'Data de nascimento','isData',document.formpedido.endereco.value,'Endereço','R',document.formpedido.bairro.value,'Bairro','R',document.formpedido.municipio.value,'Município','R',document.formpedido.uf.value,'Estado','R',document.formpedido.pais.value,'País','R',document.formpedido.cep.value,'CEP','R',document.formpedido.senha.value,'Senha','R',document.formpedido.confsenha.value,'Confirmar senha','R',document.formpedido.email.value,'e-mail','R',document.formpedido.tel_residencial.value,'Telefone Residencial','R',document.formpedido.endereco_entrega.value,'Endereço de entrega','R' ,document.formpedido.municipio_entrega.value,'Município de entrega','R',document.formpedido.cep_entrega.value,'CEP de entrega','R',document.formpedido.referencia_entrega.value,'Ponto de referência de entrega','R' ) ;
//alert("2 "+erros.length);	
//if (! FF_DataValidaReturn(document.formpedido.nascimento.value,document.formpedido.nascimento))
//alert("3 "+erros.length);
erros+="\n"+FF_DataValidaReturn(document.formpedido.nascimento.value,document.formpedido.nascimento);
//alert("4 "+erros.length);
//alert(document.formpedido.tipo.value);
if (document.formpedido.tipo.value=='cpf')
{
	//if (! valida_cpf(LimpaDado(document.formpedido.cpf.value)))
	//erros+="\n - CPF inválido.";
}
else
{
	if (! valida_cnpj(LimpaDado(document.formpedido.cpf.value)))
	erros+="\n - CNPJ inválido.";
}
if (document.formpedido.senha.value!=document.formpedido.confsenha.value)
erros+="\n - Campos senha e confirmar senha com valores diferentes.";

//alert(erros.length);
	//	alert(erros);
	if (erros.length==1)
	{	
		document.formpedido.submit();
	}
	else
	{
		alert(erros);
	}
}

function BuscarAutomovel()
{
	if ( (document.formBuscaAutomovel.field_Marca.value>0)&& (document.formBuscaAutomovel.field_Modelo.value==0))
	{
		alert("Selecione um modelo");
	}
	else
	{
			document.formBuscaAutomovel.submit();
	}
}
function BuscarServico()
{
	//alert(document.formBuscaServico.field_Categoria.value);
	if ( (document.formBuscaServico.field_Categoria.value == 0))
	{
		alert("Selecione uma categoria");
	}
	else
	{
			document.formBuscaServico.submit();
	}
}


function BuscarAutomovelAvancada()
{
	if ( (document.formBuscaAutomovelAvancada.field_MarcaAvancada.value>0)&& (document.formBuscaAutomovelAvancada.field_ModeloAvancada.value==0))
	{
		alert("Selecione um modelo");
	}
	else
	{
			document.formBuscaAutomovelAvancada.submit();
	}
}

function ConfirmarBoletimCapa()
{
	if ( MM_validateForm(document.formBoletim.field_Nome.value,'Nome','R',document.formBoletim.field_Email.value,'e-mail','isEmail',document.formBoletim.field_DataNascimento.value,'Data','isData') )
	{
		document.formBoletim.submit();
	}
}

function doDate(pStr, pFmt)
{
	eval("reDate = reDate" + pFmt);
	if (reDate.test(pStr)) {
		alert(pStr + " é uma data válida.");
	} else if (pStr != null && pStr != "") {
		alert(pStr + " NÃO é uma data válida.");
	}
}

function ConfirmarBoletimSemCPF()
{
	if ( MM_validateForm(document.formBoletimCad.field_Nome.value,'Nome','R',document.formBoletimCad.field_Email.value,'e-mail','R') )
	{
		document.formBoletimCad.submit();
	}
}

function ConfirmarSorteioPMC()
{
	if ( MM_validateForm(document.formSorteioCad.field_Nome.value,'Nome','R',document.formSorteioCad.field_Telefone.value,'Telefone','R',document.formSorteioCad.field_Email.value,'e-mail','R') )
	{
		document.formSorteioCad.submit();
	}
}

function ConfirmarAcessoIntranetWebPack()
{
	if ( MM_validateForm(document.formIntranet.field_Usuario.value,'Usuário','R',document.formIntranet.field_Senha.value,'Senha','R',document.formIntranet.tipologin.value,'O seu perfil','C') )
	{
		document.formIntranet.submit();
	}
}

function ConfirmarAcessoIntranetWebPack()
{
	if ( MM_validateForm(document.formIntranet.address.value,'E-mail','R',document.formIntranet.password.value,'Senha','R') )
	{
		selecionado = PegaValorRadioSelecionado('formIntranet','tipo'); 
		if (selecionado==1)
		{
			document.formIntranet.target='_blank';
			document.formIntranet.action='http://atmail53.redel.com.br/atmail.php';
		}
		else
		{
			document.formIntranet.target='centro';
			document.formIntranet.action='login.jsp';
		}
		document.formIntranet.submit();
	}
}

function ConfirmarAcessoIntranet()
{
	if ( MM_validateForm(document.formIntranet.field_Usuario.value,'Usuário','R',document.formIntranet.field_Senha.value,'Senha','R') )
	{	
		document.formIntranet.submit();
	}
}


function NovaJanelaProduto(idProduto,idEmpresa,idCategoriaPai,idUser,iAltura,iLargura)
{ //v2.0
  
		window.open('produto_visualizar_03.jsp?idProduto='+idProduto+'&idEmpresa='+idEmpresa+'&idCategoriaPai='+idCategoriaPai+'&idUser='+idUser,'Produtos','width=350,height=350,scrollbars=yes');
}

function AbrePagina(link)
{ //v2.0
  
if (link.length==0)
{
		alert("Você deve selecionar um link");
}
else
	{
		this.location=link;
	}
}

function ConfirmarMsgForum()
{
	if ( MM_validateForm(document.formulario.nome.value,'Nome','R',document.formulario.email.value,'e-mail','isEmail',document.formulario.titulo.value,'Título','R') )
	{
//		alert("aaa");
		document.formulario.submit();
	}
}

function AbreChat()
{
	if (document.formChat.idSala.value=="" && document.formChat.user.value=="")
	{
		alert("Você deve selecionar uma sala e informar o seu apelido");
	}
	else
	{
		if (document.formChat.idSala.value=="" )
		{
			alert("Você deve selecionar uma sala");

		}
		else
		{
			if (document.formChat.user.value=="")
			{
				alert("Você deve informar o seu apelido");
			}
			else
			{
				MM_openBrWindow('../includes/chat_conversa.jsp?idSala='+document.formChat.idSala.value+'&user='+document.formChat.user.value+'&ImgChat='+document.formChat.ImgChat.value+'&ImgBotaoSair='+document.formChat.ImgBotaoSair.value+'&ImgBotaoEnviar='+document.formChat.ImgBotaoEnviar.value+'&cor='+document.formChat.Cor.value+'&css='+document.formChat.CSS.value,'chat','width=640,height=500');
//				window.resizeTo(640,500);
			}
		}

	}
}

function MM_jumpMenu1(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}






function MM_jumpMenu(targ,selObj,restore){ //v3.0
if (selObj.options[selObj.selectedIndex].value==0)
{
	alerta("Selecione uma opção")
}
else
{
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
}

function MM_jumpMenu2(selObj,restore){ //v3.0
//alert(selObj.options[selObj.selectedIndex].target);
if (selObj.options[selObj.selectedIndex].target=='blank')
{
	window.open(selObj.options[selObj.selectedIndex].value,'','');

}
else
{
eval(selObj.options[selObj.selectedIndex].target+".location='"+selObj.options[selObj.selectedIndex].value+"'");
}
if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features)
{ //v2.0
  
	/*if ( navigator.appName == "Netscape" )
	{
		e=features.indexOf('height=');	
		largura = features.substring(e+7,features.length);
		features = features.substring(0,e);
		var larguraN = parseInt(largura);
		larguraN += 150; //TEM QUE ADICIONAR MAIS 150 NA ALTURA PARA FUNCIONAR NO NETSCAPE
		features += "height="+larguraN;
	}*/
	if(theURL!="#"){window.open(theURL,winName,features);}
	
}


function ConfirmarLivroVisitas()
{
	if ( MM_validateForm(document.formLVCad.field_Nome.value,'Nome','R',document.formLVCad.field_Mensagem.value,'CPF','R',document.formLVCad.field_Email.value,'e-mail','R') )
	{
		document.formLVCad.submit();
	}
}

function MM_validateForm()
{		
		
        var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
        for (i=0; i<(args.length-2); i+=3)
        {
                test=args[i+2];
               // val=MM_findObj(args[i]);
			   val = args[i];

               // if (val)
                //{
                        file://nm=val.name;
                        nm = args[i+1];
                        //val = val.trim();
                     //   alert('test - '+test+' val = '+val);
                        
				        if (val!="")
                        {
                                if (test.indexOf('isEmail')!=-1)
                                {
                                		validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
                                		if ((val.search(validRegExp) == -1))
                                		{
                                                errors+='- '+nm+' deve conter um endereço de e-mail.\n';
										}

                                }
								else
								{
									if (test.indexOf('isData')!=-1)
									{

										var expReg = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
										if ((!val.match(expReg)) && (!val.value!='')) {
											errors+='- '+nm+' NÃO é uma data válida.\n';
										} 

									}
									else if (test!='R')
									{
										//alert("opa !R");
                                     	num = parseFloat(val);
                                        if (test.indexOf('inRange') != -1)
                                        {
                                                p=test.indexOf(':');
                                                min=test.substring(8,p);
                                                max=test.substring(p+1);
                                                if (num<min || max<num)
                                                        errors+='- '+nm+' deve conter un número entre '+min+' e '+max+'.\n';
                                        }
                                        else
	                                	{
	                                			//alert("opa c");
	                                 		 if ((test == 'C'))
				                        	 {
				 	                        	 //alert("é c");
						                         if ((val=='0'))
					    	                            errors += '- '+nm+' é requerido.\n';
				    	                     }
				    	                     else
			                                	{
			                                		//	alert("opa f");
			                                 		 if (test.indexOf('Fzip')!=-1)
			                                 		 //if ((test == 'Fzip'))
						                        	 {
						 	                        	 //alert("é c");
						 	                        	 //alert("zip - "+val.indexOf('zip')+" rar - "+val.indexOf('rar'));
								                         if ((val.indexOf('zip') == -1) && (val.indexOf('rar') == -1))
								                         //if ((val=='0'))
							    	                            errors += '- '+nm+' deve ser um arquivo compactado (.zip ou .rar).\n';
						    	                     }
							    	            	else
							    	            	{
							    	            		if (val!=''+num)
			                                                errors+='- '+nm+' deve conter um número.\n';
							    	            		
							    	            	}
						    	            	}    
				    	                     
				    	            	}    
	                                }

								}

                        }
                        else if ((test.charAt(0) == 'R')||(test.indexOf('isEmail')!=-1)||(test.indexOf('isData')!=-1))
                                errors += '- '+nm+' é requerido.\n';
               // }
        }
        if (errors){
                alert('Aviso: \n'+errors);
				return false;
		}
        document.MM_returnValue = (errors == '');
		return true;
}

function MM_validateFormReturn()
{
        var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormReturn.arguments;
        for (i=0; i<(args.length-2); i+=3)
        {
                test=args[i+2];
               // val=MM_findObj(args[i]);
			   val = args[i];

               // if (val)
                //{
                        file://nm=val.name;
                        nm = args[i+1];
                        //val = val.trim();
				        if (val!="")
                        {
                                if (test.indexOf('isEmail')!=-1)
                                {
                                		validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
                                		if ((val.search(validRegExp) == -1))
                                		{
                                                errors+='- '+nm+' deve conter um endereço de e-mail.\n';
										}

                                }
								else
								{
									if (test.indexOf('isData')!=-1)
									{

										var expReg = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
										if ((!val.match(expReg)) && (!val.value!='')) {
											errors+='- '+nm+' NÃO é uma data válida.\n';
										} 

									}
									else if (test!='R')
									{
                                     	num = parseFloat(val);
                                        if (val!=''+num)
                                                errors+='- '+nm+' deve conter um número.\n';
                                        if (test.indexOf('inRange') != -1)
                                        {
                                                p=test.indexOf(':');
                                                min=test.substring(8,p);
                                                max=test.substring(p+1);
                                                if (num<min || max<num)
                                                        errors+='- '+nm+' deve conter un número entre '+min+' e '+max+'.\n';
                                        }
                                           
                                        
	                                }
	                                

								}

                        }
                        else if ((test.charAt(0) == 'R')||(test.indexOf('isEmail')!=-1))
                                errors += '- '+nm+' é requerido.\n';
                       
               // }
        }
        if (errors){
               
				return errors;
		}
        document.MM_returnValue = (errors == '');
		return '';
}
	function valida_cpf(cpf) 
      { 
      var numeros, digitos, soma, i, resultado, digitos_iguais; 
      digitos_iguais = 1; 
      if (cpf.length < 11) 
            return false; 
      for (i = 0; i < cpf.length - 1; i++) 
            if (cpf.charAt(i) != cpf.charAt(i + 1)) 
                  { 
                  digitos_iguais = 0; 
                  break; 
                  } 
      if (!digitos_iguais) 
            { 
            numeros = cpf.substring(0,9); 
            digitos = cpf.substring(9); 
            soma = 0; 
            for (i = 10; i > 1; i--) 
                  soma += numeros.charAt(10 - i) * i; 
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; 
            if (resultado != digitos.charAt(0)) 
                  return false; 
            numeros = cpf.substring(0,10); 
            soma = 0; 
            for (i = 11; i > 1; i--) 
                  soma += numeros.charAt(11 - i) * i; 
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; 
            if (resultado != digitos.charAt(1)) 
                  return false; 
            return true; 
            } 
      else 
      {
			alert('Número de cpf inválido');
            return false; 
      }
      } 


	function valida_cnpj(cnpj) 
      { 
      var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais; 
      digitos_iguais = 1; 
      if (cnpj.length < 14 && cnpj.length < 15) 
            return false; 
      for (i = 0; i < cnpj.length - 1; i++) 
            if (cnpj.charAt(i) != cnpj.charAt(i + 1)) 
                  { 
                  digitos_iguais = 0; 
                  break; 
                  } 
      if (!digitos_iguais) 
            { 
            tamanho = cnpj.length - 2 
            numeros = cnpj.substring(0,tamanho); 
            digitos = cnpj.substring(tamanho); 
            soma = 0; 
            pos = tamanho - 7; 
            for (i = tamanho; i >= 1; i--) 
                  { 
                  soma += numeros.charAt(tamanho - i) * pos--; 
                  if (pos < 2) 
                        pos = 9; 
                  } 
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; 
            if (resultado != digitos.charAt(0)) 
                  return false; 
            tamanho = tamanho + 1; 
            numeros = cnpj.substring(0,tamanho); 
            soma = 0; 
            pos = tamanho - 7; 
            for (i = tamanho; i >= 1; i--) 
                  { 
                  soma += numeros.charAt(tamanho - i) * pos--; 
                  if (pos < 2) 
                        pos = 9; 
                  } 
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; 
            if (resultado != digitos.charAt(1)) 
                  return false; 
            return true; 
            } 
      else 
            return false; 
      }
      
function MascaraCep(Campo, teclapres)
{
	var tecla = teclapres.keyCode;
	var vr = new String(Campo.value);
	vr = vr.replace("-", "");
	tam = vr.length + 1;
	if (tecla != 8)
	{
		if (tam == 6)
			Campo.value = vr.substr(0, 5) + '-' + vr.substr(5, 5);
	}
}
    
