function votar(){
	var opcao = document.getElementById("opcao").value;
	if (opcao==""){
		alert("Selecione uma opção!");
		return;
	}
	ajxEnquete = new Object(ajaxutil);
	ajxEnquete.method = "GET";
	ajxEnquete.target = document.getElementById("spResult")
	ajxEnquete.msg = "<img src='img/loading.gif' align='center'>";
	ajxEnquete.request("ajx/enquete_ajx.php?opcao="+opcao);		
}
function exibir_enquete(id,acao){
	ajxResult = new Object(ajaxutil);
	ajxResult.method = "GET";
	ajxResult.target = document.getElementById("spResult")
	ajxResult.msg = "<img src='img/loading.gif' align='center'>";
	ajxResult.request("ajx/enquete_ajx.php?id="+id+"&acao="+acao);		
}
function versaoImpressao(id){
	window.open('template/impressao.php?id='+id,'Impressao','toolbar=no, scrollbars=yes, width=600, height=500');
}
function curriculoImpressao(id){
	window.open('template/impressao_curriculo.php?id='+id,'Impressao','toolbar=no, scrollbars=yes, width=600, height=500');
}
function abreTela(url,method,classe,width,oklabel){
	document.getElementById('banner').style.visibility='hidden';
	//document.getElementById('projetos').style.visibility='hidden';
	Dialog.alert({url: url, options: {method: 'get'}}, 
	{className: classe, width:width, okLabel: oklabel})
}

function cadNewsletter(){

	email = document.getElementById("txtNewsleter").value;
	var femail = document.getElementById("txtNewsleter");
	
if (email == "") {
		alert("Informe seu e-mail.");
		femail.focus();
		femail.select();
		return false;
	} else {
		prim = email.indexOf("@")
		if(prim < 2) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf(".") < 1) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf(" ") != -1) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("zipmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("hotmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf(".@") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("@.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf(".com.br.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("/") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("[") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("]") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("(") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf(")") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
		if(email.indexOf("..") > 0) {
			alert("O e-mail informado parece não estar correto.");
			femail.focus();
			femail.select();
			return false;
		}
	}
	
	ajxNews = new Object(ajaxutil);
	ajxNews.method = "GET";
	ajxNews.target = document.getElementById("spNews")
	ajxNews.msg = "<img src='img/loading.gif' align='center'>";
	ajxNews.request("ajx/newsletter_ajx.php?email="+email);		
}

///////////////////////////////////
//Captura posicao do mouse
//////////////////////////////////
// Set Netscape up to run the "captureMousePosition" function whenever
// the mouse is moved. For Internet Explorer and Netscape 6, you can capture
// the movement a little easier.
if (document.all) { // Internet Explorer
//    document.onmousemove = captureMousePosition;
    document.onmouseup = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
//    document.onmousemove = captureMousePosition;
    document.onmouseup = captureMousePosition;
}

// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page
yTop = 0; // Define a posicao TOP da tela

