function initBubble(){	
	var li = document.getElementById("bubbletabs").getElementsByTagName("li");
	for (var i=0; i<li.length;i++){
		addAnEvent(li.item(i),'mouseover',switchBubble);
		addAnEvent(li.item(i),'mouseout',clearBubble);
	}
}

function switchBubble(){	
	var bub = this.id.split("bt");
	bub = "bubble"+bub[1];
	var bubdiv = document.getElementById(bub);
	bubdiv.style.visibility = 'visible';
}

function clearBubble(){
	var li = document.getElementById("bubbletabs").getElementsByTagName("li");
	for (var i=1; i<li.length+1;i++){
		var bubdiv = document.getElementById("bubble"+i);
		bubdiv.style.visibility = 'hidden';
	}
}

function initSNav(){
	var subnav = document.getElementById('subnav');
	var subnavas = subnav.getElementsByTagName('a');
	for (var a=0; a<subnavas.length; a++){
		var currenthref=String(subnavas[a].href);
		currenthref=currenthref.split("?");
		var currentloc=String(document.location);
		currentloc=currentloc.split("?");
		if (unescape(currenthref[0])==unescape(currentloc[0])){
			subnavas[a].className="current"
		}
	}
}

function addAnEvent(target, eventName, functionName){
	eval('target.on'+eventName+'=functionName');
}

function initPage(){
	if (document.getElementById){		
		if (document.getElementById("subnav")) initSNav();
		if (document.getElementById("bubble")) initBubble();
	}
}

window.onload=initPage;