﻿
  jQuery.noConflict();
  jQuery(document).ready(function() {
    oCommon = new commonObj();
  });

  jQuery.preloadImages = function() {
    imgDir = arguments[0];
    for(var i = 1; i < arguments.length; i++) {
      jQuery("<img>").attr("src", imgDir + arguments[i]);
    }
  }

  //  pre-load commonly used background images
  jQuery.preloadImages('images/',
    'bg-tl.gif','bg-tm.gif','bg-tr.gif','bg-rm.gif',
    'bg-bl.gif','bg-bm.gif','bg-br.gif',
    'h1-1-1.png','h1-1-2.png','h1-1-3.png',
    'h2-1-1.png','h2-1-2.png','h2-1-3.png',
    'h3-1-1.png','h3-1-2.png','h3-1-3.png',
    'h4-1-1.png','h4-1-2.png','h4-1-3.png',
    'h5-1-1.png','h5-1-2.png','h5-1-3.png',
    'h6-1-1.png','h6-1-2.png','h6-1-3.png',
    'h7-1-1.png','h7-1-2.png','h7-1-3.png'
  );


  jQuery.preloadCssImages = function(settings){
	//overrideable defaults
	settings = jQuery.extend({
		 imgDir: 'images'
	}, settings);

	//dump all the css rules into one string
	var sheets = document.styleSheets;
	var cssPile = '';
	for(var i = 0; i<sheets.length; i++){
		if(!jQuery.browser.msie){
			var thisSheetRules = document.styleSheets[i].cssRules;
			for(var j = 0; j<thisSheetRules.length; j++){
				cssPile+= thisSheetRules[j].cssText;
			}
		}
		else {
			cssPile+= document.styleSheets[i].cssText;
		}
	}
	//parse string for image urls and load them into the DOM
	var allImgs = [];//new array for all the image urls
	var imgUrls = cssPile.match(/[^\/]+\.(gif|jpg|jpeg|png)/g);//reg ex to get a string of between a "/" and a ".filename"
	if(imgUrls != null && imgUrls.length>0 && imgUrls != ''){//loop array
		var arr = jQuery.makeArray(imgUrls);//create array from regex obj
		jQuery(arr).each(function(k){
			allImgs[k] = new Image(); //new img obj
			allImgs[k].src = settings.imgDir +'/'+ this;
		});
	}
	return allImgs;
}

  function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
      do {
        curleft += obj.offsetLeft;
        curtop += obj.offsetTop;
      } while (obj = obj.offsetParent);
    }
    return [curleft,curtop];
  }

  function popit(url,w,h){
    popwin = window.open(url,"pop",'width=' + w + ',height=' + h + ',scrollbars=yes,menubar=no,toolbar=no,location=no,status=no,resizable=no');
    return false;
  }

  function commonObj () {
    var t = this;
    t.googleSearchURL = '';
    t.popWin = null;
    t.popWinHeight = '0';
    t.popWinWidth = '0';
    t.popWinScroll = '0';
    t.popWinResize = '0';
    t.popWinParams = 'height=%s,width=%s,' +
      'status=0,scrollbars=%s,titlebar=0,resizable=%s,toolbar=0,menubar=0,location=0';
  }

  function winPopup(sType) {
    var sURL = '', sArgs = '';
    switch (sType) {
      case 'custotmer-satisfaction':
        oCommon.popWinHeight = '500';
        oCommon.popWinWidth = '500';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './includes/in-cust-sat.htm';
        sArgs = '';
        break;
      case 'price-protection':
        oCommon.popWinHeight = '500';
        oCommon.popWinWidth = '500';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './inprice.htm';
        sArgs = '';
        break;
      case 'link-to-us':
        oCommon.popWinHeight = '500';
        oCommon.popWinWidth = '650';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './inlink.htm';
        sArgs = '';
        break;
      case 'custom-quote':
        oCommon.popWinHeight = '500';
        oCommon.popWinWidth = '650';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './incustom.htm';
        sArgs = '';
        break;
      case 'order-status':
        oCommon.popWinHeight = '500';
        oCommon.popWinWidth = '500';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './clogin.php';
        sArgs = '';
        break;
      case 'in-how-much':
        oCommon.popWinHeight = '400';
        oCommon.popWinWidth = '400';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './inhowmuch.htm';
        sArgs = '';
        break;
      case 'in-business-hours':
        oCommon.popWinHeight = '230';
        oCommon.popWinWidth = '300';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './inbusinesshours.htm';
        sArgs = '';
        break;
      case 'in-chat':
        oCommon.popWinHeight = '200';
        oCommon.popWinWidth = '520';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = './inchat.htm';
        sArgs = '';
        break;
      case 'google-search':
        oCommon.popWinHeight = '600';
        oCommon.popWinWidth = '800';
        oCommon.popWinScroll = '1';
        oCommon.popWinResize = '1';
        sURL = oCommon.googleSearchURL;
        oCommon.popWinParams = 'height=%s,width=%s,' +
          'status=1,scrollbars=%s,titlebar=1,resizable=%s,toolbar=1,menubar=1,location=1';
        sArgs = '';
        break;
    }
    if (sURL == '') {
      //  modded to use 1st argument (0) as window URL
      //  modded to use 2nd argument (1) as window height
      //  modded to use 3rd argument (2) as window width
      //  modded to use 4th argument (3) as window scroll (bool)
      //  modded to use 5th argument (4) as window resize (bool)
      sURL = sType;
      if (arguments[1]) {
        oCommon.popWinHeight = arguments[1];
      } else {
        oCommon.popWinHeight = '600';
      }
      if (arguments[2]) {
        oCommon.popWinWidth = arguments[2];
      } else {
        oCommon.popWinWidth = '800';
      }
      if (arguments[3]) {
        oCommon.popWinScroll = arguments[3];
      } else {
        oCommon.popWinScroll = '1';
      }
      if (arguments[4]) {
        oCommon.popWinResize = arguments[4];
      } else {
        oCommon.popWinResize = '1';
      }
    }
    if (oCommon.popWin !== null && oCommon.popWin.closed != true) {
      alert('Please close any previously opened windows before proceeding.')
      oCommon.popWin.focus();
      return;
    }
    if (sArgs != '') if (typeof(sArgs) == 'object') sArgs.join('&');
    sArgs = (sArgs != '') ? '?' + sArgs : '';
    oCommon.popWin = window.open(sURL + sArgs , null, sprintf(oCommon.popWinParams, oCommon.popWinHeight, oCommon.popWinWidth, oCommon.popWinScroll, oCommon.popWinResize));
    if (oCommon.popWin == null) { alert('Oops!  Your browser\'s pop-up blocker settings have disallowed the opening of this window...\n\nTo view this window, you can:\n    1.  Hold down the Ctrl + Alt keys while re-clicking the same link.\n    2.  Add \'www.jnkproducts.com\' to your pop-up blocker\'s allowed sites list.\n    3.  Set your browser\'s pop-up blocker settings to a lower filter level.'); }
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        repeat
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         string prototype function to repeat n characters
_/  parameters:      n - number - repetitions
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  String.prototype.repeat = function(n) { return (new Array(n - 1)).join(this); };

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        trim
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         string prototype function to trim leaeding/trailing whitespace
_/  parameters:      none
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        ajaxNetPost
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         wrapper to ajax class
_/  parameters:      ajaxSetup - object - ajax parameters
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function ajaxNetPost(ajaxSetup, showWait) {
    if(arguments[1] == undefined || arguments[1] == 'undefined') showWait = true;
    if (showWait) showLoading();
    Net.post(ajaxSetup);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        ajaxNetFailure
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         method alerts ajax failure error
_/  parameters:      netObj - ajax object
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function ajaxNetFailure(netObj) {
    hideLoading();
    alert('Web site services are not responding and/or errors have been encountered...\nPlease try again shortly.');
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        classSwitch
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         method shows switches elements class name
_/  parameters:      elID - element (id) to switch
_/                   className - class name to swap
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function classSwitch(elID, className) {
    domID(elID).className = className;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        showLoading
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         method shows (by id) status element
_/  parameters:      none
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function showLoading() {
    var theDiv = domID('loading-div');
    theDiv.style.display = '';
    theDiv.style.visibility = 'visible';
    centerLoadDiv(theDiv);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        hideLoading
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         method hides (by id) status element
_/  parameters:      none
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function hideLoading() {
    if (domID('loading-div') == null) {
      return;
    } else {
      var theDiv = domID('loading-div');
    }
    theDiv.style.display = 'none';
    theDiv.style.visibility = 'hidden';
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        centerLoadDiv
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         method centers element by window inner dimension
_/  parameters:      theDiv - element showing loading status
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function centerLoadDiv(theDiv) {
    var theDivWidth = theDiv.clientWidth;
    var theDivHeight = theDiv.clientHeight;
    var winInnerSizes = getWinInnerSizes();
    theDiv.style.visibility = 'hidden';
    theDiv.style.left = ((winInnerSizes.innerWidth / 2)- (theDivWidth / 2)) + 'px';
    theDiv.style.top = ((winInnerSizes.innerHeight / 2) - (theDivHeight / 2)) + 'px';
    theDiv.style.visibility = 'visible';
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        getWinInnerSizes
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         this method returns available window inner widths (cross-browser)
_/  parameters:      none
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function getWinInnerSizes() {
    var theWidth = 0, theHeight = 0;
    var theSizes = {};
    if(typeof(window.innerWidth) == 'number') {
      //  moz, others
      theWidth = window.innerWidth;
      theHeight = window.innerHeight;
    } else if(document.documentElement &&
        (document.documentElement.clientWidth ||
            document.documentElement.clientHeight)) {
      //  ie 6+
      theWidth = document.documentElement.clientWidth;
      theHeight = document.documentElement.clientHeight;
    } else if(document.body &&
        (document.body.clientWidth ||
            document.body.clientHeight)) {
      //  older ie
      theWidth = document.body.clientWidth;
      theHeight = document.body.clientHeight;
    }
    return theSizes = {innerWidth: theWidth, innerHeight: theHeight };
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        resetSelects
_/  author:          dwilliams
_/  modified:        03/18/2007 (dwilliams)
_/  purpose:         this method manipulates select lists
_/  parameters:      toLoad - mixed - select elements to show as 'loading...'
_/                   toEmpty - mixed - select elements to be zeroed out
_/                   toReset - mixed - select elements to set selected index to 0
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function resetSelects(toLoad, toEmpty, toReset) {
    var theSelects = null, theSelect = null, theOption = null;
    //  selects to show in loading state
    if ((arguments[0] != undefined && arguments[0] != 'undefined') && arguments[0] != '') {
      if (typeof(arguments[0]) == 'object') {  //  array of names
        theSelects = arguments[0];
        for (var i = 0; i < theSelects.length; i++) {
          theSelect = domID(theSelects[i]);
          theSelect.options.length = 0;
          theOption = document.createElement("option");
          theOption.setAttribute('value', '');
          theOption.innerHTML = 'Loading...' + '&nbsp;'.repeat(20);
          theSelect.appendChild(theOption);
          theOption = null;
        }
      } else {  //  single name
        theSelect = domID(arguments[0]);
        theSelect.options.length = 0;
        theOption = document.createElement("option");
        theOption.setAttribute('value', '');
        theOption.innerHTML = 'Loading...' + '&nbsp;'.repeat(20);
        theSelect.appendChild(theOption);
        theOption = null;
      }
    }
    //  selects to empty
    if ((arguments[1] != undefined && arguments[1] != 'undefined') && arguments[1] != '') {
      if (typeof(arguments[1]) == 'object') {  //  array of names
        theSelects = arguments[1];
        for (var i = 0; i < theSelects.length; i++) {
          theSelect = domID(theSelects[i]);
          theSelect.options.length = 0;
          theOption = document.createElement("option");
          theOption.setAttribute('value', '');
          theOption.innerHTML = '&nbsp;'.repeat(25);
          theSelect.appendChild(theOption);
          theOption = null;
        }
      } else {  //  single name
        theSelect = domID(arguments[1]);
        theSelect.options.length = 0;
        theOption = document.createElement("option");
        theOption.setAttribute('value', '');
        theOption.innerHTML = '&nbsp;'.repeat(25);
        theSelect.appendChild(theOption);
        theOption = null;
      }
    }
    //  selects to reset to 0
    if ((arguments[2] != undefined && arguments[2] != 'undefined') && arguments[2] != '') {
      if (typeof(arguments[2]) == 'object') {  //  array of names
        theSelects = arguments[2];
        for (var i = 0; i < theSelects.length; i++) {
          theSelect = domID(theSelects[i]);
          theSelect.selectedIndex = 0;
        }
      } else {  //  single name
        theSelect = domID(arguments[2]);
        theSelect.selectedIndex = 0;
      }
    }
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        sprintf
_/  author:          unknown
_/  modified:        11/06/2006 (dwilliams)
_/  purpose:         this method emulates the 'C' style string format function
_/  parameters:      varies
_/  returns:         formatted string - variable replacements
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function sprintf() {
    if (!arguments || arguments.length < 1 || !RegExp) return;
    var str = arguments[0];
    var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
    var a = b = [], numSubstitutions = 0, numMatches = 0;
    while (a = re.exec(str)) {
      var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
      var pPrecision = a[5], pType = a[6], rightPart = a[7];
      numMatches++;
      if (pType == '%') {
        subst = '%';
      } else {
        numSubstitutions++;
        if (numSubstitutions >= arguments.length) {
          var sMsg = 'Error! Not enough function arguments (' + (arguments.length - 1) + ', ';
          sMsg += 'excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).';
          alert(sMsg);
        }
        var param = arguments[numSubstitutions];
        var pad = '';
        if (pPad && pPad.substr(0,1) == "'") {
          pad = leftpart.substr(1,1);
        } else if (pPad) {
          pad = pPad;
        }
        var justifyRight = true;
        if (pJustify && pJustify === "-") justifyRight = false;
        var minLength = -1;
        if (pMinLength) minLength = parseInt(pMinLength);
        var precision = -1;
        if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
        var subst = param;
        if (pType == 'b') {
          subst = parseInt(param).toString(2);
        } else if (pType == 'c') {
          subst = String.fromCharCode(parseInt(param));
        } else if (pType == 'd') {
          subst = parseInt(param) ? parseInt(param) : 0;
        } else if (pType == 'u') {
          subst = Math.abs(param);
        } else if (pType == 'f') {
          subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
        } else if (pType == 'o') {
          subst = parseInt(param).toString(8);
        } else if (pType == 's') {
          subst = param;
        } else if (pType == 'x') {
          subst = ('' + parseInt(param).toString(16)).toLowerCase();
        } else if (pType == 'X') {
          subst = ('' + parseInt(param).toString(16)).toUpperCase();
        }
      }
      str = leftpart + subst + rightPart;
    }
    return str;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  custom html form element utlities
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/


/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        setSelectText
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         set select element's selected text
_/  parameters:      selectID - select element object
_/                   varText - value to locate and select
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function setSelectText(selectID, varText) {
    theSelect = domID(selectID);
    if (theSelect === null) return;
    if (theSelect.options.length == 0) return;
    if (varText === undefined) return;
    theIndex = null;
    for (var i = 0; i < theSelect.options.length; i++) {
      if (theSelect.options[i].text.trim() == varText.trim()) {
        theIndex = i;
        theSelect.options[theIndex].selected = true;
        break;
      }
    }
    if (theIndex == null) theSelect.options[0].selected = true;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        setSelectValue
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         set select element's selected value
_/  parameters:      selectID - select element object
_/                   varValue - value to locate and select
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function setSelectValue(selectID, varValue) {
    theSelect = domID(selectID);
    if (theSelect === null) return;
    if (theSelect.options.length == 0) return;
    if (varValue === undefined) return;
    theIndex = null;
    for (var i = 0; i < theSelect.options.length; i++) {
      if (theSelect.options[i].value == varValue) {
        theIndex = i;
        theSelect.options[theIndex].selected = true;
        break;
      }
    }
    if (theIndex == null) theSelect.options[0].selected = true;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        getSelectOptions
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         return select element's selected value(s)
_/  parameters:      selectID - select element (string id or object ref)
_/                   valueType - value (element property) to return
_/  returns:         mixed:  string value for single-selects
_/                           array of values for multi-selects
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function getSelectOptions(selectID, valueType) {
    var theSelect = null;
    var multiArray = new Array();
    if (arguments[1] == null || arguments[1] == '') valueType == 'value';
    switch (typeof(selectID)) {
      case 'string':
          theSelect = domID(selectID);
          if (typeof(theSelect) != 'object') {
            theSelect = domName(selectID);
          }
        break;
      case 'object':
          theSelect = selectID;
        break;
    }
    if (typeof(theSelect) != 'object') return false;
    if (theSelect.selectedIndex == -1 || theSelect.options.length == 0) return false;
    if (theSelect.getAttribute('multiple') == null) {  // single
      if (theSelect.options[theSelect.selectedIndex].getAttribute(valueType) != null) {
        return theSelect.options[theSelect.selectedIndex].getAttribute(valueType);
      } else {
        return false;
      }
    } else {  // multi
      for (var i = 0; i < theSelect.options.length; i++) {
        if (theSelect.options[i].selected == true) {
          multiArray.push(theSelect.options[i].getAttribute(valueType));
        }
      }
      return multiArray;
    }
    return false;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        getSelectValue
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         return select element's selected value
_/  parameters:      selectID - select element object
_/  returns:         selected value
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function getSelectValue(selectID) {
    var theSelect = null;
    if (typeof(selectID) == 'string') var theSelect = domID(selectID);
    if (typeof(selectID) != 'object') theSelect = domName(selectID);
    for (var i = 0; i < theSelect.options.length; i++) {
      if (theSelect.options[i].selected == true) {
        return theSelect.options[i].value;
        break;
      }
    }
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        getSelectText
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         return select element's selected text
_/  parameters:      selectID - select element object
_/  returns:         selected text
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function getSelectText(selectID) {
    var theSelect = null;
    if (typeof(selectID) == 'string') var theSelect = domID(selectID);
    if (typeof(selectID) != 'object') theSelect = domName(selectID);
    for (var i = 0; i < theSelect.options.length; i++) {
      if (theSelect.options[i].selected == true) {
        return theSelect.options[i].text;
        break;
      }
    }
  }

 /**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        transferOptionList
_/  author:          dwilliams
_/  modified:        12/05/2006 (dwilliams)
_/  purpose:         transfer option lists between selects
_/  parameters:      fromElObj - source element (actual object ref or name)
_/                   toElObj - target element (actual object ref or name)
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function transferOptionList(fromElObj, toElObj) {
    if(typeof(fromElObj) == 'string') fromElObj = domID(fromElObj);
    if(typeof(toElObj) == 'string') toElObj = domID(toElObj);
    if (fromElObj.options.length == 0) return;
    toElObj.options.length = 0;
    for (var i = 0; i < fromElObj.options.length; i++)
      toElObj.options[i] = new Option(fromElObj[i].innerHTML, fromElObj[i].value);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  custom date prototype extensions
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        datePrototypeInit
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         prototype (extend) custom date functions
_/  parameters:      none
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function datePrototypeInit() {
    Date.prototype.monthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
    Date.prototype.dayNames = new Array('Sunday', 'Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    Date.prototype.savedDate = null;
    Date.prototype.getMonthName = dateGetMonthName;
    Date.prototype.getDayName = dateGetDayName;
    Date.prototype.getDays = dateGetDays;
    Date.prototype.getEOMDate = dateGetEOMDate;
    Date.prototype.getWeekNumber = dateGetWeekNumber;
    Date.prototype.getQtrNumber = dateGetQtrNumber;
    Date.prototype.addDays = dateAddDays;
    Date.prototype.addWeeks = dateAddWeeks;
    Date.prototype.addMonths = dateAddMonths;
    Date.prototype.addQtrs = dateAddQtrs;
    Date.prototype.addYears = dateAddYears;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateGetWeekNumber
_/  author:          yahoo (yui lib)
_/  modified:        12/29/2006 (dwilliams)
_/  purpose:         wrapper to date.getWeekNumber()
_/                     reference week number of given date
_/  parameters:      none
_/  returns:         string week number
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function dateGetWeekNumber() {
  var sReturn = '';
  var ONE_DAY_MS = 1000*60*60*24;
  var theDate = new Date (Date.parse(this));
  var nearestThurs = new Date(theDate.getTime() + (4 * ONE_DAY_MS) - ((theDate.getDay()) * ONE_DAY_MS));
  var jan1 = new Date(nearestThurs.getFullYear(), 0, 1);
  var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / ONE_DAY_MS) - 1;
  sReturn = Math.ceil((dayOfYear) / 7).toString();
  return (sReturn == '0') ? '53' : sReturn;  // show week 0 or week 53?
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateGetQtrNumber
_/  author:          unknown
_/  modified:        12/29/2006 (dwilliams)
_/  purpose:         wrapper to date.getQtrNumber()
_/                     reference quarter number of given date
_/  parameters:      none
_/  returns:         string quarter number
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function dateGetQtrNumber() {
  var sReturn;
  switch (this.getMonth() + 1) {
    case 1: case 2: case 3:
      sReturn = 1;
      break;
    case 4: case 5: case 6:
      sReturn = 2;
      break;
    case 7: case 8: case 0:
      sReturn = 3;
      break;
    case 10: case 11: case 12:
      sReturn = 4;
      break;
  }
  return sReturn;
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateGetMonthName
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.getMonthName()
_/                     reference month name of given date
_/  parameters:      none
_/  returns:         string month name
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateGetMonthName() {
    return this.monthNames[this.getMonth()];
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateGetDayName
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.getDayName()
_/                     reference day name of given date
_/  parameters:      none
_/  returns:         string day name
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateGetDayName() {
    return this.dayNames[this.getDay()];
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateGetDays
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.getDays()
_/                     reference num days in given date month
_/  parameters:      none
_/  returns:         number days
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateGetDays() {
    var tempDate, nDate, nMonth;
    tempDate = new Date(Date.parse(this));
    nMonth = tempDate.getMonth();
    nDate = 28;
    do {
      nDate++;
      tempDate.setDate(nDate);
    } while (tempDate.getMonth() == nMonth);
    return nDate - 1;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateGetEOMDate
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.getEOMDate()
_/                     reference last date in given date month
_/  parameters:      none
_/  returns:         string date
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateGetEOMDate() {
    var tempDate, nDate, nMonth;
    tempDate = new Date(Date.parse(this));
    nMonth = tempDate.getMonth();
    nDate = 28;
    do {
      nDate++;
      tempDate.setDate(nDate);
    } while (tempDate.getMonth() == nMonth);
    tempDate.addDays(-1);
    return tempDate;
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateAddDays
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.addDays()
_/                     increment date object by nVal (by day) * 1
_/  parameters:      nVal - number to increment
_/  returns:         none - referenced date object effected
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateAddDays(nVal) {
    if (this.savedDate == null) this.savedDate = this.getDate();
    this.setDate(this.getDate() + nVal);
    this.savedDate = this.getDate();
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateAddWeeks
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.addWeeks()
_/                     increment date object by nVal (by day) * 7
_/  parameters:      nVal - number to increment
_/  returns:         none - referenced date object effected
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateAddWeeks(nVal) {
    if (this.savedDate == null) this.savedDate = this.getDate();
    nVal = nVal * 7;
    this.setDate(this.getDate() + nVal);
    this.savedDate = this.getDate();
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateAddMonths
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.addMonths()
_/                     increment date object by nVal (by month) * 1
_/  parameters:      nVal - number to increment
_/  returns:         none - referenced date object effected
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateAddMonths(nVal) {
    if (this.savedDate == null) this.savedDate = this.getDate();
    this.setDate(1);
    this.setMonth(this.getMonth() + nVal);
    this.setDate(Math.min(this.savedDate, this.getDays()));
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateAddQtrs
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.addQtrs()
_/                     increment date object by nVal nVal (by day) * 90
_/  parameters:      nVal - number to increment
_/  returns:         none - referenced date object effected
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateAddQtrs(nVal) {
    if (this.savedDate == null) this.savedDate = this.getDate();
    nVal = nVal * 3;
    this.setDate(1);
    this.setMonth(this.getMonth() + nVal);
    this.setDate(Math.min(this.savedDate, this.getDays()));
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        dateAddYears
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         wrapper to date.addYears()
_/                     increment date object by nVal (by year) * 1
_/  parameters:      nVal - number to increment
_/  returns:         none - referenced date object effected
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function dateAddYears(nVal) {
    if (this.savedDate == null) this.savedDate = this.getDate();
    this.setDate(1);
    this.setFullYear(this.getFullYear() + nVal);
    this.setDate(Math.min(this.savedDate, this.getDays()));
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  custom document object model utilities
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domID
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         DOM shortcut utility
_/  parameters:      elID - element object to reference
_/  returns:         reference to element object
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domID(elID) {
    return document.getElementById(elID);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domName
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         DOM shortcut utility
_/  parameters:      elName - element object(s) to reference
_/  returns:         reference to element object(s)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domName(elName) {
    return document.getElementsByName(elName);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domTag
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         DOM shortcut utility
_/  parameters:      elTag - element object(s) to reference
_/  returns:         reference to element object(s)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domTag(elTag) {
    return document.getElementsByTagName(elTag);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domEcho
_/  author:          dwilliams
_/  modified:        12/06/2006 (dwilliams)
_/  purpose:         DOM write utility
_/  parameters:      sText - text to write to screen
_/  returns:         nothing
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domEcho(sText) {
    return document.write(sText);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domAddElNode
_/  author:          dwilliams
_/  modified:        1/8/2007 (dwilliams)
_/  purpose:         add element node to document
_/  parameters:      elTag - element HTML tag name
_/  returns:         obj reference to new element node
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domAddElNode(elTag) {
    return document.createElement(elTag);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domAddTxtNode
_/  author:          dwilliams
_/  modified:        1/8/2007 (dwilliams)
_/  purpose:         add text node to document
_/  parameters:      sText - element text
_/  returns:         obj reference to new text node
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domAddTxtNode(sText) {
    return document.createTextNode(sText);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domAddChild
_/  author:          dwilliams
_/  modified:        1/8/2007 (dwilliams)
_/  purpose:         add child to specified parent node
_/  parameters:      elParent - parent node dom elem obj (or id/name)
_/                   elChild - child node dom elem obj (or id/name)
_/  returns:         nothing
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domAddChild(elParent, elChild) {
    if (typeof(elParent) == 'string') elParent = domID(elParent);
    if (typeof(elParent) != 'object') elParent = domName(elParent);
    if (elParent === null || elParent === undefined) return;
    if (typeof(elChild) == 'string') elChild = domID(elChild);
    if (typeof(elChild) != 'object') elChild = domName(elChild);
    if (elChild === null || elChild === undefined) return;
    elParent.appendChild(elChild);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        domRemoveChild
_/  author:          dwilliams
_/  modified:        1/8/2007 (dwilliams)
_/  purpose:         remove child from specified parent node
_/  parameters:      elParent - parent node dom elem obj (or id/name)
_/                   elChild - child node dom elem obj (or id/name)
_/  returns:         nothing
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function domRemoveChild(elParent, elChild) {
    if (typeof(elParent) == 'string') elParent = domID(elParent);
    if (typeof(elParent) != 'object') elParent = domName(elParent);
    if (elParent === null || elParent === undefined) return;
    if (typeof(elChild) == 'string') elChild = domID(elChild);
    if (typeof(elChild) != 'object') elChild = domName(elChild);
    if (elChild === null || elChild === undefined) return;
    elParent.removeChild(elChild);
  }

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        setElStyle
_/  author:          dwilliams
_/  modified:        1/5/2007 (dwilliams)
_/  purpose:         set specific element style property value
_/  parameters:      elID - dom elem obj (or id/name)
_/                   propName - style property name
_/                   propValue - style property value to change
_/  returns:         nothing
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function setElStyle(elID, propName, propValue){
  if (typeof(elID) == 'string') elID = domID(elID);
  if (typeof(elID) != 'object') elID = domName(elID);
  if (elID === null || elID === undefined) return;
  elID.style[propName].value = propValue;
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        getElStyle
_/  author:          dwilliams
_/  modified:        1/5/2007 (dwilliams)
_/  purpose:         retrieve specific element style property value
_/  parameters:      elID - dom elem obj (or id/name)
_/                   propName - style property name
_/  returns:         style property value
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function getElStyle(elID, propName){
  if (typeof(elID) == 'string') elID = domID(elID);
  if (typeof(elID) != 'object') elID = domName(elID);
  if (elID === null || elID === undefined) return;
  return elID.style[propName].value;
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        setElAttrib
_/  author:          dwilliams
_/  modified:        1/5/2007 (dwilliams)
_/  purpose:         set specific element attribute value
_/  parameters:      elID - dom elem obj (or id/name)
_/                   propName - element attribute name
_/                   propValue - element attribute value to change
_/  returns:         nothing
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function setElAttrib(elID, attribName, attribValue){
  if (typeof(elID) == 'string') elID = domID(elID);
  if (typeof(elID) != 'object') elID = domName(elID);
  if (elID === null || elID === undefined) return;
  elID.setAttribute(attribName, attribValue);
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        getElAttrib
_/  author:          dwilliams
_/  modified:        1/5/2007 (dwilliams)
_/  purpose:         retrieve specific element attribute value
_/  parameters:      elID - dom elem obj (or id/name)
_/                   propName - element attribute name
_/  returns:         element attribute value
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function getElAttrib(elID, attribName){
  if (typeof(elID) == 'string') elID = domID(elID);
  if (typeof(elID) != 'object') elID = domName(elID);
  if (elID === null || elID === undefined) return;
  return elID.getAttribute(attribName);
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        removeElAttrib
_/  author:          dwilliams
_/  modified:        1/5/2007 (dwilliams)
_/  purpose:         remove specific element attribute value
_/  parameters:      elID - dom elem obj (or id/name)
_/                   propName - element attribute name
_/  returns:         nothing
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function removeElAttrib(elID, attribName){
  if (typeof(elID) == 'string') elID = domID(elID);
  if (typeof(elID) != 'object') elID = domName(elID);
  if (elID === null || elID === undefined) return;
  elID.removeAttribute(attribName);
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        addTableRow
_/  author:          dwilliams
_/  modified:        1/8/2007 (dwilliams)
_/  purpose:         dynamically add table row
_/  parameters:      elTBody - (tbody only) dom elem obj (or id/name)
_/  returns:         obj reference to new row
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function addTableRow(elTBody) {
  if (typeof(elTBody) == 'string') elTBody = domID(elTBody);
  if (typeof(elTBody) != 'object') elTBody = domName(elTBody);
  if (elTBody === null || elTBody === undefined) return;
  var newTRow = domAddElNode('tr');
  domAddChild(elTBody, newTRow);
  return newTRow;
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        addTableCell
_/  author:          dwilliams
_/  modified:        1/8/2007 (dwilliams)
_/  purpose:         dynamically add table cell
_/  parameters:      elTRow - dom elem obj (or id/name)
_/                   elTCellText - cell content (text)
_/  returns:         obj reference to new cell
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
function addTableCell(elTRow, elTCellText) {
  if (typeof(elTRow) == 'string') elTRow = domID(elTRow);
  if (typeof(elTRow) != 'object') elTRow = domName(elTRow);
  if (elTRow === null || elTRow === undefined) return;
  var newTCell = domAddElNode('td');
  domAddChild(newTCell, domAddTxtNode(elTCellText));
  domAddChild(elTRow, newTCell);
  return newTCell;
}

function createElementWithName(type, name) {
  var element;
  // First try the IE way; if this fails then use the standard way
  if (document.all) {
    var sElVal = '<' + type + ' name="' + name + '" />';
    element = document.createElement(sElVal);
  } else {
    element = document.createElement(type);
    element.setAttribute('name', name);
  }
  return element;
}

/**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  xml parse utilities
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/

 /**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        parseText
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         retrieve specific XML node value
_/  parameters:      root - XML document root node
_/                   tag - XML node tag to retrieve
_/  returns:         tag node value
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function parseText(root, tag) {
    var ns = root.getElementsByTagName(tag);
    if (ns.length == 0) return null;
    ns = ns[0].childNodes;
    return ((ns.length == 0) ? '' : ((ns.length == 1) ? ns[0].data : ns[1].data ));
  }

 /**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        parseAttrib
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         extract specific XML node attribute value
_/  parameters:      root - XML document node
_/                   attr - XML node attribute to retrieve
_/  returns:         node attribute value
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function parseAttrib(root, attr) {
    var n = root.getAttributeNode(attr);
    return n ? n.value : null;
  }

 /**_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  function:        pauseTime
_/  author:          dwilliams
_/  modified:        11/28/2006 (dwilliams)
_/  purpose:         execution time delay
_/  parameters:      nMills - milliseconds to process
_/  returns:         none
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/**/
  function pauseTime(nMills) {
    var now = new Date();
    var exitTime = now.getTime() + nMills;
    while (true) {
      now = new Date();
      if (now.getTime() > exitTime) return;
    }
  }

  function isEmpty(objValue) {
   if (typeof (objValue) == 'undefined') return false;
    return (ObjValue.trim() == '' ||
      typeof (ObjValue) == undefined) ? true : false;
  }

  function validEmail(sEmail) {
    return /^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|tv|ws)$/.test(sEmail);
  }

  function validPhone(sPhone) {
    return /((\(\d{3}\) ?)|(\d{3}[- \.]))?\d{3}[- \.]\d{4}(\s(x\d+)?){0,1}$/.test(sPhone);
  }

  function validZip(sZip) {
    return /^\d{5}(?:-\d{4})?$|^[a-zA-Z]\d[a-zA-Z]\s?\d[a-zA-Z]\d$/.test(sZip);
  }

  function searchSubmit() {
    /*
      alert('Our apologies as this search feature in still under development...');
      return;
    */
    var searchText = domID('q').value;
    if (searchText.trim() != '' && searchText.trim() != 'Search Products') {
      /*
        if (confirm('Our apologies as this search feature in still under development...\n' + 'To temporarily continue your search using Google, press OK button.')) {
        oCommon.googleSearchURL = 'http://www.google.com/search?hl=en&q=+' + searchText + '+site%3Ajnkproducts.com&btnG=Google+Search';
        winPopup('google-search');
      }
      */
      domID('qs').action = 'http://www.jnkproducts.com/_searchpro/index.php';
      domID('qs').submit();
      return true;
    } else {
      alert('Please enter your search criteria.');
      return false;
    }
  }

  function tabSwitchClass(elID) {
    var activeClassName = '';
    var switchClassName = '';
    elID = elID.id;
    activeClassName = jQuery('#' + elID).attr('className');
    switchClassName = (/-off/.test(activeClassName))
      ? activeClassName.replace('-off', '-over')
      : activeClassName.replace('-over', '-off');
    jQuery('#' + elID).attr('className', switchClassName);
  }

  function tabClick(elID) {
    var classOffName = '';
    var classOnName = '';
    var thisID = '';
    var queryID = '';
    var theTab = '';
    var queryID = location.search;

    //  if fn tab argument not supplied
    if (!arguments[0]) {
      elID = tabArray[0].tabID;
      //  if url tab argument supplied
      if (queryID) {
        var pairs = queryID.substring(1).split("&");
        pairs = pairs[0].split("=");
        var elQueryID = pairs[1].toLowerCase();
        if (elQueryID == 'garage-flooring' ||
            elQueryID == 'garage-storage' ||
            elQueryID == 'roofing-gutter' ||
            elQueryID == 'home-garden' ||
            elQueryID == 'automotive-products' ||
            elQueryID == 'attic-products' ||
            elQueryID == 'office-commercial') {
          elID = elQueryID + '-tab';
        }

      }
    } else {  //  fn tab argument supplied
      elID = elID.id;
    }

    for (var i = 0; i < tabArray.length; i++) {
      thisID = tabArray[i].tabID;
      jQuery('#' + thisID).css('width', tabArray[i].tabWidth);
      if (thisID != elID) {  //  off tabs
        classOffName = tabArray[i].classPattern + 'off';
        jQuery('#' + thisID).attr('className', classOffName);
        jQuery('#' + thisID).attr('title', 'Show ' + tabArray[i].tabName);
        if (document.all) {  //  ie
          domID(thisID).onmouseover = function () { tabSwitchClass(this); };
          domID(thisID).onmouseout = function () { tabSwitchClass(this); };
          domID(thisID).onclick = function () { tabClick(this); };
        } else {  //  moz
          jQuery('#' + thisID).attr('onmouseover', 'tabSwitchClass(this);');
          jQuery('#' + thisID).attr('onmouseout', 'tabSwitchClass(this);');
          jQuery('#' + thisID).attr('onclick', 'tabClick(this);');
        }
        jQuery('#' + tabArray[i].tableID).css('visibility', 'hidden');
        jQuery('#' + tabArray[i].tableID).css('display', 'none');
      } else {  //  on tab
        classOnName = tabArray[i].classPattern + 'on';
        jQuery('#' + thisID).attr('className', classOnName);
        jQuery('#' + thisID).attr('title', 'Viewing ' + tabArray[i].tabName);
        jQuery('#' + thisID).attr('onmouseover', '');
        jQuery('#' + thisID).attr('onmouseout', '');
        jQuery('#' + thisID).attr('onclick', '');
        jQuery('#' + tabArray[i].tableID).css('visibility', 'visible');
        jQuery('#' + tabArray[i].tableID).css('display', '');
      }
    }
  }

  function navigt(URLHref,CurWindow){
    if (URLHref != ""){if (CurWindow == "_blank"){window.open(URLHref);} else {CurWindow.location = URLHref;}}
  }

  function hideShow (elObj) {
    var thElem = jQuery('ul',jQuery(elObj).parent())[0];
    var theElemState = jQuery(thElem).css('display');
    jQuery('.side-list-inner').css('display', 'none');
    if(theElemState == 'none'){
      jQuery(thElem).show('medium');
      jQuery(thElem).css('padding-bottom', '5px');
    }else{
      jQuery(thElem).hide();
      jQuery(thElem).css('padding-bottom', 'auto');
    }
  }


  /*  text-based tab functions  */

  function tabInit (tabArray, tabID, verID) {
    if (!arguments[1] || arguments[1] == '') tabID = tabArray[0].tabID;
    if (!arguments[2] || arguments[2] == '') verID = 'style2';
    var tabRef = '', tabCaption = '';
    var tabGroup = Array('-a','-b','-c');
    var tabDiv = jQuery('#tab-div');
/*
    tabDiv.append('<table cellspacing="0" cellpadding="0" class="tab-table x-left x-wauto x-hauto">');
    tabDiv.append('<tr>');
    for (var i = 0; i < tabArray.length; i++) {
      for (var j = 0; j < tabGroup.length; j++) {
        tabDiv.append('<td id="' + tabArray[i].tabID + tabGroup[j] + '">' + (tabGroup[j] != '-b' ? '&nbsp;' : '') + '</td>');
      }
      if ((i + 1) != tabArray.length) tabDiv.append('<td class="tab-space"></td>');
    }
    tabDiv.append('</table>');
    tabDiv.append('</tr>');
*/

    for (var i = 0; i < tabArray.length; i++) {
      tabRef = tabArray[i].tabID;
      tabCaption = tabArray[i].tabTitle;
      jQuery('#' + tabRef + tabGroup[1]).html(tabArray[i].tabText);
      if (tabRef != tabID) {
        for (var j = 0; j < tabGroup.length; j++) {
          jQuery('#' + tabRef + tabGroup[j]).removeClass();
          jQuery('#' + tabRef + tabGroup[j]).addClass('tab' + verID + '-off' + tabGroup[j]);
          jQuery('#' + tabRef + tabGroup[j]).bind("mouseover", {arg1: tabRef, arg2: 'over', arg3: verID}, tabClassSwitch);
          jQuery('#' + tabRef + tabGroup[j]).bind("mouseout", {arg1: tabRef, arg2: 'off', arg3: verID}, tabClassSwitch);
          jQuery('#' + tabRef + tabGroup[j]).bind("click", {arg1: tabArray, arg2: tabRef, arg3: verID}, tabClassClick);
          jQuery('#' + tabRef + tabGroup[j]).attr("title", "Show " + tabCaption);
        }
      } else {
        for (var j = 0; j < tabGroup.length; j++) {
          jQuery('#' + tabRef + tabGroup[j]).removeClass();
          jQuery('#' + tabRef + tabGroup[j]).addClass('tab' + verID + '-on' + tabGroup[j]);
          jQuery('#' + tabRef + tabGroup[j]).attr("title", "Viewing " + tabCaption);
        }
      }
    }
    tabAreaSwitch(tabArray);
  }

  function tabAreaSwitch (tabArray, tabID, verID) {
    if (!arguments[1] || arguments[1] == '') tabID = tabArray[0].tabID;
    if (!arguments[2] || arguments[2] == '') verID = 'style2';
    var tabRef = '',tabState = '',tabSection = '';
    for (var i = 0; i < tabArray.length; i++) {
      tabRef = tabArray[i].tabID;
      tabArea = tabArray[i].tabAreaID;
      if (tabRef != tabID) {  //  hide
        jQuery('#' + tabArea).css('visibility', 'hidden');
        jQuery('#' + tabArea).css('display', 'none');
        //jQuery('#' + tabArea).hide();
      } else {  //  show
        jQuery('#' + tabArea).css('visibility', 'visible');
        jQuery('#' + tabArea).css('display', 'block');
        //jQuery('#' + tabArea).show();
      }
    }
  }

  function tabClassSwitch (event) {
    var tabID = event.data.arg1;
    var classID = event.data.arg2;
    var verID = event.data.arg3;
    var tabGroup = Array('-a','-b','-c');
    for (var j = 0; j < tabGroup.length; j++) {
      jQuery('#' + tabID + tabGroup[j]).removeClass();
      jQuery('#' + tabID + tabGroup[j]).addClass('tab' + verID + '-' + classID + tabGroup[j]);
    }
  }

  function tabClassClick (event) {
    var tabArray = event.data.arg1;
    var tabID = event.data.arg2;
    var verID = event.data.arg3;
    var tabRef = '', tabCaption = '';
    var tabGroup = Array('-a','-b','-c');
    for (var i = 0; i < tabArray.length; i++) {
      tabRef = tabArray[i].tabID;
      tabCaption = tabArray[i].tabTitle;
      for (var j = 0; j < tabGroup.length; j++)
        jQuery('#' + tabRef + tabGroup[j]).removeClass();
      if (tabRef != tabID) {
        for (var j = 0; j < tabGroup.length; j++) {
          jQuery('#' + tabRef + tabGroup[j]).addClass('tab' + verID + '-off' + tabGroup[j]);
          jQuery('#' + tabRef + tabGroup[j]).bind("mouseover", {arg1: tabRef, arg2: 'over', arg3: verID}, tabClassSwitch);
          jQuery('#' + tabRef + tabGroup[j]).bind("mouseout", {arg1: tabRef, arg2: 'off', arg3: verID}, tabClassSwitch);
          jQuery('#' + tabRef + tabGroup[j]).bind("click", {arg1: tabArray, arg2: tabRef, arg3: verID}, tabClassClick);
          jQuery('#' + tabRef + tabGroup[j]).attr("title", "Show " + tabCaption);
        }
      } else {
        for (var j = 0; j < tabGroup.length; j++) {
          jQuery('#' + tabRef + tabGroup[j]).addClass('tab' + verID + '-on' + tabGroup[j]);
          jQuery('#' + tabRef + tabGroup[j]).unbind("mouseout");
          jQuery('#' + tabRef + tabGroup[j]).unbind("mouseover");
          jQuery('#' + tabRef + tabGroup[j]).unbind("click");
          jQuery('#' + tabRef + tabGroup[j]).attr("title", "Viewing " + tabCaption);
        }
      }
    }
    tabAreaSwitch(tabArray, tabID);
  }
