var win= null;
function NewWindow(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function OpenMeFull(){
	remote = window.open('', 'janela_openFull', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=0,left=0');
	remote.resizeTo(window.screen.availWidth, window.screen.availHeight);
	}

function mOvr(src,clrOver) {if (!src.contains(event.fromElement)) {src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}


function mOut(src,clrIn) {if (!src.contains(event.toElement)) {src.style.cursor = 'default';
src.bgColor = clrIn;
}
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function abrirnoticia(ID){
		var intLeft, intTop, intWidth, intHeight;
		intWidth	= 700;
		intHeight	= 480;
		intLeft		= eval((screen.width - intWidth) / 2);
		intTop		= eval((screen.height - intHeight) / 2);
		var noticia_diex = window.open('visualizar_noticia.asp?ID=' + ID,'visualizar_noticia','width='+intWidth+',height='+intHeight+',top='+intTop+',left='+intLeft+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no')
}

function abrircurso(ID){
		var intLeft, intTop, intWidth, intHeight;
		intWidth	= 700;
		intHeight	= 480;
		intLeft		= eval((screen.width - intWidth) / 2);
		intTop		= eval((screen.height - intHeight) / 2);
		var curso_diex = window.open('visualizar_curso.asp?ID=' + ID,'visualizar_curso','width='+intWidth+',height='+intHeight+',top='+intTop+',left='+intLeft+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no')
}

function abrirparceiros(ID){
		var intLeft, intTop, intWidth, intHeight;
		intWidth	= 700;
		intHeight	= 480;
		intLeft		= eval((screen.width - intWidth) / 2);
		intTop		= eval((screen.height - intHeight) / 2);
		var parceiros_diex = window.open('visualizar_parceiros.asp?uf=' + ID,'visualizar_parceiros','width='+intWidth+',height='+intHeight+',top='+intTop+',left='+intLeft+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no')
}

function pop(pagina){
	window.open(pagina,'recortes','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=400,left=10,top=10');
}


function ValidaForm()
{
   // Verifica se a consulta esta no periodo especificado
   if(document.FORM.DATAINI > document.FORM.DATAFIM)
   {
      window.alert("ATENÇÃO: A data inicial deve ser anterior à data final");
      return false;
   } else
      return true;
}

function LinkAto(psAto) {
   window.location = "txato.php?des_ato=" + psAto
}

function MostraStatus(psTexto) {
   window.status = psTexto;
}
function alerta(){
   alert('Acesso exclusivo para alunos DIEX.');
}




/*
 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
 * in FIPS PUB 180-1
 * Version 2.1 Copyright Paul Johnston 2000 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for details.
 */

/*
 * Configurable variables. You may need to tweak these to be compatible with
 * the server-side, but the defaults work in most cases.
 */
var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */

/*
 * These are the functions you'll usually want to call
 * They take string arguments and return either hex or base-64 encoded strings
 */
function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}
function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}
function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}
function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}

/*
 * Perform a simple self-test to see if the VM is working
 */
function sha1_vm_test()
{
  return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
}

/*
 * Calculate the SHA-1 of an array of big-endian words, and a bit length
 */
function core_sha1(x, len)
{
  /* append padding */
  x[len >> 5] |= 0x80 << (24 - len % 32);
  x[((len + 64 >> 9) << 4) + 15] = len;

  var w = Array(80);
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;
  var e = -1009589776;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;
    var olde = e;

    for(var j = 0; j < 80; j++)
    {
      if(j < 16) w[j] = x[i + j];
      else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
      var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), 
                       safe_add(safe_add(e, w[j]), sha1_kt(j)));
      e = d;
      d = c;
      c = rol(b, 30);
      b = a;
      a = t;
    }

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
    e = safe_add(e, olde);
  }
  return Array(a, b, c, d, e);
  
}

/*
 * Perform the appropriate triplet combination function for the current
 * iteration
 */
function sha1_ft(t, b, c, d)
{
  if(t < 20) return (b & c) | ((~b) & d);
  if(t < 40) return b ^ c ^ d;
  if(t < 60) return (b & c) | (b & d) | (c & d);
  return b ^ c ^ d;
}

/*
 * Determine the appropriate additive constant for the current iteration
 */
function sha1_kt(t)
{
  return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :
         (t < 60) ? -1894007588 : -899497514;
}  

/*
 * Calculate the HMAC-SHA1 of a key and some data
 */
function core_hmac_sha1(key, data)
{
  var bkey = str2binb(key);
  if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++) 
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);
  return core_sha1(opad.concat(hash), 512 + 160);
}

/*
 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
 * to work around bugs in some JS interpreters.
 */
