

/* Detecting Server Settings...
------------------------------------*/

/* Environment: Live */
/* Media Server to use: http://media.ef.com */


/* Detecting Browser Settings...
------------------------------------*/

/* Country:               cl
/* Language:              cl
/* Web crawler?           True
/* Your browser:          generic crawler
/* Your browser version:  1
/* Your platform:  function platform(str)
{
//Use this if you are using short hand like 'windows' or 'mac'
//The more speciffic you are the more likely this will give you an accurate response
if (platform_n.indexOf(str)!=-1)
{
Response.WriteBlock(12)
Response.Write(str)
Response.WriteBlock(13)
Response.Write(platform_n)
Response.WriteBlock(14)
return true;
} else {
return false;
}
}
/* Accepts Style sheets?  False
/*
/* You can switch style sheets using the following scripts:
/* (remove spaces between < and % for asp
/* < %if(browser("IE==5")) {% > Your styles < %}% >
/* for multiple use commas, for version equal to less than or greater than use conditionals <,>,==,!=,>=,<=
/* < %if(browser("IE>5,firefox,safari<3")) {% > Your styles < %}% >
/*
/* the following variables may also be used
/* browser_n (browser name), browser_v (version), isCrawler (boolean true if a spider)
*/


    
    docready = false; 
	function rollDown() {
	    step2 = 15;
	    step = 10;
	    y = -10;
	    obj = document.getElementById("homeContent");
	    if(obj.style.top == "") {
		    obj.style.top = "175px";
	    }
	    newTop = parseInt(obj.style.top);
	    if (newTop > y) {
		    if (y < 0) {
			    step = step - (step * 2);
		    }
		    obj.style.top = (newTop + step) + "px";
	    } else {
		    mapHidden = true;
		    obj.style.display = "none";
	    }
	    y2 = 120;
	    gtObj = document.getElementById("guidedtour");
	    gtObj.style.display = "inline";
	    if(gtObj.style.top == "") {
		    gtObj.style.top = "-300px";
	    }
	    newTop2 = parseInt(gtObj.style.top);
	    if(newTop2 < y2) {
		    if(y2 < newTop2) {
			    step2 = - step2;
		    }
		    gtObj.style.top = (newTop2 + step2) + "px";
	    } else {
		    gtShowing = true;
	    }
	    if(!mapHidden || !gtShowing) {
		    setTimeout("rollDown()", 10);
	    } else if(mapHidden && gtShowing) {
	        mapHidden = false;
	        gtShowing = false;
		}
	}
    function rollUp () {
		/* step2 = 15;
		step = 10;
		y = 185;
		obj = document.getElementById("homeContent");
		obj.style.display = "block";
		newTop = parseInt(obj.style.top);
		if (newTop < y) {
			obj.style.top = (newTop + step) + "px";
		} else {
			mapHidden = true;
		}
		y2 = -300;
		gtObj = document.getElementById("guidedtour");
		newTop2 = parseInt(gtObj.style.top);
		if(newTop2 > y2) {
			if(y2 < newTop2) {
				step2 = - step2;
			}
			gtObj.style.top = (newTop2 + step2) + "px";
		} else {
			gtShowing = true;
		    gtObj.style.display = "none";
		}
		if(!mapHidden || !gtShowing) {
			setTimeout("rollUp()", 10);
		} else if(mapHidden && gtShowing) {
		    mapHidden = false;
		    gtShowing = false;
		} */
	}	
	function sortNumber(a, b) {
		return a - b;
	}
	function setBg() {
		lnks = document.getElementById("links");
		if(lnks.style.display != "none") {
    		lnks.style.top = "550px";
		}
		contwrap = document.getElementById("content-wrapper");
		contWrapHeight = contwrap.offsetHeight;
		cwhPxValue = (contWrapHeight + footBuffer);
		cwhEmValue = cwhPxValue * 0.0756;
		contwrap.style.height = cwhEmValue + "em";
		wrap = document.getElementById("wrapper");
		wrapHeight = wrap.offsetHeight;
		whPxValue = (wrapHeight + footBuffer);
		whEmValue = whPxValue * 0.0756;
		wrap.style.height = whEmValue + "em";
	}
	function mp_go_on() {
		goButton = document.getElementById("mp_gt_go");
		if(goButton) {
		    goButton.src = "/_imgs/lt/home/mainpuff_text_hover.gif";
		}
	}
	function mp_go_off() {
		goButton = document.getElementById("mp_gt_go");
		if(goButton) {		
		    goButton.src = "/_imgs/lt/home/mainpuff_text.gif";
		}
	}

	function mylt_go_on() {
		goButton = document.getElementById("mylt_go");
		if(goButton) {
		    goButton.src = "/_imgs/lt/home/mylt_text_hover.gif";
		}
	}
	function mylt_go_off() {
		goButton = document.getElementById("mylt_go");
		if(goButton) {		
		    goButton.src = "/_imgs/lt/home/mylt_text.gif";
		}
	}
	
	function gt_lower_go_on() {
		goButton = document.getElementById("gt_lower_go");
		if(goButton) {
		    goButton.src = "/_imgs/lt/home/gt_text_hover.gif";
		}
	}
	function gt_lower_go_off() {
		goButton = document.getElementById("gt_lower_go");
		if(goButton) {		
		    goButton.src = "/_imgs/lt/home/gt_text.gif";
		}
	}

    //Slide in/out a flash object
    //give the surrounding div as the _id value, e.g. revealFlash("flashmap"); 
    function revealFlash(theId,theSwf,theSwfid,theW,theH,theV) {
        isHome = document.getElementById("homeContent");
        if(isHome) {
            //rollUp();
            homeCont = document.getElementById("homeContent");
            homeCont.style.visibility = "hidden";
        } 
        backToTop();                
        if (theSwf && !document.getElementById(theSwfid)) {
            var str = theSwf;
            var vars = new Array();
            if (str.indexOf("?")!=-1) {
                str = str.split("?");
                theSwf = str[0];
                vars = str[1].split("&");
                if (vars.length > 0) {              
                    for (var s=0; s < vars.length; s++) {
                        var varn = vars[s].split("=")[0];
                        var varv = vars[s].split("=")[1]
                        if (varn.toLowerCase()=="ctr") {
                            theSwf+="?ctr="+varv;
                        }
                    }
                }
            }
            theGt = new SWFObject(theSwf, theSwfid, theW, theH, theV, "#fff");
            if (vars.length > 0) {
                for (var s=0; s < vars.length; s++) {
                    var varn = vars[s].split("=")[0];
                    var varv = vars[s].split("=")[1]
                    if (varn.toLowerCase()!="ctr") {
                        theGt.addVariable(varn,varv);
                    }
                }
            }
            theGt.addParam("wmode", "transparent");
            theGt.write(theId);
        }
        _flashobject = document.getElementById(theId);
        _flashmask = document.getElementById("flashmask");
        if(isHome) {
            var leftpadding = ((document.body.clientWidth - 755) / 2) + 20;
            var toppadding = "150px";
        } else {
            var leftpadding = ((document.body.clientWidth - 755) / 2) - 50;
            var toppadding = "100px";
        }
        clearInterval(inTween);
        clearInterval(outTween);
        if (_flashobject.style.visibility != "visible") {
            hideDropDowns();
            _flashobject.style.visibility = "visible";
            _flashobject.style.display = "block";
            _flashobject.style.left = "-776px";
            _flashobject.style.top = toppadding;
            _flashmask.style.display = "block";
            subInTween = -776;
            var inTween = setInterval(function() {
                subInTween = (subInTween/2);
                _flashobject.style.left = ((subInTween+leftpadding)+"px");
                if (Math.abs(subInTween)<5) {
                    _flashobject.style.left = leftpadding+"px";
                    clearInterval(inTween);
                }
            },50);
        } else {
            subOutTween = (_flashobject.style.left+"").replace("px","");
            subOutTween = Math.abs(subOutTween - 0);
            subOutTween = (subOutTween < 1 ? 1 : subOutTween);
            var outTween = setInterval(function() {
                subOutTween = subOutTween * 2;
                //alert(Math.abs(subOutTween));
                _flashobject.style.left = "-"+(subOutTween-leftpadding)+"px";
                if (Math.abs(subOutTween) > 775) {
                    _flashobject.style.left = "-776px";
                    _flashobject.style.top = toppadding;                            
                    _flashobject.style.visibility = "hidden";
                    _flashmask.style.display = "none";
                    revealDropDowns();
                    clearInterval(outTween);
                    if(isHome) {
                        homeCont.style.visibility = "visible";
                    }
                }
            },50);                    
        }
    }

    //scroll the user back to the top (useful for the flash calls)
    function backToTop() {
        var x1 = x2 = x3 = 0;
        var y1 = y2 = y3 = 0;

        if (document.documentElement) {
            x1 = document.documentElement.scrollLeft || 0;
            y1 = document.documentElement.scrollTop || 0;
        }

        if (document.body) {
            x2 = document.body.scrollLeft || 0;
            y2 = document.body.scrollTop || 0;
        }

        x3 = window.scrollX || 0;
        y3 = window.scrollY || 0;

        var x = Math.max(x1, Math.max(x2, x3));
        var y = Math.max(y1, Math.max(y2, y3));

        window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

        if (x > 0 || y > 0) {
            window.setTimeout("backToTop()", 25);
        }
    }
    
    function hideDropDowns()
    {
        dds = document.getElementsBySelector(".selectdest");
        for (var i=0; i < dds.length; i++)
        {
            dds[i].tempHTML = dds[i].innerHTML;
            dds[i].innerHTML = '<div class="greyout_dropdown">&nbsp;</div>';
        }
    }
    
    function revealDropDowns()
    {
        for (var i=0; i < dds.length; i++)
        {
            dds[i].innerHTML = dds[i].tempHTML;
        }  
    }
    
    
