<!--DOCUMENT CONTENT_TYPE="text/javascript"  -->

//CERTIFICA.COM : CODIGO DE CERTIFICA.JS
/* 
  Copyright 2004 - Certifica.com 
  $Id: certifica.js,v 1.12 2004/10/27 20:12:21 leus Exp $
*/

/* 
  Copyright 2004 - Certifica.com 
  $Id$
*/

DEFAULT_PIVOT_NAME = 'cert_Pivot';
DEFAULT_REDIRECT_TIME = 3000;
DEFAULT_PERIODIC_REDIRECT_TIME = 60000;
DEFAULT_ORIGIN_COOKIE_NAME = 'cert_Origin';

var cert_CustomCounters = null;
var cert_CustomAttributes = null;

function cert_qVal(sValue) 
{
    var pos = String(document.location).indexOf('?');
    if (pos != -1) {
       var query = String(document.location).substring(pos+1);
       var vars = query.split("&");
       for (var i=0; i < vars.length; i++) {
          var pair = vars[i].split("=");
          if (pair[0] == sValue)
             return pair[1];
       }       
    }
    return null;  
}

function cert_getCookie(sName) {
  var dc = document.cookie;
  var prefix = sName + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function cert_setCookie(sName, sValue, dtExpires, sPath, sDomain, bSecure) {
  document.cookie = sName + "=" + escape(sValue) +
      ((dtExpires) ? "; expires=" + dtExpires.toGMTString() : "") +
      ((sPath) ? "; path=" + sPath : "") +
      ((sDomain) ? "; domain=" + sDomain : "") +
      ((bSecure) ? "; secure" : "");
}

function cert_getReferrer()
{
   var referrer = document.referrer;
   if (self.cert_getReferrer14)
      return cert_getReferrer14();
/*@cc_on
  @if(@_jscript_version >= 5 )
   try { 
      if ( self != top ) referrer = top.document.referrer;
   } catch(e) {};
  @end
  @*/
  return referrer;
}

/* Obtiene el tipo de protocolo del documento actual. */
function cert_getProtocol()
{
    if (window && window.location && window.location.protocol)
        return window.location.protocol;
    return null;
}
 
/* Crea una cookie con el contenido del referrer para evaluarlo
  en el paso final, si es necesario. */
function cert_setOrigin()
{
	var c = cert_getCookie(DEFAULT_ORIGIN_COOKIE_NAME);
	if (!c) {
		var l = cert_getReferrer();
		if (l) {
			var re = new RegExp('https?:\/\/([^\/]+)');
			var m = re.exec(l);
			if (m) {
				var m2 = re.exec(document.location);
				if (m2) {
					if (m[1] != m2[1]) {
						c = m[1];
					}
				}
			}
		}
		if (!c) {
			c = 'directo';
		}
		cert_setCookie(DEFAULT_ORIGIN_COOKIE_NAME, c);
	} 
}

function cert_getFlashVersion()
{
	var flashVersion = -1;
	if (navigator.plugins && navigator.plugins.length) {
		var objFlash = navigator.plugins["Shockwave Flash"];
		if (objFlash) {
			if (objFlash.description) {
				flashDesc = objFlash.description;
				flashVersion = flashDesc.charAt(flashDesc.indexOf('.')-1);
			}
		}

		if (navigator.plugins["Shockwave Flash 2.0"]) {
			flashVersion = 2;
		}
	} else if (navigator.mimeTypes && navigator.mimeTypes.length) {
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin) {
			flashVersion = 0; // no detectada!
		}
	}

	/*@cc_on
	for(var i = 10; i > 0; i--) {
		try {
			var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
			flashVersion = i;
			break;
		} catch(e){}
	}	
	@*/
	return flashVersion;
}