function captureMousePosition(e) {
if (document.all) {
		yTop = document.body.scrollTop;
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        // Netscape 6 behaves the same as Netscape 4 in this regard 
		yTop= window.pageYOffset;
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}
//////////////////////////////////
function contadorcaracter(obj,tam,cont) {
        document.getElementById(cont).value = tam - obj.value.length;
        if (obj.value.length > tam) {
           alert ("Texto maior que "+tam+" caracteres, ele será cortado!!!");
			varTemp = obj.value;
			obj.value = varTemp.substring(0,tam);
			document.getElementById(cont).value = tam - obj.value.length;
        }
}


function trim(objStr) {
// trim:
// Elimina espacos vazios no inicio e no final da string
	return objStr.replace(/(^\s*)|(\s*$)/g, "");
}

function ValidaHora(obj)
{
	var hh = obj.value.substring(0,2);
	var mm = obj.value.substring(3,5);
	
	if (hh > 23) return 1
	if (mm > 59) return 1
	
	return 0
}

function VerDig(evento,tipo,obj)
{
  if (evento.keyCode) tecla = evento.keyCode;      
  else if (evento.which) tecla = evento.which; // Netscape 4.?  
  else if (evento.charCode) tecla = evento.charCode; // Mozilla  


	switch (tipo)
	{
		case 1: // tipo 1 = Números
				 if (tecla < 48 || tecla > 57)
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				 break;
				 
		case 2:  // tipo 2 = Letras
				 if (tecla > 48 && tecla < 57)
				 	if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				 break;
		case 3:	// tipo 3 = currency
				
				 if ((tecla < 48 || tecla > 57) && (tecla != 44)){
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
					}
				break;
		case 4:	//tipo 4 = date
				if (tecla < 48 || tecla > 57)
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				else
				{
					if(obj.value.length == 2 || obj.value.length == 5) obj.value += "/";
				}
				break;
		case 5:	//tipo 5 = hora
				
				if (tecla < 48 || tecla > 57)
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				else
				{
					if(obj.value.length == 2) obj.value += ":";
				}
				break;
		case 6:	// tipo 6 = currency com ponto
				 if ((tecla < 48 || tecla > 57) && (tecla != 46))
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				 break;
		case 7:	//tipo 7 = telefone
				
				if (tecla < 48 || tecla > 57)
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				else
				{
					if(obj.value.length == 2){ 
						obj.value = "("+obj.value;
						obj.value += ") ";
					}
					if(obj.value.length == 9) obj.value += "-";
				}
				break;
		case 8:	//tipo 8 = cep
				
				if (tecla < 48 || tecla > 57)
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				else
				{
					if(obj.value.length == 5) obj.value += "-";
				}
				break;
		case 9:	//tipo 9 = cpf
				
				if (tecla < 48 || tecla > 57)
					if (evento.keyCode){
						evento.returnValue = false;
						evento.cancel = true;
					}else{
						evento.preventDefault();
					}
				else
				{
					if(obj.value.length == 3) obj.value += ".";
					else if(obj.value.length == 7)  obj.value += ".";
					else if(obj.value.length == 11)  obj.value += "-";
				}
				break;

	}


}

/* Valida EMAIL */
function validaEmail(email){
	
		prim = email.indexOf("@")
		if(prim < 2) {
			return false;
		}
		if(email.indexOf("@",prim + 1) != -1) {
			return false;
		}
		if(email.indexOf(".") < 1) {
			return false;
		}
		if(email.indexOf(" ") != -1) {
			return false;
		}
		if(email.indexOf("zipmeil.com") > 0) {
			return false;
		}
		if(email.indexOf("hotmeil.com") > 0) {
			return false;
		}
		if(email.indexOf(".@") > 0) {
			return false;
		}
		if(email.indexOf("@.") > 0) {
			return false;
		}
		if(email.indexOf(".com.br.") > 0) {
			return false;
		}
		if(email.indexOf("/") > 0) {
			return false;
		}
		if(email.indexOf("[") > 0) {
			return false;
		}
		if(email.indexOf("]") > 0) {
			return false;
		}
		if(email.indexOf("(") > 0) {
			return false;
		}
		if(email.indexOf(")") > 0) {
			return false;
		}
		if(email.indexOf("..") > 0) {
			return false;
		}
}

/* Valida CNPJ */

function validaCNPJCPF(TIPnumber) {
 
	valor = TIPnumber;
    erro = new String;
	if (valor.length == 14) {
	  CNPJ = valor;  
	  var nonNumbers = /\D/;
	  if (nonNumbers.test(CNPJ)) erro = "A verificacao de CNPJ suporta apenas numeros! ";
      var a = [];
      var b = new Number;
      var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
      var msg = "" ;
      for (i=0; i<12; i++)
		  {
          a[i] = CNPJ.charAt(i);
          b += a[i] * c[i+1];
		  }

      if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
      b = 0;
      for (y=0; y<13; y++) 
	    {
        b += (a[y] * c[y]); 
        }

      if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
	  
      if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
                       erro +="Dígito verificador do CNPJ com problema!";
      }

      if (erro.length > 0){
       	alert(erro);
        return false;
      } 
      return true;
}
else
{
    cpf = valor;
    if (cpf.length < 11)
    { 
    	erro = "Sao necessarios 11 digitos para verificacao do CPF! "; 
    	msg = "CPF";
    }
	if (cpf.length > 11) 
	 {
	 	erro = "Sao necessarios 14 digitos para verificacao do CNPJ! "; 
	 	msg = "CNPJ";
	 }
    var nonNumbers = /\D/;
    if (nonNumbers.test(cpf)) erro += "A verificacao de CPF suporta apenas numeros! "; 
    if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999"){
         erro += "Numero de" + msg + "invalido!"
	}
    var a = [];
    var b = new Number;
    var c = 11;
    for (i=0; i<11; i++){
        a[i] = cpf.charAt(i);
        if (i < 9) b += (a[i] * --c);
    }
    if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
    b = 0;
    c = 11;
    for (y=0; y<10; y++) b += (a[y] * c--); 
    if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
    if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10])){
           erro +="Digito verificador do CPF com problema!";
    }
    if (erro.length > 0){
        alert(erro);
    return false;
    }
    return true;
  }
}


