function shortlist_Disp(cottCode){	if ($("slist")){		var foundflag = "0";		var oldstr = getCookie("shortlist");		if (oldstr != null) {			shortlist = oldstr.split(",")						for (i=0; i<shortlist.length; i++) {				if (shortlist[i] == cottCode) {					foundflag = "1";				}			}		}				var strSlist;		if (foundflag == "1"){			strSlist="Shortlisted&nbsp;|&nbsp;<a class=a2 href='/my-classic/MyShortlist.aspx'>View Shortlist</a>&nbsp;|&nbsp;<a class=a2 href='javascript:shortlist_Del(" + cottCode + ");shortlist_Disp(" + cottCode + ")'>Remove</a>"		}		else{			strSlist="<a class=a2 href='javascript:shortlist_Add(" + cottCode + ");shortlist_Disp(" + cottCode + ")'>Add to shortlist</a>"		}		$("slist").innerHTML = strSlist;	}}	function shortlist_Clr()	{	var oldstr = getCookie("shortlist");	var today = new Date;	var expdate = new Date("January 1, 1980");		if (oldstr != null)		{			setCookie("shortlist","none",expdate)		}		else		{			alert("Your shortlist is already empty!")		}	}function shortlist_Add(cottCode)	{	var oldstr = getCookie("shortlist");	var oldlist = new Array();	var today = new Date;	var expdate = new Date(today.getFullYear(),today.getMonth()+1,today.getDate());			if (oldstr != null) 		{		oldlist = oldstr.split(",")		var foundflag = "0"		for (i=0; i<oldlist.length; i++)			{			if (oldlist[i] == cottCode) 				{				alert("Cottage " + cottCode + " is already included in your shortlist!")				foundflag = "1"				}			}		if (foundflag == "0")			{			newstr = oldstr + "," + cottCode			setCookie("shortlist",newstr,expdate)			}			}	else		{		newstr = cottCode		setCookie("shortlist" ,newstr,expdate)		}	}function shortlist_Del(cottCode)	{	var oldstr = getCookie("shortlist");	var oldlist = new Array();	var newlist = new Array();	var today = new Date;	var expdate = new Date(today.getFullYear(),today.getMonth()+1,today.getDate());		var foundflag = "0";	if (oldstr != null) 		{		var j = "0"		oldlist = oldstr.split(",")		for (i=0; i<oldlist.length; i++)			{			if (oldlist[i] != cottCode)				{				newlist[j] = oldlist[i]				j++				}			else				{				foundflag = "1"				}			}					if (foundflag == "1") 			{			if (newlist.length == "0") {				shortlist_Clr()			} else {				newstr = newlist.join(",")				setCookie("shortlist",newstr,expdate)			}			}		else 			{				alert("Cottage " + cottCode + " is not included on your shortlist")			}		}	else 		{		alert("Your shortlist is empty!")		}	}function setCookie(name,value,expires,path,domain,secure) {path = "/"document.cookie = name + "=" + escape (value) +((expires) ? "; expires=" + expires.toGMTString() : "") +((path) ? "; path=" + path : "") +((domain) ? "; domain=" + domain : "") +((secure) ? "; secure" : "");}function getCookie (name) {	var arg = name + "=";	var alen = arg.length;	var clen = document.cookie.length;	var i = 0;	while (i < clen) {		var j = i + alen;			if (document.cookie.substring(i, j) == arg)				return getCookieVal (j);				i = document.cookie.indexOf(" ", i) + 1;			if (i == 0) break;	}	return null;}function getCookieVal(offset) {var endstr = document.cookie.indexOf (";", offset);if (endstr == -1)endstr = document.cookie.length;return unescape(document.cookie.substring(offset, endstr));}function shortlist_load(){
	var currentTime = new Date();
	var request=new xmlHttpRequestObject();
	var reqUri='/my-classic/shortlist.aspx?t=' + currentTime.toUTCString();
	request.open('GET',reqUri, true);
	request.onreadystatechange = function() {
		if (request.readyState == 4) {
			$('frmShortlist').innerHTML = request.responseText;
		}
	}
	
	request.send(null);
}	