﻿	var oLista 	= new listaObj();

	function listaObj() {
		this.oIni;
		this.oFin;
		this.oCursor;
	};
	    //metodos
	    listaObj.prototype.pushNodo = function (obj){
		if(!this.oIni){
			this.oIni = obj;
		}
		
	if(this.oFin)
	{
			obj.oAnt		= this.oFin;
			}else{
				obj.oAnt	=	this;
		}
		obj.oAnt.oSig	= obj;
		this.oFin 		= obj;
	}
	
	listaObj.prototype.popNodo = function (){
		this.oCursor	=	this.oFin;
		if(this.oIni!=null){
			this.oFin.cierra();
			this.oFin 		= this.oFin.oAnt;
			this.oFin.oSig 	= null;
		}
		return this.oCursor;
	}

	function nodoObj() {
		this.oAnt;
		this.oSig;
		this.iPrioridad = 0;
		this.iCritico = 0;
	};
	
	function nodoObjVentana(sUrl, sName, sAtrib, sAncho, sAlto) {
		this.sUrl	= sUrl;
		this.sName	= sName;
		this.sAtrib	= sAtrib;
		this.sAncho	= sAncho;
		this.sAlto	= sAlto;
		this.sAnchoMaximo = screen.width;
		this.sLargoMaximo = screen.height;
	};
	nodoObjVentana.prototype = new nodoObj()
	nodoObjVentana.prototype.abre = function (){
		this.oVentana = window.open(this.sUrl);
	}
	nodoObjVentana.prototype.muestra = function (){
		this.oVentana.focus()
	}
	nodoObjVentana.prototype.cierra = function (){
		this.oVentana.close()
	}
	nodoObjVentana.prototype.open_window_center	= function (){
	    var w_config	= this.sAtrib;
	    if (this.sAtrib != '') { w_config = w_config + ',' }
	    w_config = w_config + "width=" + this.sAncho + ",height=" + this.sAlto + ",left=" + (this.sAnchoMaximo-this.sAncho) / 2 +",top="+(this.sLargoMaximo-this.sAlto)/2
	    this.oVentana = window.open(this.sUrl, this.sName, w_config);
	}
	nodoObjVentana.prototype.open_window_top	= function (){
	    var w_config	= this.sAtrib;

	    if (this.sAtrib != '') { w_config = w_config + ',' }
	    w_config = w_config + "width=" + this.sAncho + ",height=" + this.sAlto + ",left=0,top=0";
	    this.oVentana = window.open(this.sUrl, this.sName, w_config); 
	}

	//window.onunload = function(){
	//	while(oLista.popNodo()!=null){}
	//}