function go(pDestino, pDvDestino){
	ajxEnvia = new Object(ajaxutil);
	if (pDvDestino == null) {
		ajxEnvia.target = document.getElementById("dvTela")
	}
	else {
		ajxEnvia.target = document.getElementById(pDvDestino)
	}
	ajxEnvia.msg = "";
	ajxEnvia.request (pDestino);
	return false
}

// ********************************************
// CRIA CLASSE PARA UTILIZACAO DE AJAX
// ********************************************
// Cria o objeto
var ajaxutil = new Object()

// Define propriedades e valores iniciais
ajaxutil.method = "POST"; //metodo para envio dos dados, padrão é POST
ajaxutil.target = ""; //objeto - innerHTML - de retorno 
ajaxutil.contentType = ""; //header content type, definido padrão mais embaixo
ajaxutil.msg = "<img src='img/loading.gif'>"; //msg padrão de exibição
ajaxutil.button = ""; //
ajaxutil.TipoEnvio = ""; //assincrono = true, sincrono=false
ajaxutil.userStatus = 0;
ajaxutil.arrTrigger = new Array(); //Trigger (status,objhtml,funcao)

var bEndTrigger = false;

if(ajaxutil.TipoEnvio == "") {
	ajaxutil.TipoEnvio = true
}

//Cria o objeto ActiveXObject
ajaxutil.openAjax = function(){
	var objOpenAjax
	try{
		objOpenAjax = new XMLHttpRequest();
	}
	catch(ee){
		try{
			objOpenAjax = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				objOpenAjax = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(E){
				objOpenAjax = false;
			}
		}
	}
	return objOpenAjax
}


