/*
  This script file contains the necessary methods for all of the JSP pages for posting
  and navigation

  CopyRight (C) Micro-Phyla Systems 2002, All Rights Reserved
  Developed by John B. Moore

Code conventions
=========================================
function prefixes
   bt -  functions found in this file
var prefixes:
	 g_  - global to this file
         Local vars
	  _s    - string
	  _n    - number
	  _v   - anytype
	  _b   - boolean
	  _ar - array
	  _the - object

	 arg_ - argument param of that function
	 <none> local to that function
function suffixes:
       _s - returns string
       _n - returns number
       _b - returns boolean
       _r - returns array
       _v - returns anytype
       _obj - returns object reference
       <none> - returns nothing (void)

Dependencies;

*/



var g_navForm = document.NavForm;

var g_valueForm ;

var g_ActiveButtonKeys = new Array();
// set some defaults (add more if necessary)
g_ActiveButtonKeys[1] = "none";
g_ActiveButtonKeys[2] = "none";
g_ActiveButtonKeys[3] = "none";
g_ActiveButtonKeys[4] = "none";
g_ActiveButtonKeys[5] = "none";

var _browserName = navigator.appName;
var _version ="";
var _browserVer = parseInt(navigator.appVersion);
if(_browserName=="Netscape" && _browserVer >=3) _version ="n3";
if(_browserName=="Microsoft Internet Explorer" && _browserVer >=4) _version="n3";

//alert("loading ButtonTools.js");

function btActiveImage(arg_sImageName){
  if (_version == "n3"){
    var _imgActive = eval(arg_sImageName + "_on.src");
    document [arg_sImageName].src = _imgActive;
  }
}

function btActiveOverImage(arg_sImageName){
  if (_version == "n3"){
    var _imgActive = eval(arg_sImageName + "_over.src");
    document [arg_sImageName].src = _imgActive;
  }
}

function btInActiveImage(arg_sImageName){
  if (_version == "n3") {
    var _imgInActive = eval(arg_sImageName + "_off.src");
    document [arg_sImageName].src = _imgInActive;
  }
}

function btLoadImage(arg_sImageName) {
	if (document.images) {
		var result = new Image();
		result.src = arg_sImageName;
		return result;
	}
}

function btChangeImages(arg_sImageName, arg_sImagePath) {
		document[arg_sImageName].src = arg_sImagePath;
}

function btSetActiveKey(arg_iKeyIndex, arg_sValue) {
    g_ActiveButtonKeys[arg_iKeyIndex] = arg_sValue;
}

function btFlipActiveImage(arg_iKeyIndex, arg_sActiveImageName, arg_sActiveImagePath) {
   document[arg_sActiveImageName].src = arg_sActiveImagePath;
   btSetActiveKey(arg_iKeyIndex, "active");
}

function btChangeActiveImages(arg_iKeyIndex,
                              arg_sImageName,
                              arg_sRegImagePath,
                              arg_sActiveImagePath) {
      //alert("Key: "+ arg_iKeyIndex +" value: "+g_ActiveButtonKeys[arg_iKeyIndex]);
      if (g_ActiveButtonKeys[arg_iKeyIndex] == "active") {
          document[arg_sImageName].src = arg_sActiveImagePath;
      } else {
          document[arg_sImageName].src = arg_sRegImagePath;
      }
}

