//funcao para salto de menu------------------------------------------------------------------------------
function jump(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//função abre popup-------------------------------------------------------------------------------------
function popup(par,w,h){
	window.open(par+'.php','_blank','width='+w+'px height='+h+'px');	
}

//função abre outra aba---------------------------------------------------------------------------------
function redirect(par){
	window.open('?src=freeway/'+par);	
}

//função redireciona-------------------------------------------------------------------------------------
function enviaFor(par){
 window.location.href=par;	
}

//IMPRIMIR////////////////////////////////////////////////////////////////////
function DoPrinting(){
	if (!window.print){
	alert("Use o Firefox ou Internet Explorer \n nas versões 4.0 ou superior!")
	return
	}
	window.print()
}

//Aparece e some div de acordo com a escolha-------------------------------------------------------------
function escolha(pick,tipo) {
	if (pick == "freewaymed") {
		Justshow(tipo);
	}
	else if(pick == "aluno_freeway"){
		JustshowHide(tipo);
	}
}

//Aparece e some div-------------------------------------------------------------------------------------
function showHide(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none') {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
}

//so aparece div---------------------------------------------------------------------------------------------
function Justshow(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'block' ) {
		el.style.display = 'block';
	}
	else {
		el.style.display = 'block';
	}
}

//so some div---------------------------------------------------------------------------------------------
function JustshowHide(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'block' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'none';
	}
}

//Coloca com negrito e sem negrito------------------------------------------------------------------------
function mouseOverOut(obj){//Made a effect of hiperlink, changing its style to bold and normal
	var el = document.getElementById(obj);
	if ( el.style.fontWeight != 'bold' ) {
		el.style.fontWeight = 'bold';
	}else{
		el.style.fontWeight = 'normal';
	}
}

//VERIFICA SE É NUMERICO----------------------------------------------------------------------------------
function ifnumber(id){
	var el = document.getElementById(id);
	if(isNaN(el.value)){
		el.value="";		
		el.focus();
		return false;	
	}
		
return true;	
}

//LIBERA CAMPOS-------------------------------------------------------------------------------------------
function Vazio(id){
	if(document.getElementById(id).value.lenght!=""){
		document.getElementById(id).value="";		
		document.getElementById(id).focus();
		return false;	
	}
		
return true;	
}

//RECARREGAPAGINA-----------------------------------------------------------------------------------------
function realoaded(){

    window.location.href = "index.php";	
 
}

//VERIFICA SE REALMENTE QUER EFETUAR ALGUM PROCEDIMENTO----------------------------------------------------
function real(){
  var r=confirm("DESEJA REALMENTE DELETAR");
  if (r!=true){
	document.write("entrando....");
    window.location.href="";	
    }
	 else{

	} 
}

//FUNÇÃO VALIDA E-MAIL-------------------------------------------------------------------------------------
function validaMail(id){
	var el=document.getElementById(id);			
      p1 = el.value.indexOf("@");
		p2 = el.value.indexOf(".");
	   p3 = el.value;
		if(!(p1 >= 1 && p2 >= 3 && p3 == "")){
		alert("O campo Email deve conter um endereço válido!")
			el.focus()
			return false
	   }
return true;
}

//FUNÇÃO VALIDA FORM CONTATO--------------------------------------------------------------------------------
function validaCont(){
	if(document.formContato.nome.value.length<=2){
		alert("Campo NOME é necessário !!!");
		formContato.nome.focus();
		return false;
	}	
	if(isNaN(document.formContato.tel.value)){
		alert("Campo TELEFONE deve conter somente números !!!");
		formContato.tel.focus();
		return false;
	}	
	if(document.formContato.email.value.length<=7){
		alert("Campo E-MAIL é necessário !!!");
		formContato.email.focus();
		return false;
	}
	
	 parte1= document.formContato.email.value.indexOf("@");
	 parte2= document.formContato.email.value.indexOf(".");
   if (!(parte1>=1 && parte2>=3)){		 
		 alert("o campo E-MAIL deve ser preenchido corretamente !!!");
		 formContato.email.focus();
		 return false;
	}
	
	if(document.formContato.cidade.value.length<=2){
		alert("Campo CIDADE é necessário !!!");
		formContato.cidade.focus();
		return false;
	}
	
	if(document.formContato.uf.value.length<=3) {
		alert("Campo ESTADO é necessário !!!");
		formContato.uf.focus();
		return false;
	}
		
return true;	
}

