/////////////////////////////////////////////////////////////////////////////////////////////////

function read_cookie (key, skips)
{
	// Set skips to 0 if parameter was omitted:
	if (skips == null)
		skips = 0;

	// Get cookie string and separate into individual cookie phrases:
	var cookie_string = "" + document . cookie;
	var cookie_array = cookie_string . split ("; ");

	// Scan for desired cookie:
	for (var i = 0; i < cookie_array . length; ++ i)
	{
		var single_cookie = cookie_array [i] . split ("=");
		if (single_cookie . length != 2)
			continue;
		var name  = unescape (single_cookie [0]);
		var value = unescape (single_cookie [1]);

		// Return cookie if found:
		if (key == name && skips -- == 0)
			return value;
	}

	// Cookie was not found:
	return null;
}

uid = (read_cookie('uid',null) != null)?read_cookie('uid',null):'0';
premium = (read_cookie('premium',null) != null)?read_cookie('premium',null):'0';

visitNum = (read_cookie('visitNum',null) != null)?read_cookie('visitNum',null):'0';
//alert("UID=" + uid + "\n\nNUM=" + visitNum)
//if(uid == '0' || premium == '0' || visitNum<2)
if(uid == '0')
{
	theLink = "/premium/login/login.pl?target=" + self.location.href;
	self.location.replace(theLink);
}
