function navega(url,token)
{
	if (Page_ClientValidate()) 
	{	
		window.open(url + '?partida=' + document.all("Partida").value +'&token='+ token,'','scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=yes,top=0,left=0,width=790,height=600');
	} 
}

function maximize()
{
   maximizeWindow();
   //window.navigate("mantenimiento.htm");  
}

function maximizeWindow() {
 if (parseInt(navigator.appVersion)>3) {
  if (navigator.appName=="Netscape") {
   if (top.screenX>0 || top.screenY>0) top.moveTo(0,0);
   if (top.outerWidth < screen.availWidth)
      top.outerWidth=screen.availWidth;
   if (top.outerHeight < screen.availHeight) 
      top.outerHeight=screen.availHeight;
  }
  else {
   if(screen.availWidth > 800)
   {
	top.moveTo(-4,-4);
	top.resizeTo(screen.availWidth+8,screen.availHeight+8);
   }
  }
 }
}



function openFormularioPDF(formulario)
{
    window.open('pdf/repositorio/' + formulario,'','left=0,top=0,scrollbars=AUTO');
}

function inicializar()
{
    if(document.all('Primera').value == '0')
    {
        var xwidth  = screen.availWidth;
        var xheight = screen.availHeight;
        var xtop    = (xheight - 320) / 2;
        var xleft   = (xwidth  - 430) / 2;
        
		maximizeWindow();
		pulsar('Vencido');
		window.open("Aviso.aspx","Aviso",
		"width=430,height=320,top=" + xtop +",left=" + xleft + ",'scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=no");
	}
	else
	{
		pulsar(document.all('Div').value);
	}
	
	attachFilter(document.getElementById('PeriodosVencidos'), 1);
}

function pulsar(div)
{
    
	document.all('Vencido').style.visibility = 'hidden';
	document.all('AVencer').style.visibility = 'hidden';
	document.all('Grupal').style.visibility = 'hidden';
	document.all('Financiado').style.visibility = 'hidden';
	
	document.all(div).style.visibility = 'visible';
	document.all('Primera').value = '1';
	document.all('Div').value = div;
}

function imprimo(fila,tipo)
{
          
    retVal = makeMsgBox("Confirmacion","Usted solicito la generacion de un recibo, este proceso puede demorar, esta ud. seguro?",32,1,256,4096);
	
	if(retVal == 1)
	{ 
	
	    if (tipo == '2')
			EstadoDeuda.ComponerPDFAVencer(document.getElementById('Partida').outerText,
				document.getElementById('Responsable').outerText,
				document.getElementById('DAno'+fila).outerText,
				document.getElementById('DOpcion'+fila).outerText,
				document.getElementById('Mtot'+fila).outerText,
				document.getElementById('DFecha'+fila).outerText,
				document.getElementById('DCodBar'+fila).outerText,
				ComponerPDF_callback);
		else
			EstadoDeuda.ComponerPDFVencido(document.getElementById('Partida').outerText,
				document.getElementById('Responsable').outerText,
				document.getElementById('DDigi'+fila).outerText,
				document.getElementById('DAno'+fila).outerText,
				document.getElementById('DCuo'+fila).outerText,
				document.getElementById('Mtot'+fila).outerText,
				document.getElementById('DFecha'+fila).outerText,
				document.getElementById('ZNom'+fila).outerText,
				document.getElementById('ZAct'+fila).outerText,
				document.getElementById('ZRec'+fila).outerText,
				document.getElementById('ZTot'+fila).outerText,
				document.getElementById('ZNosv'+fila).outerText,
				document.getElementById('ZAcsv'+fila).outerText,
				document.getElementById('ZResv'+fila).outerText,
				document.getElementById('ZTosv'+fila).outerText,
				document.getElementById('ZNoem'+fila).outerText,
				document.getElementById('ZAcem'+fila).outerText,
				document.getElementById('ZReem'+fila).outerText,
				document.getElementById('ZToem'+fila).outerText,
				document.getElementById('ZNoho'+fila).outerText,
				document.getElementById('ZAcho'+fila).outerText,
				document.getElementById('ZReho'+fila).outerText,
				document.getElementById('ZToho'+fila).outerText,
				document.getElementById('ZNopc'+fila).outerText,
				document.getElementById('ZAcpc'+fila).outerText,
				document.getElementById('ZRepc'+fila).outerText,
				document.getElementById('ZTopc'+fila).outerText,
				document.getElementById('ZNopa'+fila).outerText,
				document.getElementById('ZAcpa'+fila).outerText,
				document.getElementById('ZRepa'+fila).outerText,
				document.getElementById('ZTopa'+fila).outerText,
				document.getElementById('ZPer'+fila).outerText,
				ComponerPDF_callback);
				
	} 
	else 
	{
		alert("La generacion fue cancelada");
    }
}