//menu contextual nominas -------------------------------------------------------
var arrlayer = new Array();
//si no envia lef y top centra la ventana
//si no evia width y height la dejara de 800*570
/*
Ejemplo contruccion desde asp
str = ""
if tiene_acceso(ACC_Ficha_Propiedades_con_Oferta) then
str = str & "Ver Ficha Propiedades=/propiedades/ficha_propiedad_oferta.asp?id_propiedad=" & rs("id_propiedad") & "&pr_propiedad=" & rs("pr_propiedad") & "&id_remate=" & rs("id_remate") & "&ver_ficha=1|"
end if
considerar:
-Lo que esta antes del igual es el nombre o texto que representara al menu
-Lo que esta despues es la url de destino y sus parametros
-Al final debe agregar el palito (|) que actua como separador
*/
function creamenucontextual(contenedor, str, _width, _height, _left, _top){
                if (_width==undefined){
                    _width = 800
                }
                if (_height==undefined){
                    _height = 570
                }
                var myLeft
                var myTop
                if (_left==undefined){
                    myLeft = (screen.width - _width) / 2;
                }else{
                    myLeft = _left;
                }
                if (_top==undefined){
                    myTop = (screen.height - _height) / 2;
                }else{
                    myTop = _top;
                }

                var atribw  = ''; //"scrollbars=yes,resizable=yes,menubar=no,statusbar=no, width="+_width+",height="+_height+",left="+myLeft+",top="+myTop;
                var cont = document.getElementById(contenedor)
                var layer;
                var nomw
                if (document.getElementById('div_'+cont.id)==undefined) {
                    var texto = "";
                    var arrb = new Array();
                    var arri = new Array();
                    var arrahis = new Array();
                    arrb = str.split("|");
                    //Tabla---------------------------------------------
                    texto += "<div id=\"menucont\"><div class=\"barraMenucont\"><table borderColor=\"#1860cb\" border=1 cellspacing=0 cellpadding=0 align=center  class=\"menucontextual\" width=\"130\">"
                    for (i=0;i<arrb.length;i++){
                        arri[0] = arrb[i].substring(0, arrb[i].indexOf("="))
                        arri[1] = arrb[i].substring(arrb[i].indexOf("=")+1, arrb[i].length)
			//Replaza para personalizacion por ventana
                        if (arri[1].indexOf("(")>-1){
                        	var ahis = arri[1].substring(arri[1].indexOf("(")+1, arri[1].length);
                        	ahis = ahis.substring(0,ahis.length-1);
                        	if (ahis=="maximized"){
                        		_width = screen.width
                        		_height = screen.height
                        	}else{
					arrahis = ahis.split(",");
					switch (arrahis.length){
					 case 1:
						_width = arrahis[0];
						myLeft = (screen.width - _width) / 2;
						break
					 case 2:
						_width = arrahis[0];
						_height = arrahis[1];
						myLeft = (screen.width - _width) / 2;
						myTop = (screen.height - _height) / 2;
						break
					 case 3:
						_width = arrahis[0];
						_height = arrahis[1];
						myLeft = arrahis[2];
						myTop = (screen.height - _height) / 2;
						break
					 case 4:
						_width = arrahis[0];
						_height = arrahis[1];
						myLeft = arrahis[2];
						myTop = arrahis[3];
						break
					default:
						_width = 800
						_height = 570
						myLeft = (screen.width - _width) / 2;
						myTop = (screen.height - _height) / 2;
					}
                        	}
                        }else{
				_width = 800
				_height = 570
				myLeft = (screen.width - _width) / 2;
				myTop = (screen.height - _height) / 2;
                        }
                        //alert(arri[1] + ': ' + _width + ', ' + _height)
                        atribw = "scrollbars=yes,resizable=yes,menubar=no,statusbar=no, width="+_width+",height="+_height+",left="+myLeft+",top="+myTop;
                        if (arri[0] != ""){
				texto += "  <tr>"
				texto += "    <td>"
				nomw = arri[0]
				while (nomw.indexOf(" ")>-1){
				    nomw = nomw.replace(" ","")
				}

				texto += "<a class=\"botonMenucont\" href=\"#\" onclick=\"" + "javascript:window.open('"+arri[1]+"','" + nomw + "','" + atribw + "')\">"+arri[0]+"</a>";
				texto += "    </td>"
				texto += "  </tr>"
                        }
                    }
                    texto += "</table></div></div>"
                    //-------------------------------------------------
                    layer = document.createElement('div');
                    layer.id = 'div_'+cont.id;
                    layer.style.position="absolute";
                    layer.style.width="130px";
                    layer.style.height="0px";
                    layer.style.zIndex="1";
                    layer.style.left="-130px";
                    layer.style.top="-10px";
                    layer.innerHTML = texto;
                    arrlayer[arrlayer.length] = 'div_'+cont.id;
                }else{
                    layer = document.getElementById('div_'+cont.id);
                }
                layer.style.display='';
                cont.appendChild(layer);
                cierralayers(layer);
                setTimeout("cierralayerstimeout("+layer.id+")", 5000);
}
function cierralayers(layer){
    if (layer!=undefined){
        for (i=0;i<arrlayer.length;i++){
            if (arrlayer[i]!=layer.id){
                document.getElementById(arrlayer[i]).style.display='none';
            }
        }
    }else{
        for (i=0;i<arrlayer.length;i++){
            document.getElementById(arrlayer[i]).style.display='none';
        }
    }
}
function cierralayerstimeout(layer){
    document.getElementById(layer.id).style.display='none';
}
//-------------------------------------------------------------------------------------------
function elimina_puntos(valor)
 {
 if (valor.value != '')
  {
  for (i=valor.value.length-1; i >= 0;i--)
     {
     valor.value = valor.value.replace('.','');
     }
  return true;
  }
 }

