var $j = jQuery.noConflict();

/*** Travel - Channel Header & Footer JS : Starts ***/

/* Function to add onclick, onmouseout, onmouseover and onsubmit event in header : Starts */
function headerEvents(dealsMenuSelected, travelIdeasMenuSelected, travelGuideMenuSelected){

	/* Header Tabs Click Functions : Starts */
	$j("#web").click(function (){
		changeSearchTab("search", false);return false;
	})
	
	$j("#images").click(function (){
		changeSearchTab("images", false);return false;
	})
	
	$j("#video").click(function (){
		changeSearchTab("video", false);return false;
	})
	
	$j("#news").click(function (){
		changeSearchTab("news", false);return false;
	})

	$j("#local").click(function (){
		changeSearchTab("local", false);return false;
	})
	/* Header Tabs Click Functions : Ends */

	/* Header Menu Mouseover & Mouseout Functions : Starts */
	$j("#dealsLI").mouseover(function (){
		headerMenuMouseOver("deals");
	})

	$j("#dealsLI").mouseout(function (){
		headerMenuMouseOut("deals", dealsMenuSelected);
	})

	$j("#travelIdeasLI").mouseover(function (){
		headerMenuMouseOver("travelIdeas");
	})

	$j("#travelIdeasLI").mouseout(function (){
		headerMenuMouseOut("travelIdeas", travelIdeasMenuSelected);
	})

	$j("#travelGuidesLI").mouseover(function (){
		headerMenuMouseOver("travelGuides");
	})

	$j("#travelGuidesLI").mouseout(function (){
		headerMenuMouseOut("travelGuides", travelGuideMenuSelected);
	})
	/* Header Menu Mouseover & Mouseout Functions : Ends */
}
/* Function to add onclick, onmouseout, onmouseover and onsubmit event in header : Starts */

function footerEvents(){
	$j("#ft_web").click(function (){
		changeSearchTab("search", true);return false;
	})
	
	$j("#ft_images").click(function (){
		changeSearchTab("images", true);return false;
	})
	
	$j("#ft_video").click(function (){
		changeSearchTab("video", true);return false;
	})
	
	$j("#ft_news").click(function (){
		changeSearchTab("news", true);return false;
	})

	$j("#ft_local").click(function (){
		changeSearchTab("local", true);return false;
	})	
}

function headerMenuMouseOver(objId){
	var objUL = objId + "UL";
	var objLI = objId + "LIA";
	var objFrame = objId + "Iframe";
	document.getElementById(objUL).style.display = "block";
	document.getElementById(objFrame).style.display = "block";
	document.getElementById(objLI).style.color = "#F4801E";
}

function headerMenuMouseOut(objId, menuSelectedFlag){
	var objUL = objId + "UL";
	var objLI = objId + "LIA";
	var objFrame = objId + "Iframe";
	document.getElementById(objUL).style.display = "none";
	document.getElementById(objFrame).style.display = "none";
	if(menuSelectedFlag)
		document.getElementById(objLI).style.color = "#49A3CA";
	else
		document.getElementById(objLI).style.color = "#555";
}

function checkTxtBoxValue(objId){
	if(document.getElementById(objId).value == '' || document.getElementById(objId).value == null) {
		return false;	
	}
}

$j(document).ready(function(){
	$j("a.emailThisLink").click(function(){
		staf_obj.sendEmail(); return false;
	})

	$j("a.imThisLink").click(function(){
		staf_obj.sendIM(); return false;
	})
});

