//-----> máscara cep:

function m_CEP(campo,tammax) {



var vr = campo.value;

vr = vr.replace( "-", "" );

vr = vr.replace( ".", "" );

var tam = vr.length;



if (tam < tammax) { tam = vr.length + 1; }



tam = tam - 1;

if ( (tam > 2) && (tam <= 8) ) {

vr = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ); }

if ( (tam == 7) ) {

vr = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, tam ); }



campo.value = vr;

}
	

function comprova_extensao(formulario, arquivo) { 
   extensoes_permitidas = new Array(".wmv", ".mpeg", ".mpg", ".avi", ".mov", ".flv"); 
   meuerro = ""; 
   if (!arquivo) { 
      //Se não tenho arquivo, é porque não se selecionou um arquivo no formulário. 
       meuerro = "Não foi selecionado nenhum arquivo"; 
   }else{ 
      //recupero a extensão deste nome de arquivo 
      extensao = (arquivo.substring(arquivo.lastIndexOf("."))).toLowerCase(); 
      //alert (extensao); 
      //comprovo se a extensão está entre as permitidas 
      permitida = false; 
      for (var i = 0; i < extensoes_permitidas.length; i++) { 
         if (extensoes_permitidas[i] == extensao) { 
         permitida = true; 
         break; 
         } 
      } 
      if (!permitida) { 
         meuerro = "Arquivo Inválido." ; 
       }else{ 
          //submeto! 
         //alert ("Tudo correto. Vou submeter o formulário."); 

		if(document.getElementById('titulo').value==''){
			alert("Campo Obrigatório!")
			document.getElementById('titulo').focus();
			document.getElementById('titulo').style.background='#FFC6C6';
			return false
			} else {		 
				 document.getElementById('ext').value =  extensao
				 document.getElementById('btenviar').disabled='disabled';
				 document.getElementById('btenviar').value='Aguarde enviando...';				 
				 formulario.submit(); 
				 return 1; 

			}

       } 
   } 
   //se estou aqui é porque não se pode submeter 
   alert (meuerro); 
   return 0; 
}



// VALIDAÇÃO DE E-MAIL


function checkEmail(campo)
{
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(campo.value))
 {
   return (true)
 } if(campo.value!=""){
   document.getElementById('alerta').innerHTML = "<span class='Vermelho10'><strong>E-mail Inválido</strong></span>";
   //campo.value='E-mail Inválido!';   
   campo.focus();
   
   campo.style.background='#FFC6C6';
   return (false)
 }
}

function checkEmailnd(campo)
{
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(campo.value))
 {
   return (true)
 } if(campo.value!=""){
   document.getElementById('alerta2').innerHTML = "<span class='Vermelho10'><strong>E-mail Inválido</strong></span>";
   //campo.value='E-mail Inválido!';   
   campo.focus();
   
   campo.style.background='#FFC6C6';
   return (false)
 }
}
function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

if(document.all) { // Internet Explorer
nTecla = evtKeyPress.keyCode; }
else if(document.layers) { // Nestcape
nTecla = evtKeyPress.which;
}

sValue = objForm[strField].value;

// Limpa todos os caracteres de formatação que
// já estiverem no campo.
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( ":", "" );
sValue = sValue.toString().replace( ":", "" );
fldLen = sValue.length;
mskLen = sMask.length;

i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;

while (i <= mskLen) {
bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " ") || (sMask.charAt(i) == ":"))

if (bolMask) {
sCod += sMask.charAt(i);
mskLen++; }
else {
sCod += sValue.charAt(nCount);
nCount++;
}

i++;
}

objForm[strField].value = sCod;

if (nTecla != 8) { // backspace
if (sMask.charAt(i-1) == "9") { // apenas números...
return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
else { // qualquer caracter...
return true;
} }
else {
return true;
}
}
//Fim da Função Máscaras Gerais


