function base64() {
}
base64.chars = new Array('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','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','0','1','2','3','4','5','6','7','8','9','+','/');
base64.cadena = "";
base64.cuenta = 0;
base64.setCadena = function (str){
    base64.cadena = str;
    base64.cuenta = 0;
}
base64.read = function (){    
    if (!base64.cadena) return "END_OF_INPUT";
    if (base64.cuenta >= base64.cadena.length) return "END_OF_INPUT";
    var c = base64.cadena.charCodeAt(base64.cuenta) & 0xff;
    base64.cuenta++;
    return c;
}
base64.prototype.encode = function (str){
    base64.setCadena(str);
    var result = '';
    var inBuffer = new Array(3);
    var lineCount = 0;
    var done = false;
    while (!done && (inBuffer[0] = base64.read()) != "END_OF_INPUT"){
        inBuffer[1] = base64.read();
        inBuffer[2] = base64.read();
        result += (base64.chars[ inBuffer[0] >> 2 ]);
        if (inBuffer[1] != "END_OF_INPUT"){
            result += (base64.chars [(( inBuffer[0] << 4 ) & 0x30) | (inBuffer[1] >> 4) ]);
            if (inBuffer[2] != "END_OF_INPUT"){
                result += (base64.chars [((inBuffer[1] << 2) & 0x3c) | (inBuffer[2] >> 6) ]);
                result += (base64.chars [inBuffer[2] & 0x3F]);
            } else {
                result += (base64.chars [((inBuffer[1] << 2) & 0x3c)]);
                result += ('=');
                done = true;
            }
        } else {
            result += (base64.chars [(( inBuffer[0] << 4 ) & 0x30)]);
            result += ('=');
            result += ('=');
            done = true;
        }
        lineCount += 4;
        if (lineCount >= 76){
            result += ('\n');
            lineCount = 0;
        }
    }
    return result;
}
b64 = new base64;

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + //all caps
"abcdefghijklmnopqrstuvwxyz" + //all lowercase
"0123456789+/="; // all numbers plus +/=

function decode64(inp)
{
	var out = ""; //This is the output
	var chr1, chr2, chr3 = ""; //These are the 3 decoded bytes
	var enc1, enc2, enc3, enc4 = ""; //These are the 4 bytes to be decoded
	var i = 0; //Position counter

	// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
	var base64test = /[^A-Za-z0-9\+\/\=]/g;

	if (base64test.exec(inp)) { //Do some error checking
		alert("There were invalid base64 characters in the input text.\n" +
		"Valid base64 characters are A-Z, a-z, 0-9, ?+?, ?/?, and ?=?\n" +
		"Expect errors in decoding.");
	}
	inp = inp.replace(/[^A-Za-z0-9\+\/\=]/g, "");

	do { //Here.s the decode loop.

		//Grab 4 bytes of encoded content.
		enc1 = keyStr.indexOf(inp.charAt(i++));
		enc2 = keyStr.indexOf(inp.charAt(i++));
		enc3 = keyStr.indexOf(inp.charAt(i++));
		enc4 = keyStr.indexOf(inp.charAt(i++));

		//Heres the decode part. There.s really only one way to do it.
		chr1 = (enc1 << 2) | (enc2 >> 4);
		chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
		chr3 = ((enc3 & 3) << 6) | enc4;

		//Start to output decoded content
		out = out + String.fromCharCode(chr1);

		if (enc3 != 64) {
			out = out + String.fromCharCode(chr2);
		}
		if (enc4 != 64) {
			out = out + String.fromCharCode(chr3);
		}

		//now clean out the variables used
		chr1 = chr2 = chr3 = "";
		enc1 = enc2 = enc3 = enc4 = "";

	} while (i < inp.length); //finish off the loop

	//Now return the decoded values.
	return out;
}

//funciones para las formas
function BuscarFCK(f,tipo){
	switch(tipo){
		case 1:
			window.location = urlsistema + "/sesu_user/index.php?pg=listar&criterio=" + f.criterio1.value;
		break;
		case 2:
			window.location = urlsistema + "/evaluacion/index.php?pg=listar&criterio=" + f.criterio2.value;
		break;
		case 3:
			window.location = urlsistema + "/evaluacion/index.php?pg=catpregunta&criterio=" + f.criterio3.value;
		break;
	}
}

