weekdays 	= new Array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado");
months 		= new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
today 		= new Date();
weekday 	= today.getDay();
monthday 	= today.getDate();
month 		= today.getMonth();
year 		= today.getFullYear();
weekday		= weekdays[weekday];
month 		= months[month];
dateString	= (String(weekday))+" "+(String(monthday))+" "+(String(month))+" , "+(String(year));
clase = document.form.clase.value;
//alert(clase);
var openwindow;
var openwindow2;
var openwindow3;
var openwindow4;
function OpenBalance(id){
    winame="Balance_{clase}";
    var fields="";
    var values="";
    if (!openwindow[winame] || openwindow[winame].closed){
	win ="window.open('../bin/bsws.pl?lan=es&appid={appid}&clase={clase}_balance&id="+id+"&fields="+fields+"&values="+values+"','"+winame+"','left=0,top=0,width=100,height=100,resizable=yes,scrollbars=yes')";
	openwindow[winame]=eval(win);
    }
    else{openwindow[winame].focus()}
}
function OpenAdministrativo(id,clase){
    //alert(clase);
    if(clase=="inmueble"){clase="inmueble_administrativo"}
    if(clase=="empresa"){clase="empresa_administrativo"}
    winame="Balance";
    var fields="";
    var values="";
        if (!openwindow[winame] || openwindow[winame].closed){
	    win ="window.open('../bin/gdf.pl?lan=es&appid={appid}&clase="+clase+"&id="+id+"&fields="+fields+"&values="+values+"&dt_vencimiento=2008-07-31','"+winame+"','left=0,top=0,width=100,height=100,resizable=yes,scrollbars=yes')";
	    openwindow[winame]=eval(win);
	}
	else{openwindow[winame].focus()}
}
function OpenNotificacion(id){
    winame="Notificacion_"+id;
    var fields="";
    var values="";
    if (!openwindow[winame] || openwindow[winame].closed){
	win ="window.open('../pl/mora_notificacion_expediente_rept.pl?lan=es&appid={appid}&clase={clase}&id="+id+"&fields="+fields+"&values="+values+"','"+winame+"','left=0,top=0,width=100,height=100,resizable=yes,scrollbars=yes')";
        //alert(win);
	openwindow[winame]=eval(win);
    }
    else{openwindow[winame].focus()}
}
function MarkAll(){
    var T     = document.getElementById('Grid');
    var trows = T.rows;
    for (i = trows.length-2; i != 0; i--) {
	if(eval("document.form.chk_"+i+".checked")){
		eval("document.form.chk_"+i+".checked=false")
	}else{
		eval("document.form.chk_"+i+".checked=true")			
	}
    }
}
function MoraNotificacionExpedientes(){
    var count = 0;
    var expe = "";
    for (i=1; i<document.getElementById('Grid').rows.length-1; i++){
	if(eval("document.form.chk_"+i+".checked")){
	    var x=document.getElementById('Grid').rows[i].cells[1].getElementsByTagName('a');
	    expe += x[0].innerHTML+"|";
	    count++;
	}
    }
    document.form.str_expedientes.value = expe;
    //alert(document.form.str_expedientes.value);
    if(count>0){document.form.submit();}else{alert("Favor MARQUE con un CHEQUE los Expedientes que desea notificar..")}
} 