function changeSearchTab(tabValue, footerFlag){
	if(!footerFlag) {
		var queryValue = $j("#srchBox").val();
		var liIdPrefix = "";
	} else {
		var queryValue = $j("#ft_srchBox").val();
		var liIdPrefix = "ft_";
	}

	var liID = tabValue;

	if(tabValue == "search"){
		liID = "web";
	}

	liActualId = liIdPrefix+liID;

	var actionUrl = $j("#"+ liActualId +" a").attr("href");

	if($j.trim(queryValue) != ""){
		createCookieObj("searchTerm", queryValue, 1);

		if(liActualId == "web" || liActualId == "ft_web"){
			actionUrl = "http://search.aol.com/aol/search?invocationType=hdtravel&query="+queryValue;
		} else {
			actionUrl += "?query="+queryValue; 
		}
	}

	window.open(actionUrl);
	return false;
}



	/*** JS required for Smart Box : Starts ***/

	/**
	 *  author:		Timothy Groves - http://www.brandspankingnew.net
	 *	version:	1.2 - 2006-11-17
	 *              1.3 - 2006-12-04
	 *              2.0 - 2007-02-07
	 *              2.1.1 - 2007-04-13
	 *              2.1.2 - 2007-07-07
	 *              2.1.3 - 2007-07-19
	 *
	 */

if (typeof(bsn) == "undefined")
	_b = bsn = {};


if (typeof(_b.Autosuggest) == "undefined")
	_b.Autosuggest = {};
else
	alert("Autosuggest is already set!");


_b.AutoSuggest = function (id, param)
{
	// no DOM - give up!
	//
	if (!document.getElementById)
		return 0;
	
	
	// get field via DOM
	//
	this.fld = _b.DOM.gE(id);

	if (!this.fld)
		return 0;
	
	
	// init variables
	//
	this.sInp 	= "";
	this.nInpC 	= 0;
	this.aSug 	= [];
	this.iHigh 	= 0;
	
	// parameters object
	//
	this.oP = param ? param : {};
	
	// defaults	
	//
	var k, def = {minchars:1, meth:"get", varname:"input", className:"autosuggest", timeout:2500, delay:10, offsety:-5, shownoresults: true, noresults: "No results!", maxheight: 250, cache: true, maxentries: 25};
	for (k in def)
	{
		if (typeof(this.oP[k]) != typeof(def[k]))
			this.oP[k] = def[k];
	}
	
	
	// set keyup handler for field
	// and prevent autocomplete from client
	//
	var p = this;
	
	// NOTE: not using addEventListener because UpArrow fired twice in Safari
	//_b.DOM.addEvent( this.fld, 'keyup', function(ev){ return pointer.onKeyPress(ev); } );
	
	this.fld.onkeypress 	= function(ev){ return p.onKeyPress(ev); };
	this.fld.onkeyup 		= function(ev){ return p.onKeyUp(ev); };
	
	this.fld.setAttribute("autocomplete","off");
};


_b.AutoSuggest.prototype.onKeyPress = function(ev)
{
	
	var key = (window.event) ? window.event.keyCode : ev.keyCode;

	// set responses to keydown events in the field
	// this allows the user to use the arrow keys to scroll through the results
	// ESCAPE clears the list
	// TAB sets the current highlighted value
	//
	var RETURN = 13;
	var TAB = 9;
	var ESC = 27;
	
	var bubble = 1;

	switch(key)
	{
		case RETURN:
			this.setHighlightedValue("enter");
			bubble = 0;
			break;

		case ESC:
			this.clearSuggestions();
			break;
	}

	return bubble;
};

_b.AutoSuggest.prototype.onKeyUp = function(ev)
{
	var key = (window.event) ? window.event.keyCode : ev.keyCode;
	
	// set responses to keydown events in the field
	// this allows the user to use the arrow keys to scroll through the results
	// ESCAPE clears the list
	// TAB sets the current highlighted value
	//

	var ARRUP = 38;
	var ARRDN = 40;
	
	var bubble = 1;

	switch(key)
	{
		case ARRUP:
			this.changeHighlight(key);
			bubble = 0;
			break;


		case ARRDN:
			this.changeHighlight(key);
			bubble = 0;
			break;
		
		
		default:
			this.getSuggestions(this.fld.value);
	}

	return bubble;
};