//COMPARA CAPTCHA-----------------------------------------------------------------------------------------
function CAPTCHA(){
	if(document.forms[1].captcha.value!=document.forms[1].confCaptcha.value){
		alert("ERRO DE ESCRITA NO CÓDIGO !!!");
		document.forms[1].captcha.value="";
		forms[1].confCaptcha.focus();		
		return false;
	}
return true;
}

//COMPARA SENHA--------------------------------------------------------------------------------------------
function comparaSenha(id,id2){
	var el=document.getElementById(id);
	var el2=document.getElementById(id2);
	if(el.value!=el2.value){
		alert("ERRO NA COMPARAÇÃO DE SENHA !!!");
		el.value="";
		el2.value="";
		el.focus();
		return false;
	}
return true;
}

//FORMATA TEL 	PULANDO DE CAMPO ----------------------------------------------------------------------------
function formataTelarea(id,id2){	
	var el=document.getElementById(id);
	var el2=document.getElementById(id2);
	if(el.value.length>=2 && el2.value==""){
		el2.focus();
	}
}
//FORMATA TEL 	PULANDO DE CAMPO ----------------------------------------------------------------------------
function formataTelnumero(id,id2){
	var el=document.getElementById(id);
	var el2=document.getElementById(id2);
	if(el.value.length>=4 && el2.value==""){
		el2.focus();
	}
}

//----------------------------------------------------------------------------------------------------------
// PARA ACESSAR ELEMENTOS APARTIR DA KEYWORD THIS
// getThis(element) --> element == 'id' ou um element
// retorna o objeto(elemento) --> obj = getThis(this); --> obj.style.top ou obj.
// getThis('id').firstChild.innerHTML += getThis('id').firstChild.innerHTML;
function getThis(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (Object.isString(element))
    element = document.getElementById(element);
  return Element.extend(element);
}

//----------------------------------------------------------------------------------------------------------
// FORMATAR CAMPOS DE TELEFONE
function formatTel(el,event) {
	var el = getThis(el);
	var cont = el.value.length;
	var key = event.keyCode;
	if (cont == 2 && el.value != "((" && el.value != "(0" && el.value != "(1" && el.value != "(2" && el.value != "(3" && el.value != "(4" && el.value != "(5" && el.value != "(6" && el.value != "(7" && el.value != "(8" && el.value != "(9") {
		el.value = "("+el.value+") ";
	}
	if (cont == 9 && key != 08) {
		el.value = el.value+"-";
	}
}

//----------------------------------------------------------------------------------------------------------
// FUNÇÃO PARA FAZER UM RELOAD NA PÁGINA SEM RECARREGAR O SERVIÇO NOVAMENTE
function rld () {
window.location.href=window.location.href;
}

//----------------------------------------------------------------------------------------------------------
// FUNÇÃO QUE DESABILITA CAMPO TEXT
function desable(id) { 
	var el = document.getElementById(id);
	if(el.style.visibility != 'hidden'){
		el.style.visibility = 'hidden';
	}
	else{
		el.style.visibility = 'visible';
	}
}

//-----------------------------------------------------------------------------------------------------------
// FUNÇÃO QUE RETORNA O OBJETO COM DO ID INFORMADO
function getObj(id) {
	if(document.getElementById(id)){
		el = document.getElementById(id);
		return el;
	}
}

//------------------------------------------------------------------------------------------------------------
// MY NAVEGATOR
// myNavegator ();
function myNavSuport () {
	var ttNS4 = (document.layers) ? true : false;           // the old Netscape 4
	var ttIE4 = (document.all) ? true : false;              // browser wich uses document.all
	var ttDOM = (document.getElementById) ? true : false;   // DOM-compatible browsers
	if (ttDOM) { // if DOM-compatible
		return ('DOM');
	}
	else if (ttIE4) {
		return ('IE4');
	}
	else if (ttNS4) {
		return ('NS4');
	}
}

//------------------------------------------------------------------------------------------------------------
// APARECE E SOME COM UM OBJETO SEM DEFORMAR O LAYOUT COM FADEIN E FADEOUT OPICIONAL
// showHideStay('ID','On' ou 0) --> 0 = zero
function showHideStay (obj,fade) {
	if(document.getElementById(obj)){
		var el = document.getElementById(obj);
		if ( el.style.visibility != 'hidden' ) {
			if(fade == 'On'){
				// aplica um fade in no objeto
				fadeOut(obj,1);
			}
			el.style.visibility = 'hidden';
			return true;
		}else {
			if(fade == 'On'){
				// aplica um fade in no objeto
				fadeIn(obj,1);
			}
			el.style.visibility = 'visible';
			return true;
		}
	}else{
		return false;
	}	
}

