/*PARA EVENTOS */
function addOnLoadEvent(func) {
    if (window.addEventListener || window.attachEvent) {
    addEvent(window, "load", func, false);
    } else {
    var oldQueue = (window.onload) ? window.onload : function( ) {};
    window.onload = function( ) {
        oldQueue( );
        func( );
    }
}
}
function addEvent(elem, evtType, func, capture) {
    capture = (capture) ? capture : false;
    if (elem.addEventListener) {
    elem.addEventListener(evtType, func, capture);
    } else if (elem.attachEvent) {
    elem.attachEvent("on" + evtType, func);
    } else {
    // for IE/Mac, NN4, and older
    elem["on" + evtType] = func;
    }
}
function removeEvent(elem, evtType, func, capture) {
    capture = (capture) ? capture : false;
    if (elem.removeEventListener) {
    elem.removeEventListener(evtType, func, capture);
    } else if (elem.attachEvent) {
    elem.detachEvent("on" + evtType, func);
    } else {
    // for IE/Mac, NN4, and older
    elem["on" + evtType] = null;
    }
}
//PARA EFETUAR FADE EM OUTROS NAVEGADORES
function Fade(){
		var opacs = ["0",".1",".2",".3",".4",".5",".6",".7",".8",".9","1"];
		for (var i=0;i<11;i++){
			  setTimeout('document.getElementById(\'SlideShow\').style.opacity = "'+opacs[i]+'";', ((i==0) ? i : (i*80)));
		}
}
arr=[];
indice=0;
function loadBlock(place,addr){
	if(xmlhttp){
		document.getElementById(place).style['display']= 'block';
//		document.getElementById(place).innerHTML = '<span id="carregando" align=center><img src="imagens/carregando.gif" border="0" /></span>';
		document.getElementById(place).innerHTML = '<span id="carregando" onClick="javascript: this.style[\'display\']=\'none\';" style="position: absolute; display: block; padding-left:40px; padding-right:10px; width: auto; line-height: 40px; border: 1px solid #000; font-weight: bold; background:#FFF url(\'img/loading.gif\') no-repeat 5px center;">Carregando...</span>';
		blockUPDATE(place,addr);
	}
}
function blockUPDATE(place,addr){
	if(xmlhttp){
//tenta criar um objeto XMLHttpRequest
	  //  if(document.getElementById(place)) document.getElementById(place).innerHTML="<span class='carregando'>"+"Carregando...</span>";
    	//Adiciona   fila
	    arr[arr.length]=[place,addr];
	    if((indice+1)== arr.length) RunExecute();
	}
}
function RunExecute(){
	if(!xmlhttp){
//CRIA UM OBJETO XHR
	try{
		    xmlhttp = new XMLHttpRequest();
		}catch(xmlhttp){
	    	try{
    		    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		    }catch(xmlhttp){
	    	    try{
    		        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        	}catch(xmlhttp){
            		xmlhttp = false;
	    	    }
    		}
		}
	}
	if(xmlhttp){
	xmlhttp.open("GET",arr[indice][1],true); 
	//	xmlhttp.setRequestHeader("Content-type", "charset=utf-8")
		xmlhttp.setRequestHeader('content-type', 'text/html');
		xmlhttp.setRequestHeader('Content-Type','charset=iso-8859-1');
		xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	    xmlhttp.onreadystatechange=function() {
			//alert(xmlhttp.status+" - "+xmlhttp.readyState);
	        if (xmlhttp.readyState==4){
    	        //EXIBE o HTML recebido
        	    consulta=unescape(xmlhttp.responseText); //.replace(/\+/g," "));
				//alert(consulta);
				if(document.getElementById(arr[indice][0])){
					 document.getElementById(arr[indice][0]).innerHTML=consulta;
				 }
	            //Roda o próximo
    	        indice++;
        	    if(indice<arr.length) setTimeout("RunExecute()",20);
	        }
    	}
	    //Executa
	    xmlhttp.send(null);
	}
}
	//PARA EXIBIR E OCULTAR BLOCOS
	function ShowHide(obj,s){
		if(obj && s) obj.style.display = s;
		else if(!s) obj.style.display = (obj.style.display=='none') ? 'block' : 'none';
		
		if(obj && obj.style.display == 'block') obj.scrollIntoView();
	}
	function ShowHide2(obj,s){
		if(obj && s) obj.style.display = s;
		else if(!s) obj.style.display = (obj.style.display=='none') ? 'block' : 'none';
	}
	//funcção antiga para show e hidden
	function v(obj,s){
		document.getElementById(obj).style.visibility= s;
	}
	

	//4 PARAMETROS QUE FAZEM A INTERCALAÇÃO DE CONTEÚDO
	function MinimizeMaximize(obj1,obj2,i1,i2){
		ShowHide(obj1);
		obj2.innerHTML = (obj1.style.display=='none') ? i1 : i2;
	}
	//mostra blocos e e aplica transparencia a botao
	function ChangeBlock(esconde,mostra,botao1,botao2){
		ShowHide2(esconde,"none");
		ShowHide2(mostra,"block");
		makeFade(botao2,'DescOp1');
		makeFade(botao1,'DescOp');
	}

