
var IEversion = IEver();
var myRegExp;
var origBgColor;

function cleanUpTxt(inTxt)
{
	var myRegExp = /_/gi;
	if(inTxt.search("_") != -1)
	{
		inTxt = inTxt.replace(myRegExp,"&nbsp;");
	}
	//The next bit strips off &nbsp; only from the start, if it's not at the start then it doesn't run
	if(inTxt.substr(0,6) == "&nbsp;" && inTxt.search("About&nbsp;7") == -1)
	{
		var tempRegExp = /&nbsp;/;
		inTxt = inTxt.replace(tempRegExp,"");
		//alert("Found a match in: " + inTxt);
	}
	var regExp2 = /[0-9]x/;
	if(inTxt.search(regExp2) != -1)
	{
		inTxt = inTxt.replace(regExp2,"");
	}
	return inTxt;
}

var mywin;
function openNewWindow(theURL,winName,features) {
  if(features == ''){features = "width=500,height=250,scrollbars=yes,resizable=no";}
  if(typeof(mywin) == 'object' && mywin.closed != true)
  {
	mywin.document.write("<p><b>...</b></p>");
	mywin.location = theURL;
  }
  else
  {
    mywin = window.open('',winName,features);
	mywin.document.write("<p><b>Please wait while KLM CONSTRUCTION Conects.....</b></p>");
	mywin.location = theURL;
  }
  mywin.focus();
}

function getURLinmainwindow(url)
{
	if(mywin.closed != true){mywin.close();}
	window.location = url;
}
function return_getURLinmainwindow(url)
{
	var outputURLStr
	if(IEver() < 4)
	{
		outputURLStr = "<a href=\"javascript:window.opener.getURLinmainwindow('" + url + "');\">Please "; 
  		outputURLStr += "click here for more details.</a>";
	} else {
		outputURLStr = "<a href=\"" + url + "\" target=\"_top\">Please "; 
  		outputURLStr += "click here for more details.</a>";
	}
	return outputURLStr;
}

function getSubMenuDepth(txtIn)
{
	//window.status = txtIn;
	var numRet, numArr;
	var regExp2 = /_[0-9]x/;
	if(txtIn.search(regExp2) != -1)
	{
		var regExp3 = /[0-9]/;
		numArr = txtIn.match(regExp3);
		numRet = numArr[0];
	}
	else
	{
		numRet = 1;
	}
	//window.status = numRet;
	return numRet;
}

function document_onmouseover()
{
	var srcElement = event.srcElement;
	origBgColor = srcElement.style.backgroundColor;
	if(srcElement.tagName == "TD" && typeof(srcElement.RollOver) != "undefined")
	{
		srcElement.style.backgroundColor = "#6699CC";
		if(IEversion >= 6){srcElement.style.cursor = "pointer";}
	}
}

function document_onmouseout()
{
	var srcElement = event.srcElement;
	if(srcElement.tagName == "TD" && typeof(srcElement.RollOut) != "undefined")
	{
		srcElement.style.backgroundColor = origBgColor;
		if(IEversion >= 6){srcElement.style.cursor = "default";}
	}
}

function linkmeup(goToUrl)
{
	//window.document.write("<p class=regularText>Please  while loading...</p>");
	window.location.href = goToUrl;
}

function IEver()
{
	var IEornot,IEnum;
	
	if(document.all)
	{
		IEornot = true;
	}
	else
	{
		IEornot = false;
	}
	
	IEnum = window.navigator.appVersion;
	var IEregExp = /\bMSIE\b [0-9]{0,2}(\.[0-9])?/i;
	var IEVersion;

	if(IEnum.search(IEregExp) != -1)
	{
		var matchArray = IEnum.match(IEregExp);
		//var strToTest = matchArray[0];
		IEregExp = /\b[0-9]+(\.[0-9]+)?\b/;
		matchArray = matchArray[0].match(IEregExp);
		IEVersion = parseInt(matchArray[0]);
	}
	else
	{
		IEVersion = 0;
	}
	
	return IEVersion;
}