function pagofacil()
{
	var wo=window.open('http://www.e-pagofacil.com/e-billing/muni_sanmartin/index.php','','scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=yes,width=590,height=528,top=0,left=0');
}			
					 
function ballonPartida(obj)
{
    var b2=new JSBalloon();
    b2.autoHide=false;
 	b2.Show({title:'Estado de Cuenta',message:'Para acceder al estado de cuenta ingrese el n&uacute;mero de partida municipal que le permitir&aacute; obtener un detalle de los per&iacute;odos vencidos, a vencer, opciones de pago anual y/o semestral disponibles.',
  					anchor:obj, icon:'Info'});
}

function calendario()
{
    document.all('Recibo').style.visibility = 'hidden';
	document.all('Calendario').style.visibility = 'visible';
}

function ComponerPDF_callback(response)
{
	if(response.error != null)
	{
		window.navigate('Error.aspx?status=Type F001&partida=' + document.getElementById('Partida').outerText);
		return;
	}
	
	openFormularioPDF(response.value + '.pdf');
}

function enviar()
{
	if (Page_ClientValidate())
	{
		document.getElementById("comentario").style.visibility = 'hidden';
		formi.Envio(document.getElementById("txtResponsable").value,
					document.getElementById('txtPartida').value,
					document.getElementById("txtCalle").value,
					document.getElementById("txtNumero").value,
					document.getElementById("txtDepto").value,
					document.getElementById("txtLocalidad").value,
					document.getElementById("txtCodPostal").value,
					document.getElementById("txtTelefono").value,
					document.getElementById("txtMail").value,
					document.getElementById("txtComentarios").value,
					Envio_callback);
	}
	else   
	{
		document.getElementById("comentario").style.visibility = 'visible';
	}
}

function Envio_callback(response)
{
 
	if(response.error != null)
	{
		window.navigate('Error.aspx?status=Type F003&partida=' + document.getElementById('txtPartida').value);
		return;
	}
	
	document.getElementById("contenido").innerHTML = response.value;;
}

function limpiar()
{
	document.getElementById("txtResponsable").value = '';
	document.getElementById("txtCalle").value = '';
	document.getElementById("txtNumero").value = '';
	document.getElementById("txtDepto").value = '';
	document.getElementById("txtLocalidad").value = '';
	document.getElementById("txtCodPostal").value = '';
	document.getElementById("txtTelefono").value = '';
	document.getElementById("txtMail").value = '';
	document.getElementById("txtComentarios").value = '';
	document.getElementById("comentario").style.visibility = 'hidden';
	document.getElementById("RequiredFieldValidator1").style.visibility = 'hidden';
	document.getElementById("RequiredFieldValidator2").style.visibility = 'hidden';
	document.getElementById("RequiredFieldValidator4").style.visibility = 'hidden';
	document.getElementById("RequiredFieldValidator5").style.visibility = 'hidden';
	document.getElementById("RequiredFieldValidator6").style.visibility = 'hidden';
	document.getElementById("RequiredFieldValidator7").style.visibility = 'hidden';
	document.getElementById("RequiredFieldValidator8").style.visibility = 'hidden';
	document.getElementById("CompareValidator1").style.visibility = 'hidden';
	document.getElementById("CompareValidator2").style.visibility = 'hidden';
}

function comentarios()
{
		window.open('formi.aspx?status=0&partida=0','','scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=yes,top=0,left=0,width=790,height=600');
}

function cerrar()
{
   window.close();
}

