// JScript File

/*Función para agregar la página a los favoritos del navegador*/
function agregarAFavoritos(url,titulo){
if (window.sidebar) {
    window.sidebar.addPanel(titulo, url,"");
  } else if( document.all ) {
    window.external.AddFavorite(url, titulo);
  } else if( window.opera && window.print ) {
    return true;
  }
}

/* Obtener el valor de un parámetro determinado */ 

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}

/* Retorna todas las queries con su valor salvo el parámtetro enviado como argumento */

function eliminarParam(strParamName)
{
    var cadena="";
    var strHref = window.location.href;

    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
        var aParam = aQueryString[iParam].split("=");
        if(aParam[0] != strParamName)
            cadena = cadena + aQueryString[iParam] + "&";
    }
    
    return cadena.substr(0,cadena.length-1);
}

/* elimina un parametro de un string enviado */
function eliminarP(strval, strParamName)
{
    var cadena="";
    var strHref = strval;

    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
        var aParam = aQueryString[iParam].split("=");
        if(aParam[0] != strParamName)
            cadena = cadena + aQueryString[iParam] + "&";
    }
    
    return cadena.substr(0,cadena.length-1);
}


/* redirige a la página actual agregando el query que crea a partir del Drop Down de orden */

function redirectDDPlus(obj) 
{
    var idxval = obj.options[obj.selectedIndex].value;
    var idx = idxval.split("=");

        if(idx[1]=="none")
        {
            var strHref = window.location.href;
            var strQueryString = strHref.split("?");
            strHref = strQueryString[0] + eliminarParam("orden");
        }
        else
        {
            var strHref = window.location.href;
            var strQueryString = strHref.split("?");
            strHref = strQueryString[0] +  eliminarParam("orden") + "&" + obj.options[obj.selectedIndex].value; 
        }

    window.location = eliminarP(strHref,"p");  //devuelve la url sin el parametro p que representa la pagina
}

/* Redirige a la página actual excluyendo el parámetro del argumento */

function excluirParam(P) 
{
    var strHref = window.location.href;
    var strQueryString = strHref.split("?");
    strHref = strQueryString[0] + eliminarParam(P);
    window.location = eliminarP(strHref,"p");  //devuelve la url sin el parametro p que representa la pagina
}

/* Redirige a la misma página agregando el argumento pasado como parámetro */

function redirectPlus(strP) 
{
    var campos = strP.split("=");
    var strHref = window.location.href;
    var strQueryString = strHref.split("?");
    strHref = strQueryString[0] + eliminarParam(campos[0]) + "&" + strP;
    window.location = eliminarP(strHref,"p");  //devuelve la url sin el parametro p que representa la pagina
}

/* Realiza las acciones con los filtros dependiendo de su presencia o ausencia  */

function filtrar(strP) 
{
    // URL a la que voy a redirigir
    var strHref = window.location.href;
   
    var strQueryString = strHref.split("?");

    // Obtengo el array con el query enviado y su valor
    var campos = strP.split("=");
    
    // Me fijo si el query ya esta en la URL
    if(getURLParam(campos[0])!="") {
        // Si esta y es un criterio distinto al criterio que se esta enviando, lo cambio por el nuevo
        if(getURLParam(campos[0])!=campos[1]) {

            strHref = strQueryString[0] + eliminarParam(campos[0]) + "&" + strP;
        } 
        else
        // Si esta y es el mismo lo saco (elimino el filtro)
        {
            strHref = strQueryString[0] + eliminarParam(campos[0]);
        }
    } 
    else
    // Si no esta en la URL, lo agrego
    {
         strHref = strQueryString[0] + eliminarParam(campos[0]) + "&" + strP;
    }

    // Redirijo a la URL armada
    //window.location = strHref;
    window.location = eliminarP(strHref, "p");  //devuelve la url sin el parametro p que representa la pagina
}


/* Muestra o esconde los divs de filtrado del panel de herramientas de filtrado */