function setTestimonials() {
    doTestimonials = false;
	testimData = new Array();
    testimData["theImg"] = "";
    testimData["quote"] = "";
    testimData["link"] = "";
    testimData["theName"] = "";
    testimData["email"] = "";
    testimData["theTitle"] = "";
    testimData["subtitle"] = "";
    curULs = document.getElementsByTagName('ul');
    for(thing in curULs) {
        if(curULs[thing].className == "rightnav_profile") {
            curProfile = curULs[thing];
            doTestimonials = true;
            break;
        }
    }
    if(doTestimonials) {
        curProfileNodes = curProfile.getElementsByTagName('li');
        for(i = 0; i <= curProfileNodes.length; i ++) {
            if(curProfileNodes[i] != undefined) {
                if(curProfileNodes[i].className == "title") {
                    testimData["theTitle"] = curProfileNodes[i].innerHTML;
                } else if(curProfileNodes[i].className == "subtitle") {
                    testimData["subtitle"] = curProfileNodes[i].innerHTML;
                } else if(curProfileNodes[i].className == "heading") {
                    if(curProfileNodes[(i + 1)].innerHTML.indexOf("@") != -1) {
                        testimData["email"] = new Array(curProfileNodes[i].innerHTML,curProfileNodes[(i + 1)].innerHTML);
                    } else if(curProfileNodes[i].innerHTML.indexOf("Nombre:") != -1) {
                        testimData["theName"] = new Array(curProfileNodes[i].innerHTML,curProfileNodes[(i + 1)].innerHTML);
                    } else {
                        testimData["quote"] = new Array(curProfileNodes[i].innerHTML,curProfileNodes[(i + 1)].innerHTML);
                    }
                } else if(curProfileNodes[i].innerHTML.indexOf("/master/lt/destinations") != -1) {
                    testimData["link"] = curProfileNodes[i].innerHTML;
                } else if(curProfileNodes[i].innerHTML.toLowerCase().indexOf("<img") != -1) {
                    testimData["theImg"] = curProfileNodes[i].innerHTML;
                }
            }
        }
        output = "<div id=\"testimonial\">";
        if(testimData["theImg"] != "") {
            output += "<div id=\"testimImg\">" + testimData["theImg"] + "</div>";
        }
        output += "<div id=\"testimProfile\">";
        if(testimData["theName"] != "") {
            output += "<p><strong>" + testimData["theName"][0] + "::</strong></p>";
            output += "<p>" + testimData["theName"][1] + "</p>";
        }
        if(testimData["email"] != "") {
            output += "<p><strong>" + testimData["email"][0] + "::</strong></p>";
            if(testimData["theImg"] != "") {
                curEmail = testimData["email"][1];
                curEmailArray = curEmail.split(">");
                emailTextArray = curEmailArray[1].split("<");
                emailTextArray[0] = "Haz click aquí";
                curEmailArray[1] = emailTextArray.join("<");
                curEmail = curEmailArray.join(">");
                testimData["email"][1] = curEmail;
            }
            output += "<p>" + testimData["email"][1] + "</p>";
        }
        output += "</div><div class=\"cleardiv\"></div>";
        if(testimData["quote"] != "") {
            output += "<div id=\"testimQuote\"><p><img src=\"http://media.ef.com/_imgs/lt/_shared/testimonials/openQuote.gif\" align=\"left\" width=\"31\" height=\"26\" />" + testimData["quote"][1] + "</p></div>";
        }
        if(testimData["link"] != "") {
            output += "<div id=\"testimLink\">" + testimData["link"] + "</div>";
        }       	    
        output += "</div>";
        curProfile.innerHTML = output;
    }
}    
    
    
    /* document.getElementsBySelector(selector)
       - returns an array of element objects from the current document
         matching the CSS selector. Selectors can contain element names, 
         class names and ids and can be nested. For example:
         
           elements = document.getElementsBySelect('div#main p a.external')
         
         Will return an array of all 'a' elements with 'external' in their 
         class attribute that are contained inside 'p' elements that are 
         contained inside the 'div' element which has id="main"

       New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
       See http://www.w3.org/TR/css3-selectors/#attribute-selectors

       Version 0.4 - Simon Willison, March 25th 2003
       -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
       -- Opera 7 fails 
    */

    function getAllChildren(e) {
      // Returns all children of element. Workaround required for IE5/Windows. Ugh.
      return e.all ? e.all : e.getElementsByTagName('*');
    }

    document.getElementsBySelector = function(selector) {
      // Attempt to fail gracefully in lesser browsers
      if (!document.getElementsByTagName) {
        return new Array();
      }
      // Split selector in to tokens
      var tokens = selector.split(' ');
      var currentContext = new Array(document);
      for (var i = 0; i < tokens.length; i++) {
        token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
        if (token.indexOf('#') > -1) {
          // Token is an ID selector
          var bits = token.split('#');
          var tagName = bits[0];
          var id = bits[1];
          var element = document.getElementById(id);
          if (tagName && element.nodeName.toLowerCase() != tagName) {
            // tag with that ID not found, return false
            return new Array();
          }
          // Set currentContext to contain just this element
          currentContext = new Array(element);
          continue; // Skip to next token
        }
        if (token.indexOf('.') > -1) {
          // Token contains a class selector
          var bits = token.split('.');
          var tagName = bits[0];
          var className = bits[1];
          if (!tagName) {
            tagName = '*';
          }
          // Get elements matching tag, filter them for class selector
          var found = new Array;
          var foundCount = 0;
          for (var h = 0; h < currentContext.length; h++) {
            var elements;
            if (tagName == '*') {
                elements = getAllChildren(currentContext[h]);
            } else {
                elements = currentContext[h].getElementsByTagName(tagName);
            }
            for (var j = 0; j < elements.length; j++) {
              found[foundCount++] = elements[j];
            }
          }
          currentContext = new Array;
          var currentContextIndex = 0;
          for (var k = 0; k < found.length; k++) {
            if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
              currentContext[currentContextIndex++] = found[k];
            }
          }
          continue; // Skip to next token
        }
        // Code to deal with attribute selectors
        if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
          var tagName = RegExp.$1;
          var attrName = RegExp.$2;
          var attrOperator = RegExp.$3;
          var attrValue = RegExp.$4;
          if (!tagName) {
            tagName = '*';
          }
          // Grab all of the tagName elements within current context
          var found = new Array;
          var foundCount = 0;
          for (var h = 0; h < currentContext.length; h++) {
            var elements;
            if (tagName == '*') {
                elements = getAllChildren(currentContext[h]);
            } else {
                elements = currentContext[h].getElementsByTagName(tagName);
            }
            for (var j = 0; j < elements.length; j++) {
              found[foundCount++] = elements[j];
            }
          }
          currentContext = new Array;
          var currentContextIndex = 0;
          var checkFunction; // This function will be used to filter the elements
          switch (attrOperator) {
            case '=': // Equality
              checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
              break;
            case '~': // Match one of space seperated words 
              checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
              break;
            case '|': // Match start with value followed by optional hyphen
              checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
              break;
            case '^': // Match starts with value
              checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
              break;
            case '$': // Match ends with value - fails with "Warning" in Opera 7
              checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
              break;
            case '*': // Match ends with value
              checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
              break;
            default :
              // Just test for existence of attribute
              checkFunction = function(e) { return e.getAttribute(attrName); };
          }
          currentContext = new Array;
          var currentContextIndex = 0;
          for (var k = 0; k < found.length; k++) {
            if (checkFunction(found[k])) {
              currentContext[currentContextIndex++] = found[k];
            }
          }
          // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
          continue; // Skip to next token
        }
        // If we get here, token is JUST an element (not a class or ID selector)
        tagName = token;
        var found = new Array;
        var foundCount = 0;
        for (var h = 0; h < currentContext.length; h++) {
          var elements = currentContext[h].getElementsByTagName(tagName);
          for (var j = 0; j < elements.length; j++) {
            found[foundCount++] = elements[j];
          }
        }
        currentContext = found;
      }
      return currentContext;
    }

    /* That revolting regular expression explained 
    /^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
      \---/  \---/\-------------/    \-------/
        |      |         |               |
        |      |         |           The value
        |      |    ~,|,^,$,* or =
        |   Attribute 
       Tag
    */