// $Header: /WebSites/library/javascript/trafalgar/trafalgarAdtileRedirect.js 4     8/15/07 10:26a Bpena $

// Changes the target of a Trafalgar ad tile link, based on the domain on which the ad appears

(function(){
    try { 
        if (document.getElementById('trafalgarAdtileLink')) {        
            var trafalgarAdtileLink = document.getElementById('trafalgarAdtileLink');
			var trafalgarTextLink = document.getElementById('trafalgarTextLink');
			
			trafalgarAdtileLink.setAttribute("target","_blank");
			if (trafalgarTextLink) {
			    trafalgarTextLink.setAttribute("target","_blank");
			    }

            switch (window.location.hostname.toLowerCase()) {
                case "www3.vacationoutlet.com":
                    trafalgarAdtileLink.href = "http://www.booktt.com/tourfinder/generalinfo.asp?affiliatecode=kayak&services=1";
					if (trafalgarTextLink) {
						trafalgarTextLink.href = "http://www.booktt.com/tourfinder/generalinfo.asp?affiliatecode=kayak&services=1";
					}
                    break;
                case "remyreport.vacationoutlet.com":
                    trafalgarAdtileLink.href = "http://www.booktt.com/tourfinder/generalinfo.asp?affiliatecode=remyreport&services=1";
					if (trafalgarTextLink) {
						trafalgarTextLink.href = "http://www.booktt.com/tourfinder/generalinfo.asp?affiliatecode=remyreport&services=1";
					}
                    break;
                default: 
                    trafalgarAdtileLink.href = "http://www.booktt.com/tourfinder/generalinfo.asp?affiliatecode=vacationoutlet&services=1";
					if (trafalgarTextLink) {
						trafalgarTextLink.href = "http://www.booktt.com/tourfinder/generalinfo.asp?affiliatecode=vacationoutlet&services=1";
					}
                    break;
            }
        }
    }
        
    catch (e) {
        alert("WARNING TO QA! If you see this, call the Web Team. [" + e + "]");
    }
})();

