/*********************************************************************
	Pinta los campos seleccionados
**********************************************************************/
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 7="i";4 8=b.j&&!b.k;4 1=\'\';4 0;4 c=/l|m|n/;d 5(9){2(9.6&&c.o(9.p)){2(8&&0.q==3)0=0.f.f;g r}h g s}d t(e){0=8?e.u:v.w;2(1!=\'\'){2(5(1))1.6.a=\'\';1=0;2(5(0))0.6.a=7}h{2(5(0))0.6.a=7;1=0}}',33,33,'eventobj|previous|if||var|checkel|style|highlightcolor|ns6|which|backgroundColor|document|intended|function||parentNode|return|else|lightblue|getElementById|all|INPUT|TEXTAREA|OPTION|test|tagName|nodeType|true|false|highlight|target|event|srcElement'.split('|'),0,{}))
/*******************************************************************
		Formatear fechas
********************************************************************/
function IsNumeric(valor) 
{ 
var log=valor.length; var sw="S"; 
for (x=0; x<log; x++) 
{ v1=valor.substr(x,1); 
v2 = parseInt(v1); 
//Compruebo si es un valor numérico 
if (isNaN(v2)) { sw= "N";} 
} 
if (sw=="S") {return true;} else {return false; } 
} 
var primerslap=false; 
var segundoslap=false; 
function formateafecha(fecha) 
{ 
var long = fecha.length; 
var dia; 
var mes; 
var ano; 
if ((long>=2) && (primerslap==false)) { dia=fecha.substr(0,2); 
if ((IsNumeric(dia)==true) && (dia<=31) && (dia!="00")) { fecha=fecha.substr(0,2)+"/"+fecha.substr(3,7); primerslap=true; } 
else { fecha=""; primerslap=false;} 
} 
else 
{ dia=fecha.substr(0,1); 
if (IsNumeric(dia)==false) 
{fecha="";} 
if ((long<=2) && (primerslap=true)) {fecha=fecha.substr(0,1); primerslap=false; } 
} 
if ((long>=5) && (segundoslap==false)) 
{ mes=fecha.substr(3,2); 
if ((IsNumeric(mes)==true) &&(mes<=12) && (mes!="00")) { fecha=fecha.substr(0,5)+"/"+fecha.substr(6,4); segundoslap=true; } 
else { fecha=fecha.substr(0,3);; segundoslap=false;} 
} 
else { if ((long<=5) && (segundoslap=true)) { fecha=fecha.substr(0,4); segundoslap=false; } } 
if (long>=7) 
{ ano=fecha.substr(6,4); 
if (IsNumeric(ano)==false) { fecha=fecha.substr(0,6); } 
else { if (long==10){ if ((ano==0) || (ano<1900) || (ano>2100)) { fecha=fecha.substr(0,6); } } } 
} 
if (long>=10) 
{ 
fecha=fecha.substr(0,10); 
dia=fecha.substr(0,2); 
mes=fecha.substr(3,2); 
ano=fecha.substr(6,4); 
// Año no viciesto y es febrero y el dia es mayor a 28 
if ( (ano%4 != 0) && (mes ==02) && (dia > 28) ) { fecha=fecha.substr(0,2)+"/"; } 
} 
return (fecha); 
}
/*******************************************************************
		Solo numeros
********************************************************************/
var nav4 = window.Event ? true : false;

function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || key == 46 || (key >= 48 && key <= 57));

}
/*******************************************************************
		solo letras
********************************************************************/
function acceptLetter(e) { // 1
    tecla = (document.all) ? e.keyCode : e.which; // 2
    if (tecla==8) return true; // 3
    patron =/[A-Za-z\s]/; // 4
    te = String.fromCharCode(tecla); // 5
    return patron.test(te); // 6
}
/*******************************************************************
		solo letras
********************************************************************/
function CheckIdentPass() {
	if(document.getElementById('frmClave').value != document.getElementById('frmReClave').value)
		{
			document.getElementById('Process').innerHTML = "No concuerdan las claves";
			document.getElementById('Process').style.display = "";
		}
	else
		{
			document.getElementById('Process').innerHTML = "";
			document.getElementById('Process').style.display = "none";
		}
}
/*******************************************************************
		Ir
********************************************************************/
function Go(Valor) {
	location.href=Valor;
}

Number.prototype.decimal = function(n) {
pot = Math.pow(10, parseInt(n));
return parseInt(this * pot) / pot;
}
/*******************************************************************
		Sumar totales
********************************************************************/

				function SumarSub(Valor,Muestra,Oculta){
					valor1=(Valor);
					
					valor2=(document.getElementById('subtotal').value);
					document.getElementById(Muestra).style.display='';
					document.getElementById(Oculta).style.display='none';
					document.getElementById(Oculta).disabled='disabled';
					document.getElementById(Muestra).checked=true;
					
					Total = parseFloat(valor2)+parseFloat(valor1);
					Total = Total.decimal(2);
					
					document.getElementById('subtotal').value=Total;
					
					document.getElementById('subtotal2').innerHTML=Total;
					document.getElementById('subtotal3').innerHTML=Total;
				}
/*******************************************************************
		Resta totales
********************************************************************/

				function RestaSub(Valor,Muestra,Oculta){
					valor1=(Valor);
					
					valor2=(document.getElementById('subtotal').value);
					
					document.getElementById(Muestra).style.display='';
					document.getElementById(Oculta).style.display='none';
					document.getElementById(Oculta).disabled='disabled';
					document.getElementById(Muestra).checked=false;
					
					Total = parseFloat(valor2)-parseFloat(valor1);
					Total = Total.decimal(2);
					document.getElementById('subtotal').value=Total;
					
					document.getElementById('subtotal2').innerHTML=Total;
					document.getElementById('subtotal3').innerHTML=Total;
				}