//-----------------------------------------------------------------------------------------------------------
// SIMULADOR DE PAGEX E PAGEY PARA O IE
// pageXYforIE(id);
// retorna as coordenadas X e Y em um array onde:
// o indice 1 = eixo X, e 
// o indice 2 = eixo Y
function pageXYforIE (id) {
    // reference to TooltipContainer
    if (id) {
		  nav = myNavSuport();
        if (nav == 'NS4') {
            objTarget = document.id;
        } else if (nav == 'IE4') {
            objTarget = document.all(id);
        } else if (nav == 'DOM') {
            objTarget = document.getElementById(id);
        } else {
            return;
        }

        if ( typeof( objTarget ) == 'undefined' ) {
            return;
        }
    }
	 var ttXpos = 0, ttYpos = 0;
	 var ttXadd = 0, ttYadd = 0;
    var plusX=0, plusY=0, docX=0, docY=0;
    var divHeight = objTarget.clientHeight;
    var divWidth  = objTarget.clientWidth;
    if (navigator.appName.indexOf("Explorer")!=-1) {
        if (document.documentElement && document.documentElement.scrollTop) {
            plusX = document.documentElement.scrollLeft;
            plusY = document.documentElement.scrollTop;
            docX = document.documentElement.offsetWidth + plusX;
            docY = document.documentElement.offsetHeight + plusY;
        } else {
            plusX = document.body.scrollLeft;
            plusY = document.body.scrollTop;
            docX = document.body.offsetWidth + plusX;
            docY = document.body.offsetHeight + plusY;
        }
    } else {
        docX = document.body.clientWidth;
        docY = document.body.clientHeight;
    }

    ttXpos = ttXpos + plusX;
    ttYpos = ttYpos + plusY;

    if ((ttXpos + divWidth) > docX)
        ttXpos = ttXpos - (divWidth + (ttXadd * 2));
    if ((ttYpos + divHeight) > docY)
        ttYpos = ttYpos - (divHeight + (ttYadd * 2));

    pageXY = new Array(2);
	 pageXY[1] = (ttXpos + ttXadd);
	 pageXY[2] = (ttYpos + ttYadd);
    return(pageXY);
}

//------------------------------------------------------------------------------------------------------------
// APARECE E SOMO COM UM OBJETO DEFORMANDO O LAYOUT COM FADEIN E FADEOUT OPICIONAL
// showHideOut('ID','On' ou 0) --> 0 = zero
function showHideOut (obj,fade,hideroot) {
	//alert(window.currentlyVisibleElement);
	if(document.getElementById(obj)){
		var el = document.getElementById(obj);
		if ( el.style.display != 'none' ) {
			if(fade == 'On'){
				// aplica um fade in no objeto
				fadeOut(obj,1);
			}

			el.style.display = 'none';
			if (hideroot == 1) {
				window.currentlyVisibleElement = false;
			}
			return true;
		}else {
			if(fade == 'On'){
				// aplica um fade in no objeto
				fadeIn(obj,1);
			}
			if (hideroot == 1) {
				hideCurrentElement();
				window.currentlyVisibleElement = obj;
			}
			el.style.display = 'block';
			return true;
		}
	}else{
		return false;
	}
}

//----------------------------------------------------------------------------------------------------------
// FUNÇÃO PARA O IE TROCAR O BACKGROUND DE UM ELEMENTO ONMOUSEOVER EVENT (SEM SER UM LINK)
function bgChangeHover (obj,color) {
	if(getStyles(obj)) {
		newBackground = getStyles(obj);
		newBackground.backgroundColor = color;
		return true;
	} else {
		return false;
	}
}
//----------------------------------------------------------------------------------------------------------
// APARECE UMA POPUP NA POSIÇÃO DO MOUSE
// showPopup ('ID', event) --> event não altera
// variáveis de armzenamento para controlar onde a popup irá aparecer em relação à posição do cursor
// súmeros positivos estão abaixo e a direita do cursor, números negativos estão acima e a esquerda

