function getFavouriteOffers() {
   var allCookiesString = new String(document.cookie);
   var allCookiesArray = new Array();
   allCookiesArray = allCookiesString.split("; ");
   for (var i in allCookiesArray) {
       var current = new String(allCookiesArray[i]);
       if (current.indexOf("favouriteOffers") == 0) {
           var ids = new Array();
           ids = new String(current.replace("favouriteOffers=", "")).split(",");
           //alert(ids);
           return ids;
       }
   }
   
   return new Array();
}
function setFavouriteOffer(estateId, siteTitle) {
   var ids = getFavouriteOffers();
   var found = false;
   for (var i in ids) {
       if (ids[i] == estateId) {
           found = true;
           break;
       }
   }
   if (!found) {
      ids.push(estateId);
	  var date = new Date();
	  date.setMonth(11);
	  document.cookie = "favouriteOffers=" + ids.toString() + "; path=/; expires=" + date.toGMTString();
   }
   //alert("The site '" +siteTitle+ "' is added to 'Wish list'");
}
function deleteOffer(estateId) {
	var ids = getFavouriteOffers();
	var newIds = new Array();
 	var found = false;
  	for (var i in ids) {
    	if (ids[i] == estateId) {
           found = true;
       } else {
			newIds.push(ids[i]);
       }
    }
    //alert(newIds.toString());
    if (found) {
      ids.push(estateId);
	  var date = new Date();
	  date.setMonth(11);
	  document.cookie = "favouriteOffers=" + newIds.toString() + "; path=/; expires=" + date.toGMTString();
   }
}
function redraw() {
	
}
