function getImageWidth(myImage) {
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.width;
	} else {
		return getElementWidth(myImage);
	}
	return -1;
}

function getImageHeight(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.height;
	} else {
		return getElementHeight(myImage);
	}
	return -1;
}


function currentUrlPath() {
  ss = location.protocol + "//" +
       location.host + "/" +
       location.pathname.substring(1, location.pathname.lastIndexOf("/")) + "/";
  return ( ss );
}

function displayNone(obj) {
  obj.style.display = "none";
}

function displayBlock(obj) {
  obj.style.display = "block";
}

function displayInline(obj) {
  obj.style.display = "inline";
}

function hideIt(obj) {
  obj.style.visibility = "hidden";
}

function showIt(obj) {
  obj.style.visibility = "visible";
}



function callLater1(fcn, arg1) {
  return ( function() { fcn(arg1); } );
}



function callLater2(fcn, arg1, arg2) {
  return ( function() { fcn(arg1, arg2); } );
}



String.prototype.trim=function(){
    return this.replace(/^\s*|\s*$/g,'');
}


function formatCurrency(num) {
  num = num.toString().replace(/\$|\,/g,'');
  if(isNaN(num))
    num = "0";
  sign = (num == (num = Math.abs(num)));
  num = Math.floor(num*100+0.50000000001);
  cents = num%100;
  num = Math.floor(num/100).toString();
  if(cents<10)
    cents = "0" + cents;
  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+','+
          num.substring(num.length-(4*i+3));
  return (((sign)?'':'-') + '$' + num + '.' + cents);
}



function numAsTwoDigitString(n) {
  if ( n < 10 ) {
    return ( '0' + n );
  } else {
    return ( n );
  }
}



function testIsValidObject(objToTest) {
  if (objToTest == null || objToTest == undefined) {
    return false;
  }
  return true;
}



function getTargetOfEvent(e)
{
  var targ;
  if (!e) {
    var e = window.event;
  }
  if (e.target) {
    targ = e.target;
  } else if (e.srcElement) { 
    targ = e.srcElement;
  }
  // defeat Safari bug
  if (targ.nodeType == 3) {
    targ = targ.parentNode;
  }
  return ( targ );
}



function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}




function min(a,b) {if (a>b) {return b;} else {return a;}}
function max(a,b) {if (a<b) {return b;} else {return a;}}



function commandLineToArray(ss) {
  s         = ss;
  done      = 0;
  args      = new Array();
  numArgs   = 0;
  firstChar = '';
  matchChar = '';
  matchPos  = -1;

  while ( done != 1 ) {
    if ( s.length == 0 ) {
      done = 1;
    } else {
      firstChar = s.charAt(0);
      if ( firstChar == ' ' ) {
        // Skip "leading" spaces each time around
        s = s.substring(1);
      } else {
        if ( firstChar == '"' ) {
          matchChar = '"';
        } else if ( firstChar == '\'' ) {
          matchChar = '\'';
        } else {
          matchChar = ' ';
        }
        matchPos  = s.indexOf(matchChar, 1);
        if ( matchPos == -1 ) {
          //Missing matching quote OR end of string
          if ( matchChar == ' ' ) {
            // Unquoted case, just hit end of string
            args[numArgs]  = s.substring(0);
          } else {
            // Quoted case, hit end of string without matching quote
            // Really an error, but we'll just treat things like there was a final quote
            args[numArgs]  = s.substring(1);
          }
          numArgs       += 1;
          s              = null;
          done           = 1;
        } else {
          if ( matchChar == ' ' ) {
            // Unquoted case
            args[numArgs]  = s.substring(0, matchPos);
          } else {
            // Quote case
            args[numArgs]  = s.substring(1, matchPos);
          }
          numArgs       += 1;
          s              = s.substring(matchPos+1);   // past space or quote
          // Check to see if we're at the end of string. If so, short circuit and be done
          // Also, handle trailing space -- just ignore it
          if ( s.length == 0 ) {
            s = null;
            done = 1;
          } else if ( ( s.length == 1 ) && ( s.charAt(0) == ' ' ) ) {
            s = null;
            done = 1;
          }
        }
      }
    }
  }
  return ( args );
}

