					function getPortfolio()
					{
						propertyIds = new Array();
						var sCookie = decodeURIComponent(document.cookie);
						var properties = sCookie.split("||");
						for(x = 0; x<properties.length-1;x++)
						{
							var temp = properties[x].split('=');
							propertyIds[x] = stripNonDigits(temp[0]);
						}
						if(propertyIds.length>0)
						{
							document.getElementById("portfolioMessage").innerHTML = "<a href='portfolio.asp' target='_top'>View Shortlist [" + propertyIds.length + "]</a><br/><br/>";
						}
						else
						{
							document.getElementById("portfolioMessage").innerHTML = "";
						}
						for(x = 0; x<propertyIds.length;x++)
						{
							if(document.getElementById("portfolio" + propertyIds[x]))
							{
								document.getElementById("portfolio" + propertyIds[x]).style.display="none";
								document.getElementById("removePortfolio" + propertyIds[x]).style.display="block";
							}
						}
					}
					
					function addToPortfolio(id, price, address, description, bid)
					{
						var sValue = price + "|" + address + "|" + description + "|" + bid;
						var	oExpires = new Date();
						oExpires.setDate(oExpires.getDate() + 30);
						setCookie(id, sValue, oExpires);
						getPortfolio();
						document.getElementById("portfolio" + id).style.display="none";
						document.getElementById("removePortfolio" + id).style.display="block";
					}

					
					function setCookie(sName, sValue, oExpires, sPath, sDomain, bSecure)
					{
						var sCookie = sName + "=" + encodeURIComponent(sValue + "||");
						
						//sCookie += "; expires=" + new Date(0).toGMTString();
						if(oExpires)
						{
							sCookie += "; expires=" + oExpires.toGMTString();
						}
						if(sPath)
						{
							sCookie += "; path=" + sPath;
						}
						if(sDomain)
						{
							sCookie += "; domain=" + sDomain;
						}
						if(bSecure)
						{
							sCookie += "; secure;"
						}
						document.cookie = sCookie;
					}
					
					function getCookie(sName)
					{
						var sRE = "(?:; )?" + sName + "=([^;]*);?";
						var oRE = new RegExp(sRE);
						
						if(oRE.test(document.cookie))
						{
							return decodeURIComponent(RegExp["$1"]);
						}
						else
						{
							return null;
						}
					}
					function removeFromPortfolio(ID)
					{
						deleteCookie(ID, "");
						document.getElementById("portfolio" + ID).style.display="block";
						document.getElementById("removePortfolio" + ID).style.display="none";
						getPortfolio();
					}
					function deleteCookie(sName, sValue, sPath, sDomain)
					{
						setCookie(sName, "", new Date(0), sPath, sDomain);
					}
					
					
					function stripNonDigits(n) 
					{
						var s = String(n);
						var re = /\D/g;
						return s.replace(re,"");
					}