function showPopup (targetObjectId,eventObj,xOffset,yOffset) {
	//var xOffset = 20;//30
	//var yOffset = -5;//-5
    if(eventObj) {
	// esconde qualque popup visível
	hideCurrentPopup();
	// interrompe propagação de eventos fugitivos (event Bublling) no core do navegador)
	eventObj.cancelBubble = true;
	// move a div popup para a posição atual do cursor  
	// simulação do pageX e pageY para o IE com a função pageXYforIE();
	IEscroll = pageXYforIE(targetObjectId);
	var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.clientX + xOffset + ((IEscroll[1])?IEscroll[1]:0);
	var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.clientY + yOffset + ((IEscroll[2])?IEscroll[2]:0);
	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
	// e a torna visível
	if( showHideOut(targetObjectId,'On') ) {
	    // se a popup foi apresentada corretamente
	    // armazena seu Id em um objeto de acessibilidade global
	    window.currentlyVisiblePopup = targetObjectId;
	    return true;
	} else {
	    // não pode mostrar a popup!
	    return false;
	}
    } else {
	// não há evento do objeto, sem permisão para reposicionamento, parou aqui.
	return false;
    }
} // showPopup

//----------------------------------------------------------------------------------------------------------
// ESCONDE OU APRESENTA A POPUP ARMAZENADA NO OBJETO GLOBAL window.currentlyVisiblePopup
function hideCurrentPopup () {
    if(window.currentlyVisiblePopup) {
		getStyles(window.currentlyVisiblePopup).display = 'none';
		window.currentlyVisiblePopup = false;
    }
} // hideCurrentPopup

//---------------------------------------------------------------------------------------------------------
// ESCONDE OU APRESENTA ELEMENTO ARMAZENADO NO OBJETO GLOBAL window.currentlyVisibleElement
function hideCurrentElement () {
    if(window.currentlyVisibleElement) {
		getObj(window.currentlyVisibleElement).style.display = 'none';
		window.currentlyVisibleElement = false;
    }
} // hideCurrentPopup

//-----------------------------------------------------------------------------------------------------------
// FUNÇÃO CROSS-BROWSER OBTER O STYLE DE UM OBJETO POR MEIO DE SEU ID
function getStyles (objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. nota: este não encontrava layers aninhadas
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyles

//-----------------------------------------------------------------------------------------------------------
// MOVIMENTA O OBJETO ALTERANDO SUAS COORDENADAS.
// OBTEM ATRAVÉS DA FUNÇÃO CROSS-BROWSER getStyles, O STYLE DO OBJETO PELO ID,
// OBSERVANDO SE O OBJETO REALMENTE EXISTE
function moveObject (objectId, newXCoordinate, newYCoordinate) {
	var styleObject = getStyles(objectId);
    if(styleObject) {
		styleObject.left = newXCoordinate+'px';
		styleObject.top = newYCoordinate+'px';
		return true;
   	} else {
		// o objeto não foi encontrado, logo ele não será movimentado
		return false;
    }
} // moveObject

//-----------------------------------------------------------------------------------------------------------
// ADICIONA O VALOR DE UM OBJETO NÓ A UM TEXTBOX APARTIR DE UM EVENTO (ON EVENT)
function putValueTxt (originText,targetText) {
	var txtOrigin = document.getElementById(originText);
	var objTarget = document.getElementById(targetText);	
	if ( objTarget && txtOrigin ) {
		objTarget.value = txtOrigin.firstChild.nodeValue;
		//alert(objTarget.value);
	}
}

//------------------------------------------------------------------------------------------------------------
// ADICIONA O VALOR DE UM OBJETO NÓ PARA OUTRO APARTIR DE UM EVENTO (ON EVENT)
// putObjText (targetText,originText) --> targetText é o id do obj receptor 
// e o originText é o obj que tem o texto original
function putObjText (originText,targetText) {
	var txtOrigin = document.getElementById(originText);
	var objTarget = document.getElementById(targetText);
	if ( objTarget && txtOrigin ) {
		objTarget.innerHTML = txtOrigin.firstChild.nodeValue;
	}		
}

//------------------------------------------------------------------------------------------------------------
// APRESENTA OU ESCONDE UM OBJETO, COM REDIRECIONAMENTO.
// A FUNÇÃO REDIRECT() NECESSITA ESTAR CARREGADA
function showHideRedir (obj,redirectto) {
	if(document.getElementById(obj)){
		var el = document.getElementById(obj);
		if ( el.style.display != 'none' ) {
			el.style.display = 'none';
		}else {
			el.style.display = 'block';
		}
	}else {
		redirect(redirectto);
	}
}

//------------------------------------------------------------------------------------------------------------
// FUNÇÃO PARA CRIAR UM JUMP MENU 
// AO FAZER ALGUMA ALTERAÇÃO NO MENU ELE REDIRECIONA PARA A URL NO VALUE DA TAG OPTION
// MM_jumpMenu('parent',this,0)
function jumpMenu (targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-----------------------------------------------------------------------------------------------------------
// FUNÇÃO PARA FAZER UM FADE IN OU FADE OUT (USADA NA FUNÇÃO SHOWPOPUP)
// fadeOut('ID', 1) --> 1 é o tempo
// fadeIn('ID', 1)
function fadeOut(id, time) {
	target = document.getElementById(id);
	alpha = 100;
	timer = time;//(time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha <= 0)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha -= 2;
			}, timer);
}

