﻿var Class = {
  create: function() {
	return function() {
	  this.initialize.apply(this, arguments);
	}
  }
}

var TransformView = Class.create();
TransformView.prototype = {
    initialize: function(container, slider, parameter, count, options) {
	    if(parameter <= 0 || count <= 0) return;
	    var oContainer = $('#' + container), oSlider = $('#' + slider), oThis = this;

	    this.Index = 0;//当前索引
    	
	    this._timer = null;//定时器
	    this._slider = oSlider;//滑动对象
	    this._parameter = parameter;//切换参数
	    this._count = count || 0;//切换数量
	    this._target = 0;//目标参数
    	
	    this.SetOptions(options);
    	
	    this.Up = !!this.options.Up;
	    this.Step = Math.abs(this.options.Step);
	    this.Time = Math.abs(this.options.Time);
	    this.Auto = !!this.options.Auto;
	    this.Pause = Math.abs(this.options.Pause);
	    this.onStart = this.options.onStart;
	    this.onFinish = this.options.onFinish;
    	
    	oContainer.css({ overflow : 'hidden', position : 'relative'});
        oSlider.css({ position : 'absolute', top : 0, left : 0 });
    },
    SetOptions: function(options) {
	    this.options = {//默认值
		    Up:			true,//是否向上(否则向左)
		    Step:		5,//滑动变化率
		    Time:		10,//滑动延时
		    Auto:		true,//是否自动转换
		    Pause:		2000,//停顿时间(Auto为true时有效)
		    onStart:	function(){},//开始转换时执行
		    onFinish:	function(){}//完成转换时执行
	    };
	    this.options = $.extend({}, this.options, options || {});
    },
    //开始切换设置
    Start: function() {
        if(this.Index < 0){
	        this.Index = this._count - 1;
        } else if (this.Index >= this._count){ this.Index = 0; }

        this._target = -1 * this._parameter * this.Index;
        this.onStart();
        this.Move();
    },
    //移动
    Move: function() {
        clearTimeout(this._timer);
        var oThis = this, style = this.Up ? "top" : "left", iNow = parseInt(this._slider.css(style)) || 0, iStep = this.GetStep(this._target, iNow);

        if (iStep != 0) {
	        this._slider.css(style, (iNow + iStep) + "px");
	        this._timer = setTimeout(function(){ oThis.Move(); }, this.Time);
        } else {
	        this._slider.css(style, this._target + "px");
	        this.onFinish();
	        if (this.Auto) { this._timer = setTimeout(function(){ oThis.Index++; oThis.Start(); }, this.Pause); }
        }
    },
    //获取步长
    GetStep: function(iTarget, iNow) {
        var iStep = (iTarget - iNow) / this.Step;
        if (iStep == 0) return 0;
        if (Math.abs(iStep) < 1) return (iStep > 0 ? 1 : -1);
        return iStep;
        },
        //停止
        Stop: function(iTarget, iNow) {
        clearTimeout(this._timer);
        this._slider.css(this.Up ? "top" : "left", this._target + "px");
    }
};