_b.AutoSuggest.prototype.getSuggestions = function (val)
{
	
	// if input stays the same, do nothing
	//
	if (val == this.sInp)
		return 0;
	
	// kill list
	//
	_b.DOM.remE(this.idAs);
	
	this.sInp = val;
	
	// input length is less than the min required to trigger a request
	// do nothing
	//
	if (val.length < this.oP.minchars)
	{
		this.aSug = [];
		this.nInpC = val.length;
		return 0;
	}
	
	var ol = this.nInpC; // old length
	this.nInpC = val.length ? val.length : 0;
	
	// if caching enabled, and user is typing (ie. length of input is increasing)
	// filter results out of aSuggestions from last request
	//
	var l = this.aSug.length;
	
	var pointer = this;
	var input = this.sInp;
	clearTimeout(this.ajID);
	this.ajID = setTimeout( function() { pointer.doAjaxRequest(input) }, this.oP.delay );

	return false;
};


_b.AutoSuggest.prototype.doAjaxRequest = function (input)
{
	// check that saved input is still the value of the field
	//
	if (input != this.fld.value)
		return false;
	
	var pointer = this;
	
	// create ajax request
	//
	if (typeof(this.oP.script) == "function") {
		var url = this.oP.script(encodeURIComponent(this.sInp));
	} else {
		var url = this.oP.script+"/"+encodeURIComponent(this.sInp);
	}
	
	if (!url)
		return false;
	
	var meth = this.oP.meth;
	var input = this.sInp;
	
	var onSuccessFunc = function (req) { pointer.setSuggestions(req, input) };
	var onErrorFunc = function (status) { /*alert("AJAX error: "+status);*/ };

	var myAjax = new _b.Ajax();
	myAjax.makeRequest( url, meth, onSuccessFunc, onErrorFunc );
};

_b.AutoSuggest.prototype.setSuggestions = function (req, input)
{
	// if field input no longer matches what was passed to the request
	// don't show the suggestions
	//
	if (input != this.fld.value)
		return false;
	
	this.aSug = [];
	
	if (this.oP.json)
	{
		var jsondata = eval('(' + req.responseText + ')');

		if(navigator.appVersion.indexOf('MSIE') != -1){
			jsonDateLen = jsondata.results.length - 1;
		} else {
			jsonDateLen = jsondata.results.length;
		}

		for (var i=0;i<jsonDateLen;i++)
		{
			this.aSug.push(  { 'id':jsondata.results[i].id, 'value':jsondata.results[i].value, 'info':jsondata.results[i].info }  );
		}
	}
	
	this.idAs = "as_"+this.fld.id;

	this.createList(this.aSug);

	if(navigator.appVersion.indexOf('MSIE 6') != -1) {
		var ulWidth  = $j("#as_ul").width();
		var ulHeight = $j("#as_ul").height();
		$j("#as_ifrm").width(ulWidth+3);
		$j("#as_ifrm").height(ulHeight+3);
		document.getElementById("as_ifrm").style.border = "none";
	}
};


