
//Open Window
function OpenWindow(PageName, width, height, scrollbars)
{
	var screenwidth = 1015;
	var screenheight = 700;
	var left;
	var top;
	
	left = (screenwidth - width)/2;
	top = (screenheight - height)/2;
	
	window.open(PageName,'','scrollbars=' + scrollbars + ',resizable=yes,help=no,left=' + left + ',status=no,top=' + top + ',width=' + width + ',height= '+ height)
}

//Open Window From Parent Window
function OpenWindowFromParent(PageName, width, height, scrollbars)
{
	var screenwidth = 1015;
	var screenheight = 700;
	var left;
	var top;
	
	left = (screenwidth - width)/2;
	top = (screenheight - height)/2;
	
	window.parent.open(PageName,'','scrollbars=' + scrollbars + ',resizable=no,help=no,left=' + left + ',status=no,top=' + top + ',width=' + width + ',height= '+ height)
}

// Close window
function CloseWindow()
{
	window.close();		
}

//Closes window and refreshes parent window
function CloseWindowRefreshParent()
{
	window.opener.location = window.opener.location;
	window.close();	
}

//Opens Modal Window
function OpenModalWindow(PageName, width, height, resizable)
{	
	window.showModalDialog(PageName,'Information','dialogHeight:' + height + 'px; dialogWidth:' + width + 'px; center: yes; help:no; resizable:' + resizable + '; status:no');
}

function trim(stringToTrim) 
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
			
function ltrim(stringToTrim) 
{
	return stringToTrim.replace(/^\s+/,"");
}

function rtrim(stringToTrim)
{
	return stringToTrim.replace(/\s+$/,"");
}

function setActiveStyleSheet(title) 
{
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("LINK")[i]); i++) 
	{
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) 
		{	
			a.disabled = true;
			if(a.getAttribute("title") == title) 
			{
				a.disabled = false;
			}
		}
	}
}
