/* Start Cookie functions */

function GetCookie(name){
	var result = null;
	var ftcCookie = " " + document.cookie + ";";
	var searchName = " " + name + "=";
	var startOfCookie = ftcCookie.indexOf(searchName); // find pos of name
	var endOfCookie;
	if (startOfCookie != -1){
		startOfCookie += searchName.length; // Skip passed name to retrieve value
		endOfCookie = ftcCookie.indexOf(";", startOfCookie);
		result = unescape(ftcCookie.substring(startOfCookie,endOfCookie));
	}
	return result;
}

function SetCookie(name, value, expires, path, domain, secure){
	var expString = ((expires == null) ? "" : ("; expires="+ expires.toGMTString()));
	var pathString = ((path == null) ? "" : ("; path=" + path));
	var domainString = ((domain == null) ? "" : ("; domain=" + domain));
	var secureString = ((secure == true) ? "; secure=" : "");
	document.cookie = name + "=" + escape(value) +
	expString + pathString + domainString + secureString;
}