//---------------AJAX COM POST -- //
Ap=[]; inp=0; frm=[];
function postValores(formulario,act,id,url,texto){
//	alert(formulario.name+" - "+act+" - "+id+" - "+url+" - "+texto);
var	valores = "act="+act;
	for (i=0; i < formulario.elements.length; i++){
		if ((formulario.elements[i].value && formulario.elements[i].type != 'button' && formulario.elements[i].type != 'submit' )){
			if(formulario.elements[i].type == 'checkbox' && formulario.elements[i].checked == true){
				valores += "&"+formulario.elements[i].name+"="+formulario.elements[i].value;
			}else if(formulario.elements[i].type == 'select-multiple'){	//PARA SELECTS MULTIPLOS
				var mult = formulario.elements[i];
				for(a=0;a<mult.length;a++){
					if(mult.options[a].selected){
						valores += "&"+formulario.elements[i].name+"="+mult.options[a].value;
					}
				}
			}else if(formulario.elements[i].type == 'radio' && formulario.elements[i].checked == true){ //PARA RADIOBUTTON
					valores += "&"+formulario.elements[i].name+"="+formulario.elements[i].value;
			}else if((formulario.elements[i].type == 'text' || formulario.elements[i].type == 'select-one' || formulario.elements[i].type == 'textarea' || formulario.elements[i].type == 'hidden') && (formulario.elements[i].type != 'checkbox' && formulario.elements[i].type != 'select-multiple')){
					nVal = "";
					nVal = escape(formulario.elements[i].value);
				valores += "&"+formulario.elements[i].name+"="+nVal;
				}
		}
	}
	if(document.getElementById(id)){
		document.getElementById(id).style['display']= 'block';
		document.getElementById(id).innerHTML = (texto) ? '<span id="carregando" align=center> '+texto+'</span>' : '<span id="carregando" align=center><img src="img/loading.gif" border="0" /> Aguarde, carregando dados...</span>';
	}
	frm[Ap.length]=valores.toString();
    Ap[Ap.length]=[id,url];
//	alert(Ap.length+" - "+inp);
    if((inp+1)==Ap.length) RunPost();
}
function RunPost(){
	if(xmlhttp){
		//Abre a conexão
		xmlhttp.open("POST", Ap[inp][1], true);
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded;'); 
		//Função para tratamento do retorno
	    xmlhttp.onreadystatechange=function() {
			//alert(xmlhttp.status+" - "+xmlhttp.readyState);
	        if (xmlhttp.readyState==4){
    	        //Mostra o HTML recebido
	            retorno=unescape(xmlhttp.responseText); //.replace(/\+/g," "));
				//document.getElementById(Ap[inp][0]).scrollIntoView();
				//alert(retorno);
				if(document.getElementById(Ap[inp][0])){
					 document.getElementById(Ap[inp][0]).innerHTML=retorno;
					// if(document.getElementById('globalSource')) reDimensiona();
				 }
	            //Roda o próximo
            	inp++;
        	    if(inp<Ap.length) setTimeout("RunPost()",20);
    	    }
	    }
    	//Executa	
	    xmlhttp.send(frm[inp]);
	}
}
//slideshow imagens

