
//----------------------------------------------------------------------
// Useful Page Functions
//----------------------------------------------------------------------

function JS_Utils_GetParent ( objElement )
{
	 if ( objElement.parentElement ) { return objElement.parentElement };
	 if ( objElement.parentNode ) { return objElement.parentNode };
	 if ( objElement.parent ) { return objElement.parent };
	 return;
}

function JS_Utils_ShowHide ( objElement, bShow )
{
	if ( bShow == null )
	{
		if ( objElement.style.display == "none" ) objElement.style.display = "block";
		else objElement.style.display = "none";
	}
	else
	{
		if ( bShow ) 	objElement.style.display = "block";
		else objElement.style.display = "none";
	}
	
}

//----------------------------------------------------------------------
//----------------------------------------------------------------------

function JS_Utils_Trim(s)
{
	return s.replace(/^\s+|\s+$/g,"");
}

function JS_Utils_LeftTrim(s)
{
	return s.replace(/^\s+/,"");
}

function JS_Utils_RightTrim(s)
{
	return s.replace(/\s+$/,"");
}

//----------------------------------------------------------------------
//----------------------------------------------------------------------




//----------------------------------------------------------------------
// Open Window (unused at present)
//----------------------------------------------------------------------

function JS_Utils_OpenWindow ( mypage, myname, w, h, scroll )
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresize'
	win = window.open(mypage, myname, winprops);
}

//----------------------------------------------------------------------
//----------------------------------------------------------------------