function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

/*
 * Bitwise rotate a 32-bit number to the left.
 */
function rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

/*
 * Convert an 8-bit or 16-bit string to an array of big-endian words
 * In 8-bit function, characters >255 have their hi-byte silently ignored.
 */
function str2binb(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);
  return bin;
}

/*
 * Convert an array of big-endian words to a string
 */
function binb2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (24 - i%32)) & mask);
  return str;
}

/*
 * Convert an array of big-endian words to a hex string.
 */
function binb2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF);
  }
  return str;
}

/*
 * Convert an array of big-endian words to a base-64 string
 */
function binb2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * (3 -  i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

/***** Valida Form Fale Conosco *****/
function valida_FalCon()
{
	if (document.formulario.nome.value == '' || document.formulario.email.value == '' || document.formulario.cidade.value == '' || document.formulario.estado.value == '' || document.formulario.depto.value == '' || document.formulario.assunto.value == '' || document.formulario.mensagem.value == '')
	{
		alert('Os campos assinalados com (*), não podem ficar em branco.');
		return false;
	}
	else
	{
		var email = document.formulario.email.value;
		if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
		{
			alert('Este email não é válido');
			return false;
		}
	}
}



/***** Valida Form Dúvidas *****/
function valida_Duv()
{
	if (document.formulario.disciplina.value == '' || document.formulario.duvida.value == '' || document.formulario.descri_duvida.value == '')
	{
		alert('Os campos assinalados com (*), não podem ficar em branco.');
		return false;
	}
	else
	{
		if (document.formulario.email.value == '')
		{
			var email = document.formulario.email_alt.value;
			if (email == '')
			{
				alert('Como seu cadastro não dispõe de email, digite o email alternativo.');
				return false;
			}
			else
			{
				if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
				{
					alert('Este email não é válido');
					return false;
				}
			}
		}
	}
}



function valida_CadArtigos()
{
	if (document.formulario.categoria.value == '' || document.formulario.data.value == '' || document.formulario.fonte.value == ''|| document.formulario.ativo.value == '' || document.formulario.titulo.value == '' || document.formulario.artigo.value == '')
	{
		alert('Os campos assinalados com (*), não podem ficar em branco.');
		return false;
	}
}


function valida_CadCalendario()

{
	if (document.formulario.curso.value == '' || document.formulario.semana.value == '' || document.formulario.data.value == '' || document.formulario.Hinicio.value == '' || document.formulario.Htermino.value == '' || document.formulario.disciplina.value == '' || document.formulario.professor.value == '')
	{
		alert('Os campos assinalados com (*), não podem ficar em branco.');
		return false;
	}
}


function valida_CadCursos()

{
	if (document.formulario.curso.value == '' )
	{
		alert('Este campo não pode ficar em branco.');
		return false;
	}
}


function valida_CadDisciplinas()

{
	if (document.formulario.disciplina.value == '' )
	{
		alert('Este campo não pode ficar em branco.');
		return false;
	}
}


function valida_Grade()

{
	if (document.formulario.curso.value == '' || document.formulario.disciplina.value == '' || document.formulario.professor.value == '' )
	{
		alert('Estes campos não podem ficar em branco.');
		return false;
	}
}


function valida_CadMatAula()


{
	if (document.formulario.curso.value == '' || document.formulario.data.value == '' || document.formulario.disciplina.value == '' || document.formulario.professor.value == '' || document.formulario.link.value == '' )
	{
		alert('Estes campos não podem ficar em branco.');
		return false;
	}
}


function valida_CadProfessores()

{
	if (document.formulario.professor.value == '') 
	{
		alert('Este campo não pode ficar em branco.');
		return false;
	}
}

function mascara_data_ini(data_ini)
{
	var mydata = '';
	mydata = mydata + data_ini;
	if (mydata.length == 2)
	{
		mydata = mydata + '-';
		document.formulario.data.value = mydata;
	}
	if (mydata.length == 5)
	{
		mydata = mydata + '-';
		document.formulario.data.value = mydata;
	}
	if (mydata.length == 10)
	{
		verifica_data_ini();
	}
}

function verifica_data_ini ()
{
	dia = (document.formulario.data.value.substring(0,2));
	mes = (document.formulario.data.value.substring(3,5));
	ano = (document.formulario.data.value.substring(6,10));

	situacao = "";
	// verifica o dia valido para cada mes
	if ((dia < 01)||(dia < 01 || dia > 30) && (  mes == 04 || mes == 06 || mes == 09 || mes == 11 ) || dia > 31)
	{
		situacao = "falsa";
	}

	// verifica se o mes e valido
	if (mes < 01 || mes > 12 ) {
		situacao = "falsa";
	}

	// verifica se eh ano bissexto
	if (mes == 2 && ( dia < 01 || dia > 29 || ( dia > 28 && (parseInt(ano / 4) != ano / 4))))
	{
		situacao = "falsa";
	}

	if (document.formulario.data.value == "")
	{
		situacao = "falsa";
	}

	if (situacao == "falsa")
	{
		alert("Esta data é inválida!");
		document.formulario.data.focus();
	}
}

function valida_sorteio()
{
	if (document.formulario.nome.value == '' || document.formulario.telefone.value == '' || document.formulario.endereco.value == '' || document.formulario.cidade.value == '' || document.formulario.estado.value == '' || document.formulario.cep.value == '' || document.formulario.email.value == '') 
	{
		alert('Nenhum campo pode ficar em branco.');
		return false;
	}
	else
	{
		if (document.formulario.cep.value.length != 8)
		{
			alert('O CEP informado não é válido.');
			return false;
		}
	}
}

function valida_sorteio_dados()
{
	var cpf_consulta = document.formulario.CPF.value;
	//alert("|" + cpf_consulta + "|");
	cpf_consulta = cpf_consulta.replace(".","");
	cpf_consulta = cpf_consulta.replace("-","");
	cpf_consulta = cpf_consulta.replace(".","");
	//alert(cpf_consulta);
	
	if (cpf_consulta.length != 11 )
	{
		alert('Este número de CPF não é válido.');
	}
	else
	{
		//alert(cpf_consulta);
		ValidaCpf(cpf_consulta)
	}
}

//Funcao JavaScript para validacao de CPF

function FormataCpf(campo,tammax,teclapres)
{
	var tecla = teclapres.keyCode;
	  
	vr = event.srcElement.value;
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ",", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	tam = vr.length;

	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

	if (tecla == 8 ){ tam = tam - 1 ; }
	  
	if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )
	{
		if ( tam <= 2 )
		{ 
			event.srcElement.value = vr ;
		}
		if ( (tam > 2) && (tam <= 5) )
		{
			event.srcElement.value = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ) ;
		}
		if ( (tam >= 6) && (tam <= 8) )
		{
			event.srcElement.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ;
		}
		if ( (tam >= 9) && (tam <= 11) )
		{
			event.srcElement.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ;
		}
		if ( (tam >= 12) && (tam <= 14) )
		{
			event.srcElement.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ;
		}
		if ( (tam >= 15) && (tam <= 17) )
		{
			event.srcElement.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ;
		}
	}  
}