_b.AutoSuggest.prototype.createList = function(arr)
{
	var pointer = this;
	
	// get rid of old list
	// and clear the list removal timeout
	//
	_b.DOM.remE(this.idAs);
	this.killTimeout();
	
	// if no results, and shownoresults is false, do nothing
	//
	if (arr.length == 0 && !this.oP.shownoresults)
		return false;
	
	// create holding div
	//
	var div = _b.DOM.cE("div", {id:this.idAs, className:this.oP.className});	

	try {
		document.execCommand('BackgroundImageCache', false, true);
	} catch(e) {}
	
	//Fix for IE6 selectbox Issue
	if(navigator.appVersion.indexOf('MSIE 6') != -1) {
		var iframe = _b.DOM.cE("iframe", {id:"as_ifrm",className:"ifram"});

		div.appendChild(iframe);
	}

	// create and populate ul
	//
	var ul = _b.DOM.cE("ul", {id:"as_ul"});
	
	// loop throught arr of suggestions
	// creating an LI element for each suggestion
	//
	for (var i=0;i<arr.length;i++)
	{
		// format output with the input enclosed in a EM element
		// (as HTML, not DOM)
		//
		var srchUrl = arr[i].info;
		var val = arr[i].value;
		var st = val.toLowerCase().indexOf( this.sInp.toLowerCase() );
		var output = val.substring(0,st) + val.substring(st, st+this.sInp.length) + val.substring(st+this.sInp.length);
		
		var span 		= _b.DOM.cE("span", {}, output, true);
	
		var a 			= _b.DOM.cE("a", { href:"#" });
		
		a.appendChild(span);
		
		a.name = i+1;
		a.onclick = function () { pointer.setHighlightedValue("click"); return false; };
		a.onmouseover = function () { pointer.setHighlight(this.name); };
		
		if(srchUrl.indexOf("hotel-detail") != -1){
			var li = _b.DOM.cE(  "li", {className:"hotelsIcon"}, a  );
		}else{
			var li = _b.DOM.cE(  "li", {className:"cityIcon"}, a  );
		}
		
		ul.appendChild( li );

	}
	
	
	// no results
	//
	if (arr.length == 0 && this.oP.shownoresults)
	{
		var li = _b.DOM.cE(  "li", {className:"as_warning"}, this.oP.noresults  );
		ul.appendChild( li );
	}
	
	div.appendChild( ul );

	// get position of target textfield
	// position holding div below it
	// set width of holding div to width of field
	//
	var pos = _b.DOM.getPos(this.fld);
	
	if(navigator.appVersion.indexOf('MSIE') != -1) {
		div.style.left 		= (pos.x)+ "px";
	} else {
		div.style.left 		= (pos.x - 1)+ "px";
	}
	div.style.width 	= this.fld.offsetWidth + "px";
	
	// set mouseover functions for div
	// when mouse pointer leaves div, set a timeout to remove the list after an interval
	// when mouse enters div, kill the timeout so the list won't be removed
	//
	div.onmouseover 	  = function(){ pointer.killTimeout() };
	div.onmouseout 		  = function(){ pointer.resetTimeout() };
	document.body.onclick = function(){ pointer.resetTimeout() };
	// add DIV to document
	//
	document.getElementsByTagName("body")[0].appendChild(div);

	if(this.fld.id == "ft_srchBox"){
		if(navigator.appVersion.indexOf('MSIE') != -1) {
			div.style.top 		= ((pos.y + this.oP.offsety - $j("#as_ul").height()) + 6) + "px";
		} else {
			div.style.top 		= ((pos.y + this.oP.offsety - $j("#as_ul").height()) + 3) + "px";
		}
	} else {
		div.style.top 		= ( pos.y + this.fld.offsetHeight + this.oP.offsety + 2 ) + "px";
	}
	
	// currently no item is highlighted
	//
	this.iHigh = 0;
	
	// remove list after an interval
	//
	var pointer = this;
	this.toID = setTimeout(function () { pointer.clearSuggestions() }, this.oP.timeout);
};

_b.AutoSuggest.prototype.changeHighlight = function(key)
{	
	var list = _b.DOM.gE("as_ul");
	if (!list)
		return false;
	
	var n;

	if (key == 40)
		n = this.iHigh + 1;
	else if (key == 38)
		n = this.iHigh - 1;
	
	
	if (n > list.childNodes.length)
		n = list.childNodes.length;
	if (n < 1)
		n = 1;
	
	
	this.setHighlight(n);
};

_b.AutoSuggest.prototype.setHighlight = function(n)
{
	var list = _b.DOM.gE("as_ul");
	if (!list)
		return false;
	
	if (this.iHigh > 0)
		this.clearHighlight();
	
	this.iHigh = Number(n);
	
	$j(list.childNodes[this.iHigh-1]).addClass("as_highlight")

	this.killTimeout();
};


_b.AutoSuggest.prototype.clearHighlight = function()
{
	var list = _b.DOM.gE("as_ul");
	if (!list)
		return false;
	
	if (this.iHigh > 0)
	{
		$j(list.childNodes[this.iHigh-1]).removeClass("as_highlight")
		this.iHigh = 0;
	}
};