function elimina_comas(valor)
 {
 if (valor.value != '')
  {
  for (i=valor.value.length-1; i >= 0;i--)
     {
     valor.value = valor.value.replace(',','');
     }
  return true;
  }
 }

function borrar()
 {
   document.form1.cons_clave.value=""
   document.form1.cons_user.value=""
 }

function Rut()
 {
 if (document.form1.rut.value != '') {
    return checkRutField(document.form1.rut.value);
 }
   return true;
}


///// INICIO CHEQUEO DE RESOLUCION DE PANTALLA ///////////

function Variables()
{
  tamano=4
  if (window.screen) //En versiones antiguas de los navegadores no existe este objeto
  {
    if (screen.width=="640" && screen.height=="480")
    {
       tamano=1
    }
    if (screen.width=="800" && screen.height=="600")
    {
       tamano=2
    }
    if (screen.width=="1024" && screen.height=="768")
    {
       tamano=3
    }
    if (screen.width=="1152" && screen.height=="864")
    {
       tamano=4
    }

  }
}

///// FIN CHEQUEO DE RESOLUCION DE PANTALLA ///////////

///// INICIO FUNCIONES DREAMWEAVER ///////////

 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_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_findObj(n, d) { //v3.0
   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); 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_openBrWindow(theURL,winName,features) { //v2.0
   window.open(theURL,winName,features);
 }

 function openwin(urldestino,windowsname,windowsparam)
 {
   window.open(urldestino,windowsname,windowsparam);
}

///// FIN FUNCIONES DREAMWEAVER ///////////


function FormatoNumero(valor)
{
    var digito
    alert(valor.value);
    digito = '';
    numero = '';
    if (valor.value != '')
    {
        valor.value = valor.value.replace('.','');
        j=1;
        for (i=valor.value.length-1; i >= 0;i--)
        {
            digito = valor.value.charAt(i)
            if (j == 3)
            {
                digito = '.' + digito;
                j = 1;
            }
            else
            {
                j = j + 1;
            }
            numero = digito + numero;
        }

        valor.value = numero;
        return true;
    }
}


function Grabar()
{
 if ( document.form1.prop_direccion.value == '') {
        alert('Debe ingresar Dirección de la Propiedad');
        document.form1.prop_direccion.focus();
        return false;
 }
 else if ( document.form1.id_ejecutivo.value == '0') {
        alert('Debe ingresar un Ejecutivo del Consignante');
        document.form1.eje_nom.focus();
        return false;
 }
 else if ( document.form1.id_persona.value == '0') {
        alert('Debe ingresar un Ejecutivo Macal');
        document.form1.pers_nom.focus();
        return false;
 }
 /*else if (isNaN(parseInt(form1.prod_precio.value, 10))) {
        alert('Debe ingresar digitar un número en el campo Precio Venta');
        document.form1.prod_precio.focus();
        return false;
 }
 // valida rut
 else if (document.form1.prop_rutdeudor.value != '') {
        return checkRutField(document.form1.prop_rutdeudor.value);
 }

 if ( !document.form1.es_destacado.checked ) {
        document.form1.prod_orden_destacado.value='0';
 }*/
 return true;
}

function browser(){//Constructor de un objeto "browser"
        this.ver=navigator.appVersion;
        this.browser=navigator.appName;
        this.agent=navigator.userAgent;
        this.dom=document.getElementById?1:0;
        this.IE5=(this.ver.indexOf("MSIE 5")>-1)||(IE5=this.ver.indexOf("MSIE 6")>-1);
        this.NS5=(this.dom && parseInt(this.ver)>=5)?1:0;
        this.Mac=this.agent.indexOf("Mac")>-1;
        this.NS4=(document.layers && !this.dom)?1:0;

}
BR=new browser();//Objeto de tipo "browser".
function findObj(obj){ //Esta función busca el objeto por el id según el browser del usuario.
   element=BR.IE5?window.document.all[obj]:BR.NS5?window.document.getElementById(obj):(BR.IE5&&BR.Mac)?window.document.all[obj]:(BR.NS5&&BR.Mac)?window.document.getElementById(obj):0;
   if(element==0) alert("Este sitio web está diseñado para browsers Internet Explorer o Netscape Navigator versiones 5.0 o superiores.");
   return (element);
}
ancho = screen.width;
largo = screen.height;
//function window_onload() {
//        parent.window.moveTo (-100,-100);
//        parent.window.resizeTo(1,1);
//        }
//if (BR.IE5 && !BR.Mac) window_onload();

// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****
// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****// *****
// ***** SI HACES REFERENCIA EN EL TAG BODY A ESTA FUNCION (GETWIN_POPUP), SE ABRE EL BROWSER A PANTALLA COMPLETA MEDIANTE LA PROPIEDAD FULLSCREEN='YES', TOMANDO PREVIAMENTE LOS VALORES DEL ANCHO Y ALTO DE LA PANTALLA (screen.width y screen.height)*****

function getwin_popup(wr_win, wname){

    var w_config = "status=yes,scrollbars=yes,resizable=yes,width=" + ancho + ",height=" + largo;
    var w_var = window.open(wr_win, wname, w_config);
    if (w_var.history.length >= 1) {
       var del = -w_var.history.length;
       w_var.history.go(del);
    }
    w_var.moveTo (0,0);
    if(BR.Mac) window.close();
}

function getwin_popup_web(wr_win, wname){

    var w_config = "toolbar=yes,location=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=" + ancho + ",height=" + largo;
    var w_var = window.open(wr_win, wname, w_config);
    if (w_var.history.length >= 1) {
       var del = -w_var.history.length;
       w_var.history.go(del);
    }
    w_var.moveTo (0,0);
    if(BR.Mac) window.close();
}

//function open_window_center(win_win,win_name,win_atrib,win_ancho,win_alto){
//    var w_config = win_atrib;
//    if (win_atrib != '') { w_config = w_config + ',' }
//    w_config = w_config + "width=" + win_ancho + ",height=" + win_alto + ",left=" + (ancho-win_ancho) / 2 +",top="+(largo-win_alto)/2
////    alert("config="+w_config);
//    var w_var = window.open(win_win, win_name, w_config);
//    w_var.focus();
//}



	function open_window_center(sUrl, sName, sAtrib, sAncho, sAlto){
		oLista.pushNodo(new nodoObjVentana(sUrl, sName, sAtrib, sAncho, sAlto))
		oLista.oFin.open_window_center();
	}

function open_window_top(win_win,win_name,win_atrib,win_ancho,win_alto){
    var w_config = win_atrib;
    if (win_atrib != '') { w_config = w_config + ',' }
    w_config = w_config + "width=" + win_ancho + ",height=" + win_alto + ",left=0,top=0";
    var w_var = window.open(win_win, win_name, w_config);
    w_var.focus();
}

function valida_teclas(valor)
 {
   alert('El Codigo de la tecla es :'+event.keyCode)
 }

// coloca los miles a los numeros
function formatear_monto(campo)
{
  //campo.value=campo.value.toUpperCase();
  //campo.value.replace('.','');
  if (campo.value != "")
  {
    valor=campo.value.replace('.','');
    valor=valor.replace('.','');
    valor=valor.replace('.','');
    //alert(valor);
    campo.value=valor;
    if (valor.length > 1)
    {
      campo.value= insertapuntos(valor.substring(0,valor.length));
      //alert('(insertapuntos = '+campo.value);
    }
  }
  else
  {
  campo.value="";
  }
}

function insertapuntos(strval)
{
  var A = new Array();
  var strtemp = strval;

  if(strtemp.length > 0){
    strtemp = new Number(strtemp);
    strtemp = new String(strtemp);
    if (strtemp.length > 3){
      for(var i = 0; strtemp.length > 3; i++)
      {
        A[i] = Right(strtemp,3);
        strtemp /= 1000;
        strtemp=new String(strtemp);
        if (strtemp.indexOf('.') != -1)
        {
          strtemp = strtemp.substr(0,strtemp.indexOf('.'));
        }
      }
      for(i-- ;i >= 0 ;i--){
        strtemp = strtemp + "." + A[i];
      }
    }
  }
  return(strtemp);
}