function showhideDivPanel(id) {
    //setea lenguaje en dos letras
    var lengdos;
    var cook;
    
    cook = get_cookie("idioma")
    if (cook == "en-US") lengdos = "EN";
    else if (cook == "es-AR") lengdos = "ES";
    else lengdos = "EN";

    
    
    if(document.getElementById(id).style.display == "none") {
	    document.getElementById(id).style.display = "block";
	    if(id=="desplegaredit")
	        document.getElementById("ctl00_ContentPlaceHolder1_img" + id).src = "/images/" + lengdos + "/filtro-editorial-.gif";
	    if(id=="desplegartema")
	        document.getElementById("ctl00_ContentPlaceHolder1_img" + id).src = "/images/" + lengdos + "/filtro-tema-.gif";
    } else {
        if(document.getElementById(id).style.display == "block") {
            document.getElementById(id).style.display = "none";
            if(id=="desplegaredit")
	            document.getElementById("ctl00_ContentPlaceHolder1_img" + id).src = "/images/" + lengdos + "/filtro-editorial.gif";
	        if(id=="desplegartema")
	            document.getElementById("ctl00_ContentPlaceHolder1_img" + id).src = "/images/" + lengdos + "/filtro-tema.gif";
        }
    }
}


/*AJAX*/ 

var xmlhttpreq
function crearXMLHttpRequest()
{ 
    var xmlhttp=false; 
    try 
    { 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    }
    catch(e)
    { 
        try
        { 
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
        catch(E) { xmlhttp=false; }
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
    return xmlhttp; 
} 


function comprarDesdeFicha(cod_articulo)
{
    //alert('Acabas de comprar el articulo numero ' + id_articulo);
    xmlhttpreq = crearXMLHttpRequest();
    xmlhttpreq.open("POST", "/ajax_functions.aspx", true);
    xmlhttpreq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttpreq.send("cod_art=" + cod_articulo);
    xmlhttpreq.onreadystatechange = procesarEventos;
    xmlhttpreq.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
    conexion1.send(null);
}
function addtochango(codigo) {
    var cantidad;
    cantidad = 1;
    xmlhttpreq = crearXMLHttpRequest();

    xmlhttpreq.open("GET", "/ajax_functions.aspx?a=comprar&cod=" + codigo + "&cant=" + cantidad, true);
    xmlhttpreq.onreadystatechange = compra_ajax;
    xmlhttpreq.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
    xmlhttpreq.send(null);
}

function procesarEventos()
{
    if (xmlhttpreq.readyState == 4) //Listo
    {
        if (xmlhttpreq.status == 200)
        {
            var respuesta = xmlhttpreq.responseXML;
            document.getElementById('imagen_libro_compra').src = respuesta.getElementsByTagName("url_imagen_libro")[0].childNodes[0].data;
            document.getElementById('titulo_libro_compra').innerHTML = respuesta.getElementsByTagName("titulo_libro")[0].childNodes[0].data;
            document.getElementById('carrDPrecio').innerHTML = 'Precio: $' + respuesta.getElementsByTagName("precio_libro")[0].childNodes[0].data;
            compraDesdeFicha();
            setTimeout("compraDesdeFicha()",5000);
        }
    }

}


function compraDesdeFicha(imagen, titulo, precio) 
{
    window.scrollTo(0,0);
    document.getElementById('imagen_libro_compra').src = imagen; //respuesta.getElementsByTagName("url_imagen_libro")[0].childNodes[0].data;
    document.getElementById('titulo_libro_compra').innerHTML = titulo; //respuesta.getElementsByTagName("titulo_libro")[0].childNodes[0].data;
    document.getElementById('carrDPrecio2').innerHTML = ': $' + precio; //respuesta.getElementsByTagName("precio_libro")[0].childNodes[0].data;
    Effect.toggle('carritoDown','slide'); 
    document.getElementById("lienzo").className='lienzoCarritoDown';
    setTimeout("ret()",5000);
}


function comprarLibro(codigo)
{
    var mi_select;
    mi_select = document.getElementById("ctl00_ContentPlaceHolder1_select_cant");
    var cantidad;
    cantidad = mi_select.options[mi_select.selectedIndex].value;
    xmlhttpreq = crearXMLHttpRequest();

    xmlhttpreq.open("GET", "/ajax_functions.aspx?a=comprar&cod=" + codigo + "&cant=" + cantidad, true);
    xmlhttpreq.onreadystatechange = compra_ajax;
    xmlhttpreq.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
    xmlhttpreq.send(null);
}

var lang;
function inicializar_pagina() //funcion que se ejecuta en todas las paginas en el onload
{   
    //si viene referido por algun asociado, guarda en cookie al asociado
    guardarAsociado();
   
   //actualiza el carrito
    xmlhttpreq = crearXMLHttpRequest();
    xmlhttpreq.open("GET", "/ajax_functions.aspx?a=actualizar", true);
    xmlhttpreq.onreadystatechange = compra_ajax;
    xmlhttpreq.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
    xmlhttpreq.send(null);
   
   
   //muestra footsteps
   mostrar_footsteps("1");
   mostrar_footsteps("2");
   mostrar_footsteps("3");
   mostrar_footsteps("4");
   mostrar_footsteps("5");
  
   //guarda en footsteps
   do_footsteps()
   
    //toma el idioma actual y actualiza las imagenes a ese idioma
    if (get_cookie("idioma") != null)
    {
        if (get_cookie("idioma") == "en-US")
            lang = "EN";
        else
            lang = "ES";
    }
    else lang = "EN";
    changue_images_languajes(lang);
}



function changue_images_languajes(lan)
{
    document.getElementById("banner-costos").src = "/images/" + lan + "/banner-envio.jpg";
    document.getElementById("bIzqTemas").className = "bIzqTemas_" + lan;
    document.getElementById("b-search").src = "/images/" + lan + "/b-search.jpg";
}

function preload_images_default()
{
    //en esta parte hace el preload de las imagenes de la vidriera
    img_featured_a = new Image(); img_featured_a.src = "/images/" + lang + "/b-img_menu_1.gif";
    img_featured_d = new Image(); img_featured_d.src = "/images/" + lang + "/t-img_menu_1.gif";
    img_onsale_a = new Image(); img_onsale_a.src = "/images/" + lang + "/b-img_menu_2.gif";
    img_onsale_d = new Image(); img_onsale_d.src = "/images/" + lang + "/t-img_menu_2.gif";
    img_bestsellers_a = new Image(); img_bestsellers_a.src = "/images/" + lang + "/b-img_menu_3.gif";
    img_bestsellers_d = new Image(); img_bestsellers_d.src = "/images/" + lang + "/t-img_menu_3.gif";
}


function compra_ajax () 
{
    
    if (xmlhttpreq.readyState == 4)
    {
        if (xmlhttpreq.status == 200)
        {
            var respuesta;
            respuesta = xmlhttpreq.responseXML;
            var tareacompletada = respuesta.getElementsByTagName("tarea")[0].getAttribute("completada");
            if (tareacompletada == "true")
            {
                var display_carrito = respuesta.getElementsByTagName("carrito")[0].getAttribute("cantidad") + " items | US$ ";
                display_carrito += respuesta.getElementsByTagName("carrito")[0].getAttribute("total");
                document.getElementById("ctl00_label_carrito").innerHTML = display_carrito;
            }
            else
            {
                alert("Surgió un error durante el proceso de actualizacion, será reparado a la brevedad.", "Error");
            }
        }
    }

}

function ret()
{
    document.getElementById("lienzo").className='lienzo';
    Effect.toggle('carritoDown','slide'); 
}

/* COOKIES */



function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results )
    return ( unescape ( results[1] ) );
  else
    return null;
}

