function Tabs(wrapperID,_actionType) {
	var self=this;
	var tabsWrapper = YUD.get(wrapperID);
	var actionType = _actionType;
	var currentTab, currentContent;
	
	if(typeof actionType == 'undefined') {
		actionType = 'click';
	}
	var tabAnchors = YUD.getElementsByClassName('tab','a',wrapperID,function(){
		YUE.on(this,actionType,function(){
			selectTab(this);
		});
		
		if(YUD.hasClass(this.parentNode,'selected')){
			currentTab = this.parentNode;
		}
	});
	var tabContents = YUD.getElementsByClassName('tab_content','div',wrapperID,function(){
		if(YUD.hasClass(this,'selected')){
			currentContent = this;
		}
	});
	
	
	var selectTab = function(clickedTab, fromHistory) {
		
		self.deselectActiveTab();
		
		currentTab = clickedTab.parentNode;
		activeTabClass = currentTab.className;
		YUD.addClass(currentTab,'selected');
		
		for (var i=0; i<tabContents.length; i++) {
			if(YUD.hasClass(tabContents[i],activeTabClass)) {
				YUD.addClass(tabContents[i],'selected');
				currentContent = tabContents[i];
				break;
			}
		};
		
		if (typeof(window['selectTabEx']) == 'function')
      selectTabEx(currentTab.id, fromHistory);
	}
	
	this.deselectActiveTab = function() {
		if(typeof currentTab != 'undefined') {
			YUD.removeClass(currentTab,'selected');
		}
		
		if(typeof currentContent != 'undefined') {
			YUD.removeClass(currentContent,'selected');
		}
	}
	
	this.selectTabByNumber = function(selectedNumber, fromHistory) {
		if(selectedNumber <= tabAnchors.length) {
 			var selectedTab = tabAnchors[selectedNumber-1];
			selectTab(selectedTab, fromHistory);
		}
	}
}