function m_CPF(campo,tammax) {



var vr = campo.value;

vr = vr.replace( "-", "" );

vr = vr.replace( ".", "" );

vr = vr.replace( ".", "" );

var tam = vr.length;



if (tam < tammax) { tam = vr.length + 1; }



tam = tam - 1;

if ( (tam > 2) && (tam <= 11) ) {

vr = vr.substr( 0, tam - 1 ) + '-' + vr.substr( tam - 1, tam ); }

if ( (tam == 10) ) {

vr = vr.substr( 0, tam - 7 ) + '.' + vr.substr( tam - 7, 3 ) + '.' + vr.substr( tam - 4, tam ); }



campo.value = vr;

}

function v_NR(tecla)

{

if(typeof(tecla) == 'undefined')

var tecla = window.event;

var codigo = (tecla.which ? tecla.which : tecla.keyCode ? tecla.keyCode : tecla.charCode);



// permite números, 8=backspace, 46=del e 9=tab

if ( (codigo >= 48 && codigo <= 57) || (codigo >= 96 && codigo <= 105) || codigo == 8 || codigo == 46 || codigo == 9 )

{ return true; }
else
{ alert("Apenas números são permitidos !"); return false; } 

}


//VALIDA CPF
function validacpf(){ 
  var i; 
  s = document.form.cpf.value; 
  s = s.toString().replace( "-", "" );
  s = s.toString().replace( ".", "" );
  s = s.toString().replace( ".", "" );  
  if (s.length < 11){
  	alert("CPF Invalido")
	return false;
  }
  var c = s.substr(0,9); 
  var dv = s.substr(9,2); 
  var d1 = 0; 
  for (i = 0; i < 9; i++){ 
  	d1 += c.charAt(i)*(10-i); 
  } 
  if (d1 == 0){ 
  	alert("CPF Invalido") 
    return false; 
  } 
  d1 = 11 - (d1 % 11); 
  if (d1 > 9) d1 = 0; 
  	if (dv.charAt(0) != d1) { 
  		alert("CPF Invalido") 
  		return false; 
    } 
    d1 *= 2; 
    for (i = 0; i < 9; i++){ 
    	d1 += c.charAt(i)*(11-i); 
    } 
    d1 = 11 - (d1 % 11); 
    if (d1 > 9) d1 = 0; 
    if (dv.charAt(1) != d1){ 
    	alert("CPF Invalido") 
  		return false; 
    } 
	return true; 
  
}

// Mostra e Esconde o Menu
function mostraDiv(id){
var id
x = document.getElementById(id).style.display;

if(x == ''){
	document.getElementById(id).style.display='none';
}
else{
	document.getElementById(id).style.display='';
	}
}



Total = 245
function contaChr(){
	tamanho=document.getElementById('txtcoment').value
	if (tamanho.length <= 500){
		document.getElementById('tot').value = 500 - tamanho.length
	}
	else ( document.getElementById('txtcoment').blur())
}

function validaLogin(){
	
if(document.form.user.value==''){
//	alert("Campo Obrigatório!")
	document.form.user.focus();
	document.form.user.style.background='#FFC6C6';
	return false
	}

if(document.form.pass.value==''){
	//alert("Campo Obrigatório!")
	document.form.pass.focus();
	document.form.pass.style.background='#FFC6C6';
	return false
	}
}