// Requisita a pagina destino e define o formulario
// para passagem de parâmetros, se for o caso
// pURL = pagina que será requisitada
// pForm = formulário que será processado, enviando dados para pURL (opcional)
ajaxutil.request = function(pUrl,pForm){
	
	var vAjaxTarget = this.target;
	var objAjax = this.openAjax();
	objAjax.abort();
	var vAjaxFormValues = ""
	var vAjaxButton = this.button;
	bEndTrigger = true;
	
	if (!vAjaxTarget.innerHTML) {
		//Teste realizados para funcionamentos sem problemas com IE 6 e Firefox
		vAjaxTarget = document.getElementById(this.target)
		try {
			if (!vAjaxTarget.innerHTML) {}
		}
		catch(err){
			vAjaxTarget = document.getElementById(this.target.id)
		}
	}

	if (pForm == null) {
		vAjaxFormValues = null;
		this.method = "GET";

	}
	else {
		vAjaxFormValues = this.getFields(pForm);
		if(vAjaxFormValues.length == 0){
			vAjaxFormValues = null;
		}
	}

	objAjax.open(this.method, pUrl, this.TipoEnvio)
	if (pForm != null) {
		if (this.contentType == ""){
			this.contentType = "application/x-www-form-urlencoded"
		}
//  	objAjax.setRequestHeader("Method", "POST " + pUrl + " HTTP/1.1");
		objAjax.setRequestHeader("Content-type", "text/html; charset=iso-8859-1");
  		objAjax.setRequestHeader("Content-type", this.contentType);
		objAjax.setRequestHeader("Content-length", vAjaxFormValues.length)
	}

	this.viewMsg (this.msg);
	this.objectsControl (vAjaxButton,false);

	objAjax.onreadystatechange = function() {
		if (objAjax.readyState == 1){
//			document.getElementById(vAjaxTarget).innerHTML = "carregando ";
		}
		if (objAjax.readyState == 4){
			var vAjaxText = objAjax.responseText;
			var vAjaxTargetEnd 
			var bAjaxReturnOK = false;
//		try {
				if (objAjax.status == 200){
					document.getElementById("dvAjaxMsg").style.display = "none";
					vAjaxTargetEnd = vAjaxTarget;
					bAjaxReturnOK = true;
				}
				else{
					bTrigger = false;
					for(var iArrTg = 0; iArrTg < ajaxutil.arrTrigger.length; iArrTg++){
						if(parseInt(objAjax.status) == parseInt(ajaxutil.arrTrigger[iArrTg][0])){
							bTrigger = true;
							document.getElementById("dvAjaxMsg").style.display = "none";
							if(ajaxutil.arrTrigger[iArrTg][1]!=""){
								if(document.getElementById(ajaxutil.arrTrigger[iArrTg][1])){
									vAjaxTargetEnd = document.getElementById(ajaxutil.arrTrigger[iArrTg][1]);
									bAjaxReturnOK = true;
								}
							}
							if(ajaxutil.arrTrigger[iArrTg][2]!=""){
								eval(ajaxutil.arrTrigger[iArrTg][2]);
							}
						}
					}
					
					if (bTrigger == false) {
						bAjaxReturnOK = false;
						document.getElementById("dvAjaxMsg").style.display = "none";
						if (vAjaxText == "" ){
							//Tratativa para IE
							alert('Prezado usuário.\nOcorreu um erro na conexão com o servidor de destino.');
						}
						else if (confirm('Prezado usuário.\nOcorreu um erro na página que foi chamada.\nClique em OK para ver detalhes do erro.')){
							var janAjaxErro = window.open('','janelaErro','scrollbars=1,resizable=0,width=660,height=400');
							janAjaxErro.focus();
							janAjaxErro.document.write(vAjaxText);
							janAjaxErro.document.close();
						}
					}
				}
				
//			}
/*
			catch (e) {
				document.getElementById("dvAjaxMsg").style.display = "none";
				alert('Prezado usuário.\nOcorreu um erro na conexão com o servidor de destino.');
				bAjaxReturnOK = false;
			}
*/			
			if (bAjaxReturnOK) {
				vAjaxTargetEnd.innerHTML = ajaxutil.processJs(vAjaxText);
			}
		}
		ajaxutil.objectsControl (vAjaxButton,true);
	}
	objAjax.send(vAjaxFormValues);

}


