﻿// JScript File

function imgSwap(){
	var allImgs = document.getElementsByTagName('img');
	for (var i=0;i<allImgs.length;i++) {
		if (allImgs[i].src.indexOf('_off') > -1) {
			allImgs[i].onmouseover = function(){
				this.src = this.src.replace('_off.','_on.');
			}
			allImgs[i].onmouseout = function(){
				this.src = this.src.replace('_on.','_off.');
			}
		}
	}
	var allInputs = document.getElementsByTagName('input');
	for (i=0;i<allInputs.length;i++) {
		if (allInputs[i].src.indexOf('_off') > -1) {
			allInputs[i].onmouseover = function(){
				this.src = this.src.replace('_off.','_on.');
			}
			allInputs[i].onmouseout = function(){
				this.src = this.src.replace('_on.','_off.');
			}
		}
	}
}

// Example html to modify to popup a window:
// <a href="javascript:jhfPopup('http://www.google.com')">Click here to open Google</a>
//
// If the method is called with only a single parameter as such:
//  <a href="javascript:jhfPopup('http://jhfunds.com')">JH Funds Website</a>
// then it will display a normal window at the users preferred size.
//
// If you do specify naked as such:
//  <a href="javascript:jhfPopup('http://jhfunds.com', true)">JH Funds Website</a>
// then it will display a window with no toolbars.
//
// If you specify a width only or a width and a height as such:
//  <a href="javascript:jhfPopup('http://jhfunds.com', [true or false], [640 or 640, 480])">JH Funds Website</a>
// then it will set the width only or a width and a height.
function jhfPopup(url, naked, width, height)
{
   var options = "";

   function addOption(option)
   {
      if(options != "")
      {
         options += ",";
      }
      options += option;
   }

   if(width)
   {
      addOption("width=" + width);
   }

   if(height)
   {
      addOption("height=" + height);
   }
  
   if(naked)
   {
      addOption("toolbar=0");
      addOption("location=0");
      addOption("status=0");
      addOption("scrollbars=0");
      addOption("menubar=0");
      addOption("resizable=0");
   }
   else
   {
      addOption("toolbar=1");
      addOption("location=1");
      addOption("status=1");
      addOption("scrollbars=1");
      addOption("menubar=1");
      addOption("resizable=1");
   }

   var newWindow = window.open(url,"",options)
}


function SubmitAndDisable(btn) {
    btn.form.submit();
    window.setTimeout("DisableButton('" + btn.id + "')", 0);
}

function DisableButton(buttonID) {
    document.getElementById(buttonID).disabled=true;
}


function AddListener(eventName, func) {

   if (window.addEventListener) {
      window.addEventListener(eventName, func, false);
   } else {
      window.attachEvent("on" + eventName, func, false);
   }
}

AddListener("load", imgSwap);