//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//	Title			: Asynchronous Javascript And XML
//	Project			: Apothysis
//	Date Created	: 21 - Feb - 2006
//  Last Updated	: 26 - Mar - 2007
//	Programmer		: Horizon
//	Brief			: Rapid Dynamic Web Page Retrval Script.
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

//alert("Javascript - Common Methods Class Loaded ...");

var globalEditMode = false;
var curCISelProp = 'btn_general';
var globalAltirisManaged = 'Yes';

//---------------------------
// - Close Page Function - ||
//---------------------------
function closePage(pageRequestIn)
{			
	if(pageRequestIn != null)
		refreshPage(pageRequestIn)

	window.close();
}

//-----------------------------
// - Refresh Page Function - ||
//-----------------------------
function refreshPage(pageRequestIn)
{
	opener.document.location = pageRequestIn;
}

//-------------------------------
// - Go Back a Page Function - ||
//-------------------------------
function previousPage()
{
	window.history.back();
}

//---------------------------------------------------------------
// - Eliminate Blank Spaces From the Left Side of the String - ||
//---------------------------------------------------------------
function LTrim(str) 
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1) 
	{
		var j=0, i = s.length;
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
			j++;
			s = s.substring(j, i);
	}
		return s;
}
			
//----------------------------------------------------------------
// - Eliminate Blank Spaces From the Right Side of the String - ||
//----------------------------------------------------------------
function RTrim(str) 
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(s.length-1)) != -1) 
	{
		var i = s.length - 1;       // Get length of string
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
			i--;
			s = s.substring(0, i+1);
	}
	return s;
}
			
//------------------------------------------------------------
// - Eliminate Blank Spaces From Both Sides of the String - ||
//------------------------------------------------------------
function Trim(str)
{
	return RTrim(LTrim(str));
}

//------------------------------------------------------------
// - Pause Computer for x milliseconds - ||
//------------------------------------------------------------
function pausecomp(timeoutIn)
{
	var date = new Date();
	var curDate = null;

	do
	{ 
		curDate = new Date();
	}
	while(curDate-date < (timeoutIn))
}

//------------------------------------------------------------
// - Eliminate Blank Spaces From Both Sides of the String - ||
//------------------------------------------------------------
function searching()
{
	var searchString = document.getElementById("search").value;
	location.href ='http://www.gibmaritime.com/search_results.php?searchString='+searchString;
}

//----------------------------
// - Turn DIVs on and off - ||
//----------------------------
function switchDIV(divIDIn,noOfFoldersIn)
{
	for(i=0; i<=noOfFoldersIn; i++)
	{
		document.getElementById("div_folder_"+i+"_files").style.display = 'none'
	}
	document.getElementById("div_folder_"+divIDIn+"_files").style.display = 'block';
	
}