
function loadTabs(tabIndex, tabID, tabDiv, tabBits, imagesOn, imagesOff) {
	var tabIndexValue = document.getElementById(tabIndex).value;	
	var tabIDValue = document.getElementById(tabID).value;
	var tabDivValue = document.getElementById(tabDiv).value;
	tabMouseOver(tabIndexValue, tabIDValue, tabBits, imagesOn, imagesOff);		
	tabBits[tabIndexValue] = true;		
	var on = document.getElementById(tabDivValue);
	on.className = 'visible';
	if(on.style.position == 'absolute') {
		on.style.position = 'relative';
		on.style.top = '0px';
	}
}

function tabMouseOver(index, id, tabBits, imagesOn, imagesOff) {
	if(!tabBits[index]) {
		if(document[id]) document[id].src = imagesOn[index].src;
		else document.getElementById(id).style.backgroundImage = "url(" + imagesOn[index].src + ")"; 
	}
}

function tabMouseOver2(divArray, tabState, index, id, tabBits, imagesOn, imagesOff) {
	var tabStateValue = document.getElementById(tabState).value;
	if(tabStateValue == 0) {
		document.getElementById(tabState).value = "1";		
		for(var i = 1; i < divArray.length; i++) {
			var d = document.getElementById(divArray[i]);
			d.className = 'invisible';			
			d.style.position = 'relative';
			d.style.top = '0px';
		}
	}
	tabMouseOver(index, id, tabBits, imagesOn, imagesOff);				
}

function tabMouseOut(index, id, tabBits, imagesOn, imagesOff) {
	if(!tabBits[index]) {
		if(document[id]) document[id].src = imagesOff[index].src;
		else document.getElementById(id).style.backgroundImage = "url(" + imagesOff[index].src + ")";
	}
}

function tabClick(tabIndex, tabID, tabDiv, index, id, div, tabBits, imagesOn, imagesOff) {
	var tabIndexValue = document.getElementById(tabIndex).value;
	var tabIDValue = document.getElementById(tabID).value;
	var tabDivValue = document.getElementById(tabDiv).value;	
	if(tabIndexValue != index) {
		document.getElementById(tabIndex).value = index;
		document.getElementById(tabID).value = id;
		document.getElementById(tabDiv).value = div;
		tabBits[tabIndexValue] = false;
		tabMouseOut(tabIndexValue, tabIDValue, tabBits, imagesOn, imagesOff);
		tabMouseOver(index, id, tabBits, imagesOn, imagesOff);		
		tabBits[index] = true;
		document.getElementById(tabDivValue).className = 'invisible';		
		document.getElementById(div).className = 'visible';		
	}
}