function validaComent(){
	
email=document.getElementById('txtemail');

if(document.getElementById('txtnome').value=='' || document.getElementById('txtnome').value=='Preenchimento obrigatório!'){
	document.getElementById('alerta').innerHTML = "<span class='VermelhoLg10'>Nome Obrigatório</span>";
//	document.getElementById('txtnome').value='Preenchimento obrigatório!';
	document.getElementById('txtnome').focus();
	document.getElementById('txtnome').style.background='#FFC6C6';
	return false
	}
if(document.getElementById('txtemail').value=='' || document.getElementById('txtemail').value=='Preenchimento obrigatório!' || document.getElementById('txtemail').value=='E-mail Inválido!'){
	document.getElementById('alerta').innerHTML = "<span class='VermelhoLg10'>E-mail Obrigatório</span>";
//	document.getElementById('txtemail').value='Preenchimento obrigatório!';
	document.getElementById('txtemail').focus();
	document.getElementById('txtemail').style.background='#FFC6C6';
	return false		
	}
	else{
	 if(checkEmail(email)==false){
	  return false     
	  }
	}

if(document.getElementById('txtcoment').value=='' || document.getElementById('txtcoment').value=='Preenchimento obrigatório!'){
	document.getElementById('alerta').innerHTML = "<span class='VermelhoLg10'>Comentário Obrigatório</span>";
//	document.getElementById('txtcoment').value='Preenchimento obrigatório!';
	document.getElementById('txtcoment').focus();
	document.getElementById('txtcoment').style.background='#FFC6C6';
	return false
	}

var idmateria =  document.getElementById('idmateria').value
var txtnome	  = document.getElementById('txtnome').value
var txtemail  = document.getElementById('txtemail').value
var txtcoment = document.getElementById('txtcoment').value
var endi = "grava.asp?cod="+idmateria+"&cod2="+txtnome+"&cod3="+txtemail+"&cod4="+txtcoment

ajaxLink('comentario',endi);

//MandaID(idmateria.value,'grava.asp','comentario',txtnome.value,txtemail.value,txtcoment.value);

document.getElementById('txtnome').value='';
document.getElementById('txtemail').value=''
document.getElementById('txtcoment').value='';
}




function printSWF(nomeSWF,larguraSWF,alturaSWF,wmodeSWF){
document.write('<embed src="'+nomeSWF+'?rnd=000000022" type="application/x-shockwave-flash" width="'+larguraSWF+'" height="'+alturaSWF+'" wmode="'+wmodeSWF+'"></embed>')
}

function enviaAjax(cod, cod2, cod3, cod4){

var url, emailRement,destEmail

emailRement	= document.getElementById('emailRement');
destEmail	= document.getElementById('destEmail');
url 		= "sendIndique.asp?cod="+cod+"&cod2="+cod2+"&cod3="+cod3+"&cod4="+cod4

if(document.getElementById('destEmail').value=='' || document.getElementById('destEmail').value=='Preenchimento obrigatório!' || document.getElementById('destEmail').value=='E-mail Inválido!'){
	document.getElementById('alerta2').innerHTML = "<span class='VermelhoLg10'>E-mail Obrigatório</span>";
//	document.getElementById('txtemail').value='Preenchimento obrigatório!';
	document.getElementById('destEmail').focus();
	document.getElementById('destEmail').style.background='#FFC6C6';
	return false		
	}
	else{
	 if(checkEmailnd(destEmail)==false){
	  return false     
	  }
	}

if(document.getElementById('nomeRement').value=='' || document.getElementById('nomeRement').value=='Preenchimento obrigatório!'){
	document.getElementById('alerta2').innerHTML = "<span class='VermelhoLg10'>Nome Obrigatório</span>";
//	document.getElementById('txtnome').value='Preenchimento obrigatório!';
	document.getElementById('nomeRement').focus();
	document.getElementById('nomeRement').style.background='#FFC6C6';
	return false
	}

if(document.getElementById('emailRement').value=='' || document.getElementById('emailRement').value=='Preenchimento obrigatório!' || document.getElementById('emailRement').value=='E-mail Inválido!'){
	document.getElementById('alerta2').innerHTML = "<span class='VermelhoLg10'>E-mail Obrigatório</span>";
//	document.getElementById('txtemail').value='Preenchimento obrigatório!';
	document.getElementById('emailRement').focus();
	document.getElementById('emailRement').style.background='#FFC6C6';
	return false		
	}
	else{
	 if(checkEmailnd(emailRement)==false){
	  return false     
	  }
	}

ajaxLink('enviando',url)
}


function MandaID(str,pag,campo,cod2,cod3,cod4)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Este browser não suporta HTTP Request")
	return
	}
	
	var url=pag
	url=url+"?cod="+str+"&cod2="+cod2+"&cod3="+cod3+"&cod4="+cod4
	url=url+"&sid="+Math.random()
	document.getElementById("guarda").value=campo;
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
camp = document.getElementById("guarda").value;
document.getElementById(camp).innerHTML= unescape("" + xmlHttp.responseText) 
} 
} 

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}


