var isIE = document.all?true:false;
var isNS = document.layers?true:false;
function GetToday(){
    var today 		= new Date();
    var monthday        = today.getDate();
    var month 		= today.getMonth()+1;
    var year 		= today.getFullYear();
    
    if(monthday<10){monthday="0"+monthday}
    if(month<10){month="0"+month}
    var fetc = year+"-"+month+"-"+monthday;
    return fetc;
}
function onlyDigits(e,decReq) {
    var key = (isIE) ? window.event.keyCode : e.which;
    var obj = (isIE) ? event.srcElement : e.target;
    var isNum = (key > 47 && key < 58) ? true:false;
    var dotOK = (key==46 && decReq=='decOK' && (obj.value.indexOf(".")<0 || obj.value.length==0)) ? true:false;
    window.event.keyCode = (!isNum && !dotOK && isIE) ? 0:key;
    e.which = (!isNum && !dotOK && isNS) ? 0:key;
    return (isNum || dotOK);
}
function change(id,h){
    var new_hght= 0;
    var ids	= id.split(',');
    var owidth  = {width};
    var oheight = {height};
    var hght	= parent.document.body.clientHeight;
    var wdth	= parent.document.body.clientWidth;    
    for(var i=0;i<ids.length;i++){
	identity = document.getElementById(ids[i]);
	if(identity.style.display=="none"){
	    identity.style.display = "";
	    new_hght= hght+h;
	    eval("parent.window.resizeTo({width},"+new_hght+")");
	}else{
	    identity.style.display="none";
	    new_hght= hght-h+72;
	    eval("parent.window.resizeTo({width},"+new_hght+")");
	}
    }
}
function ActivarNombre(){
    document.form.i8_contribuyente_id.value =99999999;
    document.getElementById('v128_contribuyente').readOnly=false;
    document.getElementById('c11_dui_id').readOnly=false;
    document.getElementById('c14_nit_id').readOnly=false;
    document.getElementById('c14_iva_id').readOnly=false;
    document.getElementById('v16_telefono').readOnly=false;
    document.getElementById('v16_fax').readOnly=false;
    document.getElementById('txt_email').readOnly=false;
    document.getElementById('txt_direccion').readOnly=false;
}
function Clean(s){
    var elements = s.split(',');
    for(var i=0;i<elements.length;i++){    
        eval("document.form."+elements[i]+".value=''");
    }
}
function GetExpediente(){
    var generador = document.form.v64_tipo_generador.value.toLowerCase();
    if(generador!=""){
	var command = "GetBack('LTMD','contribuyente_"+generador+"s','i8_"+generador+"_id|i8_expediente_id,txt_ubicacion|txt_expediente_direccion,txt_propietarios|txt_expediente_propietarios','parent.opener.form',100,100,'i8_contribuyente_id','i8_expediente_id')";
	//alert(command);
	eval(command);
    }else{alert("Seleccione el Generador")}
}
function noRet(e,decReq) {
	var key = (isIE) ? window.event.keyCode : e.which;
	var obj = (isIE) ? event.srcElement : e.target;
	var isRet = (key==13 || key=="35" || key=="34" || key=="126" || key=="124") ? false:true;
	window.event.keyCode = (!isRet && isIE) ? 0:key;
	return (isRet);
}
function Guardar(){
    if(document.form.c16_recibo_id.value!=""){Save();close();}else{alert("Digite el numero de recibo por favor!!!")}
}
function LlenarAnulado(){
	var existe = parent.list.document.data.exist.value;
	if(existe=="false"){
	    document.form.i8_contribuyente_id.value 	= 99999999;
	    document.form.v128_contribuyente.value	= "ANULADO";
	    document.form.i2_tipo_pago_id.value		= 1
	    document.form.v64_tipo_pago.value		= "EFECTIVO";
	    document.form.i2_tipo_departamento_id.value	= 3
	    document.form.v64_tipo_departamento.value	= "TESORERIA";
	    document.form.c16_tarifa_id__1.value 	= "TSINMANUNNAEF001";
	    document.form.v128_tarifa__1.value   	= "ANULADO";
	    document.form.d82_cantidad__1.value  	= 0;
	    document.form.d82_tarifa__1.value    	= 0;
	    document.form.txt_periodos__1.value  	= "";
	    Guardar();
	}else{alert("Esta Opcion No Puede Anular Un Recibo Existente")} 
}
function LoadToday(){
	FechaHoy = GetToday();
	document.form.dt_emision.value=FechaHoy;
	document.form.dt_vencimiento.value=FechaHoy;	
}
function AfterProcces(){
   document.form.chk_anular.disabled = false;
}