/* this function opens a popup window named popupName that displays popupFile with height popupHeight and width popupWidth */
function openPopup(popupName,popupFile,windowFeatures)
{
	window.open(popupFile, popupName, windowFeatures);
}

/* this function sets a cookie with name cookieName and value cookieValue
  the cookie will expire in x years
  to delete the cookie, set x to a negative number such as -1 */
function setCookie(cookieName,cookieValue,x,cookieDomain,cookiePath)
{
	var today = new Date();
	var expYear = today.getFullYear() + x;
	var todayExpYear = new Date(expYear, today.getMonth(), today.getDate(), 0, 0, 0, 0);
	var cookieString = "";
	cookieString = cookieName + "=" + escape(cookieValue) + "; expires=" + todayExpYear.toGMTString();
	if (cookieDomain.length)
	{
		cookieString += "; domain=" + cookieDomain;
	}
	if (cookiePath.length)
	{
		cookieString += "; path=" + cookiePath;
	}
	document.cookie = cookieString;
}

/* this function sets a cookie with name cookieName */
function readCookie(cookieName)
{
	var allCookies = "" + document.cookie;
	var cookiePosition = allCookies.indexOf(cookieName);
	if (cookiePosition == -1 || cookieName == "")
	{
		return "";
	}
	else
	{
		var cookieValueStart = cookiePosition + cookieName.length + 1;
		var cookieValueEnd = allCookies.indexOf(';',cookieValueStart);
		if (cookieValueEnd == -1)
		{
			cookieValueEnd = allCookies.length;
		}
		return unescape(allCookies.substring(cookieValueStart, cookieValueEnd));
	}
}

function Lvl_P2P(url,closeIt,delay){ //ver1.0 4LevelWebs
 			opener.location.href = url;
	if (closeIt == true)setTimeout('self.close()',delay);
}


