jslt.TabView=function(id){
	this.tabs=[]
	this.stack=[]
	this.currentId;
	this.TabView=function(id){
		var mainElement=document.getElementById(id)
		for(var i=0;i<mainElement.childNodes.length;i++){
			var curEl=mainElement.childNodes[i]
			if(curEl.nodeType==1){
				this.tabs.push(curEl)
			}
		}
	}
	this.selectById=function(id,withHistory){
		this.currentId=id
		if(withHistory){
			if(this.stack.length==0 || this.stack[this.stack.length-1]!=id){
				this.stack.push(id)
			}
		}
		for (var i = 0; i < this.tabs.length; i++) {
			var el=this.tabs[i]
			if(el.id==id){
				el.className="tabViewTab tabViewTabCurrent"
			}else{
				el.className="tabViewTab"
			}
		}
		for(var j=this.stack.length-2;j>=0;j--){
			if(this.stack[j]==id){
				this.stack.splice(j,1)
			}
		}
	}
	this.clearCurrent=function(){
		document.getElementById(this.currentId).innerHTML=""
	}
	this.getCurrent=function(){
		return document.getElementById(this.currentId)
	}
	this.back=function(nr){
		var cNr;
		if(nr==undefined){
			cNr=2
		}else{
			cNr=nr
		}
		var el;
		if((this.stack.length-cNr)>=0){
			el=this.stack[this.stack.length-cNr]
			this.stack.splice(this.stack.length-cNr,cNr)
			this.selectById(el,true)
		}else if((this.stack.length-cNr)>=-1){
			cNr=1
			el=this.stack[this.stack.length-cNr]
			this.stack.splice(this.stack.length-cNr,cNr)
			this.selectById(el,true)
		}
	}
	this.getCurrentId=function(){
		return this.currentId
	}
	this.forget=function(id){
		for(var i=this.stack.length;i>=0;i--){
			if(this.stack[i]==id){
				this.stack.splice(i,1)
			}
		}
	}
	this.TabView(id)
	  };
