function laLinkWrangler() {

	/*
	 * Runs through all links on the page and substitutes URL and
	 * You Are Here strings with the appropriate ones based on 
	 * whatever country/website the user is coming from.
	 */
	var urlReplacementString = "";
	var textReplacementString = "";
	var myLocation = window.location.href;
	
	//check to see where we're coming from and set up our url replacements
	// and our human-friendly You Are Here country strings.
	var laPresent=myLocation.indexOf("latinamerica")>0;
	var mxPresent=myLocation.indexOf("/mx/")>0;		  
	var arPresent=myLocation.indexOf("/ar/")>0;
	var clPresent=myLocation.indexOf("/cl/")>0;
	
	if(mxPresent){
		urlReplacementString = "/mx/";
		textReplacementString = "Inicio Mexico";
	}
	else if(arPresent){      
		urlReplacementString = "/ar/";
		textReplacementString = "Inicio Argentina";
	}
	else if(clPresent){
		urlReplacementString = "/cl/";
		textReplacementString = "Inicio Chile";        
	}
	else if (laPresent){
		urlReplacementString = "/latinamerica/esp/";
		textReplacementString = "Inicio Latinoam&#233;rica";   		  
	}      
	for(i=0;i<document.links.length;i++){    
		myHref = document.links[i].href;       
		replaceLaHref(myHref,urlReplacementString);
		replaceLaText(document.links[i],textReplacementString);
	}
}

function replaceLaHref(myHref,urlReplacementString){
	if(urlReplacementString == ""){
		return false;
	}	
	tempHref = myHref;
	newHref = tempHref.replace("/latinamerica/esp/",urlReplacementString);
	document.links[i].href = newHref;
	return true;
}
function replaceLaText(myLink,textReplacementString){
	if(textReplacementString == ""){
		return false;
	}
	if(myLink.innerHTML.indexOf("Inicio")>-1){
		myLink.innerHTML = textReplacementString;
		return true;	
	}
}

laLinkWrangler(); 