//
//	getCookie.js
//
//	Get a cookie.
//
//	Author: pky
//
//	Copyright (c) ZePortal.com Ltd, 2001-2002. All Rights Reserved.
//

function getCookie(cname) {
	var allcookies = document.cookie;
	var value = "";

	if (allcookies != null) {
		var cookies = allcookies.split(";");

		for (i=0; i<cookies.length; i++) {
			var cookie = cookies[i];
			var start = 0;
			var end = cookie.indexOf("=");

			while (start < end && cookie.charAt(start) == ' ') start++;

			if (end != -1 && cookie.substring(start,end) == cname) {
				value = unescape(cookie.substring(end+1));
				return value;
			}
		}
	}
	return value;
}