function Control(a){
	clearTimeout(t);
	if(t2) clearTimeout(t2);
	if(a=="menos"){
		j = (j==0) ? (p-2) : ((j==1) ? (p-1) : (parseInt(j)-2));
	}
	SlideShow();
}
function abreVideo(a){
return void(window.open(a,'','width=500,height=450,scrolling=no,status=no,menubar=no,toolbar=no'));
}
//LIMPA CAMPO FORMULARIO OU DEIXA O MESMO VALOR
function padrao(i,input,valor){
    var obj = document.forms[i].elements[input]; 
	var str = obj.value 
    if(str != valor && str.length != 0){
		valor = obj.value;
	}  
	obj.value=valor;
} 
function limpapadrao(i,input,valor){
    var obj = document.forms[i].elements[input]; 
	var str = obj.value 
	if(str != valor){
		valor = obj.value;
	}else{
		valor = "";
	}
	obj.value=valor;
}
function makeFade(Oid,c){
		Oid.className=c;
}
function fechaAviso(){
	ShowHide(document.getElementById("aviso"),"none");
}


//open window
function openPop(_url, _window, _params) {
	var newwindow = window.open(_url, _window, _params);
	if(!newwindow){
			 alert("Seu Navegador bloqueou a janela de visualização\n Por favor desbloqueie-o bloqueador de popup para visualizar o conteúdo.")
		}
		newwindow.document.close();
}

//PEGA VARIAVEL AP"S SUSTENIDO #
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('#') + 1).split('&');
 
    for(var i = 0; i < hashes.length; i++)
    {	
        hash = hashes[i].split('=');
		hash[1] = unescape(hash[1]);
		vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
 
    return vars;
}

