/*
LEFTNAVBTNS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Instructions:
Create a reference to this JS file in the document
you want to create LeftNavBtns in.

Make sure your document creates a reference to the
PlatformSniff script.

Configure the script properties any way you like
in the initLeftNavProps function.

Create a <div> element, ONLY <div> elements, for
each LeftNavBtn.

To bind the LeftNavBtn to the event delegates
bellow give each <div> element's CSS class name
the same class name specified in the
"LeftNavBtnClassName" property.

Use the "goTo(url)" method in the "onclick" event
attribute of each <div> to control navigation.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Created by:	Dan Fields (dfields@macdirect.com) DSF
On:			Tuesday, February 14, 2006
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
History:
20060216	DSF		Created script
*/


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *** LEFTNAVBTNS -- INITIALIZE PROPERTIES ***
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var	LeftNavBtnClassName, LeftNavBtnOverClassName, LeftNavBtnOutClassName,
	LeftNavBtnDownClassName, LeftNavBtnUpClassName;

function initLeftNavBtnsProps() {

	LeftNavBtnClassName = 'LeftNavBtn';
	LeftNavBtnOverClassName = 'LeftNavBtnOver';
	LeftNavBtnOutClassName = 'LeftNavBtn';
	LeftNavBtnDownClassName = 'LeftNavBtnDown';
	LeftNavBtnUpClassName = 'LeftNavBtnOver';

}

//
// EVENT DELEGATE: onmouseover
function delegateMouseOver(e) {

	var targetObj = getEventTarget(e);
	leftNavBtnOver(targetObj);

}

//
// EVENT DELEGATE: onmouseout
function delegateMouseOut(e) {

	var targetObj = getEventTarget(e);
	leftNavBtnOut(targetObj);

}

//
// EVENT DELEGATE: onmousedown
function delegateMouseDown(e) {

	var targetObj = getEventTarget(e);
	leftNavBtnDown(targetObj);

}

//
// EVENT DELEGATE: onmouseup
function delegateMouseUp(e) {

	var targetObj = getEventTarget(e);
	leftNavBtnOver(targetObj);

}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *** LEFTNAVBTNS ENGINE -- CORE CODE ***
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function leftNavBtnOver(btn) {

	if (btn.className == LeftNavBtnClassName || btn.className == LeftNavBtnOutClassName ||  btn.className == LeftNavBtnDownClassName) {
	
		btn.className = LeftNavBtnOverClassName;
	}

}

function leftNavBtnOut(btn) {

	if (btn.className == LeftNavBtnOverClassName) {
		btn.className = LeftNavBtnOutClassName;
	}

}

function leftNavBtnDown(btn) {

	if (btn.className == LeftNavBtnOverClassName) {
		btn.className = LeftNavBtnDownClassName;
	}

}

function leftNavBtnUp(btn) {

	if (btn.className == LeftNavBtnDownClassName) {
		btn.className = LeftNavBtnUpOverClassName;
	} else {
		leftNavBtnOut(btn);
	}

}

function getEventTarget(e) {

	return (brow.isAll) ? window.event.srcElement : e.target;

}

function goTo(url) {
	document.location = url;

}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *** INITIALIZE SCRIPT
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

initLeftNavBtnsProps();				// initialize properties
var brow = new PlatformSniff();		// create a platform sniffer

//
// route events to delegators
if (!brow.isAll) {
	document.captureEvents(Event.MOUSEOVER);
	document.captureEvents(Event.MOUSEOUT);
	document.captureEvents(Event.MOUSEDOWN);
	document.captureEvents(Event.MOUSEUP);
}

document.onmouseover = delegateMouseOver;
document.onmouseout = delegateMouseOut;
document.onmousedown = delegateMouseDown;
document.onmouseup = delegateMouseUp;