/* Crea la URL para obtener un pageview de Certifica. */
/* Sólo necesita los parámetros iSiteId y sPath       */
function cert_getURL(iSiteId, sPath, sAppend) 
{
    var size, colors, referrer, url;
    size = colors = referrer = 'otro';
    var o = cert_qVal('url_origen');
    var proto = cert_getProtocol();
    if (proto != 'https:')
        proto = 'http:';
    
    if (o != null && o != '')
       referrer = o;
    else 
       referrer = escape(cert_getReferrer());
    if ( window.screen.width ) size = window.screen.width;
    if ( window.screen.colorDepth ) colors = window.screen.colorDepth;
    else if ( window.screen.pixelDepth ) colors = window.screen.pixelDepth;
    url = 
       proto + '//hits.e.cl/cert/hit.dll?sitio_id=' + iSiteId + '&path=' + sPath +
       '&referer=' + referrer + '&size=' + size + '&colors=' + colors;
    url += '&java=' + navigator.javaEnabled() + '&flash=' + cert_getFlashVersion();
    if (sAppend)
        url += sAppend;
    return url;    
}

function cert_addCustomAttribute(sType, sValue)
{
	if (!cert_CustomAttributes) {
		cert_CustomAttributes = new Object();
	}

	cert_CustomAttributes[sType] = sValue;
}

function cert_addCustomCounter(sType, iValue)
{
	if (iValue && iValue > 0) {
		if (!cert_CustomCounters) {
			cert_CustomCounters = new Object();
		}

		if (cert_CustomCounters[sType]) {
			cert_CustomCounters[sType] += iValue;
		} else {
			cert_CustomCounters[sType] = iValue;
		}
	}
}


function cert_getCustomTags()
{
	var sRet = '';
	var ct_atrib = '', ct_acum = '';
	if (cert_CustomAttributes) {
		ct_atrib = 'ct_atrib=';
		for (var i in cert_CustomAttributes) {
			ct_atrib += i + ':' + cert_CustomAttributes[i] + ';';
		}
	}

	if (cert_CustomCounters) {
		ct_acum = 'ct_acum=';
		for (var i in cert_CustomCounters) {
			ct_acum += i + ':' + cert_CustomCounters[i] + ';';
		}
	}

	if (ct_atrib || ct_acum) {
		if (ct_atrib) {
			sRet += '&' + ct_atrib;
		}
		if (ct_acum) {
			sRet += '&' + ct_acum;
		}
	}
	return sRet;
}


/* Crea la URL para un sitio con e-Commerce. */
function cert_getURL_eCommerce(iSiteId, sPath, sAmount)
{
	var sOrigin = null;

	if ((sOrigin = cert_getCookie(DEFAULT_ORIGIN_COOKIE_NAME))) {
		cert_addCustomAttribute('origin', sOrigin);
	}

	if (sAmount) {
		cert_addCustomCounter('money', sAmount);
	}

	var sAppend = cert_getCustomTags();

	return cert_getURL(iSiteId, sPath, sAppend);
}
	
		
/* Efectua un hit en certifica usando una imagen pivote. */
function cert_registerHit(iSiteId, sPath, sPivotName) 
{
   var sAppend = '&cert_cachebuster=' + (1 + Math.floor (Math.random() * 10000));
   if ( !sPivotName )
      sPivotName = DEFAULT_PIVOT_NAME;
   if ( document.images )
      if ( document.images[sPivotName] )
         document.images[sPivotName].src = cert_getURL(iSiteId, sPath, sAppend);
}

/* Efectúa una redirección marcando la ruta de salida */
function cert_registerHitAndRedirect( sURL, iSiteId, sPath, sPivotName ) 
{
   cert_registerHit( iSiteId, sPath, sPivotName );
   setTimeout( "location.href = '" + sURL + "'", DEFAULT_REDIRECT_TIME );
}

