var homeTab=Class.create();
homeTab.prototype = {
	initialize:function(id,currentCss,mouseEvent){
		this.id = id;
		this.currentCss = currentCss;
		this.mouseEvent = mouseEvent;
		this.init();
	},
	
	init:function(){
		if($(this.id)){
			$(this.id).down(1).childElements().each(function(s,index){//事件绑定
				s.observe(this.mouseEvent, this._changeTab.bindAsEventListener(this,index));
			}.bind(this));
		}
	},

	_changeTab:function(e){//事件监听,改变标题样式和显示隐藏相应层
		var el =e.element();
		var cssN = this.currentCss;
		if (!el.hasClassName(cssN)){
			el.addClassName(cssN).siblings().each(function(s){
				s.removeClassName(cssN);
			});
			el.up(1).next().childElements()[$A(arguments).pop()].show().siblings().each(function(s){
				s.hide();
			});
		};
	}
}
document.observe("dom:loaded",function(){
	var homeTab_weekRank = new homeTab("flightsearch","current","click");
});