ajaxutil.getFields = function(pForm){
	var vAjaxCamposValores = "";
	var vAjaxSepara = "";

	ObjForm = document.getElementById(pForm);

	for (i=0; i < ObjForm.elements.length; i++) {

			if(ObjForm.elements[i].type == "checkbox" || ObjForm.elements[i].type == "radio"){
				if(ObjForm.elements[i].checked){
					vAjaxCamposValores += vAjaxSepara + ObjForm.elements[i].name+"="+url_encode(ObjForm.elements[i].value);
					vAjaxSepara = "&"
					}
				}
			
			else if(ObjForm.elements[i].type == "select-one" || ObjForm.elements[i].type == "select-multiple"){
					for (x=0; x < ObjForm.elements[i].options.length; x++) {
						if(ObjForm.elements[i].options[x].selected){
							vAjaxCamposValores += vAjaxSepara + ObjForm.elements[i].name+"="+url_encode(ObjForm.elements[i].options[x].value);
							vAjaxSepara = "&";
							}
						}
				}
				
			else {
				vAjaxCamposValores += vAjaxSepara + ObjForm.elements[i].name+"="+url_encode(ObjForm.elements[i].value);
				vAjaxSepara = "&";
				}
	}
	return vAjaxCamposValores;
}

ajaxutil.viewMsg = function(pMsgBrowse){
	if (!document.getElementById("dvAjaxMsg")) {
		iDv = document.createElement("DIV");
		iDv.setAttribute("name", "dvAjaxMsg");
		iDv.setAttribute("id", "dvAjaxMsg");
//		iDv.style.top = "34px";
//		iDv.style.left = "698px";
		iDv.style.width = "100px";
		iDv.style.position = "absolute";
 		iDv.style.border = "1px solid #fb1"; //FEA
		iDv.style.display = "none";
		iDv.style.padding = "3px";
		iDv.style.backgroundColor = "#fd3"; //ffD
		document.body.appendChild(iDv);
	}
	else {
		iDv = document.getElementById("dvAjaxMsg")
	}
	var vAjaxTarget = this.target;
	//posiciona a mensagem de acordo com a dimensão da tela
	vAjaxTarget.innerHTML = "<br><br>"+pMsgBrowse;
	iDv.style.top = yTop + 35+"px";
	iDv.style.left = xMousePosMax - 150+"px";
	//------------------
	iDv.innerHTML = " " + pMsgBrowse;
	iDv.style.display = "none";
}

ajaxutil.objectsControl = function(pLstObjectsName,pAction){
/* Recebe uma lista dos nomes dos objetos, separados por virgula
que serão desativados e reativados com o processamento do request
pLstObjectsName = nomes dos objetos, separados por virgula
pAction = tipo de acao: true (Ativar) ou false (Desativar)
*/
	if (pLstObjectsName == "") return;
	//Cria um array a partir da virgula
	arAjaxLstObjects = pLstObjectsName.split(",")
	for (x=0; x < arAjaxLstObjects.length; x++) {
		vObjName = arAjaxLstObjects[x];
		vObjName = vObjName.replace(" ","");
		if (document.getElementById(vObjName)) {
			objControl = document.getElementById(vObjName);
			objControl.disabled = !pAction
		}
	}
}

ajaxutil.addTrigger = function(pAddTgStatus,pAddTgObjHTML,pAddTgJS) {
/*
Acrescenta disparadores configuracoes para determinados status da pagina HTML
pAddTgStatus = codigo de status da pagina processada configurado pelo usuario 
pAddTgObjHTML = objeto html que recebera o valor em INNERHTML
pAddTgJS = funcao ou codigo javascript que será executado
*/		if (bEndTrigger == true) return;	

		vCtrlAddTg = this.arrTrigger.length;
		this.arrTrigger[vCtrlAddTg] = new Array(3);
		this.arrTrigger[vCtrlAddTg][0] = pAddTgStatus;	
		this.arrTrigger[vCtrlAddTg][1] = pAddTgObjHTML;
		this.arrTrigger[vCtrlAddTg][2] = pAddTgJS;
	}

