vc = new cookieObject();
	
	function delFromSuitcase(strVillaID)
	{
		suitcase =  vc.get("suitcase");
		arr = (suitcase).split(",");
		ln = arr.length;
		
		strSuitcase = new String("");
		
		for (n=0; n < ln;n++)
		{
			if (arr[n] != strVillaID)
			{
				strSuitcase += ((strSuitcase.length > 0) ? "," : "") + arr[n];
			}
		}
		
		vc.set("suitcase",strSuitcase);
		try
		{
			ele = document.getElementById("suitcase_"+strVillaID);
			ele.innerHTML = "Unpacked"; 
		} catch(e) { 
			//alert(e.toString()); 
		}
		history.go(0); //refresh
	}
	
	
	
function addToSuitcase(strVillaID)
{
	//check that there is a cookie set and if we need to add a ',' before adding this item
	var arr = new Array();
	var blnSuitcaseFull = false;         //flag to record if the suitcase is full
	arr["path"] = "/";
    // check if there are 8 items already in the suitcase
    sc =  vc.get("suitcase");
    if (sc != "underfined" && sc.length>1)
    {
        var arrSc = sc.split(",");
        if (arrSc.length >7)
        {
            alert("Your suitcase is fully packed with villas.\nPlease go to the enquiries page, or go to 'My Suitcase' to unpack some villas");
            blnSuitcaseFull = true;
        }
    }
      
	 
    if (!blnSuitcaseFull)
    {
        
    	vc.set("suitcase",
    			((vc.get("suitcase") && vc.get("suitcase") != "undefined") ? vc.get("suitcase") + ",": "") 
    			+ strVillaID,arr);
    	
    	setTags("Suitcase_" + strVillaID, "Added to suitcase");
	}
}

function setTags(tagName, str)
{
	try
	{
		arr = document.getElementsByTagName(tagName);
		
		if (arr.length>0)
		{
			for (n=0; n<arr.length;n++)
			{
				arr[n].innerHTML = str;
			}
		}	
	} catch (e)
	{
	}
}

function villaEnquire(id)
{
	addToSuitcase(id);
	window.location.href="/villa_enquire.php?mag=1";
	
}