/*******************************************
  get browser and versions
*******************************************/
var isNav = (navigator.appName == "Netscape") ? true:false;
var isIE  = (navigator.appName.indexOf("Microsoft") != -1) ? true:false;
var isOp  = (navigator.appName.indexOf("Opera") != -1) ? true:false;
var isMac = (navigator.appVersion.indexOf("Mac") != -1) ? true:false;
var isVersion = parseInt(navigator.appVersion.charAt(0));
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
var ns6 = (!document.all && document.getElementById) ? true:false;
var myDir; 
var TROnClickStatus;  TROnClickStatus = 1;

if (((isNav) && (isVersion < 3)) || ((isIE) && (isVersion < 2))) {alert("Warning: Requires at least a 3.0 browser!");}

/*******************************************
  start: mouse over images 
*******************************************/
var onControlsArray = new Array();
var offControlsArray = new Array();

function loadControlsImages() {
  if (document.images) {
    onControlsArray[0] = new Image(16,16);
    onControlsArray[0].src = gweb + "expand.gif";

    offControlsArray[0] = new Image(16,16);
    offControlsArray[0].src = gweb + "collapse.gif";
	
    onControlsArray[1] = new Image(7,9);
    onControlsArray[1].src = gweb + "up_enabled.gif";

    offControlsArray[1] = new Image(7,9);
    offControlsArray[1].src = gweb + "down_enabled.gif";
  }
}

loadControlsImages();

function controlOn(e,i) {
  if (document.images && e && onControlsArray[i]) e.src = onControlsArray[i].src;
}

function controlOff(e,i) {
  if (document.images && e && offControlsArray[i]) e.src = offControlsArray[i].src;
}

/*******************************************
  end: mouse over images 
*******************************************/

/*******************************************
  start: confirm functions
*******************************************/
function confirmThis(message) {
  if(confirm(message)) return true;
  return false;
}

function confirmdelete(url,message) {
  if(confirmThis(message)) {
    window.location.href = url;
  }
}
/*******************************************
  end: confirm functions
*******************************************/

/*******************************************
  start: popup functions
*******************************************/
function popUpWin(url,windowName, windowOptions) {
  windowName = window.open(url,windowName,windowOptions);
  windowName.focus();
}
/*******************************************
  end: popup functions
*******************************************/

/*******************************************
  start: form manipulation functions
*******************************************/
function checkAll(field,control) {
  if (control.checked == false) {
    field.checked = false; //gets the box if only one exists
    for (i = 0; i < field.length; i++) field[i].checked = false;  
  } else {
    field.checked = true; //gets the box if only one exists
    for (i = 0; i < field.length; i++) field[i].checked = true;  
  }
}

function disableForm(theForm) {
  for (i=0; i<theForm.elements.length; i++) {
    var element = theForm.elements[i];
    if ((element.type == "text") || (element.type == "textarea") ||(element.type == "button") || (element.type == "submit") || (element.type == "reset")) {
      element.disabled=true;
    }
  }
}
/*******************************************
  end: form manipulation functions
*******************************************/

/*******************************************
  start: css style functions
*******************************************/
function ToggleVisible(targetID, imageID, linkImage, linkImageCollapsed) {
  if (document.getElementById) {
    target = document.getElementById(targetID);
    if (target.style.display == "none") {
      target.style.display = "";
    } else {
      target.style.display = "none";
    }
    if (linkImageCollapsed != "") {
      image = document.getElementById(imageID);
      if (target.style.display == "none") {
        image.src = linkImageCollapsed;
      } else {
        image.src = linkImage;
      }
    }
  }
}
function cellclick(src) {
  src.children.tags('a')[0].click();
}
function FieldStatus(src,status) {
  if (status == 1) {
    src.className = "Fields";
  } else {
    src.className = "FieldsActive";
  }
}
function DataRowStatus(src,isalt,status) {
  if (status == 1) {
    if (!isalt) {
      src.className = "tbl_row";
    } else {
      src.className = "tbl_altrow";
    }
  } else {
    src.className = "tbl_rowOver";
  }
}
function BtnStatus(src,status) {
  if (status == 1) {
    src.className = "Btns";
  } else {
    src.className = "BtnsActive";
  }
}
function ToggleTROnClick(status) {
  TROnClickStatus = status;
}
function TROnClick(url) {
  if (TROnClickStatus == 1) {
    window.location.href = url;
  }
}
function TROnClickJS(JS) {
  if (TROnClickStatus == 1) {
    myFunction = new Function(JS);
    myReturn = myFunction();
  }
}
function ToggleDataVisibility(myObjRef,myObjID) {
  myControlObj = myObjRef + myObjID + "Control";
  myDataObj = myObjRef + myObjID + "Data";
  ObjControlID = document.images[myControlObj]; //(document.getElementById) ? document.getElementById(myControlObj) : (document.all) ? document.all[myControlObj] : document.images[myControlObj];
  ObjDataID = (document.getElementById) ? document.getElementById(myDataObj).style : (document.all) ? document.all[myDataObj].style : document.layers[myDataObj];
  if (ObjDataID.visibility == 'visible') {
    ObjDataID.visibility = 'hidden';
    ObjDataID.display = 'none';
    controlOff(ObjControlID,0);
  } else {
    ObjDataID.visibility = 'visible';
    ObjDataID.display = 'block';
    controlOn(ObjControlID,0);
  }
}
function ToggleInfoDataVisibility(myObjRef) {
  myControlObj = myObjRef + "Control";
  myDataObj = myObjRef + "Data";
  ObjControlID = document.images[myControlObj]; //(document.getElementById) ? document.getElementById(myControlObj) : (document.all) ? document.all[myControlObj] : document.images[myControlObj];
  ObjDataID = (document.getElementById) ? document.getElementById(myDataObj).style : (document.all) ? document.all[myDataObj].style : document.layers[myDataObj];
  if (ObjDataID.visibility == 'visible') {
    ObjDataID.visibility = 'hidden';
    ObjDataID.display = 'none';
    controlOff(ObjControlID,1);
  } else {
    ObjDataID.visibility = 'visible';
    ObjDataID.display = 'block';
    controlOn(ObjControlID,1);
  }
}
/*******************************************
  end: css style functions
*******************************************/

/*******************************************
  start: misc scripts
*******************************************/
function DropDownAutoJump(field,baseURL) {
  var URL = field.options[field.selectedIndex].value;
  var myURL = baseURL + URL;
  if (URL != "") {
    window.location.href = myURL;
    field.selectedIndex=0;
  }
}

function m(recip,dmn,ext,sbjct) {
  window.location.href = "mailto:" + recip + "@" + dmn + "." + ext +"?Subject=" + sbjct;
}
/*******************************************
  end: misc scripts
*******************************************/