var BSS = {
	initialize:function() {
		this.tabs = [];
		this.headers = [];
		this.tabCount = 0;
		this.activeDesc = [];
	},
	hideAll:function() {
		for (var i=0;i<this.tabCount;i++){
			var d = $(this.tabs[i]);

			if (d)
				d.style.display = 'none';

		}
	},
	add:function(t, h) {
		this.tabs.push(t);
		this.headers.push(h);
		this.tabCount = this.tabs.length;
	},
	toggleDisp:function() {
		for (var i=0;i<arguments.length;i++){
			var d = $(arguments[i]);

			if (d.style.display == 'none')
				d.style.display = '';
			else
				d.style.display = 'none';
		}
	},
	toggleTab:function(num,opennum,animate) {
		if ($(this.tabs[num]).style.display == 'none'){
			for (var i=0;i<this.tabCount;i++){
				
				var temph = this.headers[i];

				if (temph) {
					var h = Element.ancestors(temph)[0];
					if (h){
						h.id = '';
					}
				}

				if ((opennum == null) || (opennum != i)){
					var tempc = this.tabs[i];
					var c = $(tempc);

					if(c.style.display != 'none'){
						if (animate || typeof animate == 'undefined')
							Effect.toggle(tempc,'blind',{duration:0.5, queue:{scope:'menus', position:'end', limit: 3}});
						else
							toggleDisp(tempc);
					}
				}
			}
			if (this.headers[num]) {
				var h = Element.ancestors(this.headers[num])[0];
				if (h) {
					h.id = 'current';
					$(this.headers[num]).blur();
				}
			}
			var c = $(this.tabs[num]);
			//c.style.marginTop = '2px';
			if (animate || typeof animate == 'undefined'){
				Effect.toggle(this.tabs[num],'blind',{duration:0.5, queue:{scope:'menus', position:'end', limit: 3}});
			}else{
				toggleDisp(this.tabs[num]);
			}
		}
	},
	toggleDetails:function(title, desc, id) {
		var tobj;
		var ad = this.activeDesc[id];
		//ring out the old!
		if (ad != null) {
			if (ad.title == title) {
				return;
			}
			tobj = $(ad.title);
			if (tobj) {
				Effect.toggle(ad.description,'blind', {duration:0.25, queue:{scope:'menudetails', position:'end', limit: 3}});
				this.activeDesc[id] = null;
				tobj.className = "";
			}
		}

		//ring in the new!!
		tobj = $(title);
		if (tobj) {
			Effect.toggle(desc,'blind', {duration:0.25, queue:{scope:'menudetails', position:'end', limit: 3}});
			this.activeDesc[id] = {title:title, description:desc};
			tobj.className = "on";
		}

		return false;
	},
	hideDetails:function(prod, from,to) {
		var tobj;
		for(var i=from;i<=to;i++) {
			tobj = $(prod+i);
			if (tobj) {
				Element.hide(prod + i + '_text');
				tobj.className = "";
			}
		}
	}

}
/*-----------------------------------------------------------
    Toggles element's display value
    Input: any number of element id's
    Output: none 
    ---------------------------------------------------------*/
/*-----------------------------------------------------------
    Toggles tabs - Closes any open tabs, and then opens current tab
    Input:     1.The number of the current tab
               2. (optional)The number of the tab to leave open
               3. (optional)Pass in true or false whether or not to animate the open/close of the tabs
    Output: none 
    ---------------------------------------------------------*/
