// Include this file before any other javascript include file.

// Establish whether we are on the test site or not. If the test site changes, change
// the www.minisage.com to whatever the new test site is.
var bTestSite=false;
if (window.location.toString().toLowerCase().indexOf("www.minisage.com") > -1)
{
	bTestSite=true;
}

//****************************************************
// IsMac
//****************************************************
function IsMac()
{
  if(navigator.appVersion.indexOf("Win") != -1)
  {
    return false;
  }
  else if(navigator.appVersion.indexOf("Mac") != -1)
  {
    return true;
  }
  else return false;
}

//****************************************************
// IsNumberInt
//****************************************************
function IsNumberInt(inputString)
{
  return (!isNaN(parseInt(inputString))) ? true : false;
}	

//****************************************************
// popUpLinkWindow
//****************************************************
var popUpLinkWin=0;
function popUpLinkWindow(url)
{
  	if(popUpLinkWin)
  	{
    	if(!popUpLinkWin.closed) popUpLinkWin.close();
  	}
	
	popUpLinkWin = open(url, 'link', 'height=400,width=600,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,directories=yes,status=yes');
	popUpLinkWin.focus();
}
//****************************************************
// popUpEmailWindow
//****************************************************
var popUpEmailWin=0;
function popUpEmailWindow(url)
{
  	if(popUpEmailWin)
  	{
    	if(!popUpEmailWin.closed) popUpEmailWin.close();
  	}
	
	popUpEmailWin = open(url, 'email', 'height=600,width=575,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=yes,status=yes');
	popUpEmailWin.focus();
}
//****************************************************
// popUpGeneralWindow
//****************************************************
var popUpGeneralWin=0;
function popUpGeneralWindow(url)
{
  	if(popUpGeneralWin)
  	{
    	if(!popUpGeneralWin.closed) popUpGeneralWin.close();
  	}
	
	popUpGeneralWin = open(url, 'General', 'height=600,width=575,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,directories=yes,status=yes');
	popUpGeneralWin.focus();
}

//****************************************************
// popUpDLWindow
//****************************************************
var popUpDLWin=0;
function popUpDLWindow(url)
{
  	if(popUpDLWin)
  	{
    	if(!popUpDLWin.closed) popUpDLWin.close();
  	}
	
	popUpDLWin = open(url, 'DL', 'top=3000,left=3000,height=1,width=1,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=yes,directories=no,status=no,dependent=yes');
	popUpDLWin.resizeTo(1,1);
	popUpDLWin.moveTo(2000,2000);
	popUpDLWin.blur();
}

//****************************************************
// ConvertHTML
// Converts the opening and closing HTML tags to parens
//****************************************************
function ConvertHTML(sInput)
{
	var sOutput = sInput;
    sOutput=sOutput.replace(/</g,"(");
    sOutput=sOutput.replace(/>/g,")");
	return sOutput;
}
//****************************************************
// JSTrim
// Removes leading and trailing characters from a string
//****************************************************
function JSTrim (inputString, removeChar) 
{
	var returnString = inputString;
	if (removeChar.length)
	{
	  while(''+returnString.charAt(0)==removeChar)
		{
		  returnString=returnString.substring(1,returnString.length);
		}
		while(''+returnString.charAt(returnString.length-1)==removeChar)
	  {
	    returnString=returnString.substring(0,returnString.length-1);
	  }
	}
	return ConvertHTML(returnString);
}
//****************************************************
// JSTrimSpace
// Removes leading and trailing spaces from a string
//****************************************************
function JSTrimSpace(inputString)
{
	return JSTrim(inputString,' ');
}