// JavaScript Document

		sfHover = function() {
		// Find all unordered lists.
		var ieNavs = document.getElementsByTagName('ul');
		for(i=0; i<ieNavs.length; i++) {
			var ul = ieNavs[i];
			// If they have a class of nav add the menu hover.
			if(ul.className == "nav")
				setHover(ul);
		}
	
	}
	
	function setHover(nav) {
		var ieULs = nav.getElementsByTagName('ul');
		if ((navigator.appVersion.substr(22,3)!="5.0") && navigator.appName.indexOf("Microsoft") > -1) {
			// IE script to cover <select> elements with <iframe>s
			for (j=0; j<ieULs.length; j++) {
				var ieMat=document.createElement('iframe');
				if(document.location.protocol == "https:")
					ieMat.src="//0";
				else
					ieMat.src="javascript:''";
				ieMat.scrolling="no";
				ieMat.frameBorder="0";
				ieMat.style.width=ieULs[j].offsetWidth+"px";
				ieMat.style.height=ieULs[j].offsetHeight+"px";
				ieMat.style.zIndex="-1";
				ieULs[j].insertBefore(ieMat, ieULs[j].childNodes[0]);
				ieULs[j].style.zIndex="101";
			}
			// IE script to change class on mouseover
			var ieLIs = nav.getElementsByTagName('li');
			for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
				// Does this LI have children? If so add a sfnode class.
				if (ieLIs[i].getElementsByTagName("UL").length>0){
					ieLIs[i].className+=" sfnode";
				}
				
				// Add a sfhover class to the li.
				ieLIs[i].onmouseover=function() {this.className+=" sfhover";}
				ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');}
			}
		} else {
			// IE 5.0 doesn't support iframes so hide the select statements on hover and show on mouse out.
			// IE script to change class on mouseover
			var ieLIs = document.getElementById('nav').getElementsByTagName('li');
			for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
				ieLIs[i].onmouseover=function() {this.className+=" sfhover";hideSelects();}
				ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');showSelects()}
			}
		}
	}
	
	// If IE 5.0 hide and show the select statements.
	function hideSelects(){
		var oSelects=document.getElementsByTagName("select");
		for(var i=0;i<oSelects.length;i++)
			oSelects[i].className+=" hide";
	}
	
	function showSelects(){
		var oSelects=document.getElementsByTagName("select");
		for(var i=0;i<oSelects.length;i++)
			oSelects[i].className=oSelects[i].className.replace(" hide","");
	}
	
	// Run this only for IE.
	if (window.attachEvent) window.attachEvent('onload', sfHover);
	// end

    changeDividerPics();

    function changeDividerPics(){
        if (document.getElementById("noframe_1")) {
            if (document.getElementById("noframe_1").className == "topnav") {
                document.getElementById("noframe_1").innerHTML= document.getElementById("css_menu").innerHTML;
            } else {
                var arrElements = document.getElementById("noframe_1").getElementsByTagName("div");
                for(var i=0; i<arrElements.length; i++){
                    if ("topnav"== arrElements[i].className){
                        arrElements[i].innerHTML= document.getElementById("css_menu").innerHTML;
                    }
                }
            }
        } else {
            if (document.getElementById("topnav_2007")) {
                if (document.getElementById("css_menu")) {
                    document.getElementById("css_menu").style.display='';
                }
            } else {
                var arrElements = document.getElementsByTagName("div");
                for(var i=0; i<arrElements.length; i++){
                    if ("topnav"== arrElements[i].className){
                        arrElements[i].innerHTML= document.getElementById("css_menu").innerHTML;
                    }
                }
            }
        }
    }


<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


function validaFormNews(){
email=document.form.email

if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#FFC6C6';
	return false
	}
