/* =============================================================================
$Id: popup.js,v 1.6 2006/01/13 09:16:51 rupert Exp $
$Date: 2006/01/13 09:16:51 $
$Revision: 1.6 $
$Author: rupert $
Copyright (c) 2006 Conchango Ltd. All rights reserved.
Web Application Version: [BUILD_14.03.30_159_060823]
Release Date: [23-August-2006]
============================================================================= */


var topNav =
{
	overClass: 'hover',
	outClass: '',
	selClass: 'selected',
	
	over: function(el)
	{
		if (this.selClass != el.className) el.className=this.overClass;
	},
	
	out: function(el)
	{
		if (this.selClass != el.className) el.className=this.outClass;
	}
}




var leftNav =
{
	delayIn1:		20,
	delayOut1:		50,
	delayIn2:		75,
	delayOut2:		175,
	delayIn3:		150,
	delayOut3:		250,
	step:			5,
	baseColour1:	200,
	outColour1:		255,
	baseColour2:	225,
	outColour2:		255,
	baseColour3:	245,
	outColour3:		255,
	hoverColour:	175,
	up:				-1,
	down:			1,
	
	over:function(el)
	{
		if (el.timer) clearInterval(el.timer);
		
		switch(el.parentNode.className)
		{
			case 'leftNav1':
				this._change(el.id,this.baseColour1,this.hoverColour,this.delayIn1,this.up);
				break;
			case 'leftNav2':
				this._change(el.id,this.baseColour2,this.outColour2,this.delayIn1,this.down);
				break;
			case 'leftNav3':
				this._change(el.id,this.baseColour3,this.outColour3,this.delayIn1,this.down);
				break;
		}
	},
	
	out:function(el)
	{
		if (el.timer) clearInterval(el.timer);
		
		switch(el.parentNode.className)
		{
			case 'leftNav1':
				this._change(el.id,this.outColour1,this.baseColour1,this.delayOut1,this.up);
				break;
			case 'leftNav2':
				this._change(el.id,this.outColour2,this.baseColour2,this.delayOut2,this.up);
				break;
			case 'leftNav3':
				this._change(el.id,this.outColour3,this.baseColour3,this.delayOut3,this.up);
				break;
		}
	},
		
	_change:function(elid,value,target,delay,dir)
	{
		var el = $(elid); //we have to do this as IE is too dumb to allow us to pass an element referance in a timer object.
		el.style.backgroundColor = 'rgb('+value+','+value+','+value+')'
		
		if (value!=target)
		{
			value+=leftNav.step*dir;
			var fCall = 'leftNav._change("'+elid+'",'+value+','+target+','+delay+','+dir+')';
			el.timer=setTimeout(fCall,delay);
		}
		else if (target==leftNav.hoverColour)
		{
			value+=leftNav.step
			var fCall = 'leftNav._change("'+elid+'",'+value+','+255+','+delay+','+leftNav.down+')';
			el.timer=setTimeout(fCall,delay);
		}
	}
}