var Actual_Displayed_Div="div0";
function showDiv(divName){

	for (i=0;i<document.all.length;i++){
		if (document.all.item(i).tagName == 'DIV' && document.all.item(i).id.indexOf('div')==0){
			document.all.item(i).style.display = 'none';
		}			

	}
	
	//alert(document.all.item(divName).style.display);
	document.all.item(divName).style.display = 'block';
	//document.all.item(subDivName).style.display = 'block';
	//alert(document.all.item(divName).style.display);
	

}

function showPage(page)
{
	var href = window.location.href;
	if (window.location.search)
	{
		href=href.substring(0,href.indexOf(window.location.search));
	}
	window.location.href = href + "?" + page;
}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  DivToShow="div" + strReturn
  return DivToShow;
}

function showDiv_aux(divName){
	
	
	if (Actual_Displayed_Div=="div0"){
		document.all.item("div0").style.display = 'none';
		document.all.item(divName).style.display = 'block';
		}
	else{
		document.all.item(Actual_Displayed_Div).style.display = 'none';
		document.all.item(divName).style.display = 'block';
		//global=divName;
		}
	Actual_Displayed_Div=divName;
	//alert(document.all.item(divName).style.display);
	//document.all.item(divName).style.display = 'block';
	//document.all.item(subDivName).style.display = 'block';
	//alert(document.all.item(divName).style.display);
	

}

function checkSubmenu(image,submenu){

	if (image.src.indexOf('images/minus.gif')>=0){
		image.src='images/plus.gif';
		document.all.item('submenu1').style.display='none';

	}else{
		image.src='images/minus.gif';
		document.all.item('submenu1').style.display='block';
	}
}
function foo(sel){

	window.location=sel.value
	
}

function getToday(){

months = new Array();
months[1] = "Enero";  months[7] = "Julio";
months[2] = "Febrero"; months[8] = "Agosto";
months[3] = "Marzo";    months[9] = "Septiembre";
months[4] = "Abril";    months[10] = "Octubre";
months[5] = "Mayo";      months[11] = "Noviembre";
months[6] = "Junio";     months[12] = "Diciembre";

months2 = new Array();
months2[1] = "Jan"; months2[7] = "Jul";
months2[2] = "Feb"; months2[8] = "Aug";
months2[3] = "Mar"; months2[9] = "Sep";
months2[4] = "Apr"; months2[10] = "Oct";
months2[5] = "May"; months2[11] = "Nov";
months2[6] = "Jun"; months2[12] = "Dec";

days = new Array();
days[1] = "Domingo";    days[5] = "Jueves";
days[2] = "Lunes";    days[6] = "Viernes";
days[3] = "Martes";   days[7] = "Sábado";
days[4] = "Miercoles";

days2 = new Array();
days2[1] = "Sun"; days2[5] = "Thu";
days2[2] = "Mon"; days2[6] = "Fri";
days2[3] = "Tue"; days2[7] = "Sat";
days2[4] = "Wed";

todaysdate = new Date();
date  = todaysdate.getDate();
day  = todaysdate.getDay() + 1;
month = todaysdate.getMonth() + 1;
yy = todaysdate.getYear();
year = (yy < 1000) ? yy + 1900 : yy;
year2 = 2000 - year; year2 = (year2 < 10) ? "0" + year2 : year2;


minutes = todaysdate.getMinutes();

minutes = (minutes<10)? "0" + minutes : minutes;

dateline = new Array();
dateline[1] = months[month] + " " + date + ", " + year;
dateline[2] = months2[month] + " " + date + ", " + year;
dateline[3] = days[day] + " " + months[month] + " " + date + ", " + year;
dateline[4] = days2[day] + " " + months2[month] + " " + date + ", " + year;
dateline[5] = days2[day] + " " + months[month] + " " + date + ", " + year;
dateline[6] = date + " " + months[month] + " " + year;
dateline[7] = date + " " + months2[month] + " " + year;
dateline[8] = date + " " + months2[month] + " " + year2;
dateline[9] = month + "/" + date + "/" + year2;
dateline[10] = month + "-" + date + "-" + year2;
dateline[11] = days[day] + " " + months[month] + " " + date;
dateline[12] = days[day] + ", " + date + " de " + months[month] + " de " + year + ", "+ todaysdate.getHours() + ":" + minutes+" h";

 return dateline[12];
}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
		aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  //DivToShow="div" + strReturn
  //return DivToShow;
  return strReturn;
}
/*function wo(hrefValue,ob){
	window.open(hrefValue+'?p=3,'_blank','height=100,width=400,status=yes,toolbar=no,menubar=no,location=no');
	ob.className='t-selected';
}
*/
function wo(hrefValue,ob){
	hrefValue = hrefValue.replace(/%25/g,""); //La cadena no puede llevar el simbolo %	
	window.open('/econet/asp/d.asp?'+hrefValue,'_blank','height=200,width=600,resizable=yes,status=yes,toolbar=no,menubar=no,location=no');
	ob.className='t-selected';
}


function checkParam(param){
	var pag = getURLParam(param);
	if (pag.length > 0){
		document.all.item("idMun").innerHTML="<a class='a4b' href='"+pag+"'>Indice Municipios</a><span class='a4b'> | </span>";
	}			
}

function exportToExcel(){
 myWindow =window.open('/econet/asp/exportExcel.html','exportToExcelWindow','top=20,left=20,height=600,status=yes,toolbar=no,location=no,scrollbars=auto,resizable=yes','true'); 
 document.exportForm.action='/econet/asp/exportExcel.asp' 
 document.exportForm.url.value= document.location.href; 
 document.exportForm.target='exportToExcelWindow'; 
 document.exportForm.submit(); 
 document.exportForm.target='';
 

}


function exportToPDF(){
 alert("En contruccion...");
 

}

function init()
{
	var i = getURLParam("sel");
	if (i.length > 0) {
		document.all.item("sumario").options[i].selected = "True";
    	}   	
}

function initCiclo()
{
	var i = getURLParam("sel");
	if (i.length > 0) {
		document.all.item("seleccion").options[i].selected = "True";
    	}   	
}


function init2()
{
	var i2 = getURLParam("sel2");	
	if (i2.length > 0) {
		document.all.item("sumario2").options[i2].selected = "True";
	}   	
}


function checkCiclo(){	
	if (document.ciclo != undefined)
		document.ciclo.location=document.ciclo.location+"?sel="+getURLParam("sel");
	
}

function checkCiclo2(){	
	document.ciclo.location=document.ciclo.location+"?sel="+getURLParam("sel")+"&sel2="+getURLParam("sel2");
	document.ciclo2.location=document.ciclo2.location+"?sel="+getURLParam("sel")+"&sel2="+getURLParam("sel2");
	
}