/* Abre una nueva ventana, marcando el hit */
function cert_registerHitAndOpenWindow( sURL, iSiteId, sPath, sPivotName, sName, sFeatures, bReplace )
{
   cert_registerHit( iSiteId, sPath, sPivotName );
   if (!sName)
      sName = 'Downloads';
   if (!sFeatures)
      sFeatures = 'toolbar=no,location=no,directories=no,status=yes,menubar=no, scrollbars=no,resizable=no,width=425,height=510,screenX=20,screenY=20';
   window.open( sURL, 
      sName, 
      sFeatures, 
      bReplace 
   );
   return false;
}

/* Marca el hit y reemplaza/abre una URL en el frame 'sName' */
function cert_registerHitAndReplaceOtherFrame( sURL, sName, iSiteId, sPath, sPivotName ) 
{
   cert_registerHitAndOpenWindow( sURL, iSiteId, sPath, sPivotName, sName, 0, true );
}

/* Marca el hit y reemplaza/abre una URL en el frame 'sName' */
function cert_registerHitAndReplaceThisFrame( sURL, iSiteId, sPath, sPivotName ) 
{
   cert_registerHitAndRedirect( sURL, iSiteId, sPath, sPivotName );
}

/* Marca el hit y baja un archivo */
function cert_registerHitAndDownloadFile( sURL, iSiteId, sPath, sPivotName ) 
{
   cert_registerHitAndRedirect( sURL, iSiteId, sPath, sPivotName );
}

function cert_getAnchor(sUrl)
{
    return '<img src="' + sUrl + '" width="1" height="1" border="0" alt="Certifica.com">';
}

/* Marca un hit en la página actual */
function tagCertifica(iSiteId, sPath) 
{
    document.writeln(cert_getAnchor(cert_getURL(iSiteId, sPath)));
}

/* Marca un hit en la página actual, usando eCommerce */
function tagCertifica_eCommerce(iSiteId, sPath, iAmount) 
{
    document.writeln(cert_getAnchor(cert_getURL_eCommerce(iSiteId, sPath, iAmount)));
}

/* Marca un registro cada iTime milisegundos.  */
function cert_registerPeriodicHit( iSiteId, sPath, sPivotName, iTime ) 
{
   if ( !sPivotName )
      sPivotName = DEFAULT_PIVOT_NAME;
   if ( !iTime )
      iTime = DEFAULT_PERIODIC_REDIRECT_TIME;

   cert_registerHit( iSiteId, sPath, sPivotName );
   setTimeout( 'cert_registerPeriodicHit( ' + iSiteId + ', "' + sPath + '", "' + sPivotName + '", ' + iTime + ')', iTime );
}

cert_setOrigin();


/* Reemplazo de caracteres no válidos en una cadena */
function cert_replace( iString ) 
{
	sNombre=iString;
	vcertifica="";
	
	return(vcertifica);

}




//CERTIFICA.COM : CODIGO DE certifica-js14.js
/* 
  Copyright 2004 - Certifica.com 
  $Id: certifica-js14.js,v 1.4 2004/10/27 20:12:21 leus Exp $
*/
	function cert_getReferrer14(){
	   var referrer = document.referrer;
	   try { 
		  if ( self != top ) 
			 referrer = top.document.referrer;
	   } catch(e) {
		  referrer = document.referrer;
	   }
	   return referrer;
	}

//FIN certifica-js14.js


/*  VALIDACION DE EXCEPCIONES EN SECCIONES . EJ: "PORTADA" , definir  "FUTBOL" dentro de "DEPORTES" */