_b.AutoSuggest.prototype.setHighlightedValue = function (eventFired)
{
	if (this.iHigh)
	{
		this.sInp = this.fld.value = this.aSug[ this.iHigh-1 ].value;
		
		// move cursor to end of input (safari)
		//
		this.fld.focus();
		if (this.fld.selectionStart)
			this.fld.setSelectionRange(this.sInp.length, this.sInp.length);
		

		this.clearSuggestions();

		var srchUrl = this.aSug[ this.iHigh-1 ].info;
		if(srchUrl.indexOf("hotel-detail") != -1){
			var hotelFlag = true;
			createCookieObj("HotelDetailDirect", "1");
		} else {
			var hotelFlag = false;
		}
		createCookieObj("searchTerm", this.sInp, 1);
		// pass selected object to callback function, if exists
		//
		if (typeof(this.oP.callback) == "function")
			this.oP.callback( this.aSug[this.iHigh-1], eventFired, hotelFlag);
	}
};


_b.AutoSuggest.prototype.killTimeout = function()
{
	clearTimeout(this.toID);
};

_b.AutoSuggest.prototype.resetTimeout = function()
{
	clearTimeout(this.toID);
	var pointer = this;
	this.toID = setTimeout(function () { pointer.clearSuggestions() }, 1000);
};


_b.AutoSuggest.prototype.clearSuggestions = function ()
{
	
	this.killTimeout();
	
	var ele = _b.DOM.gE(this.idAs);
	var pointer = this;
	if (ele)
	{
		var fade = new _b.Fader(ele,1,0,250,function () { _b.DOM.remE(pointer.idAs) });
	}
};


// AJAX PROTOTYPE _____________________________________________

if (typeof(_b.Ajax) == "undefined")
	_b.Ajax = {};

_b.Ajax = function ()
{
	this.req = {};
	this.isIE = false;
};

_b.Ajax.prototype.makeRequest = function (url, meth, onComp, onErr)
{
	
	if (meth != "POST")
		meth = "GET";
	
	this.onComplete = onComp;
	this.onError = onErr;
	
	var pointer = this;
	
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest)
	{
		this.req = new XMLHttpRequest();
		this.req.onreadystatechange = function () { pointer.processReqChange() };
		this.req.open("GET", url, true); //
		this.req.send(null);
	// branch for IE/Windows ActiveX version
	}
	else if (window.ActiveXObject)
	{
		this.req = new ActiveXObject("Microsoft.XMLHTTP");
		if (this.req)
		{
			this.req.onreadystatechange = function () { pointer.processReqChange() };
			this.req.open(meth, url, true);
			this.req.send();
		}
	}
};

_b.Ajax.prototype.processReqChange = function()
{
	
	// only if req shows "loaded"
	if (this.req.readyState == 4) {
		// only if "OK"
		if (this.req.status == 200)
		{
			this.onComplete( this.req );
		} else {
			this.onError( this.req.status );
		}
	}
};


// DOM PROTOTYPE _____________________________________________

if (typeof(_b.DOM) == "undefined")
	_b.DOM = {};

/* create element */
_b.DOM.cE = function ( type, attr, cont, html )
{
	var ne = document.createElement( type );
	if (!ne)
		return 0;
		
	for (var a in attr)
		ne[a] = attr[a];
	
	var t = typeof(cont);
	
	if (t == "string" && !html)
		ne.appendChild( document.createTextNode(cont) );
	else if (t == "string" && html)
		ne.innerHTML = cont;
	else if (t == "object")
		ne.appendChild( cont );

	return ne;
};

/* get element */
_b.DOM.gE = function ( e )
{
	var t=typeof(e);
	if (t == "undefined")
		return 0;
	else if (t == "string")
	{
		var re = document.getElementById( e );
		if (!re)
			return 0;
		else if (typeof(re.appendChild) != "undefined" )
			return re;
		else
			return 0;
	}
	else if (typeof(e.appendChild) != "undefined")
		return e;
	else
		return 0;
};

/* remove element */
_b.DOM.remE = function ( ele )
{
	var e = this.gE(ele);
	
	if (!e)
		return 0;
	else if (e.parentNode.removeChild(e))
		return true;
	else
		return 0;
};

