function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  
}

function btnConsultar_onclick() 
{

	Consultar();
}
function Consultar(){
	var intDepto=0;
	var intPos=0;
	var intCant=0;
	var strURL=" ";
	
	var strCuenta=txtCuenta.value;
	var strClave=txtClave.value;
	var strNombre="Clave";
	 	if (strCuenta.length==0) 
		{
			alert("No se Ingreso Cuenta");
			return;
		}	
		if (strCuenta.length>10)
		{ 
			alert("Excede cantidad de digito en la Cuenta");
			return;
		}
	 	if (strClave.length==0) 
		{
			alert("No se Ingreso Clave");
			return;
		}	
	 if (window.clientInformation.cookieEnabled==false)
	  {
		alert("Para Nevegar el sitio habilite cookies");
		return;
	  }
	
	
	if (rdbTasas.checked==true) 
		{
			intDepto=1;
		}
		
	if (rdbComercio.checked==true)
		{
			intDepto=2;
		}
	//if (rdbCementerio.checked==true)
	//	{
	//		intDepto=3;
	//	}
	//if (rdbFondeadero.checked==true)
	//	{
	//		intDepto=4;
	//	}
	if (rdbVehiculos.checked==true)
		{
			intDepto=5;
		}
	strCuenta=strCuenta.toUpperCase(strCuenta);
	intCant=strCuenta.length;
	if (intDepto<5)
	   {
		for(intPos=0;intPos<intCant;intPos++)
			{
			if ((intNumero=strCuenta.substr(intPos,1)<"0")|| (intNumero=strCuenta.substr(intPos,1)>"9"))
				{
					alert("La Cuenta debe ser Numerica");
					return;
				}
			}
		}
	if (intDepto==5)
		 {
		 
		for(intPos=0;intPos<intCant;intPos++)
			{
			if ((intNumero=strCuenta.substr(intPos,1)<"0")|| (intNumero=strCuenta.substr(intPos,1)>"9"))
				{
				if ((intNumero=strCuenta.substr(intPos,1)<"A")|| (intNumero=strCuenta.substr(intPos,1)>"Z"))
					{
						alert("La Cuenta no debe Contener [" + strCuenta.substr(intPos,1) + "]");
						return;
					}
				}
			}
		}
	strURL="ConsultaDeuda.aspx?depto="+intDepto+"&cuenta="+strCuenta
		
	document.cookie= strNombre + "=" + escape( strClave)
		
	window.navigate(strURL)
	
	

}


function VeoSeleccion(chk){
		var strNumero=chk.name;
		var strCookie=new String(document.cookie);
		var strLista;
		var strPeriodo;
		var intIdice=0;
		var intIndTab=0;
		var dblImporte=0.00;
		var intItem=0;	
		var intFilas=0;
		var intMorosidad=0;
		var hoy=new Date();
		
		var anio=hoy.getFullYear(); 
				
		strNumero=strNumero.substr(strNumero.length-4,4)
		intIndice=parseInt(strNumero,10);
		strLista=strCookie.split(";")
		for (intIndTab=0;intIndTab<strLista.length;intIndTab++)
		{
			if (strLista[intIndTab].substr(1,5)=="Deuda")
			{	var strImportes=new String(strLista[intIndTab].substr(7));
				
			}
			if (strLista[intIndTab].substr(1,5)=="Filas")
			{intFilas=parseInt(strLista[intIndTab].substr(7),10)}
	
			if (strLista[intIndTab].substr(1,7)=="Periodo")
			{strPeriodo=new String(strLista[intIndTab].substr(9))}
			if (strLista[intIndTab].substr(1,9)=="Morosidad")
			{intMorosidad=parseInt(strLista[intIndTab].substr(11),10)}


		}

		
		
		strLista=strImportes.split("|");
		strPeriodo=strPeriodo.split("|");
		
		if (chk.checked)
			
			if (document.Consulta.txtRecibo.value=="") 
				{
				
				var strImporte=new String(strLista[intIndice]);
				
				strImporte=strImporte.substr(0,strImporte.length-2) + "." + strImporte.substr(strImporte.length-2,2)
				document.Consulta.txtRecibo.value=strImporte;
				}
				else
				{
				var strImporteT=new String(document.Consulta.txtRecibo.value);
				strImporteT=strImporteT.substr(0,strImporteT.length-3)+strImporteT.substr(strImporteT.length-2,2)
				
				var dblImporteS1=parseInt(strImporteT);
				var dblImporteS2=parseInt(strLista[intIndice]);
				var strImporteS=new String(dblImporteS1+dblImporteS2);
				strImporteS=strImporteS.substr(0,strImporteS.length-2) + "." + strImporteS.substr(strImporteS.length-2,2)
				document.Consulta.txtRecibo.value=strImporteS;
				}
			else
			{
			var strImporteM=new String(document.Consulta.txtRecibo.value);
			strImporteM=strImporteM.substr(0,strImporteM.length-3)+strImporteM.substr(strImporteM.length-2,2)
			var dblImporteR1=parseInt(strImporteM);
			var dblImporteR2=parseInt(strLista[intIndice]);
			var strImporteR=new String(dblImporteR1-dblImporteR2);
			strImporteR=strImporteR.substr(0,strImporteR.length-2) + "." + strImporteR.substr(strImporteR.length-2,2)
			document.Consulta.txtRecibo.value=strImporteR;
			}
			if (parseFloat(document.Consulta.txtRecibo.value)==0)
				document.Consulta.txtRecibo.value="" 
		
		
		
	
		
	}
	function Recibo(){
		var strCookie=new String(document.cookie);
		var strLista;
		var intIndTab=0;
		var intItem=0;	
		var intFilas=0;
		var strURL;
		var strRenglon = new String();
		var intPeriodos=0;
		if (document.Consulta.txtRecibo.value=='')
			{
			alert("No se Seleccionaron Periodos");
			return
			}
		strLista=strCookie.split(";")
		for (intIndTab=0;intIndTab<strLista.length;intIndTab++)
		{
			if (strLista[intIndTab].substr(1,5)=="Filas")
			{intFilas=parseInt(strLista[intIndTab].substr(7),10)
			break;}
			
	
		}
			
		for (intItem=0;intItem<intFilas-1;intItem++)
								
			{var strFila=new String(intItem);
				
				var strIndice=new String();
				if(strFila.length<4)
					{var intIndice=0;
					for (intIndice=strFila.length;intIndice<4;intIndice++)
						strIndice=strIndice+'0';
					strIndice=strIndice+strFila;}
					else
					strIndice=strFila;
					if (document.all['Check'+strIndice].checked)
						{intPeriodos++;
						if (strRenglon=='')
							if (intItem==0)
								strRenglon='0|'
								else
								strRenglon=intItem+'|';
							else
							strRenglon=strRenglon+intItem+'|'
						}
						
			}
			document.cookie="Seleccion="+strRenglon;
			strURL="ImpresionRecibo.aspx?fila=0"
			window.open(strURL,'consulta','scrollbars=yes,width=665,height=500');
			window.navigate("Default.htm");
}

