

//global object
var afs = new Object;

//look for mac/ie5
afs.mie = (
	typeof document.getElementById != 'undefined' 
	&& 
	typeof document.all != 'undefined' 
	&& 
	typeof window.opera == 'undefined' 
	&&
	(/mac/i.test(navigator.userAgent))
	);


//onload
window.onload = function()
{
	
	//if homepage function is present, call it
	if(typeof homepage == 'function') { homepage(); }
	
	//if tooltips function is present, call it
	if(typeof tooltips == 'function') { tooltips(); }
	
	//get spans inside tabs
	afs.spans = document.getElementById('tabset').getElementsByTagName('span');
	afs.spansLen = afs.spans.length;
	
	//for each span
	for(var i=0; i<afs.spansLen; i++)
	{
		//bind mouseover handler to span
		//which sets "hover" class on parent link
		//because the hover event appears not to 'bubble' naturally in safari
		afs.spans[i].onmouseover = function()
		{
			//get parent link
			afs.link = this.parentNode;
			
			//add or append classname
			(afs.link.className == '') ? afs.link.className = 'hover' : afs.link.className += ' hover';
			
		};
		//bind mouseout handler to span
		//which removes "hover" class on parent link
		afs.spans[i].onmouseout = function()
		{
			//get parent link
			afs.link = this.parentNode;
			
			//remove classname
			afs.link.className = afs.link.className.replace(/[ ]?hover/g,'');
			
		};
		
		
		//if this is mac/ie5
		if(afs.mie)
		{
			//bind onclick handler to span, which clicks parent link 
			//because the click event appears not to 'bubble' naturally
			afs.spans[i].onclick = function() { this.parentNode.click(); };
		}
	}
	
	

	
};
