var d, dom, ie, ie4, ie5x, moz, mac, win, lin, old, ie5mac, ie5xwin, op;

theFrame = false;
theDiv = false;
theClient = false;
gSearchArea = '';
eiProxyURL = '';
d = document;
n = navigator;
na = n.appVersion;
nua = n.userAgent;
win = ( na.indexOf( 'Win' ) != -1 );
mac = ( na.indexOf( 'Mac' ) != -1 );
lin = ( nua.indexOf( 'Linux' ) != -1 );

if ( !d.layers ){
	dom = ( d.getElementById );
	op = ( nua.indexOf( 'Opera' ) != -1 );
	konq = ( nua.indexOf( 'Konqueror' ) != -1 );
	saf = ( nua.indexOf( 'Safari' ) != -1 );
	moz = ( nua.indexOf( 'Gecko' ) != -1 && !saf && !konq);
	ie = ( d.all && !op );
	ie4 = ( ie && !dom );

	ie5x = ( d.all && dom );
	ie5mac = ( mac && ie5x );
	ie5xwin = ( win && ie5x );
}

function doAjaxRequest(url, nameOfObjectToLoad) {
	AjaxRequest.get({
      		'url': url,
      		'onLoading':function() {getObj(nameOfObjectToLoad).innerHTML = '<table width=100%><tr><td align=center><B>Loading....</B><BR><IMG SRC="/Images/progress.gif"></td></tr></table>';},
      		'onSuccess':function(req) {
      			getObj(nameOfObjectToLoad).innerHTML = req.responseText;
      		}     		
    	})
}

function doAjaxRequestNoLoading(url, nameOfObjectToLoad) {
	AjaxRequest.get({
      		'url': url,
//      		'onLoading':function() {getObj(nameOfObjectToLoad).innerHTML = '<B>Loading...</B>';},
      		'onSuccess':function(req) {
      			getObj(nameOfObjectToLoad).innerHTML = req.responseText;
      		}     		
    	})
}

function replaceSelectOptions(obj, options)
{
	if (ie) {
		var strData = '' + obj.outerHTML;	
		strData = strData.substring(0, strData.indexOf('>')+1);
		strData = strData + options;
		strData = strData + '</SELECT>';
		obj.outerHTML = strData;
        } else {
        	obj.innerHTML = options;
        }	
}

function isObjVisible(objName)
{
	return getObj(objName).style.display == '';
}

function setObjDisp(objName, newDispVal)
{
	getObj(objName).style.display = newDispVal;
}

function getSelectText(sel) {
	return sel.options[sel.selectedIndex].text;
}
	
function getObj(id) {
	return document.getElementById(id);
}	

function getTopPos(inputObj)
{	
	var returnValue = inputObj.offsetTop;
	while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
	return returnValue;
}

function getLeftPos(inputObj)
{
	var returnValue = inputObj.offsetLeft;
	while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
	return returnValue;
}