function Right(strvar,intcant)
{
  strtemp = "";
  intlargo = strvar.length -1;
  for(i = 1;i <= intcant; i++)
  {
    strtemp = strtemp + strvar.charAt(intlargo);
    intlargo--;
  }

  strtmp2=""
  for(intlargo = strtemp.length -1; intlargo >=0; intlargo--)
  {
    strtmp2 = strtmp2 + strtemp.charAt(intlargo);
  }
  return(strtmp2);
}

  function mOvr(src,clrOver) {   
     //alert(clrOver);
    if (!src.contains(event.fromElement))
      {
        src.style.cursor = 'hand';
        src.bgColor = clrOver;
      }
    }

  function mOut(src,clrIn) {
  //alert(clrIn);
    if (!src.contains(event.toElement))
      {
        src.style.cursor = 'default';
        src.bgColor = clrIn;
      }
    }


// pa la letra capital
function letraCapital(objeto)

{
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = objeto.value.toLowerCase();
strLen = tmpStr.length;
    if (strLen > 0)
    {
    for (index = 0; index < strLen; index++)
        {
        if (index == 0)
            {
            tmpChar = tmpStr.substring(0,1).toUpperCase();
            postString = tmpStr.substring(1,strLen);
            tmpStr = tmpChar + postString;
            }
            else
            {
            tmpChar = tmpStr.substring(index, index+1);
                if (tmpChar == " " && index < (strLen-1))
                {
                tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
                preString = tmpStr.substring(0, index+1);
                postString = tmpStr.substring(index+2,strLen);
                tmpStr = preString + tmpChar + postString;
                }
            }
        }
    }
objeto.value = tmpStr;
}