function delete_cookie ( cookie_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

function set_cookie ( name, value, exp_y, exp_m, exp_d, domain)
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }



  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  cookie_string += "; path=/"
  
  document.cookie = cookie_string;
}

function cambiar_idioma()
{
    var current_date = new Date;
    var idioma;
    if (!get_cookie ("idioma")) //si no existe cookie designa por defecto ingles
    {
        
        var cookie_year = current_date.getFullYear ( ) + 1;
        var cookie_month = current_date.getMonth ( );
        var cookie_day = current_date.getDate ( );
        set_cookie ( "idioma", "es-AR", cookie_year, cookie_month, cookie_day);
        idioma = "es-AR";
    }
    else //si existe la cookie la cambia
    {
      idioma = get_cookie ( "idioma" );
      if (idioma == "en-US")
        idioma = "es-AR";       
      else
        idioma = "en-US";
      
      //delete_cookie("idioma");
      set_cookie("idioma", idioma, current_date.getFullYear() + 1, current_date.getMonth(), current_date.getDate());
      

    }
      if (idioma == "en-US") window.location = window.location.href.split("/ES/").join("/EN/");
      if (idioma == "es-AR") window.location = window.location.href.split("/EN/").join("/ES/");
}

/* FIN COOKIES */


/* javascript masterpage */

// los metodos para manejar cookies estan repetidos,
// con mas tiempo se deberian unificar...

// estos lo usa para guardar el vienede de los asociados
// los de arriba los usa para el cambio de idioma
function getCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') {
		    c = c.substring(1,c.length);
		}
		if (c.indexOf(nameEQ) == 0) 
		    return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setCookie(name,value,expires, options) {
if (options===undefined) { options = {}; }
if ( expires ) {
var expires_date = new Date();
expires_date.setDate(expires_date.getDate() + expires)
}
document.cookie = name+'='+escape( value ) +
( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) +
( ( options.path ) ? ';path=' + options.path : '' ) +
( ( options.domain ) ? ';domain=' + options.domain : '' ) +
( ( options.secure ) ? ';secure' : '' );
}

