<!--
// Form Compendium f9_Initial Text (22-10-2005)
// by Vic Phillips http://www.vicsJavaScripts.org.uk

// When a page loads Text Boxes and Areas will display an initial value.
// When focused the initial value is removed to allow user input.
// If the text box/area value is blank (value='') the initial value is displayed again.

// Application Note

// Initialised with a <body> onload event
// <body onload="f9_InitialText('ID','*Text*');f9_InitialText('keywords2','Search Product');" >
// where
// *ID*   = the id of the text box/area            ('string')
// *Text* = the initial value of the text box/area ('string')

// All variable, function etc. names are prefixed with 'f9_' to minimise conflicts with other javascripts


// Customising Variables
var f9_InitialColor='gray'
var f9_NormalColor='black'

// Functional Code - NO Need to Change
function f9_InitialText(id,txt){
 f9_target=document.getElementById(id);
 f9_target.dtxt=txt;
 f9_target.style.color=f9_InitialColor;
 f9_target.value=txt;
 f9_AddFocus(f9_target);
 f9_AddBlur(f9_target);
}

function f9_Focus(){
 if (this.value==this.dtxt){
  this.style.color=f9_NormalColor;
  this.value='';
 }
}

function f9_Blur(){
 if (this.value==''){
  this.style.color=f9_InitialColor;
  this.value=this.dtxt;
 }
}

function f9_EventAdd(f9_o,f9_t,f9_f) {
 if ( f9_o.addEventListener ){ f9_o.addEventListener(f9_t, function(e){ f9_o[f9_f](e);}, false); }
 else if ( f9_o.attachEvent ){ f9_o.attachEvent('on'+f9_t,function(e){ f9_o[f9_f](e); }); }
 else {
  var f9_Prev=f9_o["on" + f9_t];
  if (f9_Prev){ f9_o['on'+f9_t]=function(e){ f9_Prev(e); f9_o[f9_f](e); }; }
  else { f9_o['on'+f9_t]=f9_o[f9_f]; }
 }
}

function f9_AddFocus(f9_){
 if (f9_.addFocus){ return; }
 f9_.addFocus=f9_Focus;
 f9_EventAdd(f9_,'focus','addFocus');
}

function f9_AddBlur(f9_){
 if (f9_.addBlur){ return; }
 f9_.addBlur=f9_Blur;
 f9_EventAdd(f9_,'blur','addBlur');
}

//-->