// -- Imagenes -- //

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_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
   }
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
 if(selObj.options[selObj.selectedIndex].value=="titulo"){
  }else {
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  }
}
//////////////////////////////////////////

/////// - Ordenamiento - ///////

//Ordenar por titulo,tipo o fecha de publicacion para Ambito local y municipal
function Submite(seleccion,form1){
 //alert(seleccion +' Edo:'+document.form1.edo.value+' ID Poder'+document.form1.idPoder.value);
  //document.form1.FeCat.value=document.form1.ordena.value;
  document.form1.HCat.value=seleccion;
  //alert('Seleccionado ' + document.form1.HCat.value);
  document.form1.method="get";
  document.form1.action="listPoder2.php?edo=<? print $edo;?>&idPoder=<? print $idPoder;?>";
  document.form1.submit();	 
 }

//Ordenar por titulo,tipo o fecha de publicacion para Ambito local y municipal
function SubmiteTipo(seleccion,form1){
 //alert(seleccion +' Edo:'+document.form1.edo.value+' ID Poder'+document.form1.idPoder.value);
  //document.form1.FeCat.value=document.form1.ordena.value;
  document.form1.HCat.value=seleccion;
  //alert('Seleccionado ' + document.form1.HCat.value);
  document.form1.method="get";
  document.form1.action="listPoder3.php?edo=<? print $edo;?>&idPoder=<? print $idPoder;?>";
  document.form1.submit();	 
 }

//Ordenar por titulo,tipo o fecha de publicacion para en Busqueda
function SubmiteBusq(seleccion,form1){
  document.form1.HCat.value=seleccion;
  document.form1.method="get";
  //document.form1.action="busqueda.php?edo=<? print $edo;?>&frase=<? print $frase;?>";
  document.form1.action="busqueda.php";
  document.form1.submit();	 
 }
/////////////////////////////////////////////
/////////////////////////////////////////////

//########## AMBITO FEDERAL ##########
//Ordenar por titulo,tipo o fecha de publicacion para Ambito Federal
function SubmiteFed(seleccion,form1){
  document.form1.HCat.value=seleccion;
  document.form1.method="get";
  document.form1.action="listDependenciabeta.php?idDep=<? print $idDep;?>&idPoder=<? print $idPoder;?>&idGrupo=<? print $idGrupo;?>&idDepUp=<? print $idDepUp;?>";
  document.form1.submit();	 
 }

//Ordenar por titulo,tipo o fecha de publicacion para en Busqueda Ambito Federal
function SubmiteBusqFed(seleccion,form1){
  document.form1.HCat.value=seleccion;
  document.form1.method="get";
  //document.form1.action="busqueda.php?edo=<? print $edo;?>&frase=<? print $frase;?>";
  document.form1.action="busqueda.php";
  document.form1.submit();	 
 }
/////////////////////////////////////////////
//Ordenar por titulo,tipo o fecha de publicacion para en Busqueda Ambito Federal
function SubmiteBusqGral(seleccion,form1){
  document.form1.HCat.value=seleccion;
  document.form1.method="get";
  //document.form1.action="busqueda.php?edo=<? print $edo;?>&frase=<? print $frase;?>";
  document.form1.action="busquedaGral.php";
  document.form1.submit();	 
 }
/////////////////////////////////////////////

/////// - Paginador - ///////
var curpart=0

function getElementbyClass(classname){
 partscollect=new Array()
 var inc=0
 var alltags=document.getElementsByTagName("DIV")
 for (i=0; i<alltags.length; i++){
 if (alltags[i].className==classname)
     partscollect[inc++]=alltags[i]
 }
}

function cycleforward(){
 partscollect[curpart].style.display="none"
 curpart=(curpart<partscollect.length-1)? curpart+1 : 0
 partscollect[curpart].style.display="block"
 updatenav()
}

function cycleback(){
 partscollect[curpart].style.display="none"
 curpart=(curpart>0)? curpart-1 : partscollect.length-1
 partscollect[curpart].style.display="block"
 updatenav()
}

function goToPage(index){
 partscollect[curpart].style.display="none"
 curpart=index
 partscollect[curpart].style.display="block"
 updatenav()
}

function updatenav(){
 var Pointer=(curpart+1)+" / "+(partscollect.length)
 document.getElementById("pointerdiv").innerText=Pointer
 document.getElementById("backbutton").style.visibility=(curpart==0)? "hidden" : "visible"
 document.getElementById("forwardbutton").style.visibility=(curpart==partscollect.length)? "hidden" : "visible"
// document.getElementById("forwardbutton").innerText=(curpart==partscollect.length-1)? "Ir al inicio" : "Siguiente >>"
 document.getElementById("forwardbutton").style.visibility=(curpart==partscollect.length-1)? "hidden" : "visible"
}

function onloadfunct(){
 getElementbyClass("multiparts")
   if(partscollect.length != 0)
   {
 	partscollect[0].style.display="block";
 	document.getElementById("formnavigation").style.display="block";
 	updatenav();
   }
}

if (window.addEventListener)
    window.addEventListener("load", onloadfunct, false)
else if (window.attachEvent)
    window.attachEvent("onload", onloadfunct)
else if (document.getElementById)
    window.onload=onloadfunct
/////////////////////////////////////////////




