function stopError() {
  return true;
}

window.onerror = stopError();

/*//---------------------------------------------*/
/*// Name: ping_page()							 */
/*// Desc: Send Get Variables to page 			 */
/*//---------------------------------------------*/
function ping_page(pageLocation)
{
	var xmlHttp;

	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not have the correct requirements to run this software, please contact support immediately");
				return false;
			}
		}
	}

	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			return true;
		}
	}

	xmlHttp.open("GET", pageLocation ,true);
	xmlHttp.send(null);
}

/*//---------------------------------------------*/
/*// Name: post_form_popBox()					 */
/*// Desc: POST form & load content				 */
/*//---------------------------------------------*/
function post_form_popBox (pageLocation, elementId, formId, width, height)
{
	var xmlHttp;	
	var currentForm = document.getElementById(formId);
	var elementId2 = document.getElementById(elementId);
	
	
	if	(
			width != null &&
			width != undefined
		)
	{
		document.getElementById(elementId).style.width = width + "px";
		document.getElementById(elementId).style.marginLeft = "-" + width / 2 + "px";
	}
	
	if	(
			height != null &&
			height != undefined
		)
	{
		document.getElementById(elementId).style.height = height + "px";
		document.getElementById(elementId).style.marginTop = "-" + height / 2 + "px";
	}
	
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not have the correct requirements to run this software, please contact support immediately");
				return false;
			}
		}
	}
	
	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState < 4)
		{
			document.getElementById(elementId).innerHTML = '<div id="load"></div>';
		}
		else if(xmlHttp.readyState == 4)
		{
			document.getElementById(elementId).innerHTML = '<div id="close" onClick="popBoxClose();"></div>' + xmlHttp.responseText;

			realWidth = 400;
			realHeight = 400;

			if(document.getElementById('popBox').childNodes[1].tagName == 'FORM')
			{
				var parent = document.getElementById('popBox').childNodes[1];
				if(parent.childNodes[0].tagName == 'TABLE')
				{
					realWidth = parent.childNodes[0].offsetWidth;
					realHeight = parent.childNodes[0].offsetHeight;
				}
				else if(parent.childNodes[1].tagName == 'TABLE')
				{
					realWidth = parent.childNodes[1].offsetWidth;
					realHeight = parent.childNodes[1].offsetHeight;
				}
				else
				{
					realWidth = parent.childNodes[2].offsetWidth;
					realHeight = parent.childNodes[2].offsetHeight;
				}
			}
			else
			{
				realWidth = document.getElementById('popBox').childNodes[1].offsetWidth;
				realHeight = document.getElementById('popBox').childNodes[1].offsetHeight;
			}

			elementId2.style.width = realWidth + 'px';
			elementId2.style.height = realHeight + 'px';
			elementId2.style.marginLeft = '-' + Math.round((realWidth / 2)) + 'px';
			elementId2.style.marginTop = '-' + Math.round((realHeight / 2)) + 'px';		
			
			if(document.forms.popBoxForm)
			{
				document.forms.popBoxForm[0].focus();
			}
		}
	}

	var postData = '';
	
	for (var i = 0; i < currentForm.elements.length; i++)
	{
		var thisElement = currentForm.elements[i];
		var elementType = thisElement.type;
		var elementName = thisElement.name;
		var elementValue = thisElement.value;
					
		if (elementType == 'text' || elementType == 'hidden' || elementType == 'textarea' || elementType == 'password')
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
		else if (
					elementType == 'checkbox' &&
					thisElement.checked == true
				)
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
		else if (
					elementType == 'radio' &&
					thisElement.checked == true
				)
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
		else if (
					elementType == 'select-one'
				)
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
	}
	
	xmlHttp.open("POST", pageLocation, true);
	xmlHttp.setRequestHeader(
			'Content-Type',
			'application/x-www-form-urlencoded; charset=UTF-8'
		);
	xmlHttp.send(postData);
	
	return false;
}

/*//---------------------------------------------*/
/*// Name: post_form()							 */
/*// Desc: POST form & load content				 */
/*//---------------------------------------------*/
function post_form (pageLocation, elementId, formId, noCloseButton)
{
	var xmlHttp;	
	var currentForm = document.getElementById(formId);
	
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not have the correct requirements to run this software, please contact support immediately");
				return false;
			}
		}
	}

	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState < 4)
		{
			document.getElementById(elementId).innerHTML = '<div id="loadGrey"></div>';
		}
		else if(xmlHttp.readyState == 4)
		{
			if (noCloseButton > 0)
			{
				document.getElementById(elementId).innerHTML = xmlHttp.responseText;
			}
			else
			{
				document.getElementById(elementId).innerHTML = '<div id="close" onClick="popBoxClose();"></div>' + xmlHttp.responseText;
			}
			document.forms.popBoxForm[0].focus();
		}
	}

	var postData = '';
	
	for (var i = 0; i < currentForm.elements.length; i++)
	{
		var thisElement = currentForm.elements[i];
		var elementType = thisElement.type;
		var elementName = thisElement.name;
		var elementValue = thisElement.value;
					
		if (elementType == 'text' || elementType == 'hidden' || elementType == 'textarea')
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
		else if (
					elementType == 'checkbox' &&
					thisElement.checked == true
				)
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
		else if (
					elementType == 'radio' &&
					thisElement.checked == true
				)
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
		else if (
					elementType == 'select-one'
				)
		{
			postData = postData + '&' + elementName + '=' + elementValue;
		}
	}

	xmlHttp.open("POST", pageLocation, true);
	xmlHttp.setRequestHeader(
			'Content-Type',
			'application/x-www-form-urlencoded; charset=UTF-8'
		);
	xmlHttp.send(postData);
	
	return false;
}

function getInternetExplorerVersion()
{
	var rv = -1; // Return value assumes failure.
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		var ua = navigator.userAgent;
		var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if (re.exec(ua) != null)
			rv = parseFloat( RegExp.$1 );
	}
	return rv;
}

function getElemntSize(elementid)
{
	var myWidth = 0;
	var myHeight = 0;
	var elem = document.getElementById(elementid);
	
	if( typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	return { width : myWidth, height : myHeight};
}

function getSize()
{
	var myWidth = 0;
	myHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	return { width : myWidth, height : myHeight};
}

function returnObjById( id )
{
	if (document.getElementById)
		var returnVar = document.getElementById(id);
	else if (document.all)
		var returnVar = document.all[id];
	else if (document.layers)
		var returnVar = document.layers[id];
	return returnVar;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function bosOpenPopupWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}