///////////////////////////////////////////////////////////////////
// Determine if a mcn member is logged in by investigating
// the cookie.
//
// cmm 10-25-2000
//
///////////////////////////////////////////////////////////////////
function isMemberLoggedIn(cookies){
	
	//var cookies;
	var start;
	var end;
	var mcn_cookie;
	var mcn_user_id;
	
	////////////////////////////////////////////////////
	// initialize the cookie
	////////////////////////////////////////////////////
	//cookies = document.cookie;
	
	////////////////////////////////////////////////////
	// search the cookie for our trademark cookie
	////////////////////////////////////////////////////
	start = cookies.indexOf("memtoken",1);
	
	if (start == -1) {
		return false;
	}
	else {
		start = start + 9;
	}
	
	end = cookies.indexOf(";",start);
	
	if (end == -1) {
		end = cookies.length;
	}

	////////////////////////////////////////////////////
	// chop our cookie attribute string out
	////////////////////////////////////////////////////
	mcn_cookie = cookies.substring(start,end);
	
	////////////////////////////////////////////////////
	// search for the UserID attribute
	////////////////////////////////////////////////////
	start = mcn_cookie.indexOf("sessionuserid",1);
	
	if (start == -1) {
		return false;
	}
	else {
		start = start + 14;
	}
	
	end = mcn_cookie.indexOf("&",start);
	
	if (end == -1) {
		end = mcn_cookie.length;
	}
	
	////////////////////////////////////////////////////
	// display the contents of the findings	
	////////////////////////////////////////////////////
	mcn_user_id = mcn_cookie.substring(start,end);
	
	///////////////////////////////////////////////////
	// Debugging:
	///////////////////////////////////////////////////
	//alert("Full Cookie: " + cookies);
	//alert("Start: " & start);
	//alert("End: " + end);
	//alert("Mcn_Cookie: " + mcn_cookie);
	//alert("UserID: " + mcn_user_id);
	
	if (mcn_user_id == "") {
		return false;
	}
	else {
		return true;
	}
}