﻿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='';
          }
        //-->
//****************************************************