/* Meus Callbacks Personalizados */

function Calls()
{
	this.normal = function(resultado) {
		xmlhttp = this.obj;
		destino = this.GETaffect();
		xmlhttp.send(resultado);
		xmlhttp.close;
		retorno  = new String((xmlhttp.responseText));
		lay.style.display = 'none';
		return retorno;
	}

	this.criarcombo = function(resultado) {
		xmlhttp = this.obj;
		destino = this.GETaffect();
		xmlhttp.send(resultado);
		xmlhttp.close;
		retorno  = new String(((xmlhttp.responseText)));
		lay.style.display = 'none';
	  	i=0;
			while(document.getElementById(destino).options.length  != 0){
				if(	document.getElementById(destino).options[i]){
					document.getElementById(destino).options[i] = null ;
				}
			}
			mensagem = retorno.split('#');
			selecionado = mensagem[0];
			sp2 = mensagem[1].split('&');
			var loop = 0;
			while (loop < sp2.length)
			{
				var inter = sp2[loop].split("*");

				document.getElementById(destino).options[document.getElementById(destino).options.length] = new Option(inter[1], inter[0]);

				loop++;
			}
			document.getElementById(destino).value = selecionado;
			return true;
	}
}

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;
}