if(document.form.email.value==''){
	alert("Campo Obrigatório!")
	document.form.email.focus();
	document.form.email.style.background='#FFC6C6';
	return false		
	}
	else{
	 if(checkEmail(email)==false){
	  return false     
	  }
	}
if(document.form.estado.value==''){
	alert("Campo Obrigatório!")
	document.form.estado.focus();
	document.form.estado.style.background='#FFC6C6';
	return false
	}
if(document.form.cidade.value==''){
	alert("Campo Obrigatório!")
	document.form.cidade.focus();
	document.form.cidade.style.background='#FFC6C6';
	return false
	}

}

function validaForm(){

email=document.form.email

if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#FFC6C6';
	return false
	}
if(document.form.email.value==''){
	alert("Campo Obrigatório!")
	document.form.email.focus();
	document.form.email.style.background='#FFC6C6';
	return false		
	}
	else{
	 if(checkEmail(email)==false){
	  return false     
	  }
	}
if(document.form.estado.value==''|| document.form.estado.value=='Selecione um Estado'){
	alert("Campo Obrigatório!")
	document.form.estado.focus();
	document.form.estado.style.background='#FFC6C6';
	return false
	}
if(document.form.cidade.value=='' || document.form.cidade.value=='Selecione uma Cidade'){
	alert("Campo Obrigatório!")
	document.form.cidade.focus();
	document.form.cidade.style.background='#FFC6C6';
	return false
	}
if(document.form.comentario.value==''){
	alert("Campo Obrigatório!")
	document.form.comentario.focus();
	document.form.comentario.style.background='#FFC6C6';
	return false
	}
if(document.form.codigo.value==''){
	alert("Campo Obrigatório!")
	document.form.codigo.focus();
	document.form.codigo.style.background='#FFC6C6';
	return false
	}
} 	
function Agree(button){
if (document.getElementById(button).disabled==0)
{document.getElementById(button).disabled=1}
else
{document.getElementById(button).disabled=0}
}


/**
*	"Rate This"
*
*	@author Rogerio Alencar Lino Filho
*	@date  31 de dezembro de 2007
*	@link http://rogeriolino.wordpress.com/
*/
var Rate = function(total_stars) {
	var self = this;
	this.stars = new Array(total_stars);
	this.clicked = 0;
	this.padrao = 0;
	this.container;
	
	function createStars() {
		self.container = document.createElement("div");
		for (var i=0; i<self.stars.length; i++) {
			var star = document.createElement("span");
			star.innerHTML = (i+1);
			star.setAttribute("class", "off");
			star.className = "off";
			star.onmouseover = function() {
				rollOver(this.innerHTML);
			}
			star.onmouseout = function() {
				rollOut();
			}
			star.onmousedown = function() {
				self.clicked = this.innerHTML;
				self.onclick();
			}
			self.stars[i] = star;
			self.container.appendChild(star);
		}
	}
	
	function rollOver(n) {
		clear();
		for (var i=0; i<n; i++) {
			self.stars[i].setAttribute("class", "on");
			self.stars[i].className = "on";
		}
	}
	
	function rollOut() {
		clear();
		markDefault();
	}
	
	function clear() {
		for (var i=0; i<self.stars.length; i++) {
			self.stars[i].setAttribute("class", "off");
			self.stars[i].className = "off";
		}
	}
	
	function markDefault() {
		if (self.padrao > 0 && self.padrao <= self.stars.length) {
			rollOver(self.padrao);
		}
	}

	/**
	*	Define o titulo do tooltip da estrela
	*	@param int star
	*/
	this.setTitle = function(star, title) {
		self.stars[star-1].setAttribute("title", title);
	}
	
	/**
	*	Retorna o valor escolhido (clicado)
	*	@return int
	*/
	this.getValue = function() {
		return self.clicked;
	}
	
	/**
	*	Evento que e acionado ao clicar em algum item
	*	Metodo null, para ser personalizado
	*/
	this.onclick = function() { }
	
	/**
	*	Define um valor padrao,
	*	ficando marcado
	*/
	this.setDefault = function(n) {
		self.padrao = n;
	}

	/**
	*	Adiciona o objeto a algum elemento HTML
	*	atravez do Id do mesmo
	*/	
	this.append = function(id) {
		createStars();
		markDefault();
		document.getElementById(id).appendChild(self.container);
	}
}


