/* $Id: utility.js,v 1.1.2.2 2005/11/30 21:09:00 robinmonks Exp $ */

// functions for clearing and restoring input field values

function clearText(thefield) { 
  if (thefield.defaultValue == thefield.value) 
  {
    thefield.value = ""; // if the field hasn't been edited, clear it
  }
}
function replaceText(thefield) { 
  if (thefield.value == "") 
  {
    thefield.value = thefield.defaultValue; // if the field hasn't been edited, restore the default value
  }
}


/***
* class rollOverContainer
*/
function rollOverContainer ( c )
{
	this.c = $( c );
	this.oi = '_gray';
	this.separator = '_';
	this.a = [];
	this.i = [];	
	
	this.init = function()
	{
		if ( ! this.c )
			return false;

		this.a = this.c.getElementsByTagName( 'IMG' );
		
		if ( ! this.a.length )
			return false;
		else
		{
			for ( var ___i = 0; ___i < this.a.length; ___i++ )
			{
				this.i [ ___i ] = new Image();
				this.i [ ___i ].src = this.a [ ___i ].src.replace(/_gray/, '');
				this.a [ ___i ].onmouseover = this.setMouseOverImg.bindAsEventListener( this );	
				this.a [ ___i ].onmouseout = this.setMouseOutImg.bindAsEventListener( this );	
			}
		}
	}

	this.setMouseOverImg = function ( e )
	{
		var pt = e.target ? e.target : e.srcElement; // ie trick -> pseudo target...
		pt.src = pt.src.replace(/_gray/, '');
	}

	this.setMouseOutImg = function (e )
	{
		var pt = e.target ? e.target : e.srcElement; // ie trick -> pseudo target...
		pt.src = pt.src.replace(/.jpg/, '_gray.jpg');
	}

	this.init();
}

window.onload = function () { rollOverContainer ( 'div_column_right' ) };

