
function trim(item) {
    return item.replace(/(^\s+)|(\s+$)/g, '');
}

function openWin(sDestination,sName,nWidth,nHeight,nLeft,nTop)
{
	if (!nLeft)
		nLeft = (document.body.clientWidth / 2) - (nWidth / 2);
	if (!nTop)
		nTop  = document.body.offsetTop;

	var sFeatures = 'directories=no,scrollbars=no,resizable=yes,top=' + nTop +',left=' + nLeft + ',width=' + nWidth + ',height=' + nHeight + ',status=no,toolbar=no';
	
	var bReplace = true;
	oWin = window.open(sDestination,sName,sFeatures,bReplace)
}

function RemoveFromQueryString( HttpUrl, Item )
{
	var i,ScriptName,QueryString,tempArray,resultStr;
	i = HttpUrl.indexOf("?")
	resultStr = "";
	if ( i > 0 )
	{
		ScriptName = HttpUrl.substr( 0, i );
		QueryString = HttpUrl.substr( i+1 );
		tempArray = QueryString.split("&");
		QueryString = "";
		for (i=0; i < tempArray.length; i++)
		{
			if ( tempArray[i].indexOf(Item + "=") != 0 )
				QueryString += "&" + tempArray[i];
		}
		resultStr = ScriptName;
		if ( QueryString != "" ) resultStr += "?" + QueryString.substr(1);
	}
	else
		resultStr = HttpUrl;
	
	return resultStr;
}