function cierraVentana(){
    window.close();
    try {
        window.opener.document.location.reload(true);
        window.opener.focus();
    }
    catch(e){
    }
}

 function mueve_fecha(tipo){

                var dia, mes, ano, fecha, cadena , plazodias;
                fecha = document.form1.fechadesde.value;
                dia = '';
                mes = '';
                ano = '';
                p = 1;
                plazodias = 40;

                for (i = 0; i < fecha.length; i++)
                {
                cadena = fecha.charAt(i);
                    if ( (cadena !='-') && (cadena != '/') )
                      {
                        if (p==1)
                            {
                            dia = dia + cadena;
                            }
                        if (p==2)
                            {
                            mes = mes + cadena;
                            }
                        if (p==3)
                            {
                            ano = ano + cadena;
                            }
                      }
                     else
                        {
                        p++;
                        }

                }
                fecha = dia +'/'+ mes +'/' + ano
                d= parseInt(dia)
                m= parseInt(mes)
                a= parseInt(ano)

                fecha = document.form1.fechahasta.value;
                dia = '';
                mes = '';
                ano = '';
                p = 1;
                plazodias = 40;

                for (i = 0; i < fecha.length; i++)
                {
                cadena = fecha.charAt(i);
                    if ( (cadena !='-') && (cadena != '/') )
                      {
                        if (p==1)
                            {
                            dia = dia + cadena;
                            }
                        if (p==2)
                            {
                            mes = mes + cadena;
                            }
                        if (p==3)
                            {
                            ano = ano + cadena;
                            }
                      }
                     else
                        {
                        p++;
                        }

                }
                fecha = dia +'/'+ mes +'/' + ano
                d1= parseInt(dia)
                m1= parseInt(mes)
                a1= parseInt(ano)




   if ( tipo == 2 )
   {
        val1 = suma_dia(d,m,a)
        val2 = suma_dia(d1,m1,a1)
   }


   if ( tipo == 1 )
   {
        val1 = resta_dia(d,m,a)
        val2 = resta_dia(d1,m1,a1)
   }


  document.form1.fechadesde.value = val1
  document.form1.fechahasta.value = val2
     document.form1.submit();

 }

     function suma_dia(d, m, a){

       a_aux = a
       m_aux = m

       if ( (d >= diasMes(m,a)) && (m == 12) )
       {
         m = 1
         d = 1
         a = a +1
       }

       if ( (d >= diasMes(m,a))  &&  (m != 12) )
       {
         m = m + 1
         d = 1
       }

       if ( (d <= diasMes(m,a)) && (a == a_aux) && (m == m_aux)  )
       {
         d = d + 1
       }

        fec =  d + '/' + m + '/' + a
        return fec;
     }


     function resta_dia(d, m, a){
       m_aux = m
       a_aux = a

       if ( (d == 1) && (m != 1) )
       {
             m = m - 1
             d = diasMes(m,a);
       }

       if ( ( d ==1 ) && ( m == 1 ) )
       {
         a = a - 1
         m = 12
         d = 31
       }

       if ( ( d <= diasMes(m,a) ) && (m == m_aux ) && (a == a_aux) )
       {
         d = d - 1
       }

       fec =  d + '/' + m + '/' + a
       return fec;
     }



      function diasMes(mes, ano) {
         switch( mes ) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:        // meses de 31 dias
               return 31;
               break;

            case 4:
            case 6:
            case 9:
            case 11:        // meses de 30 dias
               return 30;
               break;

            case 2:     // febrero
               if (esBisiesto( ano ))
                  return  29;
               else
                  return  28;
               break;

            default:            // mes incorrecto
               alert('Mes incorrecto');
         }
      }

      function esBisiesto(  agno ) {
         return (( ((agno % 4) == 0) && ((agno % 100) != 0) )
                || ((agno % 400) == 0) );
      }




      function move(fbox, tbox) {
         var arrFbox = new Array();
         var arrTbox = new Array();
         var arrLookup = new Array();
         var i;
         for (i = 0; i < tbox.options.length; i++) {
             arrLookup[tbox.options[i].text] = tbox.options[i].value;
             arrTbox[i] = tbox.options[i].text;
         }
         var fLength = 0;
         var tLength = arrTbox.length;
         for(i = 0; i < fbox.options.length; i++) {
            arrLookup[fbox.options[i].text] = fbox.options[i].value;
            if (fbox.options[i].selected && fbox.options[i].value != "") {
               arrTbox[tLength] = fbox.options[i].text;
               tLength++;
            }
            else {
               arrFbox[fLength] = fbox.options[i].text;
               fLength++;
            }
         }
      //   arrFbox.sort();
      //   arrTbox.sort();
         fbox.length = 0;
         tbox.length = 0;
         var c;
         for(c = 0; c < arrFbox.length; c++) {
             var no = new Option();
             no.value = arrLookup[arrFbox[c]];
             no.text = arrFbox[c];
             fbox[c] = no;
         }
         for(c = 0; c < arrTbox.length; c++) {
             var no = new Option();
             no.value = arrLookup[arrTbox[c]];
             no.text = arrTbox[c];
             tbox[c] = no;
         }
      }

      function moveall(fbox, tbox) {
         var arrFbox = new Array();
         var arrTbox = new Array();
         var arrLookup = new Array();
         var i;
         for (i = 0; i < tbox.options.length; i++) {
             arrLookup[tbox.options[i].text] = tbox.options[i].value;
             arrTbox[i] = tbox.options[i].text;
         }
         var fLength = 0;
         var tLength = arrTbox.length;
         for(i = 0; i < fbox.options.length; i++) {
            arrLookup[fbox.options[i].text] = fbox.options[i].value;
            if (fbox.options[i] && fbox.options[i].value != "") {
               arrTbox[tLength] = fbox.options[i].text;
               tLength++;
            }
            else {
               arrFbox[fLength] = fbox.options[i].text;
               fLength++;
            }
         }
      //   arrFbox.sort();
      //   arrTbox.sort();
         fbox.length = 0;
         tbox.length = 0;
         var c;
         for(c = 0; c < arrFbox.length; c++) {
             var no = new Option();
             no.value = arrLookup[arrFbox[c]];
             no.text = arrFbox[c];
             fbox[c] = no;
         }
         for(c = 0; c < arrTbox.length; c++) {
             var no = new Option();
             no.value = arrLookup[arrTbox[c]];
             no.text = arrTbox[c];
             tbox[c] = no;
         }
      }

      function select_total(){
          if (document.form1.list2.length == 0) {
              alert("Debe seleccionar al menos 1 Elemento de la Lista de Selección");
              return false;
          }
          else {
             for(i=0; i<document.form1.list2.length; i++)
                document.form1.list2[i].selected = true;
             return true;
         }
      }


      //  End -->


      <!-- Begin 2do select
      function move2(fbox2, tbox2) {
         var arrfbox2 = new Array();
         var arrtbox2 = new Array();
         var arrLookup2 = new Array();
         var i2;
         for (i2 = 0; i2 < tbox2.options.length; i2++) {
             arrLookup2[tbox2.options[i2].text] = tbox2.options[i2].value;
             arrtbox2[i2] = tbox2.options[i2].text;
         }
         var fLength2 = 0;
         var tLength2 = arrtbox2.length;
         for(i2 = 0; i2 < fbox2.options.length; i2++) {
            arrLookup2[fbox2.options[i2].text] = fbox2.options[i2].value;
            if (fbox2.options[i2].selected && fbox2.options[i2].value != "") {
               arrtbox2[tLength2] = fbox2.options[i2].text;
               tLength2++;
            }
            else {
               arrfbox2[fLength2] = fbox2.options[i2].text;
               fLength2++;
            }
         }
      //   arrfbox2.sort();
      //   arrtbox2.sort();
         fbox2.length = 0;
         tbox2.length = 0;
         var c2;
         for(c2 = 0; c2 < arrfbox2.length; c2++) {
             var no2 = new Option();
             no2.value = arrLookup2[arrfbox2[c2]];
             no2.text = arrfbox2[c2];
             fbox2[c2] = no2;
         }
         for(c2 = 0; c2 < arrtbox2.length; c2++) {
             var no2 = new Option();
             no2.value = arrLookup2[arrtbox2[c2]];
             no2.text = arrtbox2[c2];
             tbox2[c2] = no2;
         }
      }

      function moveall2(fbox2, tbox2) {
         var arrfbox2 = new Array();
         var arrtbox2 = new Array();
         var arrLookup2 = new Array();
         var i2;
         for (i2 = 0; i2 < tbox2.options.length; i2++) {
             arrLookup2[tbox2.options[i2].text] = tbox2.options[i2].value;
             arrtbox2[i2] = tbox2.options[i2].text;
         }
         var fLength2 = 0;
         var tLength2 = arrtbox2.length;
         for(i2 = 0; i2 < fbox2.options.length; i2++) {
            arrLookup2[fbox2.options[i2].text] = fbox2.options[i2].value;
            if (fbox2.options[i2] && fbox2.options[i2].value != "") {
               arrtbox2[tLength2] = fbox2.options[i2].text;
               tLength2++;
            }
            else {
               arrfbox2[fLength2] = fbox2.options[i2].text;
               fLength2++;
            }
         }
      //   arrfbox2.sort();
      //   arrtbox2.sort();
         fbox2.length = 0;
         tbox2.length = 0;
         var c2;
         for(c2 = 0; c2 < arrfbox2.length; c2++) {
             var no2 = new Option();
             no2.value = arrLookup2[arrfbox2[c2]];
             no2.text = arrfbox2[c2];
             fbox2[c2] = no2;
         }
         for(c2 = 0; c2 < arrtbox2.length; c2++) {
             var no2 = new Option();
             no2.value = arrLookup2[arrtbox2[c2]];
             no2.text = arrtbox2[c2];
             tbox2[c2] = no2;
         }
      }