function GuardarCookie (nombre, valor, caducidad) {
	if(!caducidad)
		caducidad = Caduca(0)

	//crea la cookie: incluye el nombre, la caducidad y la ruta donde esta guardada
	//cada valor esta separado por ; y un espacio
	document.cookie = nombre + "=" + escape(valor) + "; expires=" + caducidad + "; path=/"
}

function Caduca(dias) {
	var hoy = new Date()					//obtiene la fecha actual
	var msEnXDias = eval(dias) * 24 * 60 * 60 * 1000	//pasa los dias a mseg.

	hoy.setTime(hoy.getTime() + msEnXDias)			//fecha de caducidad: actual + caducidad
	return (hoy.toGMTString())
}

function BorrarCookie(nombre) {
	//para borrar la cookie, se le pone una fecha del pasado mediante Caduca(-1)
	document.cookie = nombre + "=; expires=" + Caduca(-1) + "; path=/"
}

/**
 * Verifica si se recibe por qs el codigo de asociado
 * y lo guarda en una cookie
 */

var vienede;

function parseParams(query) 
{
	var qsParm = new Array();
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
   		var pos = parms[i].indexOf('=');
   		if (pos > 0) {
      			var key = parms[i].substring(0,pos);
      			var val = parms[i].substring(pos+1);
      			qsParm[key] = val;
      		}
	}
	return qsParm;
}

function guardarAsociado()
{
	var query = window.location.search.substring(1);
	var qs = parseParams(query);
	if (qs['vienede'])
	{
		vienede=qs['vienede'];
		if(getCookie("vienede")!=vienede)
		{
		var current_date = new Date();
		    //setCookie('vienede', qs['vienede'], 366);
		    set_cookie('vienede', qs['vienede'], current_date.getFullYear() + 1, current_date.getMonth(), current_date.getDate());
		    SendQueryAsoc();
		}
	}
}

function SendQueryAsoc() {
    var xmlhttpreq = crearXMLHttpRequest();
    var url = "/actualizaAsoc.aspx?vienede=" + vienede;
    if (xmlhttpreq != null) {
        xmlhttpreq.open("GET", url, true);
        xmlhttpreq.send(null);
    }
}

//-----------------------------------------------------

function menu_click(num1,num2,num3,idioma)
{
    document.getElementById("vid_" + num1).style.display="block";
    document.getElementById("vid_" + num2).style.display="none";
    document.getElementById("vid_" + num3).style.display="none";
    
    document.getElementById("div_menu_" + num1).className='hVidTit011';
    document.getElementById("div_menu_" + num2).className='hVidTit021';
    document.getElementById("div_menu_" + num3).className='hVidTit021';
    

    document.getElementById("img_menu_" + num1).src = "/images/" + idioma + "/b-img_menu_" + num1 + ".gif";
    document.getElementById("img_menu_" + num2).src = "/images/" + idioma + "/t-img_menu_" + num2 + ".gif";
    document.getElementById("img_menu_" + num3).src = "/images/" + idioma + "/t-img_menu_" + num3 + ".gif";

   
}
/* fin javascript masterpage */