function validaNews(){

var email= document.getElementById('email');

if(document.getElementById('nome').value==''){
	document.getElementById('alerta').innerHTML = "<span class='VermelhoLg10'>Nome Obrigatório</span>";
	document.getElementById('nome').focus();
	document.getElementById('nome').style.background='#FFC6C6';
	return false
	}
if(document.getElementById('email').value==''){
	document.getElementById('alerta').innerHTML = "<span class='VermelhoLg10'>E-mail Obrigatório</span>";
	document.getElementById('email').focus();
	document.getElementById('email').style.background='#FFC6C6';
	return false		
	}
	else{
	 if(checkEmail(email)==false){
	  return false     
	  }
	}
	MandaID(email.value,'grava.asp','news',nome.value);
}


function AtualizaImput(nomeDiv,act,Ct,id,InpN,AlertN,Cp){
	url  = "/adm/user/upd.asp?act="+act+"&Ct="+Ct+"&Ndiv="+nomeDiv+"&AlertN="+AlertN+"&Cp="+Cp+"&InpN="+InpN+"&id="+id
	ajaxLink(nomeDiv,url);
	document.getElementById(AlertN).style.display='none';

}


function Atualiza_Imput(nomeDiv,act,Ct,id,InpN,AlertN,Cp){
	url  = "/adm/videos/updAction.asp?act="+act+"&Ct="+Ct+"&Ndiv="+nomeDiv+"&AlertN="+AlertN+"&Cp="+Cp+"&InpN="+InpN+"&id="+id
	ajaxLink(nomeDiv,url);
	document.getElementById(AlertN).style.display='none';
}

function ADMvalidaIns(){

var nome   = document.getElementById('INSnome').value;
var login  = document.getElementById('INSlogin').value;
var senha  = document.getElementById('INSsenha').value;
var email  = document.getElementById('INSemail').value;

url  = "/adm/user/upd.asp?act=InsUser&nome="+nome+"&login="+login+"&email="+email+"&senha="+senha

if(document.getElementById('INSnome').value==''){
	document.getElementById('INSnome').focus();
	document.getElementById('INSnome').style.background='#FFC6C6';
	return false;
	}

if(document.getElementById('INSlogin').value==''){
	document.getElementById('INSlogin').focus();
	document.getElementById('INSlogin').style.background='#FFC6C6';
	return false;
	}

if(document.getElementById('INSsenha').value==''){
	document.getElementById('INSsenha').focus();
	document.getElementById('INSsenha').style.background='#FFC6C6';
	return false;
	}
if(document.getElementById('INSemail').value==''){
	document.getElementById('INSemail').focus();
	document.getElementById('INSemail').style.background='#FFC6C6';
	return false;

	}	

	ajaxLink('Insere',url);
}



function selALL(eu,frm){
	var ln=document.forms[frm].elements.length;
	
	for (j=0; j<ln; j++) { 
		if (document.forms[frm].elements[j].type=="checkbox"){
			document.forms[frm].elements[j].checked=eu;
		}
	
	}
}


function teste(campo,id){

	valor = document.getElementById('arquivo'+campo).value;
//	url  = "/adm/user/upd.asp?act=InsUser&nome="+nome+"&login="+login+"&email="+email+"&senha="+senha
	url  = "/adm/noticias/upd.asp?act=updfoto&campo="+valor+"&id="+id
//	alert(url)
	ajaxLink(campo,url)
}




function validacurso(trackday){

if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#FFC6C6';
	return false
	}
if(document.form.Nascimento.value==''){
	alert("Campo Obrigatório!")
	document.form.Nascimento.focus();
	document.form.Nascimento.style.background='#FFC6C6';
	return false
	}
if(document.form.nrg.value==''){
	alert("Campo Obrigatório!")
	document.form.nrg.focus();
	document.form.nrg.style.background='#FFC6C6';
	return false
	}