function cert_perucom_secciones_excepciones(v_rutacompleta, v_url2, v_dato) 
{
	if (v_rutacompleta == "http://www.peru.com/" || v_rutacompleta == "http://www.peru.com/index.asp" || v_rutacompleta == "http://peru.com/" || v_rutacompleta == "http://peru.com/index.asp" )	
	{
			v_return = "/portada/index.asp";
	}
	else if ( v_rutacompleta.indexOf('http://www.peru.com/diegodibos/')>=0 || v_rutacompleta.indexOf('http://www.peru.com/rossywar/')>=0  || v_rutacompleta.indexOf('http://www.peru.com/lauraborlini/')>=0 || v_rutacompleta.indexOf('http://www.peru.com/barbarayfiorella/')>=0 )
	{
			v_return = "/sites_exclusivos" + v_dato ;
	}
	else if ( v_rutacompleta.indexOf('http://www.peru.com/otros_especiales/')>=0 )
	{
			v_return = "/especiales" + v_dato ;
	}
	else if ( v_rutacompleta.indexOf('http://www.peru.com/Advertisers/radio/')>=0 )
	{
			v_return = "/radio_en_vivo" + v_rutacompleta.substr(37,v_rutacompleta.length-37) ;
	}
	else if ( v_rutacompleta.indexOf('http://www.peru.com/idocs/videos/')>=0 )
	{
			v_return = "/videos" + v_rutacompleta.substr(32,v_rutacompleta.length-32) ;
	}
	else 
	{
			v_return = v_dato;
	} 						

return v_return;
}


function cert_app01_secciones_excepciones(v_rutacompleta_app01, v_url2_app01, v_dato_app01) 
{
	if (v_rutacompleta_app01 == "http://www.peru.com/" || v_rutacompleta_app01 == "http://www.peru.com/index.asp" || v_rutacompleta_app01 == "http://peru.com/" || v_rutacompleta_app01 == "http://peru.com/index.asp" )	
	{
			v_return = "/portada/index.asp";
	}
	else if ( v_rutacompleta_app01.indexOf('http://www.peru.com/includes/autonoticias/portada/')>=0 )
	{
			v_return = "/portada" + v_rutacompleta_app01.substr(49,v_rutacompleta_app01.length-49) ;
	}
	else if ( v_rutacompleta_app01.indexOf('http://peru.com/includes/autonoticias/portada/')>=0 )
	{
			v_return = "/portada" + v_rutacompleta_app01.substr(45,v_rutacompleta_app01.length-45) ;
	}
	else if ( v_rutacompleta_app01.indexOf('http://199.125.90.75/includes/autonoticias/portada/')>=0 )
	{
			v_return = "/portada" + v_rutacompleta_app01.substr(50,v_rutacompleta_app01.length-50) ;
	}	
	else if ( v_rutacompleta_app01.indexOf('http://www.peru.com/v07/includes/')>=0 )
	{
			v_return = "/portada" + v_rutacompleta_app01.substr(32,v_rutacompleta_app01.length-32) ;
	}
	else if ( v_rutacompleta_app01.indexOf('http://peru.com/v07/includes/')>=0 )
	{
			v_return = "/portada" + v_rutacompleta_app01.substr(28,v_rutacompleta_app01.length-28) ;
	}	
	else if ( v_rutacompleta_app01.indexOf('http://199.125.90.75/v07/includes/')>=0 )
	{
			v_return = "/portada" + v_rutacompleta.substr(33,v_rutacompleta_app01.length-33) ;
	}
	else if ( v_rutacompleta_app01.indexOf('http://app01.interlatin.com/astrologia/')>=0 )
	{
			v_return_app01 = "/horoscopo" + v_rutacompleta_app01.substr(38,v_rutacompleta_app01.length-38) ;
	}
	else if ( v_rutacompleta_app01.indexOf('http://app01.interlatin.com/representacionesperu/')>=0 )
	{
			v_return_app01 = "/peruanos_enelmundo" + v_rutacompleta_app01.substr(48,v_rutacompleta_app01.length-48) ;
	}	
	else if ( v_rutacompleta_app01.indexOf('http://app01.interlatin.com/nothistorico/')>=0 )
	{
			v_return_app01 = "/buscador" + v_rutacompleta_app01.substr(40,v_rutacompleta_app01.length-40) ;
	}
	else if ( v_rutacompleta_app01.indexOf('http://app01.interlatin.com/search/')>=0 )
	{
			v_return_app01 = "/buscador" + v_rutacompleta_app01.substr(34,v_rutacompleta_app01.length-34) ;
	}	
	else 
	{
			v_return_app01 = v_dato_app01;
	} 						

return v_return_app01;
}