var newWindow;
function makeNewWindow(ttl) {
	if (!newWindow || newWindow.closed) {
	newWindow = window.open(ttl,"","width=750,height=600,scroll=yes");
	setTimeout("writeToWindow()", 50);
	} else if (newWindow.focus) {
	newWindow.focus( );
	}
}
function writeToWindow() {
	if(!newWindow){
	 alert("Seu Navegador bloqueou a janela de impressão\n Por favor desbloqueie-o bloqueador de popup para imprimir o conteúdo.")
	}else{
		var ccal = "<html><head>";
			ccal += "<style>";
			ccal += "body{ font-family:\"Trebuchet MS\", Arial, Helvetica, sans-serif; } #l-leitura h1,#l-leitura h2, #l-leitura h3{ border:none;} #calendario {	font-family:\"Trebuchet MS\"; text-transform:capitalize;}  #calendario ul li {	list-style:none; font-size:13px; margin-bottom:1px;	border-bottom:1px solid #eaeaea; padding:5px; background:#f0f0f0; margin:0px;} #calendario ul li strong { color:#F60; } #calendario ul li{ padding:0px; border-top:1px solid #FFF; } #calendario ul li a{display:block; width:100%; padding:5px;  height:auto; cursor:default; text-decoration:none; font-weight:normal; color:#727272; } #calendario ul li a:hover{ cursor:default; }";
			//ccal += ".agendaItem {	border-bottom:1px dashed #e4e4e4;	padding:20px 0 20px 0;	margin:0; } .agendaItemin {	border-left:15px solid #2690C0;}.data {	float:left;	width:135px;	display:block;	padding:0 0 0 20px; }.data .dia, .data .mes, .data .ano {	font-family:Georgia, \"Times New Roman\", Times, serif;	padding:0 0 5px 0;	margin:0;	border:0;	display:block;} .data .dia{	font-size:30px;	color:#333;} .data .mes {	font-size:20px;	color:#2690C0;} .data .ano {	font-size:25px;	color:#999;}.leituraAgenda {width:520px;	padding:20px;	background:#f6f6f6;	float:left;	font-size:15px;	line-height:1.3;}.leituraAgenda h4 {	color:#2690BF;	font-size:15px;	font-weight:bold;	padding:0 0 5px 0; }";
			ccal += "</style>";
			ccal += "</head><link href=\"" + URL + "css/internas.css\" rel=\"stylesheet\" type=\"text/css\"  media=\"screen\" /><body><div id='l-leitura'>";
			try{
				
				ccal += (document.getElementById("contenttitulo")) ? document.getElementById("contenttitulo").innerHTML.toString() : "";
				
				if(document.getElementById("contentcal")) ccal += document.getElementById("contentcal").innerHTML.toString();
				else if  (document.getElementById("l-leitura")) ccal += document.getElementById("l-leitura").innerHTML.toString();
			}catch(e){ alert("Error"); }
			ccal += "</div></body></html>";
	newWindow.document.write(ccal);
		try{
			if(newWindow.document.getElementById("formleitura")){
				newWindow.document.getElementById("formleitura").style["display"] = "none";
				}
		}catch(e){ }
	newWindow.print();
	}
	newWindow.document.close( ); 
}
//POPIN
function open_(url_,h,w) {
	popcont.innerHTML = '' +
		'<div id="popupInner">' +
			'<div id="popupTitleBar">' +
				'<div id="popupControls">' +
					'<a onclick="javascript: hidePopWin(false);" id="popCloseBox"> <font>Fechar</font></a>' +
				'</div>' +
			'</div>' +
				'<iframe src="' + URL + 'load.html" style="width:100%;height:100%;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%"></iframe>' +
		'</div>';
	theBody.appendChild(popmask);
	theBody.appendChild(popcont);
	gPopupMask = document.getElementById("popupMask");
	gPopupContainer = document.getElementById("popupContainer");
	gPopFrame = document.getElementById("popupFrame");	
	var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
	if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {
		gHideSelects = true;
	}
	showPopWin(url_, w, h,null,true);
	// window.open(url_);
}
/*abre media youtube*/
function OpenMidia(Oid,OidCap,Cap,OidMidia,auto,provider){
			
			var s1 = new SWFObject(URL + "video/hybridplayer.swf?provider=" + provider + "&video=" + OidMidia ,Oid,"280","210","7");
			s1.addParam("allowfullscreen","true");
			s1.addParam("flashvars","provider=" + provider + "&video=" + OidMidia);
					
			s1.addVariable("displayheight","210");
			s1.addVariable("autostart",auto);
			s1.addVariable('frontcolor','0xFFFFFF');
			s1.addVariable('backcolor','0x00416F');
			s1.write(Oid);
			if(OidCap!="")	document.getElementById(OidCap).innerHTML = Cap;
	}


