var Actual=new Date();
var Fecha=Actual.getFullYear()
mes=Actual.getMonth();
mes=mes+1;
if(mes<10)
	Fecha=Fecha+"0"+mes;
else
	Fecha=Fecha+""+mes;
dia=Actual.getDate();
if(dia<10)
	Fecha=Fecha+"0"+dia;
else
	Fecha=Fecha+""+dia;

function BoaDiaActual(seccion,base){
	var url;
	url="/cgi-bin/BRSCGI?CMD=VERLST&BASE="+base+"&DOCS=1-200&SEC=BOA_DIA_ACTUAL"+seccion+"&AUX="+seccion+"&SEPARADOR=&@PUBL-E="+Fecha;
	window.location.href=url;
}

function Leyes(agno){
	var url;
	url="/cgi-bin/BRSCGI?CMD=VERLST&BASE=BOLE&DOCS=1-100&SEC=LEYES&SORT=@OLEY,PUBL&SEPARADOR=&RANG=LEY&ALEY="+agno;
	window.location.href=url;
}

function LicitacionesPublicas(){
	var url;
    url="/cgi-bin/BRSCGI?CMD=VERLST&BASE=BZHT&DOCS=1-100&SORT=ORGA&SEC=LICITACIONES_PUBLICAS&SEPARADOR=&TIPO=concurso&@FANE-GE="+Fecha;
	window.location.href=url;
}

function Calendario(agno){
	var url;
	url="/cgi-bin/BRSCGI?CMD=VERLST&BASE=BOLE&DOCS=1-2&SEC=CALENDARIO"+agno+"&SEPARADOR=&@PUBL-GE="+agno+"0101&@PUBL-LE="+agno+"1231";
	window.location.href=url;
}

function NoHayBOA(seccion,aux,base){
	var url;
	var FechaURL=window.location.href.split("PUBL-E=");
	url="/cgi-bin/BRSCGI?CMD=VERLST&BASE="+base+"&DOCS=1-200&SEC="+seccion+"&AUX="+aux+"&SEPARADOR=&@PUBL-E="+DiaAnteriorBRS(FechaURL[1]);
	window.location.href=url;
}

function DiaAnteriorBRS(fecha){
	agnoS = fecha.substring(0,4);
	mesS = fecha.substring(4,6);
	if (mesS.substring(0,1) == "0") mesS = mesS.substring(1,2);
	diaS = fecha.substring(6,8);
	if (diaS.substring(0,1) == "0") diaS = diaS.substring(1,2);
	agnoI = parseInt(agnoS);
	mesI = parseInt(mesS);
	diaI = parseInt(diaS);
	if(diaI>1){
		diaI--;
		if(diaI<10){
			if(mesI<10)
				DiaAnterior = agnoI + "0" + mesI + "0" + diaI;
			else
				DiaAnterior = agnoI + "" + mesI + "0" + diaI;
		}
		else{
			if(mesI<10)
				DiaAnterior = agnoI + "0" + mesI + "" + diaI;
			else
				DiaAnterior = agnoI + "" + mesI + "" + diaI;
		}
	}
	else{
		if(mesI>1){
			mesI--;
			if(mesI<10)
				DiaAnterior= agnoI + "0" + mesI + "31";
			else
				DiaAnterior= agnoI + "" + mesI + "31";
		}
		else{
			DiaAnterior=agnoI-1 + "1231";
		}
	}
	return DiaAnterior;
}

function PrimeraLista(inicio,fin,total,rango){
	var separador;
	var url;
	if(inicio != "1"){
		documentoFinal=parseInt(inicio)+rango-1;
		separador=inicio+"-"+documentoFinal;
		aux=window.location.href.split(separador);
		url=aux[0]+"1-"+rango+aux[1];
		document.write("<a href="+url+"><img src='/images/primero.gif' border='0' alt='PRIMEROS DOCUMENTOS'></a>&nbsp;&nbsp;");
	}
}


function UltimaLista(inicio,fin,total,rango){
	var separador;
	var url;
	if(parseInt(fin) < parseInt(total)){
		documentoFinal=parseInt(inicio)+rango-1;
		primeroDeUltimaLista=total-total%rango+1;
		ultimoDeUltimaLista=primeroDeUltimaLista+rango-1;
		separador=inicio+"-"+documentoFinal;
		aux=window.location.href.split(separador);
		url=aux[0]+primeroDeUltimaLista+"-"+ultimoDeUltimaLista+aux[1];
		document.write("&nbsp;&nbsp;<a href="+url+"><img src='/images/ultimo.gif' border='0' alt='ULTIMOS DOCUMENTOS'></a>");
	}
}