// FUNÇÃO FADE IN
function fadeIn(id, time) {
	target = document.getElementById(id);
	alpha = 0;
	timer = time;//(time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha >= 100)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha += 2;
			}, timer);
}

// ESTA FUNÇÃO DEFINE A TRANSPARÊNCIA (USADA NAS FUNÇÕES FADEOUT E FADEIN)
function setAlpha(target, alpha) {
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/15;
}
//--------------------------------------------------------------------------------------------------------
// FUNÇÃO DESENVOLVIDA SOMENTE PARA O SELETOR
// list --> id da lista atual
// listItem --> id do item atual da lista
// textBox --> id de um campo textFild de um formulário
// reDir --> se diferente de 0 redireciona a página (URL)
// inEvent --> escolher de acordo com o evento "over, click ou out"
function seletor (list, listItem, textBox, reDir, inEvent, eventObj) {
	//if (list && listItem && textBox && reDir) {
		if (inEvent == 'over') {
			showPopup ('altText', eventObj,20,-5);
			putObjText (listItem, 'altText');
			bgChangeHover (listItem, '');
		} else if (inEvent == 'click') {
			putValueTxt (listItem, textBox);			
			putValueTxt ("value_"+listItem, "value_"+textBox);
			showHideOut (list);
			if (reDir != 0) {
				redirect (reDir);
			}
		} else if (inEvent == 'out') {
			hideCurrentPopup();
			bgChangeHover (listItem, '');
		}// else if
	//} else {
	//	return false;
	//}// else
}// function seletor

//---------------------------------------------------------------------------------------------------------
// FUNÇÃO DESENVOLVIDA PARA UTILIZAÇÃO DO FORM EM AJAX COM XML
function trataDadosXML(){
	var info ="<h3>Dados recebidos pelo servidor</h3>";
	var meuXML = ajax.responseXML; //OBTEM A RESPOSTA EM XML
	var raiz = meuXML.documentElement;
	var nodos;
	if(raiz.hasChildNodes()){
		nodos = raiz.childNodes;
		for(var i=0; i<nodos.length;i++){
			info += nodos[1].nodeName+" - ";
			if(nodos[i].hasChildNodes())
				info += nodos[i].firstChild.nodeValue+" <br /> ";
			else
				info += "Vazio <br />";
		}
	}
	document.getElementById("campoResposta").style.backgroundColor="yellow";
	document.getElementById("campoResposta").innerHTML=info;
}

//-----------------------------------------------------------------------------------------------------------
// EXECUTA PESQUISA DOS DADOS - DE ACORDO COM ONKEYDOWN
function enviaDadosCidade(originText) {
	var txtOrigin = document.getElementById(originText).value.length;
	if(txtOrigin>=2){
		txt = document.getElementById(originText).value;
		var url="ScriptsPHP/pesquisaCidades.php?estado="+txt;
		requisicaoHTTP("GET",url,true);
	   //alert(txt);
	}
}

//-----------------------------------------------------------------------------------------------------------
// FUNÇÃO DESENVOLVIDA remover todos os filhos do nodo fornecido
function limpa(elemento){
		if(elemento != null && elemento.hasChildNodes()){
			for(var i=0; i<elemento.childNodes.length; i++){
				elemento.removeChild(elemento.firstChild);
			}
		}
}

