browser = navigator.appName.toLowerCase();
version = navigator.appVersion.substring(0,1);
userAgent = navigator.userAgent.toLowerCase();

NN4 = ((browser.indexOf("netscape") >= 0) && (userAgent.indexOf("mozilla/4") >= 0));
NN6 = (userAgent.indexOf("netscape6") >= 0);
NN7 = (userAgent.indexOf("netscape/7") >= 0);
MO = ((userAgent.indexOf("gecko") >= 0) && (userAgent.indexOf("netscape") == -1));
IE4 = ((userAgent.indexOf("msie 4") >= 0) && (userAgent.indexOf("opera") == -1));
IE5 = ((userAgent.indexOf("msie 5") >= 0) && (userAgent.indexOf("opera") == -1));
IE6 = ((userAgent.indexOf("msie 6") >= 0) && (userAgent.indexOf("opera") == -1));
OP4 = ((userAgent.indexOf("opera 4") >= 0) || (userAgent.indexOf("opera/4") >= 0));
OP5 = ((userAgent.indexOf("opera 5") >= 0) || (userAgent.indexOf("opera/5") >= 0));
OP6 = ((userAgent.indexOf("opera 6") >= 0) || (userAgent.indexOf("opera/6") >= 0));
KQ = (userAgent.indexOf("konqueror") >= 0);

NN = (NN4 || NN6 || NN7);
IE = (IE4 || IE5 || IE6);
OP = (OP4 || OP5 || OP6);
DOM2 = (NN6 || NN7 || MO || IE5 || IE6 || OP4 || OP5 || OP6);

Win = (userAgent.indexOf("win") >= 0);
Mac = (userAgent.indexOf("mac") >= 0);
X11 = ((userAgent.indexOf("x11") >= 0) || (userAgent.indexOf("linux") >= 0));

WinNT = (userAgent.indexOf("windows nt 4") >= 0);
Win2K = (userAgent.indexOf("windows nt 5.0") >= 0);
WinXP = (userAgent.indexOf("windows nt 5.1") >= 0);



this.isUndefined = function(obj)
  {
    return(typeof(obj) == "undefined");
  };
	
this.isNull = function(obj)
  {
    return((typeof(obj) == "object") && (obj===null));
  };

this.isNative = function(obj)
  {
    return(!isUndefined(obj) && !isNull(obj) && (typeof(obj.constructor) == "function"));
  };
	
this.isNumber = function(obj)
  {
    return(isNative(obj) && (obj.constructor == Number) && isFinite(obj));
  };



if (document.all && !document.getElementsByTagName)
{
  document.getElementsByTagName = function(tagName) {return document.all.tags(tagName);};
}

if (isNumber(window.innerWidth) && isNumber(window.innerHeight))
{
  // mozilla
  document.getClientWidth = function() {return window.innerWidth;};
  document.getClientHeight = function() {return window.innerHeight;};
}
else if (document.all || window.opera)
{
  // msie && opera
  document.getClientWidth = function() {return document.body.clientWidth;};
  
  if (document.documentElement && isNumber(document.documentElement.clientHeight) && document.documentElement.clientHeight != 0)
  {
    document.getClientHeight = function() {return document.documentElement.clientHeight;};  
  }
  else
  {
    document.getClientHeight = function() {return document.body.clientHeight;};
  }
}

function paramValue( theParamName ) {
    sArgs = location.search.slice(1).split('&');
    r = '';
    for (var i = 0; i < sArgs.length; i++){
        eqIndex = sArgs[i].indexOf('=');
	currParamName = sArgs[i].slice(0,eqIndex);
	if( currParamName == theParamName ) {
            r = sArgs[i].slice(sArgs[i].indexOf('=')+1);
            break;
        }
    }
    return r;
}

function browserBack(){
   window.history.back();
}

function hideLayer(layerName)
{
  if (document.getElementsByTagName('div')[layerName])
  {
    document.getElementsByTagName('div')[layerName].style.visibility = 'hidden';
  }
}

function showLayer(layerName)
{
  if (document.getElementsByTagName('div')[layerName])
  {
    document.getElementsByTagName('div')[layerName].style.visibility = 'visible';
  }
}

function setDisplayStyle(layerName, style)
{
  if (document.getElementsByTagName('div')[layerName])
  {
    document.getElementsByTagName('div')[layerName].style.display = style;
  }
}

var popupHandle = {};popupHandle.closed = true;
function openPopup(url, target, width, height, left, top, addRandom) {
	var screenX = (left) ? left : Math.round((792 - width) / 2);
	var screenY = (top) ? top : Math.round((480 - height) / 2);
	if (screenX < 20) {screenX = 20;}
 	if (screenY < 20) {screenY = 20;}

	if (addRandom) {
		url = url.appendUrlParameter("random=" + Math.random());
	}
	popupHandle = window.open(url, target, 'width=' + width + ',height=' + height + ',left=' + screenX + ',top=' + screenY + ',toolbar=no,scrollbars=no,resizable=no');
	popupHandle.focus();
}