/* get position */
_b.DOM.getPos = function ( e )
{
	var e = this.gE(e);

	var obj = e;

	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	
	var obj = e;
	
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;

	return {x:curleft, y:curtop};
};

// FADER PROTOTYPE _____________________________________________

if (typeof(_b.Fader) == "undefined")
	_b.Fader = {};

_b.Fader = function (ele, from, to, fadetime, callback)
{	
	if (!ele)
		return 0;
	
	this.e = ele;
	
	this.from = from;
	this.to = to;
	
	this.cb = callback;
	
	this.nDur = fadetime;
		
	this.nInt = 50;
	this.nTime = 0;
	
	var p = this;
	this.nID = setInterval(function() { p._fade() }, this.nInt);
};


_b.Fader.prototype._fade = function()
{
	this.nTime += this.nInt;
	
	var ieop = Math.round( this._tween(this.nTime, this.from, this.to, this.nDur) * 100 );
	var op = ieop / 100;
	
	if (this.e.filters) // internet explorer
	{
		try
		{
			this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity = ieop;
		} catch (e) { 
			// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
			this.e.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity='+ieop+')';
		}
	}
	else // other browsers
	{
		this.e.style.opacity = op;
	}
	
	
	if (this.nTime == this.nDur)
	{
		clearInterval( this.nID );
		if (this.cb != undefined)
			this.cb();
	}
};

_b.Fader.prototype._tween = function(t,b,c,d)
{
	return b + ( (c-b) * (t/d) );
};
	/*** JS required for Smart Box : Ends ***/
/*** Travel - Channel Header & Footer JS : Ends ***/

/*** Travel - Auth Code JS : Starts ***/

var rsp_cookie=getCk("RSP_COOKIE");var loginId=null;if(rsp_cookie){b64loginId=getValue(rsp_cookie,"name");if(b64loginId){loginId=base64Decode(b64loginId);}}function getCk(M){var c=document.cookie.indexOf(M+"=");if(c==-1){return null;}c=document.cookie.indexOf("=",c)+1;var p=document.cookie.indexOf(";",c);if(p==-1){p=document.cookie.length;}return unescape(document.cookie.substring(c,p));}function getValue(t,p){var M=t.split("&");nmvalpos=0;while(nmvalpos<M.length){if(M[nmvalpos].indexOf(p+"=")>=0){var m=M[nmvalpos].indexOf("=")+1;var c=M[nmvalpos].substring(m,M[nmvalpos].length);return c;}nmvalpos++;}return null;}function base64Decode(u){var E=new Array();var T=0,m=0,G,k=0,M=-1,p=0;var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];var X;for(T=0;T<u.length;T++){X=u.charAt(T);if("A"<=X&&X<="Z"){G=u.charCodeAt(T)-65;}else{if("a"<=X&&X<="z"){G=u.charCodeAt(T)-97+26;}else{if("0"<=X&&X<="9"){G=u.charCodeAt(T)-48+52;}else{if(X=="+"){G=62;}else{if(X=="/"){G=63;}else{continue;}}}}}M++;switch(M%4){case 0:k=G;continue;case 1:p=(k<<2)|(G>>4);k=G&15;break;case 2:p=(k<<4)|(G>>2);k=G&3;break;case 3:p=(k<<6)|(G>>0);k=G&0;break;}var L=p;if((L<32||L>126)&&(L!=13)&&(L!=10)){E[m++]="<";E[m++]=t[((L/16)&15)];E[m++]=t[((L/1)&15)];E[m++]=">";}else{E[m++]=String.fromCharCode(L);}}return E.join("");}

