
if(!Masque.L){Masque.L={};}
Masque.L.Tabs=Class();Masque.L.Tabs.extend({__SelectIndex:-1,__SelectTab:null,initialize:function(TabsBox,options){this.option={SelectedCSS:'Selected',NoneCSS:'NoSelected',Select:null,Selected:function(selectTab,index){},Event:"mouseover",TurnTime:0,Roll:false};var me=this;this.TabsBox=$(TabsBox);if(this.TabsBox.children().length>1){var dNoneCSS=this.TabsBox.children().eq(1).attr("class");if(dNoneCSS)
this.option.NoneCSS=dNoneCSS;}
var dSelectedCSS=this.TabsBox.children().eq(0).attr("class");if(dSelectedCSS)
this.option.SelectedCSS=dSelectedCSS;var id=this.TabsBox.attr("id");if(id){if(this.option.NoneCSS.indexOf(id)==-1)
this.option.NoneCSS=id+" "+this.option.NoneCSS;if(this.option.SelectedCSS.indexOf(id)==-1)
this.option.SelectedCSS=id+" "+this.option.SelectedCSS;}
this.SetOption(options);this.__bindEvent();this.Select(0);var me=this;if(this.option.TurnTime>0){this.__TurnInterval=window.setInterval(function(){me.__Turn();},this.option.TurnTime);}},__TurnInterval:-1,__Turn:function(){this.__TurnState=true;this.SelectNext();},__Select:function(handler){var ctabs=handler.data;if(ctabs.__TurnInterval>0){window.clearInterval(ctabs.__TurnInterval);ctabs.__TurnInterval=window.setInterval(function(){ctabs.__Turn();},ctabs.option.TurnTime);}
ctabs.____Select($(this));return false;},____Select:function(tab){if(tab!=null&&this.__SelectTab!=tab){var sIndex=this.TabsBox.children().index(tab);if(sIndex>-1){if(this.__SelectTab!=null){var thref=this.__SelectTab.attr("href");if(thref&&thref.length>1&&thref.indexOf("#")==0){var t=$(thref);if(t!=null)t.hide();}
this.__SelectTab.attr("class",this.option.NoneCSS);}
var href=tab.attr("href");if(href&&href.length>1&&href.indexOf("#")==0){var t=$(href);if(t!=null)t.show();}
this.__SelectIndex=sIndex;this.__SelectTab=tab;this.__SelectTab.attr("class",this.option.SelectedCSS);this.option.Selected(this.__SelectTab,this.__SelectIndex);}}},__bindEvent:function(){var me=this;var selectCallBack=null;if(this.option.Select!=null)
selectCallBack=this.option.Select;else
selectCallBack=this.__Select;var event="";if(this.option.Event.toLowerCase()=="mouseover"){event="mouseover";}else{event="click";}
this.TabsBox.children().bind(event,me,selectCallBack);},Select:function(index){if(index>-1&&index!=this.__SelectIndex){this.____Select(this.TabsBox.children().eq(index));}},SelectNext:function(stopRoll){var index=this.__SelectIndex+1;var length=this.TabsBox.children().length;if(index>=length){if(this.option.Roll||this.option.TurnTime>0){index=0;}else{index--;}}
if(stopRoll==true&&this.__TurnInterval>0){window.clearInterval(this.__TurnInterval);var me=this;this.__TurnInterval=window.setInterval(function(){me.__Turn();},this.option.TurnTime);}
this.Select(index);},SelectPrve:function(stopRoll){var index=this.__SelectIndex-1;if(index<0){if(this.option.Roll||this.option.TurnTime>0){index=this.TabsBox.children().length-1;}else{index=0;}}
if(stopRoll==true&&this.__TurnInterval>0){window.clearInterval(this.__TurnInterval);var me=this;this.__TurnInterval=window.setInterval(function(){me.__Turn();},this.option.TurnTime);}
this.Select(index);}});