//-----------------------------------------------------------------------------------------------------------
// FUNÇÃO DESENVOLVIDA CRIAR OPTION, ADICIONANDO A LISTA
function criaOpcoes(lista,opcoes){
		if(opcoes == null || opcoes.length == 0){return;}
		var op = null;
		for(var i=0; i<opcoes.length; i++){
			op = document.creatElement("option");
			op.appendChild(document.createTextNode(opcoes[i]));
			lista.appendChild(op);
		}
}


//------------------------------------------------------------------------------------------------------------
//FUNÇÃO DESENVOLVIDA PARA UTILIZAÇÃO DO FORM EM AJAX EM CADASTRO PARA ENVIO DE DADOS PARA O PHP
function enviaValores(tipo,nome,email,area,tel1,tel2,endereco,cidade,uf,periodo,curso,confsenha,senha){
	var url="ScriptsPHP/envia_cadastroAjax.php?tipo="+tipo+"&nome="+nome+"&email="+email+"&area="+area+"&tel1="+tel1+"&tel2="+tel2+"&endereco="+endereco+"&cidade="+cidade+"&uf="+uf+"&periodo="+periodo+"&curso="+curso+"&confsenha="+confsenha+"&senha="+senha;	
	//alert(tipo+nome+email+area+tel1+tel2+endereco+cidade+uf+periodo+curso+confsenha+senha);
	requisicaoHTTP("POST",url,true);	
}

//------------------------------------------------------------------------------------------------------------
//FUNÇÃO DESENVOLVIDA PARA UTILIZAÇÃO DO FORM EM AJAX EM USER AUTHENTICATION PARA ENVIO DE DADOS PARA O PHP
function enviaValoresAuth(email,senha){
	var url="ScriptsPHP/autenticaUserAjax.php?email="+email+"&senha="+senha;	
	//alert(email+senha);
	requisicaoHTTPauth("POST",url,true);	
}

//-------------------------------------------------------------------------------------------------------------
// FUNÇÃO DESENVOLVIDA PARA UTILIZAÇÃO DO FORM EM AJAX COM TXT
function trataDados(){
	var info = ajax.responseText;
	if(info==1){alerta="ERRO!!!\nCAMPOS OBRIGATÓRIOS VAZIOS ";}
	if(info==2){alerta="ERRO!!!\nCAMPO LOGIN INCORRETO.\nDIGITE UM E-MAIL VÁLIDO ";}
	if(info==3){alerta="ERRO!!!\nA SENHA NÃO CONFERE. ";}
	if(info==4){alerta="ERRO!!!\nTELEFONE PREENCHIDO INCORRETAMENTE. ";}
	if(info==5){alerta="ERRO!!!\nSERVIDOR OCUPADO TEMPORARIAMENTE... ";}
	if(info==6){alerta="GRAVAÇÃO DE CADASTRO REALIZADA COM SUCESSO!!!\nSEU ACESSO ESTÁ LIBERADO AO CONTEÚDO RESTRITO.\n\nUTILIZE SUA SENHA E LOGIN DE CADASTRO LOCALIZADO NO TOPO DO SITE, NO CAMPO * MY FREEWAY *"; document.formCadastro.reset(); location.href="index.php? #myfreeway";}
	if(info==7){alerta="ERRO!!!\nESTE USUÁRIO JÁ ESTÁ CADASTRADO EM NOSSO SISTEMA. ";}
	if(info==8){alerta="LIMITE DE ENVIO POR IP EXCEDIDO\nFAVOR DESTRUA SUA SESSÃO OU REINICIE SEU NAVEGADOR. ";}
	/**/
 alert(alerta);
}

//-------------------------------------------------------------------------------------------------------------
// FUNÇÃO DESENVOLVIDA PARA UTILIZAÇÃO DO FORM EM AJAX COM TXT PARA LOGIN E SENHA
function trataDadosRestrita(){
	var info = Ajax.responseText;
	if(info==1){alert("ACESSO NEGADO !!!\nÁREA RESTRITA.");}
	if(info==2){location.href="index.php?pass=ok1";}
	if(info==3){location.href="index.php?pass=ok2";}
	if(info==4){alert("LIMITE EXCEDIDO PARA TENTATIVAS DE LOGIN !!!\nFAVOR FECHE SEU NAVEGADOR E TENTE NOVAMENTE.");}

	//alert(info);
}