ajaxutil.processJs = function(pTxtScript){
/*
Recebe um texto e separa todos os códigos que referente a javascript, identificados pela
TAG "script" e igual a "javascript"
Com o resultado é criado elementos "script" dentro do BODY do documento
permitindo que a expressão seja válida.
Retorna o texto sem todos os codigos de "script"
Testada com FF e IE
*/
	var vJsTxtSrc, vJsTxtScript, vJsIntIni, vJsIntEnd, vJsTxtPart 
	var vJsReturn, vJsReturnIni
	vJsIntIni = 0
	vJsTxtSrc = ""
	mJsScript = pTxtScript.match(/\<script\s+language\s*=["\'\s]*javascript.*>/gi)

	vJsReturn = ""
	vJsReturnIni = 0

	if (mJsScript != null) {
		for (vJsIntCntScpt=0; vJsIntCntScpt < mJsScript.length; vJsIntCntScpt++) {
			vJsTxtPart = mJsScript[vJsIntCntScpt].substring(0,mJsScript[vJsIntCntScpt].indexOf(">")+1)
			vJsIntIni = pTxtScript.indexOf(vJsTxtPart,vJsIntIni);
			mJsSrc = vJsTxtPart.match(/src\s*=\s*".+\.js\s*"/gi);
			if (mJsSrc != null) { 
				vJsTxtSrc = mJsSrc[0].replace(/[\s="]/gi,"").substring(3);
			}
			vJsReturn += pTxtScript.substring(vJsReturnIni,vJsIntIni)
			vJsIntIni = vJsIntIni + vJsTxtPart.length;
			vJsIntEnd = pTxtScript.toLowerCase().indexOf("<\/script>".toLowerCase(),vJsIntIni)
			vJsReturnIni = vJsIntEnd + "<\/script>".length

			if (vJsIntEnd != -1) {
				vJsTxtScript = pTxtScript.substring(vJsIntIni,vJsIntEnd);
				vJsIntIni = vJsIntEnd
				//Cria o elemento script
		        vJsObjScript = document.createElement("script");
				if (vJsTxtSrc != "") vJsObjScript.src = vJsTxtSrc;
				else vJsObjScript.text = vJsTxtScript;
				document.body.appendChild(vJsObjScript)
				vJsObjScript = null;
				vJsTxtSrc = "";
			}
		}
	}
	vJsReturn += pTxtScript.substring(vJsReturnIni)
	return vJsReturn 
}


// ********************************************
// FIM CLASSE DE AJAX
// ********************************************


// Codificação e decodificação de UTF-8 - CHAR ISO-8859-1
// url_encode version 1.0 
function url_encode(str) { 
    var hex_chars = "0123456789ABCDEF"; 
//    var noEncode = /^([a-zA-Z0-9\_\-\.<>\s\\\"\',\{\}\[\]=#;:!\(\)\/])$/; 
    var noEncode = /^([a-zA-Z0-9\_\-\.])$/; 
    var n, strCode, hex1, hex2, strEncode = ""; 
//	str = str.replace(/\n/gi,"\r\n")
    for(n = 0; n < str.length; n++) { 
        if (noEncode.test(str.charAt(n))) { 
            strEncode += str.charAt(n); 
        } else { 
            strCode = str.charCodeAt(n); 
            hex1 = hex_chars.charAt(Math.floor(strCode / 16)); 
            hex2 = hex_chars.charAt(strCode % 16); 
            strEncode += "%" + (hex1 + hex2); 
        } 
    } 
    return strEncode; 
} 

// url_decode version 1.0 
function url_decode(str) { 
    var n, strCode, strDecode = ""; 

    for (n = 0; n < str.length; n++) { 
        if (str.charAt(n) == "%") { 
            strCode = str.charAt(n + 1) + str.charAt(n + 2); 
            strDecode += String.fromCharCode(parseInt(strCode, 16)); 
            n += 2; 
        } else { 
            strDecode += str.charAt(n); 
        } 
    } 
    return strDecode; 
}
