function mover_pestana(nombre) {
	var capa = new div("menu_" + nombre);
	var izq = 60;
	switch (nombre) {
		case "2":
			izq = 108  + 10 + 3 + 12;
			break;
		case "3":
			izq = 187 + 10 + 3 + 3 + 12;
			break;
		case "4":
			izq = 283 + 10 + 3 + 3 + 3 + 12;
			break;
		case "5":
			izq = 389 + 10 + 3 + 3 + 3 + 3 + 13;
			break;
		case "6":
			izq = 443 + 10 + 3 + 3 + 3 + 3 + 3 + 13;
			break;
		case "7":
			izq = 512 + 10 + 3 + 3 + 3 + 3 + 3 + 6;
			break;
		case "8":
			izq = 581 + 10 + 3 + 3 + 3 + 3 + 3 + 4;
			break;
	}
	var mas = (info.pageWidth() - 760) / 2;
	mas = mas > 0 ? mas : 0;
	izq = izq + mas;

	capa.moveTo(izq, capa.top());
}

function mostrar_menu(nombre) {
	mover_pestana(nombre);
	var menu = new div('menu_' + nombre);
	menu.show();
}

function ocultar_menu(nombre) {
	var menu = new div('menu_' + nombre);
	menu.hide();
}

function reSubmit(URL) {
	document.datosIdentificacion.action = URL;
	document.datosIdentificacion.submit();
}

function windowopener(URL,ancho,alto)
{
	var propiedades;
	propiedades = "toolbar=no,directories=no,menubar=no,status=no,scrollbars=yes,resizable=yes,width=" + ancho + ",height=" + alto;
	window.open(URL,'',propiedades)
	if (navigator.appVersion.indexOf("(X11") != -1 || navigator.appVersion.indexOf("(mac") != -1)
	window.open(URL,'',propiedades)

}

function generar_fecha() {
    var fecha = new Date();
    var dia_letra = fecha.getDay();
    var dia = fecha.getDate();
    var mes = fecha.getMonth();
    var anyo = fecha.getFullYear();

    switch(dia_letra) {
        case 0: dia_letra = "Domingo"; break;
        case 1: dia_letra = "Lunes"; break;
        case 2: dia_letra = "Martes"; break;
        case 3: dia_letra = "Miércoles"; break;
        case 4: dia_letra = "Jueves"; break;
        case 5: dia_letra = "Viernes"; break;
        case 6: dia_letra = "Sábado"; break;
        default: dia_letra = "Domingo"; break;
    }
    switch(mes) {
        case 0: mes = "Enero"; break;
        case 1: mes = "Febrero"; break;
        case 2: mes = "Marzo"; break;
        case 3: mes = "Abril"; break;
        case 4: mes = "Mayo"; break;
        case 5: mes = "Junio"; break;
        case 6: mes = "Julio"; break;
        case 7: mes = "Agosto"; break;
        case 8: mes = "Septiembre"; break;
        case 9: mes = "Octubre"; break;
        case 10: mes = "Noviembre"; break;
        case 11: mes = "Diciembre"; break;
        default: mes = ""; break;
    }
    document.write(dia_letra+", "+dia+" de "+mes+" de "+anyo);
}

function RestaurarImagen()
{
 var Contador, Imagen, Documento = document.RI; 
  
 for (Contador = 0; (Documento) && (Contador < Documento.length) && (Imagen = Documento[Contador]) && (Imagen.oSrc); Contador++)
  Imagen.src = Imagen.oSrc;
}

function PrecargaImagen()
{
 var Documento = document; 

 if (Documento.images)
 { 
  if (!Documento.PI) 
   Documento.PI = new Array();
    
  var Contador, Longitud = Documento.PI.length, Argumentos = PrecargaImagen.arguments; 
      
  for (Contador = 0; Contador < Argumentos.length; Contador++)
   if (Argumentos[Contador].indexOf("#") != 0)
   { 
    Documento.PI[Longitud] = new Image; 
    Documento.PI[Longitud++].src = Argumentos[Contador];
   }
 }
}

function BuscarImagen(Cadena, Documento) 
{
 var Contador, Posicion, Objeto;  
    
 if (!Documento) 
  Documento = document; 
    
 if (((Posicion = Cadena.indexOf("?")) > 0) && (parent.frames.length)) 
 {
  Documento = parent.frames[Cadena.substring(Posicion + 1)].document; 
  Cadena = Cadena.substring(0,Posicion);
 }
    
 if (!(Objeto = Documento[Cadena])&& (Documento.all)) 
  Objeto = Documento.all[Cadena]; 
     
 for (Contador = 0; (!Objeto) && (Contador < Documento.forms.length); Contador++) 
  Objeto = Documento.forms[Contador][Cadena];
     
 for (Contador = 0; (!Objeto) && (Documento.layers) && (Contador < Documento.layers.length); Contador++) 
  Objeto = BuscarImagen(Cadena,Documento.layers[Contador].document); 
     
 return Objeto;
}

function CambiarImagen()
{
 var Contador, Posicion = 0, Imagen, Argumentos = CambiarImagen.arguments; 
    
 document.RI = new Array; 
    
 for(Contador = 0; Contador < (Argumentos.length - 2); Contador += 3)
  if ((Imagen = BuscarImagen(Argumentos[Contador])) != null)
  {  
   document.RI[Posicion++] = Imagen; 
      
   if (!Imagen.oSrc) 
    Imagen.oSrc = Imagen.src; 
   
   Imagen.src = Argumentos[Contador + 2];
  }
}

function ParametrosFormulario(href,formularioquellama,input,ancho,alto)
{
	var texto = new String();
	if (input == "IdPais")
	{
		var textoPaises = eval ("document.forms['" + formularioquellama + "'].IdPais.value;");
		texto = "windowopener('" + href + "&" + input + "="  + textoPaises + "'," + ancho + "," + alto + ")";
	}	
	if (input == "IdSector")
	{
		var textoSectores = eval ("document.forms['" + formularioquellama + "'].IdSector.value;");
		texto = "windowopener('" + href + "&" + input + "="  + textoSectores + "'," + ancho + "," + alto + ")";
	}	
	if (input == "IdTipo")
	{
		var textoTipos = eval ("document.forms['" + formularioquellama + "'].IdTipo.value;");
		texto = "windowopener('" + href + "&" + input + "="  + textoTipos + "'," + ancho + "," + alto + ")";
	}	
	eval (texto);	
}

//la siguiente función no se usa
function ParametrosIdTipo(href,formularioquellama,input,ancho,alto)
{
	var texto = new String();
	var textoTipos = eval ("document.forms['" + formularioquellama + "'].IdTipo.value;");
	texto = "windowopener('" + href + "&" + input + "="  + textoTipos + "'," + ancho + "," + alto + ")";
	eval (texto);	
}

function habilitaYEnvia(formularioquellama,url)
{
	eval ("document.forms['" + formularioquellama + "'].Pais.disabled = false;");
	eval ("document.forms['" + formularioquellama + "'].sector.disabled = false;");
	eval ("document.forms['" + formularioquellama + "'].action = '" + url + "';");
	eval ("document.forms['" + formularioquellama + "'].submit();");
}

function envia()
{
	document.datosIdentificacion.submit();
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null)
  {
	v=args[i+2];
    if (obj.style)
    {
		obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;
	}
    //obj.visibility=v;
    if (obj.visibility=='visible')
    {
		obj.visibility='hidden';
	}
	else
	{
		obj.visibility='visible';
	}
  }
}