/* footsteps */
var hoy = new Date;
function do_footsteps()
{
 
    // si no existen las cookies las crea
    /*
    if (get_cookie("footsteps_1") == null) set_cookie("footsteps_1","",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate());
    if (get_cookie("footsteps_2") == null) set_cookie("footsteps_2","",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate());
    if (get_cookie("footsteps_3") == null) set_cookie("footsteps_3","",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    if (get_cookie("footsteps_4") == null) set_cookie("footsteps_4","",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    if (get_cookie("footsteps_5") == null) set_cookie("footsteps_5","",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    */
    if (get_cookie("footsteps_1") == null) set_cookie("footsteps_1","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate());
    if (get_cookie("footsteps_2") == null) set_cookie("footsteps_2","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate());
    if (get_cookie("footsteps_3") == null) set_cookie("footsteps_3","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    if (get_cookie("footsteps_4") == null) set_cookie("footsteps_4","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    if (get_cookie("footsteps_5") == null) set_cookie("footsteps_5","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    
    // despues de validar que sea necesario crearlas
    var titulo;
    var vect;
    
    //diferentes casos de url
    if (procesaurl())
    {
        vec = document.title.split("-");
        if (window.location.pathname == "/" || window.location.pathname == "/default.aspx") //si es la home
            titulo = "HOME SFB";
        else 
        {
            if (window.location.pathname == "/resultados.aspx")
            {
                titulo = "Results for \"" + vec[0] + "\"";
            }
            else
            {
                titulo = vec[0];
            }
        }
        guardar_en_footsteps(window.location.href + "~" + titulo);   
    }
}
/*
function procesaurl()
{
    var urlactual;
    var aux2;
    var aux1;
    var cookieanterior = get_cookie("footsteps_1").split("~");
    
    if (window.location.href == cookieanterior[0])
        return false;
    else
    {
        if (window.location.pathname != "/resultados.aspx")
            return true;
        else
        {
        
            var nuevakey = get_parameter(window.location.href,"key");
            var viejakey = get_parameter(cookieanterior[0],"key");
            var nuevocrit = get_parameter(window.location.href,"criterio");
            var viejocrit = get_parameter(cookieanterior[0],"criterio");
            if (nuevakey == viejakey && nuevocrit == viejocrit)
                return false;
            else
                return true;
        }
    }
    return true;
}
*/
function get_parameter(url,par)
{
    var aux = url.split("?");
    var aux2 = aux[1].split("&");
    var aux3;
    for (j = 0;j < j.length; j++)
    {
        aux3 = aux2[j].split("=");
        if (aux3[0] == par)
            return aux3[1];
    }
    return "";
}


function procesaurl()
{
    var urlactual;
    var aux2;
    var aux1;
    var cookieanterior2 = get_cookie("footsteps_1");
    
    if (cookieanterior2 == null || cookieanterior2 == "null") return true;
    var cookieanterior = cookieanterior2.split("~");
    
    if (window.location.href == cookieanterior[0])
        return false;
    else
    {
        if (window.location.pathname != "/resultados.aspx" && window.location.pathname != "/temas.aspx")
            return true;
        else
        {
            urlactual = window.location.href.split("?");
            if (urlactual[1] != null)
            {
                aux1 = urlactual[1].split("&");
                for (i = 0; i < aux1.length; i++)
                {
                    aux2 = aux1[i].split("=");
                    if (aux2[0] == "p")
                    {
                        return false;
                    }
                }
            }
        }
    }
    return true;
}


function guardar_en_footsteps(datos)
{
    var aux;
    
    //desplaza
    aux = get_cookie("footsteps_4");
    set_cookie("footsteps_5",aux,hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate())
    aux = get_cookie("footsteps_3");
    set_cookie("footsteps_4",aux,hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate())
    aux = get_cookie("footsteps_2");
    set_cookie("footsteps_3",aux,hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate())
    aux = get_cookie("footsteps_1");
    set_cookie("footsteps_2",aux,hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate())
    
    //guarda
    set_cookie("footsteps_1",datos,hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()) 
}

function mostrar_footsteps(num)
{
    /*
    if (get_cookie("footsteps_1") == null) set_cookie("footsteps_1","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate());
    if (get_cookie("footsteps_2") == null) set_cookie("footsteps_2","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate());
    if (get_cookie("footsteps_3") == null) set_cookie("footsteps_3","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    if (get_cookie("footsteps_4") == null) set_cookie("footsteps_4","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    if (get_cookie("footsteps_5") == null) set_cookie("footsteps_5","null",hoy.getFullYear() + 1,hoy.getMonth(),hoy.getDate()); 
    */
   var aux;
   var vector;
   aux = get_cookie("footsteps_" + num);
   if (aux != null && aux != "" && aux != "undefined" && aux != "null")
   {
        vector = aux.split("~");
        document.getElementById("a_footsteps_" + num).href = vector[0];
        document.getElementById("a_footsteps_" + num).innerHTML = vector[1];
        document.getElementById("div_footsteps_" + num).style.display = "block";
        document.getElementById("ultVisHuellas").style.display = "none";
   }
   
   /* 
   document.getElementById("a_footsteps_1").href="http://www.google.com";
   document.getElementById("a_footsteps_1").innerHTML = "GOOGLE";
   
   document.getElementById("a_footsteps_2").href="http://www.yahoo.com.ar";
   document.getElementById("a_footsteps_2").innerHTML = "YAHOO";
   
   document.getElementById("a_footsteps_3").href="http://www.live.com.ar";
   document.getElementById("a_footsteps_3").innerHTML = "LIVE SEARCH";
   */
}
/* fin footsteps */



