
function loadCookie(label)
{
	var cStart;
	var cEnd;
	
	cStart = document.cookie.indexOf(label + '=');
	if (cStart >= 0)
	{
		cStart += label.length + 1;
		cEnd = document.cookie.indexOf(';', cStart);
		if (cEnd == -1)
			cEnd = document.cookie.length;
		return unescape(document.cookie.substring(cStart, cEnd));
	}
	return "";
}

function saveCookie(label, value, expDays)
{
	var expDate = new Date();
	if (expDays == null || isNaN(parseInt(expDays))) expDays = gnExpDays__;
	expDate.setTime (expDate.getTime() + 1000 * 60 * 60 * 24 * parseInt(expDays)); //# of seconds
	document.cookie = label + '=' + escape(value) + ";expires=" + expDate.toUTCString(); // + ";path=/";
}

//Trim the string
function trim(sent) 
{
	var S = new String(sent);
	S = S.replace(/^\s+/g,"");
	return S.replace(/\s+$/g,"");
}

function popwindow_open(theURL,winName, features) 
{
	  popWin = window.open(theURL,winName,features);
	  popWin.focus();
}

function popwindow_close(url)
{
	if (window.opener != null)
	{
		window.close();
		window.opener.location = url ;
		window.opener.focus() ;
	}
	else
		window.location = url ;
}