function HTMLCliTabFields(tbs,cnts,sel){
	this.tabs = tbs;
	this.conts = [];
	this.selection = document.getElementById(sel);
	this.tabselection = null;
	this.checkselected = true;
	var i,length = cnts.length,indx=null;
	for(i=0;i<length;i++){
		this.conts[i] = document.getElementById(cnts[i]);
		if(this.conts[i] == this.selection){
			indx = 0;
		}
	}
	if(indx != null){
		this.switchTab(indx);
		this._clearSelect(indx);
	}
}
pt = HTMLCliTabFields.prototype;
pt.switchTab = function (num,src){
	//if(this.checkselected && (typeof(this.selection) != 'undefined' && this.selection != null) && this.selection == this.conts[num]) return;
	if(typeof(this.selection) != 'undefined' && this.selection != null)
		this.selection.style.display = 'none';
	this.conts[num].style.display = '';
	this.onSelect(src,this.selection,this.conts[num]);
	if(typeof(this.tabs[num].onSelect) == 'function' || typeof(this.tabs[num].onSelect) == 'object'){
		this.tabs[num].onSelect(src,this.tabselection,this.tabs[num]);
	}
	this.selection = this.conts[num];
	this.tabselection = this.tabs[num];
}
pt.clearSelect = function(src){
	for(var i=0;i< this.tabs.length;i++){
		if(this.tabs[i] != src){
			this.onDeSelect(this.tabs[i]);
		}
	}
}
pt._clearSelect = function(indx){
	for(var i=0;i< this.tabs.length;i++){
		if(i!=indx){
			if(this.tabs[i] != null && (typeof(this.tabs[i].onSelect) == 'function' || typeof(this.tabs[i].onSelect) == 'object')){
				this.tabs[i].onDeSelect();
			}
			if(this.conts[i] != null){
				this.conts[i].style.display = 'none';
			}
		}
	}		
}
pt.onSelect = function(src,osel,nsel){};
pt.onDeSelect = function(obj){};
function HTMLCliTabField(id,type){
	this.elm = document.getElementById(id);
	if(typeof(type) != 'undefined' && type != null){
		switch(type){
			case 'perstate':
				this.onSelect = this.perstate_onSelect;
				this.onDeSelect = this.perstate_onDeSelect;				
				this.onState = document.getElementById(arguments[2]);
				this.offState = document.getElementById(arguments[3]);
			break;
		}
	}
}
pt = HTMLCliTabField.prototype;
pt.perstate_onSelect = function(src,osel,nsel){
	if(typeof(osel) != 'undefined' && osel != null)	
		osel.onDeSelect(src,osel,nsel);
	this.onState.style.visibility = 'visible';
	this.onState.style.display = '';
	this.offState.style.visibility = 'hidden';
	this.offState.style.display = 'none';
};
pt.perstate_onDeSelect = function(src,osel,nsel){
	this.onState.style.visibility = 'hidden';
	this.onState.style.display = 'none';
	this.offState.style.visibility = 'visible';
	this.offState.style.display = '';
}
delete pt;