dominio=document.domain;
url=document.location.pathname;
rutacompleta=document.location.href;
url2=url;
dato=url;
datoback=dato;
dato2=dato.charAt(dato.length-1);
cadena="/";
otracadena="|";
contador=0;
while (datoback.indexOf(cadena) > -1)
	{    dato3=datoback.indexOf(cadena);
		 datoback=datoback.substring(0,dato3)+otracadena+datoback.substring(dato3+1,datoback.length);
		 contador=contador+1;
	}	
if (dato2 == '/')
	{    dato=dato+"index.asp";
    }
   
if (dominio == 'cine.peru.com')
    {	vcertifica_path="/cine"+dato;
	    vcertifica_sitio=18970;
    }
else if (dominio == 'perurunners.peru.com')
    {	vcertifica_path="/perurunners"+dato;
		vcertifica_sitio=18970;
    }
else if (dominio == 'amigosycontactos.interlatin.com')
    {	vcertifica_path="/amigosycontactos"+dato;
		vcertifica_sitio=18970;
    }	
else if (dominio == 'travel.peru.com')
    {	vcertifica_path="/travel.peru.com"+dato;
		vcertifica_sitio=18970;
    }		
else if (dominio == 'app04.interlatin.com' || dominio == 'ads.peru.com' )
    {	vcertifica_path="/email"+dato;
		vcertifica_sitio=18970;
    }			
else if (dominio == 'search.interlatin.com')
    {	vcertifica_path="/buscador"+dato;
		vcertifica_sitio=18970;
    }	
else if (dominio == 'forum.peru.com' || dominio == 'forum.peru.com:8080' )
    {	vcertifica_path="/foro"+dato;
		vcertifica_sitio=18970;
    }	
else if (dominio == 'www.idonde.com' || dominio == 'idonde.com')
    {	vcertifica_path="/www.idonde.com"+dato;
		vcertifica_sitio=18970;
    }	
else if (dominio == 'www.ipostales.com' || dominio == 'ipostales.com')
    {	vcertifica_path="/postales"+dato;
		vcertifica_sitio=18970;
    }	
else if (dominio == 'www.magalyteve.com' || dominio == 'magalyteve.com')
    {	vcertifica_path=dato;
		vcertifica_sitio=19133;
    }		
else if (dominio == 'minuto.peru.com')
    {	vcertifica_path = "/minutoaminuto"+dato;
		vcertifica_sitio=18970;
    }	
else if (dominio == 'www.iencuentra.com' || dominio == 'iencuentra.com')
    {	vcertifica_path="/iencuentra"+dato;
		vcertifica_sitio=18970;
    }
else if (dominio == 'poll.interlatin.com')
    {	vcertifica_path="/encuestas"+dato;
		vcertifica_sitio=18970;
    }
else if (dominio == 'peru.bumeran.com.pe')
    {	vcertifica_path="/empleos"+dato;
		vcertifica_sitio=18970;
    }	
else if (dominio == 'app01.interlatin.com')
    {	vcertifica_path = cert_app01_secciones_excepciones(rutacompleta, url2, dato);
		vcertifica_sitio=18970;
    }	
else if (dominio == 'www.peru.com' || dominio == 'peru.com' || dominio == '199.125.90.75')
    {	vcertifica_path = cert_perucom_secciones_excepciones(rutacompleta, url2, dato);
		vcertifica_sitio=18970;
    }
else
    {	 vcertifica_path="/otras_secciones"+dato;
	     vcertifica_sitio=18970;		 
    }	
   
document.writeln("<div id='certifica' style='position:absolute; width:0; height:0; z-index:6; top: 0; left: 0; visibility: hidden'>");
tagCertifica( vcertifica_sitio, vcertifica_path );
document.writeln("</div>");

//SITIO_ID DE WWW.PERU.COM : 18970 