/*
Funciones JAVASCRIPT que adapta licitaciones en caso de tener javascript activado.
*/

  function prepararPaginaJS(pagina)
  {
    switch(pagina)
    {
      case "licitaciones.asp":
        enlaceSuscribirse();
        //enlaceAmpliarLicitacion();   
        break;
      case "licitaciones-detalle.asp":
        //enlaceDescarPliego();
        break;
      case "suscripcion.asp":
        mostrarMarcarTodosCursos();
        mostrarMarcaFamiliaPadre();
        break;
    }
  }


  function enlaceSuscribirse()
  {
    var enlace=document.getElementById('enlaceSuscribirse');
    enlace.onclick=function(){window.open('suscripcion.asp?idm=es','registro','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=550,screenX=30,screenY=30,top=60,left=90');return false;}
    enlace.href="#";
  }


  function abrirVentana(url)
  {
	window.open(url,'newwin','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=500,screenX=5,screenY=5,left=90,top=90');
  }
  
  
  function enlaceAmpliarLicitacion()
  {
	var enlaces=document.getElementsByTagName('a');
       for (x=0;x<enlaces.length;x++)
       {
          if (enlaces[x].id.indexOf('enlaceAmpliarLicitacion')>=0)
          {
			alert(enlaces[x].id + " -- " + enlaces[x].href);
            var url=enlaces[x].href;
            enlaces[x].onclick=function(){window.open(url,'newwin','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=355,screenX=5,screenY=5,left=150,top=170');return false;};
           enlaces[x].onkeydown=function(){window.open(url,'newwin','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=355,screenX=5,screenY=5,left=150,top=170');return false;};
          }
       }
  }


  function enlaceDescarPliego()
  {
    var enlace=document.getElementById('descargaPliego');

    if (enlace!=null)
    {
       var url=enlace.href;
       enlace.onclick=function(){window.open(url, 'descarga','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=580,screenX=30,screenY=30,top=100,left=100');return false;};
       enlace.onkeydown=function(){window.open(url, 'descarga','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=580,screenX=30,screenY=30,top=100,left=100');return false;};
       enlace.href="#";
    }
  }


  function mostrarMarcarTodosCursos()
  {
     document.getElementById('dtSeleccionarTodosConcursos').style["display"] = "";
  }


  function mostrarMarcaFamiliaPadre()
  {
    var opciones=document.getElementsByTagName('span');
    for(x=0;x<opciones.length;x++)
    {
      if(opciones[x].id.indexOf('familiaPadreAcc')>=0)
      {
         opciones[x].style["display"] = "none";
      }
      if(opciones[x].id.indexOf('__familiaPadre')>=0)
      {
         opciones[x].style["display"] = "";
      }
    }
  }
