UIDB = {};

	//牟少峰
UIDB.Mask=$Class({
	_o:null,
	$init:function(objs){
		this._o={
			showBtn:objs.showBtn,
			hideBtn:objs.hideBtn,
			showLayer:objs.showLayer||$$.getSingle("div.fixed", document),
			showPos:objs.showPos||{left:"450px",top:"300px"},
			FoggyParam:objs.FoggyParam||{showDuration:1000,showOpacity:0.7,hideDuration:1000,hideOpacity:0,zIndex:32000}
		}
        this.foggy = new nhn.Foggy({
            showDuration: this._o.FoggyParam.showDuration,
            showOpacity: nhn.Effect.linear(this._o.FoggyParam.showOpacity),
            hideDuration: this._o.FoggyParam.hideDuration,
            hideOpacity: nhn.Effect.linear(this._o.FoggyParam.hideOpacity),
            zIndex: this._o.FoggyParam.zIndex
        }).attach({
            show: function(){
            },
            hide: function(){
            }
        });

		this._bindEvents();

	},

	hide: function(){
   		$Element(this._o.showLayer).disappear(0, this.foggy.hide());
	},
	show: function (){
		this.foggy.getFog().className = 'fog';
        $Element(this._o.showLayer).appear(1, this.foggy.show(this._o.showLayer));
		//new Fiexed对象前一定要初始位置否则第二次显示会出问题;
		$Element(this._o.showLayer).css({left:this._o.showPos.left,top:this._o.showPos.top})
	   	foo = new nhn.Fixed(this._o.showLayer);
		 },
	 _bindEvents:function(){
	 	$Fn(this.show,this).attach(this._o.showBtn, 'click');
		$Fn(this.hide,this).attach(this._o.hideBtn, 'click');
	 }

}).extend(nhn.Component)

/**
 * @name UIDB.ADSwitcher
 * @author sundongguo
 * @version 20090416
 *
 * 说明：
 *     创建一个广告轮播器。
 *
 * 需要：
 *     nhn.Timer
 *     nhn.TabControl
 *
 * 语法：
 *     var oADSwitcher=new UIDB.ADSwitcher("ad",{
 *         classPrefix:"ad-",
 *         duration:2000
 *     });
 *     "ad"	目标div的id。
 *     "ad-"	样式前缀。
 *     2000	轮播间隔。
 *
 *    <div id="ad" class="xxx">
 *        <ul class="xxx">
 *            <li class="ad-panel ad-selected"><a href="#"><img src="xxx alt=""></a></li>
 *            <li class="ad-panel"><a href="#"><img src="xxx" alt=""></a></li>
 *            <li class="ad-panel"><a href="#"><img src="xxx" alt=""></a></li>
 *        </ul>
 *        <ul class="xxx">
 *            <li class="ad-tab ad-selected"><a href="#">1</a></li>
 *            <li class="ad-tab"><a href="#">2</a></li>
 *            <li class="ad-tab"><a href="#">3</a></li>
 *        </ul>
 *    </div>
 */
//--------------------------------------------------[UIDB.ADSwitcher]
UIDB.ADSwitcher=$Class({
	_el:null,
	_nTotal:null,
	_nCurrent:null,
	_oTimer:null,
	_oTab:null,
	$init:function(el,oOptions){
		this.option({
			classPrefix:"",
			duration:1000
		});
		this.option(oOptions||{});
		var sPrefix=this.option("classPrefix");
		var nDuration=this.option("duration");
		var el=this._el=jindo.$(el);
		this._nTotal=$$("."+sPrefix+"tab",el).length;
		this._nCurrent=0;
		this._oTimer=new nhn.Timer();
		this._oTab=new nhn.TabControl(el,{
			classPrefix:sPrefix
		}).attach({
			select:function(o){
				this._nCurrent=o.index;
			}
		});
		//Run.
		var _this=this;
		this._oTimer.start(function(){
			_this._nCurrent++;
			if(_this._nCurrent>=_this._nTotal)_this._nCurrent=0;
			_this._oTab.selectTab(_this._nCurrent);
			return true;
		},nDuration);
		$Fn(function(){
			_this._oTimer.pause();
		}).attach(el,"mouseover");
		$Fn(function(){
			_this._oTimer.resume();
		}).attach(el,"mouseout");
	}
}).extend(nhn.Component);

UIDB.BaseGrade = $Class({
    $init: function(obj, optionEvnets) {
        this.gradeImg = obj.gradeImg,
        this.gradeText = obj.gradeText
    },
    Change: function(num) {
        var number = parseInt(num);
        if (isNaN(number) || number < 0 || number > 100) {
            return;
        }
        this.gradeImg.style.width = number + "%";
        $Element(this.gradeText).text(number + "%");
    }
});