if(document.form.ncpf.value==''){
	alert("Campo Obrigatório!")
	document.form.ncpf.focus();
	document.form.ncpf.style.background='#FFC6C6';
	return false
	}
if(document.form.Endereco.value==''){
	alert("Campo Obrigatório!")
	document.form.Endereco.focus();
	document.form.Endereco.style.background='#FFC6C6';
	return false
	}
if(document.form.Numero.value==''){
	alert("Campo Obrigatório!")
	document.form.Numero.focus();
	document.form.Numero.style.background='#FFC6C6';
	return false
	}
if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#FFC6C6';
	return false
	}
if(document.form.Cidade.value==''){
	alert("Campo Obrigatório!")
	document.form.Cidade.focus();
	document.form.Cidade.style.background='#FFC6C6';
	return false
	}
if(document.form.Estado.value==''){
	alert("Campo Obrigatório!")
	document.form.Estado.focus();
	document.form.Estado.style.background='#FFC6C6';
	return false
	}
if(document.form.CEP.value==''){
	alert("Campo Obrigatório!")
	document.form.CEP.focus();
	document.form.CEP.style.background='#FFC6C6';
	return false
	}
if(document.form.email.value==''){
	alert("Campo Obrigatório!")
	document.form.email.focus();
	document.form.email.style.background='#FFC6C6';
	return false
	}
if(document.form.Referencia_Pessoal.value==''){
	alert("Campo Obrigatório!")
	document.form.Referencia_Pessoal.focus();
	document.form.Referencia_Pessoal.style.background='#FFC6C6';
	return false
	}
if(document.form.Fone_Referencia.value==''){
	alert("Campo Obrigatório!")
	document.form.Fone_Referencia.focus();
	document.form.Fone_Referencia.style.background='#FFC6C6';
	return false
	}
if(document.form.Grau_Parentesco.value==''){
	alert("Campo Obrigatório!")
	document.form.Grau_Parentesco.focus();
	document.form.Grau_Parentesco.style.background='#FFC6C6';
	return false
	}
	
/*if(document.form.Acompanhante.value=='1_Acompanhante'){
	if(document.form.acomp1F.value==''){
		alert("Campo Obrigatório!")
		document.form.acomp1F.focus();
		document.form.acomp1F.style.background='#FFC6C6';
		return false
		}
	}	

if(document.form.Acompanhante.value=='2_Acompanhantes'){
	if(document.form.acomp1F.value==''){
		alert("Campo Obrigatório!")
		document.form.acomp1F.focus();
		document.form.acomp1F.style.background='#FFC6C6';
		return false
		}
	
	if(document.form.acomp2F.value==''){
		alert("Campo Obrigatório!")
		document.form.acomp2F.focus();
		document.form.acomp2F.style.background='#FFC6C6';
		return false
		}
	}	

Foto('pop.asp?trackday='+trackday);*/
}


/*function vldAcomp(){

if(document.form.Acompanhante.value=='Nenhum'){
	document.getElementById('acomp1').style.display='none'
	document.getElementById('acomp2').style.display='none'
	}

if(document.form.Acompanhante.value=='2_Acompanhantes'){
	document.getElementById('acomp2').style.display='block'
	document.getElementById('acomp1').style.display='block'
	}

if(document.form.Acompanhante.value=='1_Acompanhante'){
	document.getElementById('acomp1').style.display='block'
	document.getElementById('acomp2').style.display='none'
	}
}*/



function validacurso2(trackday){

if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#FFC6C6';
	return false
	}
if(document.form.Nascimento.value==''){
	alert("Campo Obrigatório!")
	document.form.Nascimento.focus();
	document.form.Nascimento.style.background='#FFC6C6';
	return false
	}
if(document.form.nrg.value==''){
	alert("Campo Obrigatório!")
	document.form.nrg.focus();
	document.form.nrg.style.background='#FFC6C6';
	return false
	}