//Funcao JavaScript para validacao de CPF e CNPJ

function ValidaCpf(cpf_consulta)
{
	var NUMERO = cpf_consulta;
	var POSICAO, I, SOMA, DV, DV_INFORMADO;
	var DIGITO = new Array(10);

/*Retira do número informado os dois últimos dígitos*/
	DV_INFORMADO = NUMERO.substr( 9, 2);

/*Desmembra o número  do CPF na matriz DOGITO*/
	for (I=0; I<=8; I++)
	{
		DIGITO[I]= NUMERO.substr( I,1);
	}
/*Calcula o valor  do 10º dígito de verificação*/
	POSICAO = 10;
	SOMA = 0;
	for (I=0; I<=8; I++)
	{
		SOMA = SOMA + DIGITO[I] * POSICAO;
		POSICAO = POSICAO - 1;
	}
	DIGITO[9] = SOMA % 11;
	if (DIGITO[9]< 2)
	{
		DIGITO[9]= 0;
	}
	else
	{
		DIGITO[9]= 11 - DIGITO[9];
	}
/* CALCULA O VALOR DO 11 º DIGITO DE VERIFICAÇÃO*/
	POSICAO = 11;
	SOMA = 0;
	
	for (I=0; I<=9; I++)
	{
		SOMA = SOMA + DIGITO[I] * POSICAO;
		POSICAO = POSICAO - 1;
	}
	DIGITO[10] = SOMA % 11;
	
	if (DIGITO[10] < 2)
	{
		DIGITO[10] = 0;
	}
	else
	{
		DIGITO[10]= 11 - DIGITO [10];
	}

	DV = DIGITO[9] * 10 + DIGITO[10];
	
	if (DV != DV_INFORMADO)
	{
		alert('Este número de CPF é Inválido');
		document.formulario.CPF.value = '';
		document.formulario.CPF.focus();
	}
	else
	{
		document.formulario.submit();
	}
}
//Funcao JavaScript para validacao de CPF e CNPJ