// From: http://www.anyexample.com/webdev/javascript/javascript_getelementsbyclass_function.xml
function getElementsByClass( searchClass, domNode, tagName) {
	if (domNode == null) domNode = document;
	if (tagName == null) tagName = '*';
	var el = new Array();
	var tags = domNode.getElementsByTagName(tagName);
	var tcl = " "+searchClass+" ";
	for(i=0,j=0; i<tags.length; i++) {
		var test = " " + tags[i].className + " ";
		if (test.indexOf(tcl) != -1)
			el[j++] = tags[i];
	}
	return el;
}

// Begin cookie-related classes

// Use: setCookie('username', username, 365);
function setCookie(c_name, value, expiredays) {
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  document.cookie=c_name + "=" + escape(value) + ( (expiredays==null) ? "" : ";expires=" + exdate.toGMTString() );
}

// Use: username=getCookie('username');
function getCookie(c_name) {
  if ( document.cookie.length > 0 ) {
    c_start = document.cookie.indexOf(c_name + "=");
    if ( c_start!=-1 ) { 
      c_start = c_start + c_name.length+1; 
      c_end   = document.cookie.indexOf(";", c_start);
      if ( c_end==-1 ) { c_end = document.cookie.length; }
      return ( unescape(document.cookie.substring(c_start,c_end)) );
    } 
  }
  return ( "" );
}

// End cookie-related classes



// Dynamically "attach" a Javascript file to document
function include(url, onload, onreadystatechange, headTrueOrBodyFalse) {
  var script = document.createElement('script');
  script.src                = url;
  script.type               = 'text/javascript';
  script.onload             = onload;
  script.onreadystatechange = onreadystatechange;
  if ( headTrueOrBodyFalse == true ) {
    document.getElementsByTagName("head")[0].appendChild(script);
  } else {
    document.body.appendChild(script);
  }
}

function getElementsByClassName(clsName, tagName) {
    var retVal = new Array();
    var elements = document.getElementsByTagName(tagName);
    for(var i = 0;i < elements.length;i++) {
        if(elements[i].className.indexOf(" ") >= 0) {
            var classes = elements[i].className.split(" ");
            for(var j = 0;j < classes.length;j++) {
                if(classes[j] == clsName) {
                    retVal.push(elements[i]);
                }
            }
        } else if(elements[i].className == clsName) {
           retVal.push(elements[i]);
        }
    }
    return retVal;
}


function PositionX(obj, xx) {
  obj.style.left = xx;
}

function PositionY(obj, yy) {
  obj.style.top  = yy;
}

function Position(obj, xx, yy) {
  PositionX(obj, xx);
  PositionY(obj, yy);
}

// NOT WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function KeepInPlace(objName) {
  var ns  = (navigator.appName.indexOf("Netscape") != -1);
  var d   = document;
  var obj = d.getElementById(objName);
  yy = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  PositionY(obj, yy);
  alert(objName + "   " + yy);
  setTimeout("KeepInPlace('"+objName+"')", 5000);
}


//----------------------------------------------------------------------------------
<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { 
  document.onmousemove = UpdateCursorPositionDocAll; 
} else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
  if(self.pageYOffset) {
    rX = self.pageXOffset;
    rY = self.pageYOffset;
  } else if ( document.documentElement && document.documentElement.scrollTop ) {
    rX = document.documentElement.scrollLeft;
    rY = document.documentElement.scrollTop;
  } else if (document.body) {
    rX = document.body.scrollLeft;
    rY = document.body.scrollTop;
  }
  if (document.all) {
    cX += rX; 
    cY += rY;
  }
  d.style.left = (cX+10) + "px";
  d.style.top = (cY+10) + "px";
}
function HideContent(d) {
  if (d.length < 1) { return; }
  document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
  if(d.length < 1) { return; }
  var dd = document.getElementById(d);
  AssignPosition(dd);
  dd.style.display = "block";
}
function ReverseContentDisplay(d) {
  if(d.length < 1) { return; }
  var dd = document.getElementById(d);
  AssignPosition(dd);
  if(dd.style.display == "none") {
    dd.style.display = "block"; 
  } else { dd.style.display = "none";
  }
}
//----------------------------------------------------------------------------------