if(document.form.ncpf.value==''){
	alert("Campo Obrigatório!")
	document.form.ncpf.focus();
	document.form.ncpf.style.background='#FFC6C6';
	return false
	}
if(document.form.Endereco.value==''){
	alert("Campo Obrigatório!")
	document.form.Endereco.focus();
	document.form.Endereco.style.background='#FFC6C6';
	return false
	}
if(document.form.Numero.value==''){
	alert("Campo Obrigatório!")
	document.form.Numero.focus();
	document.form.Numero.style.background='#FFC6C6';
	return false
	}
if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#FFC6C6';
	return false
	}
if(document.form.Cidade.value==''){
	alert("Campo Obrigatório!")
	document.form.Cidade.focus();
	document.form.Cidade.style.background='#FFC6C6';
	return false
	}
if(document.form.Estado.value==''){
	alert("Campo Obrigatório!")
	document.form.Estado.focus();
	document.form.Estado.style.background='#FFC6C6';
	return false
	}
if(document.form.CEP.value==''){
	alert("Campo Obrigatório!")
	document.form.CEP.focus();
	document.form.CEP.style.background='#FFC6C6';
	return false
	}
if(document.form.email.value==''){
	alert("Campo Obrigatório!")
	document.form.email.focus();
	document.form.email.style.background='#FFC6C6';
	return false
	}
if(document.form.Referencia_Pessoal.value==''){
	alert("Campo Obrigatório!")
	document.form.Referencia_Pessoal.focus();
	document.form.Referencia_Pessoal.style.background='#FFC6C6';
	return false
	}
if(document.form.Fone_Referencia.value==''){
	alert("Campo Obrigatório!")
	document.form.Fone_Referencia.focus();
	document.form.Fone_Referencia.style.background='#FFC6C6';
	return false
	}
if(document.form.Grau_Parentesco.value==''){
	alert("Campo Obrigatório!")
	document.form.Grau_Parentesco.focus();
	document.form.Grau_Parentesco.style.background='#FFC6C6';
	return false
	}

if(turma.checked==true){
//checado
}else{
alert("Escolha a data do Curso!")
return false
} 

}


function admValidaTxt(){
	
if(document.form._Stitulo.value==''){
	alert("Campo Obrigatório!")
	document.form._Stitulo.focus();
	document.form._Stitulo.style.background='#FFC6C6';
	return false
	}
	
if(document.form._Sfonte.value==''){
	alert("Campo Obrigatório!")
	document.form._Sfonte.focus();
	document.form._Sfonte.style.background='#FFC6C6';
	return false
	}	
document.getElementById('bt').disabled='disabled'; 
document.getElementById('bt').value='Aguarde enviando...';
}


function ValidaDepo(){

if(document.getElementById('nome').value==''){
	alert("Campo Obrigatório!")
	document.getElementById('nome').focus();
	document.getElementById('nome').style.background='#FFC6C6';
	return false
	}

if(document.getElementById('email').value==''){
	alert("Campo Obrigatório!")
	document.getElementById('email').focus();
	document.getElementById('email').style.background='#FFC6C6';
	return false
	}
		
if(document.getElementById('moto').value==''){
	alert("Campo Obrigatório!")
	document.getElementById('moto').focus();
	document.getElementById('moto').style.background='#FFC6C6';
	return false
	}	
if(document.getElementById('depoimento').value==''){
	alert("Campo Obrigatório!")
	document.getElementById('depoimento').focus();
	document.getElementById('depoimento').style.background='#FFC6C6';
	return false
	}
if(document.form1.codigo.value==''){
	alert("Campo Obrigatório!")
	document.form1.codigo.focus();
	document.form1.codigo.style.background='#FFC6C6';
	return false
	}	

 document.getElementById('btenviar').disabled='disabled';
 document.getElementById('btenviar').value='Aguarde enviando...';				 

}

function lB(){
if(document.getElementById('aceito').checked==true ){
	document.getElementById('btenviar').disabled=''; 
}else{
	document.getElementById('btenviar').disabled='disabled'; 
}
}