function valida_cadastronet()
{
	if (document.cadastronet.nome.value == '' || document.cadastronet.email.value == '' || document.cadastronet.endereco.value == '' || document.cadastronet.bairro.value == '' || document.cadastronet.cidade.value == '' || document.cadastronet.cep.value == '' || document.cadastronet.estado.value == '' || document.cadastronet.cpf.value == '' || document.cadastronet.rg.value == '' || document.cadastronet.telefone.value == '' || document.cadastronet.celular.value == '' || document.cadastronet.unidade.value == '')
	{
		alert('Os campos assinalados com (*), não podem ficar em branco.');
		return false;
	}
	else
	{
		var email = document.cadastronet.email.value;
		if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
		{
			alert('Este email não é válido');
			return false;
		}
	}
}
function valida_cadastrod()
{
	if (document.cadastrod.nome.value == '' || document.cadastrod.email.value == '' || document.cadastrod.endereco.value == '' || document.cadastrod.bairro.value == '' || document.cadastrod.cidade.value == '' || document.cadastrod.cep.value == '' || document.cadastrod.estado.value == '' || document.cadastrod.cpf.value == '' || document.cadastrod.rg.value == '' || document.cadastrod.telefone.value == '' || document.cadastrod.celular.value == '' || document.cadastrod.unidade.value == '')
	{
		alert('Todos os campos são de preenchimento obrigatório e não podem ficar em branco.');
		return false;
	}
	else
	{
		var email = document.cadastrod.email.value;
		if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
		{
			alert('Este email não é válido');
			return false;
		}


		var frete = document.getElementById("idfrete").innerHTML
		if (document.getElementById("idfrete").innerHTML=='0,00')
		{
			alert('Valor do frete não foi Calculado ');
			return false;
		}
	}

}

function valida_cadastrof()
{
	if (document.cadastrof.nome.value == '' || document.cadastrof.email.value == '' || document.cadastrof.endereco.value == '' || document.cadastrof.bairro.value == '' || document.cadastrof.cidade.value == '' || document.cadastrof.cep.value == '' || document.cadastrof.estado.value == '' || document.cadastrof.cpf.value == '' || document.cadastrof.rg.value == '' || document.cadastrof.telefone.value == '' || document.cadastrof.celular.value == '' || document.cadastrof.cidadei.value == '' || document.cadastrof.senha.value == '' || document.cadastrof.csenha.value == '')
	{
		alert('Todos os campos são de preenchimento obrigatório e não podem ficar em branco.');
		return false;
	}
	else
	{
		var email = document.cadastrof.email.value;
		if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
		{
			alert('Este email não é válido');
			return false;
		}

		var senha = document.cadastrof.senha.value;
		var csenha = document.cadastrof.csenha.value;
		if (senha != csenha)
		{
			alert('A Senha não confere com a confirmação da Senha');
			return false;
		}

	}
}


function valida_cadastrobsp()
{
	if (document.cadastrobsp.nome.value == '' || document.cadastrobsp.email.value == '' || document.cadastrobsp.endereco.value == '' || document.cadastrobsp.bairro.value == '' || document.cadastrobsp.cidade.value == '' || document.cadastrobsp.cep.value == '' || document.cadastrobsp.estado.value == '' || document.cadastrobsp.cpf.value == '' || document.cadastrobsp.rg.value == '' || document.cadastrobsp.telefone.value == '' || document.cadastrobsp.celular.value == '')
	{
		alert('Todos os campos são de preenchimento obrigatório e não podem ficar em branco.');
		return false;
	}
	else
	{
		var email = document.cadastrobsp.email.value;
		if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
		{
			alert('Este email não é válido');
			return false;
		}


	}
}



