function Tabs(i_sDivPrefix, i_sSelectedTab, i_sDivClassName, i_sParentTab){
	this.sDivPrefix = i_sDivPrefix;
	this.sSelectedTabName = i_sSelectedTab;
	this.parentTab = i_sParentTab;
	this.iDivsCounter = 0;
	this.oTabsArray = new Array();
	
	this._construct = function(){
		//get all tabs into an array;
		var oDivsObj = document.getElementsByTagName("DIV");
		for(var i = 0; i < oDivsObj.length; i++){
			if(oDivsObj[i].attributes.name && oDivsObj[i].attributes.name.value == this.sDivPrefix){
				this.oTabsArray[this.iDivsCounter] = oDivsObj[i];
				this.iDivsCounter++;
			}
		}
	}
	
	this.changeTab = function(i_sDivName){
		
		var sDivId = this.sDivPrefix + "_" + i_sDivName;
		
		if(!document.getElementById(sDivId)){
				return false;
		}
		
		for (var i = 0; i < this.oTabsArray.length; i++){
			this.oTabsArray[i].className = i_sDivClassName + " hidden " + this.parentTab;
		}
		
		// show selected div
		document.getElementById(sDivId).className = i_sDivClassName + " visible " + this.parentTab;
		// change images
		var oSelectedImage = document.getElementById("img_" + i_sDivName);
		var oCurrentImage = document.getElementById("img_" + this.sSelectedTabName);
		if(oSelectedImage){
			var oTempImgObj = new Images("oTempImgObj");
			oTempImgObj.selectImage(oSelectedImage);
			oTempImgObj.enableImage(oCurrentImage);
			this.sSelectedTabName = i_sDivName;
		}
		//highlight text
		else{
			var oHrefObj = document.getElementById("href_" + i_sDivName);
			var oOldHrefObj = document.getElementById("href_" + this.sSelectedTabName);
			oHrefObj.className = "tabsMenu selected";
			oOldHrefObj.className = "tabsMenu";
			this.sSelectedTabName = i_sDivName;
		}
	}
	
	this._construct();
}

function changeTab(i_sDivName, i_sTabsObjName){
	var oTabsObj = eval(i_sTabsObjName);
	if (oTabsObj == null){
		return false;
	}
	
	oTabsObj.changeTab(i_sDivName);
}