function checkAuth(id){
	var loginStr = null;
	var aolBrowser = (navigator.userAgent.toLowerCase().indexOf("aol") != -1)?1:0;
	
	if(typeof _sns_isLoggedIn != "undefined"){
		if(_sns_isLoggedIn == 1){	
			if(loginId != null){
				if(aolBrowser){		
					loginStr = "";	
					loginStr += "<span id='userName'>Hi "
					+loginId
					+"</span>";
				}else{
					loginStr = "";	
					loginStr += "<span id='userName'>Hi "
					+loginId
					+"</span>"
					+"<br />"
					+"<span id='sns_logout'><a href='#' onclick='javascript:userLogout();return false;'>Log out</a></span>"
				}
				createCookieObj("travelupstate", "1", "");
			}else{
				loginStr = "";
				loginStr += "<a id='sns_login' href='javascript:userLogin();'>Log In</a>";	
			}
		} else {
			loginStr = "";
			loginStr += "<a id='sns_login' href='javascript:userLogin();'>Log In</a>";	
		}
	} else {
		loginStr = "";
		loginStr += "<a id='sns_login' href='javascript:userLogin();'>Log In</a>";	
	}
	
	document.getElementById(id).innerHTML = loginStr;
}

function userLogin(){
	var url = window.location.toString();
	var list =  escape(url);
	var startUrl = "/_cqr/login/login.psp?mcState=initialized&sitedomain=travel.aol.com&authLev=1&seamless=y&lang=en&locale=us&siteState=OrigUrl%3d";
	var finalUrl = snsURL+ startUrl +list;
	window.location.href = finalUrl;
}

function userLogout(){
	var url = window.location.toString();
	var list =  escape(url);
	var startUrl = "/_cqr/logout/mcLogout.psp?mcState=initialized&sitedomain=travel.aol.com&authLev=1&seamless=y&lang=en&locale=us&siteState=OrigUrl%3d";
	var finalUrl = snsURL+ startUrl +list;
	eraseCookieObj("travelupstate");
	window.location.href = finalUrl;
}

/*** Travel - Auth Code JS : Ends ***/

/*** Travel - Email & IM JS : Starts ***/

function staf_SE() {

/*
 * 	 Author : STaF Team
 *
 */
	var omniture_tracking;

	// Email This variables
	var width, height;        // Width and Height of Email Popup
	var im_width, im_height;  // Width and Height of Email Popup
	var lang = "";            // Language parameter

	// IM Variables
	var message = "";        // IM Message
	var linkURL = "";        // Default URL is the current page.
	var pageTitle = "";      // Page Title
	var confirm = false;     // Confirmation pop-up window for non-AOL browsers

	// Launch IM
	var sendIM = function () {
		winl = (screen.width - im_width) / 2;
		wint = (screen.height - im_height) / 2;

		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;

		window.open("http://sendtoafriend.aol.com/im.adp?url=" + linkURL + "&title=" + pageTitle + "&lang=" + lang, "IM_Window", "height=" + im_height + ",width=" + im_width + ",top=" + wint + ",left=" + winl + ",statusbar=0,toolbar=0,menubar=0,location=0,resizable=0");
	}

	// Launch Email
	var sendEmail = function () {
		winl = (screen.width - width) / 2;
		wint = (screen.height - height) / 2;

		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;

		window.open("http://sendtoafriend.aol.com/?url=" + linkURL + "&title=" + pageTitle + "&lang=" + lang, "Email_Window", "height=" + height + ",width=" + width + ",top=" + wint + ",left=" + winl + ",statusbar=0,toolbar=0,menubar=0,location=0,resizable=0");
	}

	// Default Values
	var setDefault = function () {
		message = "Your friend wants you to check this out:";
		linkURL = escape(document.location);
		pageTitle = escape(document.title);
		confirm = false;
		width = ($j.browser.mozilla) ? 450 : 292;
		height = 500;
		im_width = ($j.browser.mozilla) ? 450 : 292;
		im_height = 150;
		lang = "en-US";
	}

	// Set default values.
	setDefault();

	return {

		sendIM: function () {

			if (omniture_tracking) {
				setOmniStaf("IM");
			}

			sendIM();
		},

		sendEmail: function () {

			if (omniture_tracking) {
				setOmniStaf("Email");
			}

			sendEmail();
		},

		setMessage: function (custom_message) {
			if (typeof(custom_message) == "string") {
				message = custom_message;
			}
		},

		setWidth: function (custom_width) {
			if (typeof(custom_width) == "number") {
				width = custom_width;
			}
		},

		setHeight: function (custom_height) {
			if (typeof(custom_height) == "number") {
				height = custom_height;
			}
		},

		setIMWidth: function (custom_width) {
			if (typeof(custom_width) == "number") {
				im_width = custom_width;
			}
		},

		setIMHeight: function (custom_height) {
			if (typeof(custom_height) == "number") {
				im_height = custom_height;
			}
		},

		setLang: function (custom_lang) {
			if (typeof(custom_lang) == "string") {
				lang = custom_lang;
			}
		},

		setTitle: function (custom_title) {
			if (typeof(custom_title) =="string") {
				pageTitle = escape(custom_title);
			}
		},

		setURL: function (custom_url) {
			if (typeof(custom_url) =="string") {
				linkURL = escape(custom_url);
			}
		}

	};

}