function valor_frete()
{

if (document.cadastrod.estado.value == 'SP')
		{
		alert('Valor do Frete é 9,00');
		document.getElementById("idfrete").innerHTML = '9,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'MG')
		{
		alert('Valor do Frete é 19,00');
		document.getElementById("idfrete").innerHTML = '19,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'PR')
		{
		alert('Valor do Frete é 19,00');
		document.getElementById("idfrete").innerHTML = '19,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'RJ')
		{
		alert('Valor do Frete é 19,00');
		document.getElementById("idfrete").innerHTML = '19,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'SC')
		{
		alert('Valor do Frete é 19,00');
		document.getElementById("idfrete").innerHTML = '19,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'DF')
		{
		alert('Valor do Frete é 23,00');
		document.getElementById("idfrete").innerHTML = '23,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'ES')
		{
		alert('Valor do Frete é 23,00');
		document.getElementById("idfrete").innerHTML = '23,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'GO')
		{
		alert('Valor do Frete é 27,00');
		document.getElementById("idfrete").innerHTML = '27,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'MS')
		{
		alert('Valor do Frete é 23,00');
		document.getElementById("idfrete").innerHTML = '23,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'RS')
		{
		alert('Valor do Frete é 23,00');
		document.getElementById("idfrete").innerHTML = '23,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'BA')
		{
		alert('Valor do Frete é 29,00');
		document.getElementById("idfrete").innerHTML = '29,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'MT')
		{
		alert('Valor do Frete é 29,00');
		document.getElementById("idfrete").innerHTML = '29,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'TO')
		{
		alert('Valor do Frete é 29,00');
		document.getElementById("idfrete").innerHTML = '29,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'AL')
		{
		alert('Valor do Frete é 31,00');
		document.getElementById("idfrete").innerHTML = '31,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'SE')
		{
		alert('Valor do Frete é 31,00');
		document.getElementById("idfrete").innerHTML = '31,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'CE')
		{
		alert('Valor do Frete é 37,00');
		document.getElementById("idfrete").innerHTML = '37,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'MA')
		{
		alert('Valor do Frete é 37,00');
		document.getElementById("idfrete").innerHTML = '37,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'PB')
		{
		alert('Valor do Frete é 34,00');
		document.getElementById("idfrete").innerHTML = '34,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'PE')
		{
		alert('Valor do Frete é 34,00');
		document.getElementById("idfrete").innerHTML = '34,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'PI')
		{
		alert('Valor do Frete é 34,00');
		document.getElementById("idfrete").innerHTML = '34,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'RN')
		{
		alert('Valor do Frete é 37,00');
		document.getElementById("idfrete").innerHTML = '37,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'RO')
		{
		alert('Valor do Frete é 34,00');
		document.getElementById("idfrete").innerHTML = '34,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'AC')
		{
		alert('Valor do Frete é 37,00');
		document.getElementById("idfrete").innerHTML = '37,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'AP')
		{
		alert('Valor do Frete é 37,00');
		document.getElementById("idfrete").innerHTML = '37,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'PA')
		{
		alert('Valor do Frete é 37,00');
		document.getElementById("idfrete").innerHTML = '37,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'AM')
		{
		alert('Valor do Frete é 37,00');
		document.getElementById("idfrete").innerHTML = '37,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}
if (document.cadastrod.estado.value == 'RR')
		{
		alert('Valor do Frete é 44,00');
		document.getElementById("idfrete").innerHTML = '44,00';
		document.cadastrod.frete.value = document.getElementById("idfrete").innerHTML;
		}




}


function valida_cadastro1()
{
	if (document.precadastronet.unidade.value == '' || document.precadastronet.unidade.value == '0')
	{
		alert('É Obrigatório a seleção da Unidade');
		document.precadastronet.unidade.focus();
		return false;
	}

	else
	{
	if (document.precadastronet.cpf.value == '')
	{
		alert('É obrigatório o preenchimento do CPF');
		document.precadastronet.cpf.focus();
		return false;
	}
	}

}
function valida_cadastro2()
{
	if (document.precadastronet.estado.value == '' || document.precadastronet.estado.value == '0')
	{
		alert('É Obrigatório a seleção do Estado');
		document.precadastronet.estado.focus();
		return false;
	}

	else
	{
	if (document.precadastronet.cpf.value == '')
	{
		alert('É obrigatório o preenchimento do CPF');
		document.precadastronet.cpf.focus();
		return false;
	}
	}

}

function valida_cadastro3()
{
	if (document.cadastro3.nome.value == '' || document.cadastro3.email.value == '' || document.cadastro3.endereco.value == '' || document.cadastro3.bairro.value == '' || document.cadastro3.cidade.value == '' || document.cadastro3.cep.value == '' || document.cadastro3.estado.value == '' || document.cadastro3.cpf.value == '' || document.cadastro3.rg.value == '' || document.cadastro3.telefone.value == '' || document.cadastro3.celular.value == '')
	{
		alert('Todos os campos são de preenchimento obrigatório e não podem ficar em branco.');
		return false;
	}
	else
	{
		var email = document.cadastro3.email.value;
		if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
		{
			alert('Este email não é válido');
			return false;
		}
	}

}

function valida_newsletter()
{
	if (document.newsletter.nome.value == '' || document.newsletter.email.value == '')
	{
		alert('Todos os campos são de preenchimento obrigatório e não podem ficar em branco.');
		return false;
	}
	else
	{
		var email = document.newsletter.email.value;
		if (email.indexOf('@') == -1 || email.indexOf('.') == -1)
		{
			alert('Este email não é válido');
			return false;
		}
	}

}


