//tabSetID is id of container hold a's to select tabs
//tabPageClass is class of the pages for each of above
//tab styles: tabstyleOn | tabstyleOff: On and Off are assumed, based on f() arg below
//assumes pages are all display: block

function initTabs(tabSetID, tabPageClass, tabstyle, startNum){
	var i,z;
	
	if(!startNum) var startNum = 0;
	//first find tabset
	var ulset = document.getElementById(tabSetID);
	
	if(ulset){
		ulset.tabPages = new Array();	//build new array of pages into ulset
		ulset.tabstyle = tabstyle;

		var tabPages = document.getElementsByTagName("div");
		for(i=0,z=0; i<tabPages.length; i++){
			if(tabPages[i].className == tabPageClass){
				ulset.tabPages[z] = tabPages[i];
				//turn off all but current
				if(z != startNum) ulset.tabPages[z].style.display = "none";
				z++;
			}
		}


		var set = ulset.getElementsByTagName('a');
		for(i=0;i<set.length;i++){
			set[i].tabNum = i; //self aware of what num it is
			set[i].tabSet = ulset; //ref to containing ul
			set[i].tabPage = ulset.tabPages[i]; //ref to it's page

			if(i == startNum) set[i].className = ulset.tabstyle + "On";
			else set[i].className = ulset.tabstyle + "Off";

//TAB ONCLICK
			set[i].onclick = function(){
				var tset = this.tabSet.getElementsByTagName('a');
				for(var x=0;x<tset.length; x++){
					//styleoff all tabs
					tset[x].className = this.tabSet.tabstyle + "Off";
					//hide all pages
					this.tabSet.tabPages[x].style.display = "none";
				}
				//styleon this tab
				this.className = this.tabSet.tabstyle + "On";	
				//show this tab's page
				this.tabSet.tabPages[this.tabNum].style.display = "block";
				
			} //end inline f()
		}
	}//end if ulset
}