function RemoveAcentos(obj) {
    var texto = obj.value.split('');
    var len = obj.value.length;
    var Alterado = false;
    var acento = 'ÀÁÂÃ"Å áâãäå\'""ÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûü\'ñÿý^´`~';
    var semacento = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'c', 'c', 'd', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'n', 'n', 's', 's', 'y', 'y', 'y', 'z', '', '', '', '', ''];  
    for (var x = 0; x < len; x++) {
        if (acento.indexOf(texto[x]) > -1)
        {
            texto[x] = semacento[acento.indexOf(texto[x])];
            Alterado = Alterado || true;
        }
    }  
    obj.value = texto.join('');   
  //RemoveCaracteresEspeciais(obj, Alterado);
}
function RemoveAcentosString(str) {
    var texto = str.split('');
    var len = str.length;
    var Alterado = false;
    var acento = 'ÀÁÂÃ"Å áâãäå\'""ÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûü\'ñÿý^´`~';
    var semacento = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'c', 'c', 'd', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'n', 'n', 's', 's', 'y', 'y', 'y', 'z', '', '', '', '', ''];  
    for (var x = 0; x < len; x++) {
        if (acento.indexOf(texto[x]) > -1)
        {
            texto[x] = semacento[acento.indexOf(texto[x])];
            Alterado = Alterado || true;
        }
    }  
    str = texto.join('');   
	return str;
  //RemoveCaracteresEspeciais(obj, Alterado);
}
function RemoveCaracteresEspeciais(obj, Alterado) {
    var caracNormal = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@._-';
    var ret =  obj.value.split('');
    var i = 0;   
    for (i = 0; i < obj.value.length; i++) {
         if (caracNormal.indexOf(ret[i],0) == -1) {
              ret[i] = '';
              Alterado = Alterado || true;
         }
    }
    obj.value = ret.join('');   
    ToLowerCase(obj, Alterado);
}
function ToLowerCase(obj, Alterado) {
    var texto = obj.value.split('');
    var len = obj.value.length;
    var ALTA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';    
    var BAIXA = ['a','b','c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
    for (var x = 0; x < len; x++) {
        if (ALTA.indexOf(texto[x]) > -1)
        {
            texto[x] = BAIXA[ALTA.indexOf(texto[x])];
            Alterado = Alterado || true;
        }
    }
    obj.value = texto.join('');
    
}

//CONTATO
function validaContato(formulario){
  with(formulario){
    if(nome.value.length==""){
     alert("Preencha o campo Nome.");
     nome.focus();
     return false;
     }
         else if(email.value.length==""){
	      alert("Preencha o campo E-mail.");
    	  email.focus();
	      return false;
	   }
         else if(email.value.indexOf("@") == -1 || email.value.indexOf(".") == -1 || email.value.length <= 6){
		   alert("E-mail incorreto, \n Preencha novamente.");
		   email.value = "";
		   email.focus();
		   return false;
		}
    }
return true;
//formulario.submit();
}

function pessoafj(p)
{
	if (p == 'j')
	{
		document.getElementById("pj").style["display"]= "block";
		document.getElementById("pf").style["display"]= "none";
		document.cadastro.nome.disabled = true;
		//document.cadastro.nome.style['background'] = "#CCCCCC";
		//document.cadastro.nome.ClassName = "inputdisabled";
//		document.cadastro.sobrenome.disabled = true;
//		document.cadastro.sobrenome.style['background'] = "#CCCCCC";
		document.cadastro.cad_dia_nasc.disabled = true;
		//document.cadastro.cad_dia_nasc.style['background'] = "#CCCCCC";
		//document.cadastro.cad_dia_nasc.ClassName = "inputdisabled";
		document.cadastro.cad_mes_nasc.disabled = true;
		//document.cadastro.cad_mes_nasc.style['background'] = "#CCCCCC";
		//document.cadastro.cad_mes_nasc.ClassName = "inputdisabled";
		
/*		document.cadastro.sexo.disabled = true;
		document.cadastro.sexo.style['background'] = "#CCCCCC";
		document.cadastro.email.disabled = true;
		document.cadastro.email.style['background'] = "#CCCCCC";*/
		document.cadastro.sexo.disabled = true;
		
//		document.cadastro.cnpj.disabled = false;
//		document.cadastro.cnpj.style['background'] = "#FFFFFF";
		document.cadastro.razao.disabled = false;
//		document.cadastro.razao.style.background = "#FFFFFF url('../img/bg-form-campo-leitura.png') left top no-repeat;";
		//document.cadastro.razao.style.background = "#FFFFFF";
		//document.cadastro.razao.ClassName = "input";
		document.cadastro.nomeContato.disabled = false;
		//document.cadastro.nomeContato.style.background = "#FFFFFF";
		//document.cadastro.nomeContato.ClassName = "input";
	}
	else
	{
		document.getElementById("pj").style["display"]= "none";
		document.getElementById("pf").style["display"]= "block";
//		document.cadastro.cnpj.disabled = true;
//		document.cadastro.cnpj.style['background'] = "#CCCCCC";
		document.cadastro.razao.disabled = true;
		//document.cadastro.razao.style['background'] = "#CCCCCC";
		//document.cadastro.razao.ClassName = "inputdisabled";
		document.cadastro.nomeContato.disabled = true;
		//document.cadastro.nomeContato.style['background'] = "#CCCCCC";
		//document.cadastro.nomeContato.ClassName = "inputdisabled";
		document.cadastro.nome.disabled = false;
		//document.cadastro.nome.style.background = "#FFFFFF url('../img/bg-form-campo-leitura.png') left top no-repeat;";
		//document.cadastro.nome.style.ClassName = "input";
//		document.cadastro.sobrenome.disabled = false;
//		document.cadastro.sobrenome.style['background'] = "#FFFFFF url('"+URL+"img/bck_form.gif') repeat-x bottom left;";
		document.cadastro.cad_dia_nasc.disabled = false;
		//document.cadastro.cad_dia_nasc.style.background = "#FFFFFF url('../img/bg-form-campo-leitura.png') left top no-repeat;";
		//document.cadastro.cad_dia_nasc.ClassName = "input";
		document.cadastro.cad_mes_nasc.disabled = false;
		//document.cadastro.cad_mes_nasc.style.background = "#FFFFFF url('../img/bg-form-campo-leitura.png') left top no-repeat;";
		//document.cadastro.cad_mes_nasc.ClassName = "input";
		document.cadastro.sexo.disabled = false;
		//document.cadastro.sexo.style.background = "#FFFFFF url('../img/bg-form-campo-leitura.png') left top no-repeat;";
		//document.cadastro.sexo.ClassName = "input";
		//document.cadastro.cad_email.disabled = false;
		//document.cadastro.cad_email.style.background = "#FFFFFF url('../img/bg-form-campo-leitura.png') left top no-repeat;";
		//document.cadastro.cad_email.ClassName = "input";
		document.cadastro.sexo.disabled = false;
		
	}
}
function verifica(f)
{
	if (f.tipo_pessoa[0].checked)
	{
		if (f.nome.value.length==0)
		{
			alert('Digite o seu nome.');
			f.nome.focus();
			return false;
		}
		if (f.cad_dia_nasc.value.length==0)
		{
			alert('Digite seu dia de aniversrio.');
			f.cad_dia_nasc.focus();
			return false;
		}
		if (f.cad_mes_nasc.value.length==0)
		{
			alert('Digite seu ms de aniversrio.');
			f.cad_mes_nasc.focus();
			return false;
		}
		if (f.cad_email.value.length==0)
		{
			alert('Digite seu e-mail.');
			f.cad_email.focus();
			return false;
		}
		
		if(f.membro == "SIM"){
			if(f.cad_senha.value.length<5){
			  alert("O campo senha deve ter mais de 4 caracteres");
			  f.cad_senha.focus();
			  return false;
			   }
		
			if(f.cad_senha.value!=f.confirmacao.value){
			  alert("Confirmao de senha diferente do campo senha!!!");
			  f.confirmacao.focus();
			  return false;
			   }
		}

	}
	else
	{
		if (f.nomeContato.value.length==0)
		{
			alert('Digite o nome do contato.');
			f.nomeContato.focus();
			return false;
		}
	}
     if(f.cad_email.value.length==0){
      alert("Preencha o campo E-mail!!!");
      f.cad_email.focus();
      return false;
	   }
         else if(f.cad_email.value.indexOf("@") == -1 || f.cad_email.value.indexOf(".") == -1 || f.cad_email.value.length <= 6){
		   alert("Endereo de E-mail incorreto, \n Preencha novamente!!!");
		   f.cad_email.value = "";
		   f.cad_email.focus();
		   return false;
		}
	if(f.membro == "SIM"){
		if(f.cad_senha.value.length<5){
		  alert("O campo senha deve ter mais de 4 caracteres");
		  f.cad_senha.focus();
		  return false;
		   }
	
		if(f.cad_senha.value!=f.confirmacao.value){
		  alert("Confirmao de senha diferente do campo senha!!!");
		  f.confirmacao.focus();
		  return false;
		   }
	}

	return f.submit();
}

