// blossomTabs constructor
var blossomTabs = function(tabsetID, activeTab, useArrow){
	
	var method = this;
	
	//activateTab method
	this.activateTab = function(tab){
		jQuery(tabsetID + ' .tabs .tab').removeClass('active');
		jQuery(tabsetID + ' .tabs .' + tab).addClass('active');
		
		jQuery(tabsetID + ' .tabs .tab').each(function(i) {
			method.textUnColor(this.id.substr(3));
			
		});
		//method.textColor(tab);
		if(useArrow){
			method.tabArrow(tab);
		}

		jQuery(tabsetID + ' .contents .content').hide();
		jQuery(tabsetID + ' .contents .' + tab).fadeIn("fast");
		
		this.activeTab = tab;

	}

	
	//tabArrow vars
	method.tabwidth = parseInt(jQuery(tabsetID + ' .tabs .tab').css("width").substr(0,3));
	method.arrowpos = parseInt(jQuery(tabsetID + ' .tabarrow img').css("left").substr(0,3));
	method.tabindex = new Array();
	jQuery(tabsetID + ' .tabs .tab').each(function(i) {
        	var tabname = this.id.substr(3);
		method.tabindex[tabname] = i;
		    
        });

	//tabArrow method
	if(useArrow){
	method.tabArrow = function(tab){
		var arrowpos = method.arrowpos;
		var numloops = method.tabindex[tab];
		if (numloops != 0){
			/*for (i=0;i<=numloops;i++){			
				arrowpos = arrowpos + method.tabwidth;
			}*/
		arrowpos = arrowpos + method.tabwidth;
		}else{ arrowpos = method.arrowpos; }

		//alert(arrowpos);

		jQuery(tabsetID + ' .tabarrow img').animate({left: arrowpos + "px"}, 250 );
		//jQuery(tabsetID + ' .tabarrow img').css({'left': arrowpos + 'px'});
	}
	}
	//textColor method
	method.textColor = function(tab){
		jQuery(tabsetID + ' .tabs .' + tab + ' img').attr("src","/fls/14800/site_graphics/2009/tabtxt_" + tab + "_on.png");
	}
	
	//textUnColor method
	method.textUnColor = function(tab){
		jQuery(tabsetID + ' .tabs .' + tab + ' img').attr("src","/fls/14800/site_graphics/2009/tabtxt_" + tab + "_off.png");
	}

	//click event
	jQuery(tabsetID + ' .tabs .tab').click(function() {
		method.activateTab(this.id.substr(3));
	});

	//hover event
	jQuery(tabsetID + ' .tabs .tab').hover(function() {
		if(this.id.substr(3) != method.activeTab){
			method.textColor(this.id.substr(3));
		}
		}, function() {
			//if(this.id.substr(3) != method.activeTab){
				method.textUnColor(this.id.substr(3));
			//}
	});
	

	//initialize
	this.activateTab(activeTab);

}//end blossomTabs constructor

