function findCookie(name) {
	if (document.cookie == '') { 
    return false;
	} else {
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	firstChar = theBigCookie.indexOf(name);
		if(firstChar != -1)  {
		firstChar += name.length + 1;
		lastChar = theBigCookie.indexOf(';', firstChar);
		if(lastChar == -1) lastChar = theBigCookie.length;
		return unescape(theBigCookie.substring(firstChar, lastChar));
		} else {
		return false;
		}
    }
}

function readCookie(info,data)
{
	var cookie = data;
	var separated_values = cookie.split("&");
	var property_value = "";
	for (var loop = 0; loop < separated_values.length; loop++)
	{
		property_value = separated_values[loop];
		var broken_info = property_value.split("|");
		var property = broken_info[0];
		var value = broken_info[1];
		info[property] = value;
	}
}

//traffic source cookie
var strSource  = "no cookie set";
var strDateSet = "";
var cookiedata = findCookie("trafficsource");
if (cookiedata) {
	var cookie_information = new Array();
	readCookie(cookie_information, cookiedata);
	strSource = cookie_information["source"];
	strDateSet = cookie_information["createdate"];
	}
else {
	strSource = "no cookie set";
}
//if (Safari125OrNewer) {
if (AnySafari) {
	strSource = escape(strSource);
	strDateSet = escape(strDateSet);
} else if ((brName == "Netscape") && (NS6OrNewer == false)) {
		strSource = "unavailable";
		strDateSet = "";
} else {
	//strNewSource = strSource.replace(/\s/g,"%20");
	strSource = escape(strSource);
	strDateSet = escape(strDateSet);
}


//web site optimizer cookie
var strWSL ="";
var strWSODateSet = "";
cookiedata = findCookie("websiteOptimizer");
if (cookiedata) {
	var cookie_information2 = new Array();
	readCookie(cookie_information2, cookiedata);
	strWSL = cookie_information2["id"];
	strWSODateSet = cookie_information2["createdate"];
}

//if (Safari125OrNewer) {
if (AnySafari) {
	strWSL = escape(strWSL);
	strWSODateSet = escape(strWSODateSet);
} else if ((brName == "Netscape") && (NS6OrNewer == false)) {
		strWSL = "";
		strWSODateSet = "";
} else {
	//strNewSource = strSource.replace(/\s/g,"%20");
	strWSL = escape(strWSL);
	strWSODateSet = escape(strWSODateSet);
}


//strSource = brName + "and" + NS6OrNewer + "and" + Safari125OrNewer + "and" + AnySafari