var tianker = {};
tianker.page = {
    window : function() {
        return window;
    }
}
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('5 M={H:8(n){3(z==n||15 n==\'1g\'){9 o}9 t},C:8(n){3(b.H(n)||n.F==0){9 o}9 t},G:8(6,k){G(6);3($.I(k)){k()}},D:8(6,k){3(D(6)){3($.I(k)){k()}9 o}9 t},11:8(){A.B=A.B},13:8(J){A.B=J},1f:8(w){3(w){b.6();9}b.6(\'<K L="\'+l.O+\'" />N，1e...\')},1h:8(w){3(w){b.6();9}b.6(\'<K L="\'+l.O+\'" />N，1c...\')},6:8(6){5 1=z;5 1b=M;3(4.c&&4.c.j){1=$(4.c.j).g(\'1\')}Y{$(\'1\')}3(z==1){9}3(b.C(6)){1.g(\'#a\').i();1.g(\'#d\').1a(\'1d\',8(){$(b).E()});3($.v.P&&$.v.Q<7){5 p=8(){9 $(b).h(\'s\')==\'o\'};5 e=l.V.4().$;e(\'y\').x(p).h(\'s\',\'t\').p();e=l.W.4().$;e(\'y\').x(p).h(\'s\',\'t\').p()}9}1.g(\'#d\').E();1.g(\'#a\').i();3(4.c&&4.c.j){5 m=4.c.j.10(\'f\');m.u=\'d\';m.16=\'<f X="R">\'+6+\'</f>\';4.c.j.1.Z(m);3(1.g(\'#a\').F==0){5 a=4.c.j.10(\'f\');a.u=\'a\';4.c.j.1.Z(a)}}Y{5 m=$(\'<f>\').h(\'u\',\'d\').19(\'<f X="R">\'+6+\'</f>\');1.S(m);1.S($(\'<f>\').h(\'u\',\'a\'))}3($.v.P&&$.v.Q<7){5 i=8(){9 $(b).T(\'18\')!=\'12\'};5 e=l.V.4().$;e(\'y\').x(i).h(\'s\',\'o\').i();e=l.W.4().$;e(\'y\').x(i).h(\'s\',\'o\').i()}1.g(\'#a\').p();5 d=1.g(\'#d\');5 r=d.r();5 q=d.q();d.T({q:q,r:r,17:\'-\'+q/ 2 + \'U\', 14 : \'-\' + r /2+\'U\'})}}',62,80,'|body||if|window|var|msg||function|return|overlay|this|top|msgbox|jq|div|find|attr|hide|document|func|tianker|objMsg|obj|true|show|width|height|isHide|false|id|browser|complete|filter|select|null|location|href|isNullOrEmpty|comfirm|remove|length|alert|isNull|isFunction|url|img|src|C5|请稍候|loadingImg|msie|version|content|append|css|px|page|framework|class|else|appendChild|createElement|refresh|none|redirect|marginTop|typeof|innerHTML|marginLeft|display|html|fadeOut|objC5|数据提交中|slow|加载中|loading|undefined|posting'.split('|'),0,{}))

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('2.V={t:\'<!---->\',Q:{},1c:4(14){3 13={h:\'V\',1k:\'/\',1g:\'1u\',l:\'1b%\',p:\'1t\',5:\'\',16:b,17:b,N:{M:n,G:\'1v-1F\'}};9=$.1D({},13,14||{});6(2.P(1r)){2.g(\'1G!\');c}3 f=1z 1r(9.h);f.1x=9.1k;f.1A=9.1g;f.1B=9.l;f.1C=9.p;f.1y=9.5;f.1o.M=9.N.M;f.1o.G=9.N.G;6(9.16){f.1H()}19{f.1I()}6(9.17){7.Q[9.h]=n;c}3 j=$(\'#\'+9.h);6(j.B().m==0){j.B(7.t)}},1E:4(u,A){3 q=12.15(u.W);6(2.P(q)){2.g(\'1n\'+u.W+\'1h!\');A.U=b;c}3 5=q.1j(n);I(4(){6(5.m==0){$(\'#\'+u.W).B(2.V.t)}},1b);6(5.m==0||5==7.t){A.U=b}19{A.U=n}},1w:4(){3 E=b;K(3 a L 7.Q){3 q=12.15(a);6(2.P(q)){2.g(\'1n\'+a+\'1h!\');c b}3 5=q.1j(n);E=5.m>0&&5!=7.t;6(b==E){2.g(\'1s!\');c b}}c E}};2.29={27:4(e,Y,H){6(2.2b(e.h)){2.g(\'2a\');c}6(e.5.m==0||b==/^[\\S\\s]*\\.\\w*$/.24(e.5)){2.g("2i");c}3 11=e.h;$(\'#\'+e.h+\'2h\').2k(4(){$(7).F()}).2j(4(){$(7).1d()});$.2g({Y:Y,2d:b,2c:e.h,2f:\'2e\',C:4(8,1m){6(8.O){2.g(8.O);c}3 k=\'\';3 C=b;K(3 a L 8.5){k+=\'1Q\'+(8.5[a].z+1)+\' -> \'+8.5[a].1S;6(8.5[a].1R){$(\'#\'+11).1e().B(8.5[a].1f);C=n}}6(C&&$.1N(H)){c H(8.5)}g(k)},O:4(8,1m,e){2.1Y(e)}});c b},21:4(8,1l){3 D=$(\'.\'+1l);K(3 a L 8){6(8[a].z<D.m){D[8[a].z].1X=8[a].1f+\'?r=\'+1T.1W();D[8[a].z].1K.1O=\'\'}}}};2.d={o:1P,v:\'.Z\',18:\'.25\',i:\'.d\',1c:4(){$(7.v).1d();T(7.o);$(7.v).1e(7.18).1a("R").1a("X").R(4(e){T(2.d.o);2.d.F(7,e)}).X(4(e){2.d.o=I(4(){$(2.d.i).J()},10)})},F:4(j,e){$(7.i).J();3 Z=$(j).22(7.v);3 k=\'<1i 26="d">\'+Z.k()+\'</1i>\';$(j).23().20(k);3 y=e.1U;3 x=e.1V;3 l=$(7.i).l()+28;3 p=$(7.i).p()+28;6(x+l>$.1p()){x=$.1p()-l}6(y+p>$.1q()){y=$.1q()-p}$(7.i).1Z({1M:x,1L:y}).F("1J").R(4(){T(2.d.o)}).X(4(){2.d.o=I(4(){$(2.d.i).J()},10)})}};',62,145,'||C5|var|function|value|if|this|data|options|item|false|return|cardPop||fckEditor|alert|id|cardPopClass|obj|html|width|length|true|cardTick|height|instance|||emptyValue|source|cardClass||||Index|arguments|val|success|imgs|reVal|show|DefaultLanguage|func|setTimeout|remove|for|in|ToolbarStartExpanded|config|error|isNull|instances|mouseover||clearTimeout|IsValid|editor|controltovalidate|mouseout|url|card|200|senderId|FCKeditorAPI|defaults|opts|GetInstance|create|isSubmitValidate|cardTitleClass|else|unbind|100|init|hide|prev|ImageUrl|toolbarSet|编辑器实例不存在|div|GetXHTML|basePath|cssClass|status|id为|Config|pageWidth|pageHeight|FCKeditor|内容不能为空|400|Basic|zh|onSubmitValidate|BasePath|Value|new|ToolbarSet|Width|Height|extend|customValidate|cn|请在页面引入FCKeditor脚本文件|Create|ReplaceTextarea|fast|style|top|left|isFunction|display|null|文件|Success|Msg|Math|pageY|pageX|random|src|debug|css|append|updateImages|next|parent|test|cardTitle|class|upload||fileUpload|请设置好上传控件的id|isNullOrEmpty|fileElementId|secureuri|json|dataType|ajaxFileUpload|_loading|请选择上传的上文件|ajaxComplete|ajaxStart'.split('|'),0,{}))