var staf_obj = new staf_SE(); staf_obj.setLang("en-US");

/*** Travel - Email & IM JS : Ends ***/


/*** Travel - ClaraBridge - Feedback JS : Starts ***/

/* fbLink v1.0b
/*  */
var _fBsp='%3A\\/\\/',_fBrp='%3A//',_fBd=document,_fBw=window,_fBr=escape(_fBw.location.href),_sW=screen.width,_sH=screen.height,_fBtm=(new Date()).getTime(),_fBpv=escape(_fBd.referrer);
function _fBe(_fBarg){_fBs=_fBsp+',\\/,\\.,-,_,'+_fBrp+',%2F,%2E,%2D,%5F';_fBa=_fBs.split(',');for(i=0;i<5;i++){eval('_fBarg=_fBarg.replace(/'+_fBa[i]+'/g,_fBa[i+5])')}return _fBarg;}
function _fBsG () {var _chG = typeof 's_channel' == 'undefined'? s_channel : "";return _chG;}
function _fBsH () {var _chH = 'channel' in s_265? s_265.channel : "";_chH = _chH=='undefined'?'':_chH;return _chH;}
function fBch() {var _ch = typeof s_265 == 'undefined'?_fBsG():_fBsH();return _ch;}
function fBo(_sid){_fBhref = 'http://feedback.aol.com/rs/rs.php?sid='+_sid;_fBw.open(_fBhref+'&time1='+_fBtm+'&time2='+(new Date()).getTime()+'&referer='+_fBe(_fBr)+'&prev='+_fBe(_fBpv)+'&width='+_sW+'&height='+_sH+'&ch='+fBch(),'feedback','width=535,height=425,screenX='+((_sW-535)/2)+',screenY='+((_sH-425)/2)+',top='+((_sH-425)/2)+',left='+((_sW-535)/2)+',resizable=yes,copyhistory=yes,scrollbars=no');return false;}
function fBo2(_sid){_fBhref = 'http://feedback.aol.com/rs/rs.php?sid='+_sid;_fBw.open(_fBhref+'&time1='+_fBtm+'&time2='+(new Date()).getTime()+'&referer='+_fBe(_fBr)+'&prev='+_fBe(_fBpv)+'&width='+_sW+'&height='+_sH+'&ch='+fBch(),'feedback','width=535,height=425,screenX='+((_sW-535)/2)+',screenY='+((_sH-425)/2)+',top='+((_sH-425)/2)+',left='+((_sW-535)/2)+',resizable=yes,copyhistory=yes,scrollbars=no');}

/*** Travel - claraBridge - Feedback JS : Ends ***/


/*** Travel - Common JS Functions : Starts ***/

/* Function to set a cookie */
function createCookieObj(name,value,days) {
        if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();
        } else {
			var expires = "";
		}
        document.cookie = name+"="+value+expires+"; path=/";
}

/* Function to read a cookie */
function readCookieVal(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 '';
}

/* Function to delete a cookie */
function eraseCookieObj(name) {
        createCookieObj(name,"",-1);
}


/* Function to find the X-Position of a object in the page*/
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

/* Function to find the Y-Position of a object in the page*/
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}