/*
:Focus doesn't work in IE, so I had to use JS... 
Inroducing the FORM FIELD FOCUSIZER FOR IE!

Created by: Alf Magne Kalleland :: www.dhtmlgoodies.com (C) www.dhtmlgoodies.com, November 2005

Modified by: Chris Underwood :: www.nicasiodesign.com, Feb 27 2009
				(to allow for multiple classes on form field)
*/


var currentlyActiveInputRef = false;
var currentlyActiveInputClassName = false;

function highlightActiveInput() {
  if(currentlyActiveInputRef) {
    currentlyActiveInputRef.className = currentlyActiveInputClassName;
  }
  currentlyActiveInputClassName = this.className;
  //this.className = 'inputHighlighted'; Modified by Chris Underwood...
  this.className = this.className+' inputHighlighted';
  currentlyActiveInputRef = this;
}

function blurActiveInput() {
  this.className = currentlyActiveInputClassName;
}

function initInputHighlightScript() {
  var tags = ['INPUT','TEXTAREA', 'SELECT'];
  for(tagCounter=0;tagCounter<tags.length;tagCounter++){
    var inputs = document.getElementsByTagName(tags[tagCounter]);
    for(var no=0;no<inputs.length;no++){
      if(inputs[no].className && inputs[no].className=='doNotHighlightThisInput')continue;
      if((inputs[no].tagName.toLowerCase()=='textarea' || inputs[no].tagName.toLowerCase()=='input' || inputs[no].tagName.toLowerCase()=='select') && inputs[no].type.toLowerCase()=='text'){
        inputs[no].onfocus = highlightActiveInput;
        inputs[no].onblur = blurActiveInput;
      }
    }
  }
}


/*

LOAD POP UP WINDOW

*/

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=680,height=570');");
}




/*

TOGGLE 'Show More Info... | Hide Info...' LINKS 

*/

function showhide(targetID) {
	//change target element mode
	var elementmode = document.getElementById(targetID).style;
	elementmode.display = (!elementmode.display) ? 'none' : '';
}

function changetext(changee,oldText,newText) {
	//changes text in source element
	var elementToChange = document.getElementById(changee);
	elementToChange.innerHTML = (elementToChange.innerHTML == oldText) ? newText : oldText;
}

function workforchange(targetID,sourceID,oldContent,newContent) {
	showhide(targetID);
	changetext(sourceID,oldContent,newContent);
}