
<!--

// Onload unobtrusive handler
// Dean Edwards/Matthias Miller/John Resig

/* for Mozilla/Opera9 */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState == "complete") {
			init(); // call the onload handler
		}
	};
/*@end @*/

/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			init(); // call the onload handler
		}
	}, 10); 
}

/* for other browsers */
window.onload = init;

//**********************************
// Unobtrusive functions
//**********************************
function init() {
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	if (_timer) clearInterval(_timer);
	
	// OnLoad stuff
	if ($('brand_tabs')) { itabs(); }
	
	
}

//**********************************
// Tabbing 
//**********************************

function itabs(){
	tab = { 	// New tabs
		timeDelay : 10, 			// 1000 = 1 second
		//tabCookie : "cookieTab",  	// cookie name
		timeToKeep : 31449600000 	// one week
	}
	// Tabs Events
	$('brand_tabs').onmouseover = tabbing;
	// Tabs Accessibility
	accessible(document, "brand_content");
	// Tabs Initiate, includes cookie lookup 
	tabInit();
}

// Initiate a tab, if no cookie, open tab1
function tabInit(){
	//var tmp = get_cookie(tab.tabCookie);
	//if (tmp) { 	// if cookie
	//	swapTab($(tmp));	
	//} else { 	
	//	swapTab($('tab1'));	
	//}
	swapTab($('tab1'));	
}


// actions
function tabbing(e){
	var t = getTarget(e); 
	if (t.className=="brand_tab") {
		t.onmouseout = clearTime;
		t.onmousedown = downTab;
		tab.time = setTimeout(function () { swapTab(t); }, tab.timeDelay);
	}
}

// On a mouse down
function downTab(e){
	clearTime();
	var t = getTarget(e);
	swapTab(t);
}

// If user has moused over for time period
function swapTab(obj) {
	objCon = $(obj.id + "_con");
	obj.className = "brand_tab_on";
	dsp(objCon,'block'); 	
	if (tab.prev) {
		tab.prev.className = "brand_tab";
		dsp(tab.conPrev,'none'); 
	}
	//var expires = new Date();
	//expires.setTime(expires.getTime() + tab.timeToKeep);
	//set_cookie(tab.tabCookie, obj.id, expires);
	tab.prev=obj;
	tab.conPrev=objCon;
	obj.onmousedown = null;
}

function clearTime(){
	clearTimeout(tab.time);
}


// Object Accessibility || parent Object, objects to hide
function accessible(pObj, tObj){
	var tmp = getElementsByClassName(pObj, "*", tObj); 
	for(var i=0;i<tmp.length;i++){
		dsp(tmp[i],'none');
	}
}

// Event Delegations
function getTarget(x){ 
	x = x || window.event;
	return x.target || x.srcElement;
}
// Prototype Method to get the element based on ID
function $(d){
	return document.getElementById(d);
}

// set or get the current display style of the div
function dsp(d,v){
	if(v==undefined){
		return d.style.display;
	}else{
		d.style.display=v;
	}
}

// set or get the height of a div.
function sh(d,v){
	// if you are getting the height then display must be block to return the absolute height
	if(v==undefined){
		//if style = block
		if(dsp(d)!='none'&& dsp(d)!=''){
			return d.offsetHeight;
		}
		// else
		viz = d.style.visibility;
		d.style.visibility = 'hidden';
		o = dsp(d);
		dsp(d,'block');
		r = parseInt(d.offsetHeight);
		dsp(d,o);
		d.style.visibility = viz;
		return r;
	}else{
		d.style.height=v;
	}
}

// get elements by class name
function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/-/g, "\-");
	var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}


// Cookie Toolbox Javascript
// copyright 4th September 2002, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.
// For instructions on how to use these functions see "A Cookie Toolbox"
// in the Javascript section of our site at http://www.felgall.com/