function validateKeyPress(e)
 {
   var key;
   var keychar;

   if(window.event || !e.which) // IE
   {
      key = e.keyCode; // para IE
   }
    else if(e) // netscape
   {
     key = e.which;
   }
    else
   {
    return true;
   }
   if (key==13) //Enter
   {
    document.form1.style.cursor='wait';
    document.form1.submitir.value='Ir';
    document.form1.submit();
   }
 }

function submitea_pagina()
{
  if (event.keyCode==13)
  {
    document.form1.submit();
    //if (document.form1.numeropag.value > 1)
    //{
    //  document.form1.navega.value = ''
    //}
  }
}

function submitea_pagina_inicio()
{
  if (event.keyCode==13)
  {
    document.form1.submit();
  }
}

function maxmimizar()
  {
    window.moveTo(0,0);
    if (document.all) {
      top.window.resizeTo(screen.availWidth,screen.availHeight);
     }

    else if (document.layers||document.getElementById) {
      if (top.window.outerHeight<screen.availHeight || top.window.outerWidth<screen.availWidth){
      top.window.outerHeight = screen.availHeight;
      top.window.outerWidth = screen.availWidth;
      }
    }
  }


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_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_findObj(n, d) { //v3.0
  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); 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 cuentaConDiv(id_contador, url, urlOrigen) {
    /*
    var Digital = new Date();
    var seconds = Digital.getSeconds();
    
    if (document.getElementById("divContador")) {
        document.removeChild(document.getElementById("divContador"));        
    }

    contenedor = document.createElement('div');
    contenedor.id = 'divContador';
    contenedor.innerHTML = "<iframe id=\"" + seconds + "\" src=\"if_contador.aspx?id_contador=" + id_contador + "&sec=" + seconds + "\" ></iframe>";
    document.appendChild(contenedor);
    */

    var strC = '';
    if (url == undefined) {
        //contadores en produccion: contadores2009.macalplataforma.cl/cuenta.asp
        url = "www.macal.cl/cuenta.asp"
    }
    //str+='&r=' + escape(document.referrer);
    strC += 'id_contador=' + id_contador;
    strC += '&url=' + escape(urlOrigen);
    strC += '&co_resolucion=' + screen.width + 'x' + screen.height;
    strC += '&co_titulo=' + escape(document.title);
    strC += '&co_cpuclass=' + navigator.cpuClass;
    strC += '&co_plataforma=' + navigator.platform;
    strC += '&co_navegador=' + navigator.appName;

    var Digital = new Date();
    var seconds = Digital.getSeconds();
    // si es mozilla o netscape hace el modo clasico, si es IE lo llama via ajax
    var nav = navigator.appName;

    if (nav != "Netscape") {
        strC += '&clrs=' + screen.colorDepth
    } else {
        strC += '&clrs=' + screen.pixelDepth;
    }

    if (typeof (ip) != 'undefined') {
        strC += '&valip=' + ip;
    }
    
    if (document.getElementById("divContador")) {
        document.removeChild(document.getElementById("divContador"));        
    }

    contenedor = document.createElement('div');
    contenedor.id = 'divContador';
    contenedor.innerHTML = "<img id=\"" + seconds + "\" src=\"http://" + url + "?" + strC + "&sec=" + seconds + "\" />";
    //document.appendChild(contenedor);
    //ej: url=http://contadores2009.macalplataforma.cl/cuenta.asp
 
}     


//****************************************************
<!--
        //se ingresa el limite del tiempo para actualizar pagina en
        // "minutes:seconds" los minutos deberian tener el formato 0 a infinito y segundos  0 a 59
         
        var limit="15:00"
        if (document.images)
          {
          var parselimit=limit.split(":")
          parselimit=parselimit[0]*60+parselimit[1]*1
          }
         
        function begintimer(id)//url
          {
          if (!document.images)
            return
          if (parselimit==1)
            //window.location=url
            top.recargaVentanas(id)
          else
            {
            parselimit-=1
            curmin=Math.floor(parselimit/60)
            cursec=parselimit%60
            if (curmin!=0)
              curtime="Faltan "+curmin+" minutos y "+cursec+" segundos para Actualizar la Pagina"
            else
              curtime="Faltan "+cursec+" segundos para Actualizar la Pagina"
              window.status=curtime
              setTimeout("begintimer("+id+")",1000)
            }
          }
          
          function cleartimer()
          {
            window.status='';
          }
        //-->
//****************************************************