var fechas={
	_this : this,
	_mensaje:'Fecha inválida',
	formato:'aaaa/mm/dd',
	resultados:false,
	anos : {
		min : 2000,
		max : new Date().getFullYear()+2
	},
	_fecha:new Array(),
	is_digit:function(char){
		return (char.charCodeAt(0)>47 && char.charCodeAt(0)<58);
	},
	valida:function(str_fecha,limites){
		switch(limites){
			case 'edad':
				this.anos.min=this.anos.max-100;
			break;
			case 'prop':
				this.anos.min=2000;
			break;
			case 'desa':
				this.anos.min=2006;
			break;
			default:
				this.anos.min=this.anos.max-100;
			break;
		}
		this._fecha=str_fecha.split('/');
		if(this._fecha[0]!='' && this._fecha[1]!='' && this._fecha[2]!=''){
			var formato_fecha=this._checkformat(this.formato);
			switch(formato_fecha){
				case 'french_regular':
					valida.posicion=new Array('dia','mes','ano');
					var str_dia=this._fecha[0];
					var str_mes=this._fecha[1];
					var str_ano=this._fecha[2];
				break;
				case 'french_inverse':
					valida.posicion=new Array('ano','mes','dia');
					var str_dia=this._fecha[2];
					var str_mes=this._fecha[1];
					var str_ano=this._fecha[0];
				break;
				case 'american_regular':
					valida.posicion=new Array('mes','dia','ano');
					var str_dia=this._fecha[0];
					var str_mes=this._fecha[1];
					var str_ano=this._fecha[2];
				break;
				case 'american_inverse':
					valida.posicion=new Array('ano','dia','mes');
					var str_dia=this._fecha[1];
					var str_mes=this._fecha[2];
					var str_ano=this._fecha[0];
				break;
			}
			resultados=this._checkdate(str_dia, str_mes, str_ano);
			return resultados;
		}
		return false;
	},
	_checkdate:function(str_dia, str_mes, str_ano){
		var result0=false;
		var result1=false;
		var result2=false;
		var str_valida0='result0=this.valida_'+valida.posicion[0]+'('+str_dia+','+str_mes+','+str_ano+');';
		var str_valida1='result1=this.valida_'+valida.posicion[1]+'('+str_dia+','+str_mes+','+str_ano+');';
		var str_valida2='result2=this.valida_'+valida.posicion[2]+'('+str_dia+','+str_mes+','+str_ano+');';
		eval(str_valida0);
		eval(str_valida1);
		eval(str_valida2);
		if(!result0){
			if(valida.posicion[0]=='ano'){str_mensaje='año';}else{str_mensaje=valida.posicion[0];}
			this._mensaje='Fecha inválida, revisa el formato y rectifica el '+str_mensaje;
		}
		if(!result1){
			if(valida.posicion[1]=='ano'){str_mensaje='año';}else{str_mensaje=valida.posicion[1];}
			this._mensaje='Fecha inválida, revisa el formato y rectifica el '+str_mensaje;
		}
		if(!result2){
			if(valida.posicion[2]=='ano'){str_mensaje='año';}else{str_mensaje=valida.posicion[2];}
			this._mensaje='Fecha inválida, revisa el formato y rectifica el '+str_mensaje;
		}
		if(result0 && result1 && result2){
			return true;
		}
		return false;
	},
	_checkformat:function(){
		if(arguments[0]==undefined)
			arguments[0]=this.formato;		
		var array_formato=arguments[0].split('/');
		if(array_formato[0]=='dd')
			return 'french_regular';
		if(array_formato[0]=='mm')
			return 'american_regular';
		if(array_formato[0]=='aaaa')
			if(array_formato[1]=='mm')
				return 'french_inverse';
			if(array_formato[1]=='dd')
				return 'american_inverse';
		return 'french_regular';
	},
	valida_dia:function(str_dia,str_mes,str_ano){
		var resultado=false;
		var int_dia = parseInt(str_dia, 10);
		resultado = resultado || ((int_dia >= 1) && (int_dia <= this.dias_mes(str_mes)));
		return resultado;
	},
	valida_mes:function(str_dia,str_mes,str_ano){
		var resultado = false;
		var int_mes = parseInt(str_mes, 10);
		resultado = resultado || ((int_mes >= 1) && (int_mes <= 12));
		return resultado;
	},
	valida_ano:function(str_dia,str_mes,str_ano){
		var resultado = false;
		var int_ano = parseInt(str_ano,10);
		resultado = resultado || ((int_ano >= this.anos.min) && (int_ano<=this.anos.max));
		return resultado;
	},
	dias_mes:function(str_mes){
		var int_mes=parseInt(str_mes,10);
		if(int_mes >= 1 && int_mes <= 12){
			var dias_m=0;
			var dias_x_mes={
				 "m1":"31",
				 "m2":"29",
				 "m3":"31",
				 "m4":"30",
				 "m5":"31",
				 "m6":"30",
				 "m7":"31",
				 "m8":"31",
				 "m9":"30",
				"m10":"31",
				"m11":"30",
				"m12":"31"
			};
			eval('dias_m=parseInt(dias_x_mes.m'+str_mes+',10);');
			return dias_m;
		}
		return false;
	},
	error : function (){
		alert(this._mensaje);
	}
};
var caracter={
	cadena_original		:	'',
	cadena_sustituta	:	'',
	caracter_buscado	:	'',
	caracter_reemplazo	:	'',
	ansicode_buscado	:	'',
	ansicode_reemplazo	:	'',
	posicion_caracter	:	0,
	reemplaza	:	function(){
	
		if(arguments[0]!='' && arguments[1]!='' && arguments[2]!=''){
			this.cadena_sustituta='';
			this.cadena_original=arguments[0];
			this.caracter_buscado=arguments[1];
			this.ansicode_buscado=this.caracter_buscado.charCodeAt(0);
			this.caracter_reemplazo=arguments[2];
			this.ansicode_reemplazo=this.caracter_reemplazo.charCodeAt(0);
			for(i=0;i<this.cadena_original.length;i++){
				if(this.cadena_original.charCodeAt(i)==this.ansicode_buscado){
					this.cadena_sustituta=this.cadena_sustituta+String.fromCharCode(this.ansicode_reemplazo);
				}else{
					this.cadena_sustituta=this.cadena_sustituta+String.fromCharCode(this.cadena_original.charCodeAt(i));
				}
			}
			return this.cadena_sustituta;		
		}else{
			return false;
		}	
	},
	busca		:	function(){
		if(arguments[0]!='' && arguments[1]){
			this.cadena_original=arguments[0];
			this.caracter_buscado=arguments[1];
			this.ansicode_buscado=this.caracter_buscado.charCodeAt(0);
			for(i=0;i<this.cadena_original.length;i++){
				if(this.cadena_original.charCodeAt(i)==this.ansicode_buscado){
					return i;
				}
			}
			return false
		}else{
			return false;
		}
	}
};
var enter={
	_submit:function(event,forma){
		code = event.keyCode;
		if (code==13)
			forma.submit();
		else
			return false;
	}
};
var valida={
	_nKeypress : window.Event ? true : false,
	numeros : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 13 || (key >= 48 && key <= 57));
	},
	alfanumerico : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 12 || (key >= 48 && key <= 57) || ((key >= 65 && key <= 90) || (key >= 97 && key <= 122)) || (key==193 || key==201 || key==205 || key==209 || key==211 || key==218 || key==225 || key==233 || key==237 || key==241 || key==243 || key==250 || key==32));
	},
	alfa_email : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 13 || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || (key==64 || key==46 || key==42 || key==43 || key==45 || key==47 || key==95));
	},
	alfanumericosignos : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 13 || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || (key >= 40 && key <= 47) || (key==32 || key==38 || key==58 || key==59 || key==64 || key==91 || key==92 || key==93 || key==95));
	},
	alfanumericosignos_sinenter: function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 12 || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || (key >= 40 && key <= 47) || (key==32 || key==38 || key==58 || key==59 || key==64 || key==91 || key==92 || key==93 || key==95));
	},
	numeros_banco : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 13 || (key >= 48 && key <= 57) || key==44 || key==46);
	},
	letras : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 13 || ((key >= 65 && key <= 90) || (key >= 97 && key <= 122)) || (key==193 || key==201 || key==205 || key==209 || key==211 || key==218 || key==225 || key==233 || key==237 || key==241 || key==243 || key==250 || key==32));
	},
	decimales : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 13 || (key >= 48 && key <= 57) || key == 46);
	},
	fecha : function(evt){
		var key = this._nKeypress ? evt.which : evt.keyCode;
		return (key <= 12 || (key >= 47 && key <= 57));
	},
	email : function(str_email){
		var filtrar=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})$/;
		if (filtrar.test(str_email)){
			return true;
		}else{
			return false;
		}
	},
	correo : function(idObjeto){
		var valor=$('#'+idObjeto).val();
		var filtrar=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})$/;
		if (filtrar.test(valor)){
			return true;
		}else{
			alert('Debe proporcionar una dirección de correo electrónico válida');
			$('#'+idObjeto).focus();
			return false;
		}
	},
	nss : function(numero_nss){
		var salida=true;
		var valuenss=numero_nss*1;

		if(valuenss>0 || valuenss!=""){
			var auxcve=numero_nss;
			if (auxcve.substr(6,4)=="0000" || auxcve.substr(0,2)=="00"){
				alert("Número de Seguridad Social incorrecto!!!...");
				return false;
			}

			var digito=0;
			for(i=0;i<10;i++){
				var valo1=0;
				var valo2=0;
				var cambio=((i+1)/2)-parseInt((i+1)/2);
				if(cambio==0){
					var valor=parseInt(auxcve.substr(i,1)*2);
					if(valor>=10){
						valo1=parseInt(valor/10);
						valo2=valor-10;
						valor=valo1+valo2;
					}
				}else{
					var valor=parseInt(auxcve.substr(i,1)*1);
				}
				digito=digito+valor;
			}
			digito=digito % 10;
			digito=10 - digito;
			if(digito==10){digito=0;}
			if(auxcve.substr(10,1)!=digito){
				alert("Digito Verificador incorrecto!!!...");
				return false;
			}else{
				return true;
			}
		}else{
			if(valuenss=="" || valuenss<=0){
				alert("Debe ingresar un número de NSS válido!!!...");
			}
		}
		return false;
	},
	vacio : function(idObjeto){
		var valor=$('#'+idObjeto).val();
		if(valor!=""){
			return true;
		}else{
			alert('Este campo no debe ir vacio');
			$('#'+idObjeto).focus();
			return false;
		}
	}	
};
var convierte={
	str2float : function(str_precio){
		if(str_precio.length>0){
			var new_float=0;
			new_float=this.str2num(str_precio);
			return parseFloat(new_float);
		}
		return false;
	},
	str2int : function(str_precio){
		var new_int=0;
		new_int=this.str2num(str_precio);
		return parseInt(new_int);
	},
	str2num : function(str_precio){
		var newCad="";
		for(i=0;i<str_precio.length;i++){
			var char1=str_precio.charAt(i);
			if(char1!=',' && char1!='$' && char1!=' ')
				newCad=newCad+char1;
		}
		return newCad;
	}
};
var login={
	_mensaje : '',
	usuario : function(txt_usuario){
		if(txt_usuario.length>0){
			return true;
		}else{
			this._mensaje='El nombre del usuario no puede estar vacío!!!';
			return false;
		}
	},
	usuario_email : function(txt_usuario){
		if(txt_usuario.length>0){
			if(valida.email(txt_usuario)){
				return true;
			}else{
				this._mensaje='Debe proporcionar una dirección de correo válida!!!';
				return false;
			}
		}else{
			this._mensaje='El nombre del usuario no puede estar vacío!!!';
			return false;
		}
	},
	clave : function(txt_clave){
		if(txt_clave.length>0){
			return true;
		}else{
			this._mensaje='La clave de acceso del usuario no puede estar vacía!!!';
			return false;
		}
	},
	alerta : function (){
		alert(this._mensaje);
	}
}
var galleta={
	nombre	: '',
	valor	: '',
	vigencia: '',
	crear	: function(){
		this.nombre=arguments[0];
		this.valor=Clase64.encode(arguments[1]);
		this.vigencia=arguments[2];
		if (this.vigencia){
			var fecha = new Date();
			fecha.setTime(fecha.getTime()+(this.vigencia*24*60*60*1000));
			var expires="; expires="+fecha.toGMTString();
		}else{
			var expires = "";
		}
		document.cookie = this.nombre+"="+this.valor+expires+"; path=/";
	},
	leer	: function(){
		this.nombre=arguments[0];
		var nombre_cookie=this.nombre+"=";
		var contenido_cookie=document.cookie.split(';');
		for(i=0;i<contenido_cookie.length;i++){
			var elemento_cookie=contenido_cookie[i];
			while(elemento_cookie.charAt(0)==' '){
				elemento_cookie=elemento_cookie.substring(1,elemento_cookie.length);
			}
			if(elemento_cookie.indexOf(nombre_cookie)==0){
				return Clase64.decode(elemento_cookie.substring(nombre_cookie.length,elemento_cookie.length));
			}
		}
		return null;
	},
	borrar	: function(){
		this.nombre=arguments[0];
		this.crear(this.nombre,"",-1);
	}
};
var Clase64 = {
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
	encode : function (input,limit) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
		input = Clase64._replacement_encode(input);
		input = Clase64._utf8_encode(input);
		while (i < input.length) {
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
			if (isNaN(chr2)){
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)){
				enc4 = 64;
			}
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
		}
		return output;
	},
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		while (i < input.length) {
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
			output = output + String.fromCharCode(chr1);
			if (enc3 != 64){
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64){
				output = output + String.fromCharCode(chr3);
			}
		}
		output = Clase64._utf8_decode(output);
		output = Clase64._replacement_decode(output);
		return output;
	},
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++){
			var c = string.charCodeAt(n);
			if (c < 128){
				utftext += String.fromCharCode(c);
			}else if((c > 127) && (c < 2048)){
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}else{
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
		}
		return utftext;
	},
	_utf8_decode : function (utftext){
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ){
			c = utftext.charCodeAt(i);
			if (c < 128){
				string += String.fromCharCode(c);
				i++;
			}else if((c > 191) && (c < 224)){
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}else{
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
		}
		return string;
	},
	_replacement_encode : function(texto){
		var strcode="";
		var char='';
		var charcode='';
		for(i=0;i<texto.length;i++){
			char=texto.charCodeAt(i);
			charcode=String.fromCharCode(char+3);
			strcode=strcode+charcode;
		}
		return strcode;
	},
	_replacement_decode : function(texto){
		var strdecode="";
		var char='';
		var charcode='';
		for(i=0;i<texto.length;i++){
			char=texto.charCodeAt(i);
			charcode=String.fromCharCode(char-3);
			strdecode=strdecode+charcode;
		}
		return strdecode;
	}
}
var ClaseMD5 = {
	hexcase : 0,
	chrsz   : 8,
	string_md5 : "time-gee-m3",
	txt2md5 : function(texto){
		return this.hex_md5(this.string_md5 + texto);
	},
	hex_md5 : function(s){
		return ClaseMD5.binl2hex(ClaseMD5.core_md5(ClaseMD5.str2binl(s), s.length * this.chrsz));
	},
	binl2hex : function(binarray){
		var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
		var str = "";
		for(var i = 0; i < binarray.length * 4; i++)
		{
			str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
		}
		return str;
	},
	core_md5 : function(x, len){
		x[len >> 5] |= 0x80 << ((len) % 32);
		x[(((len + 64) >>> 9) << 4) + 14] = len;
		var a =  1732584193;
		var b = -271733879;
		var c = -1732584194;
		var d =  271733878;
		for(var i = 0; i < x.length; i += 16){
			var olda = a;
			var oldb = b;
			var oldc = c;
			var oldd = d;
			a = ClaseMD5.md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
			d = ClaseMD5.md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
			c = ClaseMD5.md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
			b = ClaseMD5.md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
			a = ClaseMD5.md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
			d = ClaseMD5.md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
			c = ClaseMD5.md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
			b = ClaseMD5.md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
			a = ClaseMD5.md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
			d = ClaseMD5.md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
			c = ClaseMD5.md5_ff(c, d, a, b, x[i+10], 17, -42063);
			b = ClaseMD5.md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
			a = ClaseMD5.md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
			d = ClaseMD5.md5_ff(d, a, b, c, x[i+13], 12, -40341101);
			c = ClaseMD5.md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
			b = ClaseMD5.md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
			a = ClaseMD5.md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
			d = ClaseMD5.md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
			c = ClaseMD5.md5_gg(c, d, a, b, x[i+11], 14,  643717713);
			b = ClaseMD5.md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
			a = ClaseMD5.md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
			d = ClaseMD5.md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
			c = ClaseMD5.md5_gg(c, d, a, b, x[i+15], 14, -660478335);
			b = ClaseMD5.md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
			a = ClaseMD5.md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
			d = ClaseMD5.md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
			c = ClaseMD5.md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
			b = ClaseMD5.md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
			a = ClaseMD5.md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
			d = ClaseMD5.md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
			c = ClaseMD5.md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
			b = ClaseMD5.md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
			a = ClaseMD5.md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
			d = ClaseMD5.md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
			c = ClaseMD5.md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
			b = ClaseMD5.md5_hh(b, c, d, a, x[i+14], 23, -35309556);
			a = ClaseMD5.md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
			d = ClaseMD5.md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
			c = ClaseMD5.md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
			b = ClaseMD5.md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
			a = ClaseMD5.md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
			d = ClaseMD5.md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
			c = ClaseMD5.md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
			b = ClaseMD5.md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
			a = ClaseMD5.md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
			d = ClaseMD5.md5_hh(d, a, b, c, x[i+12], 11, -421815835);
			c = ClaseMD5.md5_hh(c, d, a, b, x[i+15], 16,  530742520);
			b = ClaseMD5.md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
			a = ClaseMD5.md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
			d = ClaseMD5.md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
			c = ClaseMD5.md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
			b = ClaseMD5.md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
			a = ClaseMD5.md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
			d = ClaseMD5.md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
			c = ClaseMD5.md5_ii(c, d, a, b, x[i+10], 15, -1051523);
			b = ClaseMD5.md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
			a = ClaseMD5.md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
			d = ClaseMD5.md5_ii(d, a, b, c, x[i+15], 10, -30611744);
			c = ClaseMD5.md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
			b = ClaseMD5.md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
			a = ClaseMD5.md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
			d = ClaseMD5.md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
			c = ClaseMD5.md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
			b = ClaseMD5.md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
			a = ClaseMD5.safe_add(a, olda);
			b = ClaseMD5.safe_add(b, oldb);
			c = ClaseMD5.safe_add(c, oldc);
			d = ClaseMD5.safe_add(d, oldd);
		}
		return Array(a, b, c, d);
	},
	md5_cmn : function(q, a, b, x, s, t){
		return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s),b);
	},
	md5_ff : function(a, b, c, d, x, s, t){
		return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
	},
	md5_gg : function(a, b, c, d, x, s, t){
		return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
	},
	md5_hh : function(a, b, c, d, x, s, t){
		return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
	},
	md5_ii : function(a, b, c, d, x, s, t){
		return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
	},
	bit_rol : function(num, cnt){
	  return (num << cnt) | (num >>> (32 - cnt));
	},
	safe_add : function(x, y){
	  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
	  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
	  return (msw << 16) | (lsw & 0xFFFF);
	},
	str2binl : function(str){
		var bin = Array();
		var mask = (1 << this.chrsz) - 1;
		for(var i = 0; i < str.length * this.chrsz; i += this.chrsz)
			bin[i>>5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i%32);
		return bin;
	}
}
