//
// browser checks
//
var isDOM    = (document.getElementById) ? true : false;
var isOpera  = (navigator.userAgent.indexOf('Opera') != -1) ;

var isDall   = (document.all) ? true : false;
var isIE     = (document.all && !isOpera) ? true : false;
var isIE4    = isIE && !isDOM;
var isIE5    = isIE && isDOM ;
var isIE55   = (isIE5) && (navigator.appVersion.indexOf('MSIE 5.5') != -1);

var isMac    = (navigator.appVersion.indexOf('Mac') != -1);
var isIE5Mac = isIE5 && isMac;

var isIEWin  = isIE && !isMac;
var isIE4Win = isIE4 && isIEWin;
var isIE5Win = isIE5 && isIEWin;

var isNS     = navigator.appName == ("Netscape");
var isNS4    = (document.layers) ? true : false;
var isNS6    = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));


function doPageLoad() { }


function setClass(theObj, theClassName) {
  if (!isIE) return;
  theObj.className = theClassName
}


function getObjectRef(objName) {
 var obj = null ;

 if (isDOM)
  obj = document.getElementById(objName)
 else
   if (isIE)
    obj = document.all[objName];

 return obj;

}

function helpPopUp(objName) {
  if (isNS4) return false;
  var obj = getObjectRef(objName)
  if (obj == null) return false;
  obj.style.display = 'block';
  obj.style.visibility = 'visible';
  return true;
}

function helpPopDown(objName) {
  if (isNS4) return false;
  var obj = getObjectRef(objName)
  if (obj == null) return false;
  obj.style.visibility = 'hidden';
  obj.style.display = 'none'
}

function toggleDisplay(objName) {
  if (isNS4) return false;
  var obj = getObjectRef(objName);
  if (obj == null) return false;
  if (obj.style.display == 'none') {
    obj.style.display = 'block';
    obj.style.visibility = 'visible';
  } else {
   obj.style.visibility = 'hidden';
   obj.style.display = 'none'
  }

}


function popUp(url, width, height) {

 var features =
   'toolbar=no,' +
   'location=no,' +
   'directories=no,' +
   'status=yes,' +
   'menubar=yes,' +
   'scrollbars=no,' +
   'resizable=yes,' +
   'width=' + width + ',' + 
   'height=' + height;
   
 var name = width + 'x' + height ;
 var w=window.open(url, name, features) ;
 w.focus() ;

 return false ;
 
}

//
// returns true if all elements on the form have not changed
// this uses the form elements's defaultValue property
// to check for changes against the value property.
//
function formElementsUnchanged(theFrm) {
  var e ;
  for (var i=0; i < theFrm.elements.length; i++) {
    e = theFrm.elements[i] ;
    switch (e.type) {
      case 'select-one' :
        for (var j=0; j < e.options.length; j++)
           if (e.options[j].defaultSelected != e.options[j].selected) { return false; }
        break; 
      case 'text' :
        if (e.value != e.defaultValue) { return false; }
        break;
      case 'file' :
        if (e.value != e.defaultValue) { return false; }
        break;  
      case 'textarea' :
        if (e.value != e.defaultValue) { return false; }
        break;
      case 'password' :
        if (e.value != e.defaultValue) { return false; }
        break;
      case 'hidden' :
        if (e.value != e.defaultValue) { return false; }
        break;
      case 'radio' :
        if (e.defaultChecked != e.checked) { return false; }
        break ;
      case 'checkbox' :
        if (e.defaultChecked != e.checked) { return false; }
        break ;
    }
  }
  
  return true;
}

