// Global variable to hold the Active Tab Name
var activeTabName = "";

// Function to change the image
function changeImage(imgName, tabName, imgURL){
	document.getElementById('tabImage').src=imgName;
	document.getElementById(tabName).className="tabTextOver";
	
	// Clear the tab-over state of the previously clicked tab
	if(activeTabName != "" && activeTabName != tabName)	
		document.getElementById(activeTabName).className="tabText";
	activeTabName = tabName;
	
	//set link
	if(imgURL!="#"){
		var imgId = document.getElementById('tabImage');
		imgId.parentNode.href=imgURL;
		imgId.parentNode.style.cursor = "hand";
	}else{
		var imgId = document.getElementById('tabImage');
		imgId.parentNode.href=imgURL;
		imgId.parentNode.style.cursor = "default";
	}
}

// Function to implement the mouse-over functioanlity
function tabOver(tabName){
	if(activeTabName == tabName) return;
	document.getElementById(tabName).className="tabTextOver";
	document.getElementById(tabName).style.cursor="pointer";
}

// Function to implement the mouse-out functioanlity
function tabOut(tabName){
	if(activeTabName == tabName) return;
	document.getElementById(tabName).className="tabText";
}