function setCookie(cookieName, cookieValue, lifeTimeMonths, path, domain, isSecure) 
{
	//get cookie duration
	lifeTimeDate=getCookieLifeTime(lifeTimeMonths)
	//default path
	if (!path)
		{
		path="/"
		}
		if(!cookieName ) 
		{ 
		return false; 
		}
	//not sure ?=0r but what is : for
	strCookie = escape( cookieName ) + "=" + escape( cookieValue ) +
		( lifeTimeDate ? ";expires=" + lifeTimeDate : "" ) + 
		( path ? ";path=" + path : "") + 
		( domain ? ";domain=" + domain : "") + 
		( isSecure ? ";secure" : "");
	document.cookie = strCookie	
}
function getCookie(cookieName) 
{
	var cookieJar = document.cookie.split("; ");
	for(var x = 0; x < cookieJar.length; x++) 
	{
		var oneCookie = cookieJar[x].split("=");
		if(oneCookie[0] == escape(cookieName)) 
			{
			//return logic values not text for check boxes
			if(oneCookie[1] == "true")
				{
				return true
				}
			 if(oneCookie[1] == "false")
				{
				return false
				}
			if(oneCookie[1] == "")
				{
				return "";
				}
			return unescape(oneCookie[1]) 
			}
	}
	//cookie not found so return null
	return "";
}
function getCookieLifeTime (MonthsReqText)
{
	//if no duration specified set it to 24
	//setCookie( "test", "fred","24 Months");
	//x=setCookie( "test2", "", "00 Months delete");
	
	//set expiry to now by creating a new date variable
	expiryDate = new Date
	if (!MonthsReqText)
		{
		//set expiry 2yr
		lifeTimeDate = expiryDate.setMonth(expiryDate.getMonth()+24)
		return expiryDate.toGMTString()
		}
	//get months
	monthsNo=MonthsReqText.substring(0, 2);          	
	if(monthsNo == 0) 
		{
			lifeTimeDate = expiryDate.setMonth(expiryDate.getMonth()-10)
			return expiryDate.toGMTString()
		}
	//set months from now
	lifeTimeDate = expiryDate.setMonth(expiryDate.getMonth() + monthsNo)
	return expiryDate.toGMTString()
}

