/* /webgame/home/js/jScrollPane.js */
(function($){$.event.special.mousewheel={setup:function(){var handler=$.event.special.mousewheel.handler;if($.browser.mozilla){$(this).bind("mousemove.mousewheel",function(event){$.data(this,"mwcursorposdata",{pageX:event.pageX,pageY:event.pageY,clientX:event.clientX,clientY:event.clientY})})}if(this.addEventListener){this.addEventListener(($.browser.mozilla?"DOMMouseScroll":"mousewheel"),handler,false)}else{this.onmousewheel=handler}},teardown:function(){var handler=$.event.special.mousewheel.handler;$(this).unbind("mousemove.mousewheel");if(this.removeEventListener){this.removeEventListener(($.browser.mozilla?"DOMMouseScroll":"mousewheel"),handler,false)}else{this.onmousewheel=function(){}}$.removeData(this,"mwcursorposdata")},handler:function(event){var args=Array.prototype.slice.call(arguments,1);event=$.event.fix(event||window.event);$.extend(event,$.data(this,"mwcursorposdata")||{});var delta=0,returnValue=true;if(event.wheelDelta){delta=event.wheelDelta/120}if(event.detail){delta=-event.detail/3}event.data=event.data||{};event.type="mousewheel";args.unshift(delta);args.unshift(event);return $.event.handle.apply(this,args)}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}})})(jQuery);(function($){$.jScrollPane={active:[]};$.fn.jScrollPane=function(settings){settings=$.extend({},$.fn.jScrollPane.defaults,settings);var rf=function(){return false};return this.each(function(){var $this=$(this);var paneEle=this;var currentScrollPosition=0;var paneWidth;var paneHeight;var trackHeight;var trackOffset=settings.topCapHeight;var $container;if($(this).parent().is(".jScrollPaneContainer")){$container=$(this).parent();currentScrollPosition=settings.maintainPosition?$this.position().top:0;var $c=$(this).parent();paneWidth=$c.innerWidth();paneHeight=$c.outerHeight();$(">.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown, >.jScrollCap",$c).remove();$this.css({"top":0})}else{$this.data("originalStyleTag",$this.attr("style"));$this.css("overflow","hidden");this.originalPadding=$this.css("paddingTop")+" "+$this.css("paddingRight")+" "+$this.css("paddingBottom")+" "+$this.css("paddingLeft");this.originalSidePaddingTotal=(parseInt($this.css("paddingLeft"))||0)+(parseInt($this.css("paddingRight"))||0);paneWidth=$this.innerWidth();paneHeight=$this.innerHeight();$container=$("<div></div>").attr({"class":"jScrollPaneContainer"}).css({"height":paneHeight+"px","width":paneWidth+"px"});if(settings.enableKeyboardNavigation){$container.attr("tabindex",settings.tabIndex)}var containerStr=$container[0].outerHTML;$this.wrap(containerStr);$container=$this.parent();$(document).bind("emchange",function(e,cur,prev){$this.jScrollPane(settings)})}trackHeight=paneHeight;if(settings.reinitialiseOnImageLoad){var $imagesToLoad=$.data(paneEle,"jScrollPaneImagesToLoad")||$("img",$this);var loadedImages=[];if($imagesToLoad.length){$imagesToLoad.each(function(i,val){$(this).bind("load readystatechange",function(){if($.inArray(i,loadedImages)==-1){loadedImages.push(val);$imagesToLoad=$.grep($imagesToLoad,function(n,i){return n!=val});$.data(paneEle,"jScrollPaneImagesToLoad",$imagesToLoad);var s2=$.extend(settings,{reinitialiseOnImageLoad:false});$this.jScrollPane(s2)}}).each(function(i,val){if(this.complete||this.complete===undefined){this.src=this.src}})})}}var p=this.originalSidePaddingTotal;var realPaneWidth=paneWidth-settings.scrollbarWidth-settings.scrollbarMargin-p;var cssToApply={"height":"auto","width":realPaneWidth+"px"};if(settings.scrollbarOnLeft){cssToApply.paddingLeft=settings.scrollbarMargin+settings.scrollbarWidth+"px"}else{cssToApply.paddingRight=settings.scrollbarMargin+"px"}$this.css(cssToApply);var contentHeight=$this.outerHeight();var percentInView=paneHeight/contentHeight;var isScrollable=percentInView<0.99;$container[isScrollable?"addClass":"removeClass"]("jScrollPaneScrollable");if(isScrollable){$container.append($("<div></div>").addClass("jScrollCap jScrollCapTop").css({height:settings.topCapHeight}),$("<div></div>").attr({"class":"jScrollPaneTrack"}).css({"width":settings.scrollbarWidth+"px"}).append($("<div></div>").attr({"class":"jScrollPaneDrag"}).css({"width":settings.scrollbarWidth+"px"}).append($("<div></div>").attr({"class":"jScrollPaneDragTop"}).css({"width":settings.scrollbarWidth+"px"}),$("<div></div>").attr({"class":"jScrollPaneDragBottom"}).css({"width":settings.scrollbarWidth+"px"}))),$("<div></div>").addClass("jScrollCap jScrollCapBottom").css({height:settings.bottomCapHeight}));var $track=$(".jScrollPaneTrack",$container);var $drag=$(".jScrollPaneTrack .jScrollPaneDrag",$container);var currentArrowDirection;var currentArrowTimerArr=[];var currentArrowInc;var whileArrowButtonDown=function(){if(currentArrowInc>4||currentArrowInc%4==0){positionDrag(dragPosition+currentArrowDirection*mouseWheelMultiplier)}currentArrowInc++};if(settings.enableKeyboardNavigation){$container.bind("keydown.jscrollpane",function(e){switch(e.keyCode){case 38:currentArrowDirection=-1;currentArrowInc=0;whileArrowButtonDown();currentArrowTimerArr[currentArrowTimerArr.length]=setInterval(whileArrowButtonDown,100);return false;case 40:currentArrowDirection=1;currentArrowInc=0;whileArrowButtonDown();currentArrowTimerArr[currentArrowTimerArr.length]=setInterval(whileArrowButtonDown,100);return false;case 33:case 34:return false;default:}}).bind("keyup.jscrollpane",function(e){if(e.keyCode==38||e.keyCode==40){for(var i=0;i<currentArrowTimerArr.length;i++){clearInterval(currentArrowTimerArr[i])}return false}})}if(settings.showArrows){var currentArrowButton;var currentArrowInterval;var onArrowMouseUp=function(event){$("html").unbind("mouseup",onArrowMouseUp);currentArrowButton.removeClass("jScrollActiveArrowButton");clearInterval(currentArrowInterval)};var onArrowMouseDown=function(){$("html").bind("mouseup",onArrowMouseUp);currentArrowButton.addClass("jScrollActiveArrowButton");currentArrowInc=0;whileArrowButtonDown();currentArrowInterval=setInterval(whileArrowButtonDown,100)};$container.append($("<a></a>").attr({"href":"javascript:;","class":"jScrollArrowUp","tabindex":-1}).css({"width":settings.scrollbarWidth+"px","top":settings.topCapHeight+"px"}).html("Scroll up").bind("mousedown",function(){currentArrowButton=$this;currentArrowDirection=-1;onArrowMouseDown();this.blur();return false}).bind("click",rf),$("<a></a>").attr({"href":"javascript:;","class":"jScrollArrowDown","tabindex":-1}).css({"width":settings.scrollbarWidth+"px","bottom":settings.bottomCapHeight+"px"}).html("Scroll down").bind("mousedown",function(){currentArrowButton=$this;currentArrowDirection=1;onArrowMouseDown();this.blur();return false}).bind("click",rf));var $upArrow=$(".jScrollArrowUp",$container);var $downArrow=$(".jScrollArrowDown",$container)}if(settings.arrowSize){trackHeight=paneHeight-settings.arrowSize-settings.arrowSize;trackOffset+=settings.arrowSize}else{if($upArrow){var topArrowHeight=$upArrow.height();settings.arrowSize=topArrowHeight;trackHeight=paneHeight-topArrowHeight-$downArrow.height();trackOffset+=topArrowHeight}}trackHeight-=settings.topCapHeight+settings.bottomCapHeight;$track.css({"height":trackHeight+"px",top:trackOffset+"px"});var $pane=$this.css({"position":"absolute","overflow":"visible"});var currentOffset;var maxY;var mouseWheelMultiplier;var dragPosition=0;var dragMiddle=percentInView*paneHeight/2;var getPos=function(event,c){var p=c=="X"?"Left":"Top";return event["page"+c]||(event["client"+c]+(document.documentElement["scroll"+p]||document.body["scroll"+p]))||0};var ignoreNativeDrag=function(){return false};var initDrag=function(){ceaseAnimation();currentOffset=$drag.offset();currentOffset.top-=dragPosition;maxY=trackHeight-$drag[0].offsetHeight;mouseWheelMultiplier=2*settings.wheelSpeed*maxY/contentHeight};var onStartDrag=function(event){initDrag();dragMiddle=getPos(event,"Y")-dragPosition-currentOffset.top;$("html").bind("mouseup",onStopDrag).bind("mousemove",updateScroll).bind("mouseleave",onStopDrag);if($.browser.msie){$("html").bind("dragstart",ignoreNativeDrag).bind("selectstart",ignoreNativeDrag)}return false};var onStopDrag=function(){$("html").unbind("mouseup",onStopDrag).unbind("mousemove",updateScroll);dragMiddle=percentInView*paneHeight/2;if($.browser.msie){$("html").unbind("dragstart",ignoreNativeDrag).unbind("selectstart",ignoreNativeDrag)}};var positionDrag=function(destY){$container.scrollTop(0);destY=destY<0?0:(destY>maxY?maxY:destY);dragPosition=destY;$drag.css({"top":destY+"px"});var p=destY/maxY;$this.data("jScrollPanePosition",(paneHeight-contentHeight)*-p);$pane.css({"top":((paneHeight-contentHeight)*p)+"px"});$this.trigger("scroll");if(settings.showArrows){$upArrow[destY==0?"addClass":"removeClass"]("disabled");$downArrow[destY==maxY?"addClass":"removeClass"]("disabled")}};var updateScroll=function(e){positionDrag(getPos(e,"Y")-currentOffset.top-dragMiddle)};var dragH=Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2),settings.dragMaxHeight),settings.dragMinHeight);$drag.css({"height":dragH+"px"}).bind("mousedown",onStartDrag);var trackScrollInterval;var trackScrollInc;var trackScrollMousePos;var doTrackScroll=function(){if(trackScrollInc>8||trackScrollInc%4==0){positionDrag((dragPosition-((dragPosition-trackScrollMousePos)/2)))}trackScrollInc++};var onStopTrackClick=function(){clearInterval(trackScrollInterval);$("html").unbind("mouseup",onStopTrackClick).unbind("mousemove",onTrackMouseMove)};var onTrackMouseMove=function(event){trackScrollMousePos=getPos(event,"Y")-currentOffset.top-dragMiddle};var onTrackClick=function(event){initDrag();onTrackMouseMove(event);trackScrollInc=0;$("html").bind("mouseup",onStopTrackClick).bind("mousemove",onTrackMouseMove);trackScrollInterval=setInterval(doTrackScroll,100);doTrackScroll();return false};$track.bind("mousedown",onTrackClick);$container.bind("mousewheel",function(event,delta){delta=delta||(event.wheelDelta?event.wheelDelta/120:(event.detail)?-event.detail/3:0);initDrag();ceaseAnimation();var d=dragPosition;positionDrag(dragPosition-delta*mouseWheelMultiplier);var dragOccured=d!=dragPosition;return !dragOccured});var _animateToPosition;var _animateToInterval;function animateToPosition(){var diff=(_animateToPosition-dragPosition)/settings.animateStep;if(diff>1||diff<-1){positionDrag(dragPosition+diff)}else{positionDrag(_animateToPosition);ceaseAnimation()}}var ceaseAnimation=function(){if(_animateToInterval){clearInterval(_animateToInterval);delete _animateToPosition}};var scrollTo=function(pos,preventAni){if(typeof pos=="string"){try{$e=$(pos,$this)}catch(err){return}if(!$e.length){return}pos=$e.offset().top-$this.offset().top}ceaseAnimation();var maxScroll=contentHeight-paneHeight;pos=pos>maxScroll?maxScroll:pos;$this.data("jScrollPaneMaxScroll",maxScroll);var destDragPosition=pos/maxScroll*maxY;if(preventAni||!settings.animateTo){positionDrag(destDragPosition)}else{$container.scrollTop(0);_animateToPosition=destDragPosition;_animateToInterval=setInterval(animateToPosition,settings.animateInterval)}};$this[0].scrollTo=scrollTo;$this[0].scrollBy=function(delta){var currentPos=-parseInt($pane.css("top"))||0;scrollTo(currentPos+delta)};initDrag();scrollTo(-currentScrollPosition,true);$("*",this).bind("focus",function(event){var $e=$(this);var eleTop=0;var preventInfiniteLoop=100;while($e[0]!=$this[0]){eleTop+=$e.position().top;$e=$e.offsetParent();if(!preventInfiniteLoop--){return}}var viewportTop=-parseInt($pane.css("top"))||0;var maxVisibleEleTop=viewportTop+paneHeight;var eleInView=eleTop>viewportTop&&eleTop<maxVisibleEleTop;if(!eleInView){var destPos=eleTop-settings.scrollbarMargin;if(eleTop>viewportTop){destPos+=$(this).height()+15+settings.scrollbarMargin-paneHeight}scrollTo(destPos)}});if(settings.observeHash){if(location.hash&&location.hash.length>1){setTimeout(function(){scrollTo(location.hash)},$.browser.safari?100:0)}$(document).bind("click",function(e){$target=$(e.target);if($target.is("a")){var h=$target.attr("href");if(h&&h.substr(0,1)=="#"&&h.length>1){setTimeout(function(){scrollTo(h,!settings.animateToInternalLinks)},$.browser.safari?100:0)}}})}function onSelectScrollMouseDown(e){$(document).bind("mousemove.jScrollPaneDragging",onTextSelectionScrollMouseMove);$(document).bind("mouseup.jScrollPaneDragging",onSelectScrollMouseUp)}var textDragDistanceAway;var textSelectionInterval;function onTextSelectionInterval(){direction=textDragDistanceAway<0?-1:1;$this[0].scrollBy(textDragDistanceAway/2)}function clearTextSelectionInterval(){if(textSelectionInterval){clearInterval(textSelectionInterval);textSelectionInterval=undefined}}function onTextSelectionScrollMouseMove(e){var offset=$this.parent().offset().top;var maxOffset=offset+paneHeight;var mouseOffset=getPos(e,"Y");textDragDistanceAway=mouseOffset<offset?mouseOffset-offset:(mouseOffset>maxOffset?mouseOffset-maxOffset:0);if(textDragDistanceAway==0){clearTextSelectionInterval()}else{if(!textSelectionInterval){textSelectionInterval=setInterval(onTextSelectionInterval,100)}}}function onSelectScrollMouseUp(e){$(document).unbind("mousemove.jScrollPaneDragging").unbind("mouseup.jScrollPaneDragging");clearTextSelectionInterval()}$container.bind("mousedown.jScrollPane",onSelectScrollMouseDown);$.jScrollPane.active.push($this[0])}else{$this.css({"height":paneHeight+"px","width":paneWidth-this.originalSidePaddingTotal+"px","padding":this.originalPadding});$this[0].scrollTo=$this[0].scrollBy=function(){};$this.parent().unbind("mousewheel").unbind("mousedown.jScrollPane").unbind("keydown.jscrollpane").unbind("keyup.jscrollpane")}})};$.fn.jScrollPaneRemove=function(){$(this).each(function(){$this=$(this);var $c=$this.parent();if($c.is(".jScrollPaneContainer")){$this.css({"top":"","height":"","width":"","padding":"","overflow":"","position":""});$this.attr("style",$this.data("originalStyleTag"));$c.after($this).remove()}})};$.fn.jScrollPane.defaults={scrollbarWidth:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,reinitialiseOnImageLoad:false,tabIndex:0,enableKeyboardNavigation:true,animateToInternalLinks:false,topCapHeight:0,bottomCapHeight:0,observeHash:true};$(window).bind("unload",function(){var els=$.jScrollPane.active;for(var i=0;i<els.length;i++){els[i].scrollTo=els[i].scrollBy=null}})})(jQuery);
/* /webgame/home/js/txtScroll.js */
function txtScroll(ctg){if(!(this instanceof txtScroll)){return new txtScroll(ctg)}this._defaultOption={_id:ctg.id,_tag:ctg.tag,_dir:ctg.dir||"up",_speed:ctg.speed||500,_line:ctg.line||1,_step:ctg.step||1,_delay:ctg.delay||1000};this.tempScroll=0;this.timer=null;this._t=null;this._pause=0}txtScroll.prototype={get$:function(obj){return typeof obj=="object"?obj:document.getElementById(obj)},clearWhiteSpce:function(oEelement){if(typeof oEelement.childNodes.length!="undefined"){for(var i=0;i<oEelement.childNodes.length;i++){var node=oEelement.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue)){node.parentNode.removeChild(node)}}}},doScroll:function(opt,obj,h){var that=this;clearTimeout(that._t);that._t=setTimeout(function(){that.scrollDir(opt,obj,h)},opt._delay)},doStop:function(obj){var that=this;obj.onmouseover=function(){clearTimeout(that._t);that._pause=1}},doPlay:function(opt,obj,h){var that=this;obj.onmouseout=function(){that._pause=0;that.doScroll(opt,obj,h)}},scrollUp:function(opt,obj,h){var that=this;that.timer=setInterval(function(){that.tempScroll+=opt._step;if(that.tempScroll>h){var _firstChild=obj.removeChild(obj.firstChild);obj.appendChild(_firstChild);that.tempScroll=0}if(that.tempScroll==h){clearInterval(that.timer);if(that._pause==0){that.doScroll(opt,obj,h)}}obj.style.marginTop=-that.tempScroll+"px"},opt._speed)},scrollDown:function(opt,obj,h){var that=this;that.timer=setInterval(function(){that.tempScroll+=opt._step;if(that.tempScroll>h){that.tempScroll=0;var _lastChild=obj.removeChild(obj.lastChild);obj.insertBefore(_lastChild,obj.firstChild)}if(that.tempScroll==0){clearInterval(that.timer);if(that._pause==0){that.doScroll(opt,obj,h)}}obj.style.marginTop=that.tempScroll+"px"},opt._speed)},scrollDir:function(opt,obj,h){var that=this;if(that.timer){clearInterval(that.timer)}switch(opt._dir){case"up":that.scrollUp(opt,obj,h);break;case"down":that.scrollDown(opt,obj,h);break}},init:function(){var that=this,_default=that._defaultOption,_obj=that.get$(_default._id);if(!document.getElementById(_default._id)=="undefined"){return}if(!_obj){return}that.clearWhiteSpce(_obj);_length=_obj.getElementsByTagName(_default._tag).length;if(_length<=1){return}if(!_obj.firstChild){return}var _height=_obj.firstChild.offsetHeight,_scrollHeight=_default._line*_height;if(_length!=1&&_length!=0){that.doScroll(_default,_obj,_scrollHeight);that.doPlay(_default,_obj,_scrollHeight);that.doStop(_obj)}}};
/* /webgame/home/js/ue.dialog.js */
!function(t,o,i,e){function n(t,o){return t.replace(/\@{([a-zA-Z_0-9\-]*)\}/g,function(t,i){return"undefined"!=typeof o[i]?o[i]:""})}function s(){return o.innerWidth||i.documentElement.clientWidth}function a(){return o.innerHeight||i.documentElement.clientHeight}function l(){return i.documentElement.scrollTop||i.body.scrollTop}function r(){return i.documentElement.scrollLeft||i.body.scrollLeft}function h(e){var n="100%";y&&(t(i.body).width()>s()&&(n=t(i.body).width()),t(o).unbind("resize.lock").bind("resize.lock",function(){return new Date-_<100?!1:(_=new Date,n=t(i.body).width()>s()?t(i.body).width():"100%",void t(".ui-dialog-mask").width(n))}));var a={opacity:.3,width:n,height:t(i.body).height(),"background-color":"#000000",position:y?"absolute":"fixed",left:0,top:0,"z-index":e.options.zIndex-1};0==t(".ui-dialog-mask").length&&(t("body").append(t('<div class="ui-dialog-mask"></div>')),t(".ui-dialog-mask").bind("click",function(){w[w.length-1].close()})),t(".ui-dialog-mask").css(a).show(),w.push(e)}function u(){0!=w.length&&(w.pop(),0==w.length?t(".ui-dialog-mask").remove():y?t(".ui-dialog-mask").show().css("z-index",w[w.length-1].options.zIndex-1):t(".ui-dialog-mask").show().css({"z-index":w[w.length-1].options.zIndex-1,left:r()}))}function d(o){var i={id:"",force:!1,left:"auto",right:"auto",top:"auto",bottom:"auto",position:"absolute",width:"auto",height:"auto",minWidth:"auto",maxWidth:"auto",lock:!1,drag:!1,dragHock:"",closeBtn:".ui-dialog-close_btn",zIndex:m,content:"",forceLock:!0,init:v,beforeClose:v,afterClose:v},e=this;if(o.id=o.id||b+ ++g,o.zIndex=o.zIndex||++m,o.position="fixed"==o.position?"fixed":"absolute",o.forceLock!==!1&&(o.forceLock=!0),o.lock&&o.forceLock&&(o.position="fixed",o.left="auto",o.right="auto",o.top="auto",o.bottom="auto"),this.options=o=t.extend(i,o),o.id&&d.list[o.id]){if(!o.force)return e=d.list[o.id],e.show(),e;d.list[o.id].close()}this.create(),this.options.init.call(this),this.obj.find(o.closeBtn).bind("click",function(){return e.close.call(e),!1})}function c(o,i,e,n){var s;if("object"==typeof o&&o.length>0)s=o;else{if("object"!=typeof o)return;o.left=0,o.right=0,o.position="absolute",s=new uiDialog(o).obj}for(var a,l,e=e||"",r=t.trim(e).toUpperCase().split("_"),h=0;h<r.length;h++)k[r[h]]?(a=k[r[h]],this._h_pos=r[h]):x[r[h]]&&(l=x[r[h]],this._v_pos=r[h]);a=a||k.LEFT,l=l||x.TOP,this.follow=s,this.isfollowed=i,this.h_pos=a,this.v_pos=l,this.trun=n,this.pos=e,this.reset(),c.list.push(this)}var f,p,g=0,b="ui-dialog_",m=1989,w=[],v=function(){},y=t.browser.msie&&"6.0"==t.browser.version,_=new Date;p='	<div class="ui-dialog" id ="@{id}">@{content}</div>',f='	<div class="ui-dialog-autoSize" style="position:absolute; top:-10000px;">							<table class="ui-dialog-autoSize-table" style="border-collapse:collapse;border-spacing:0;">								<tr><td style="margin:0;padding:0">									<div class="ui-dialog" style="overflow:hidden;">@{content}</div>								</td></tr>							</table>					 	</div>',d.list={},d.prototype={reset:function(){this.obj.height("auto");var t=this.obj.height();this._size.height=t,this._offset=this.offset(this._size),this.obj.css(this._size),y?this.ie6fixed.options.height=t:this.obj.css(this._offset)},autoSize:function(o,e){var s,a=(this.options,t(n(f,{content:o})));return t(i.body).append(a),"undefined"!=typeof e&&a.find(".ui-dialog-autoSize-table").width(e),s={width:a.find(".ui-dialog-autoSize-table").width(),height:a.find(".ui-dialog-autoSize-table").height()},"undefined"!=typeof e&&(s.width=e),a.remove(),s},size:function(t){var o,i=this.options,e=i.width,n=i.height,t=i.content;return o="number"==typeof e||"auto"!==e?this.autoSize(t,e):this.autoSize(t),"number"==typeof e&&(o.width=e),"number"==typeof n&&(o.height=n),o},offset:function(o){var i=this.options,e=i.position,n=(i.lock,i.left),s=i.top,h=i.bottom,u=i.right,d={};return"number"!=typeof n&&"number"!=typeof u&&(n="auto",u="auto"),"number"!=typeof s&&"number"!=typeof h&&(s="auto",h="auto"),"number"==typeof s&&(s=0>s?0:s),"number"==typeof n&&(n=0>n?0:n),"number"==typeof u&&(u=0>u?0:u),"number"==typeof h&&(h=0>h?0:h),d=t.extend(d,{left:n,top:s,bottom:h,right:u}),"auto"==n&&"auto"==u&&(d.left="50%","fixed"==e?d["margin-left"]=-o.width/2:d["margin-left"]=-o.width/2+r()),"auto"==s&&"auto"==h&&("fixed"==e?(d["margin-top"]=-o.height/2,d.top="50%"):d.top=l()+a()/2-o.height/2),d},create:function(){var o=this.options,i=o.position,e=(o.hold,o.content||o.loading||"loading"),s=n(p,{content:e,id:o.id});0==t(".ui-dialog-mask").length?t("body").append(s):t(".ui-dialog-mask").before(s),this.obj=t("#"+o.id);var a,l={zIndex:o.zIndex,position:i},r=this.size();"auto"!==this.options.minWidth&&r.width<this.options.minWidth&&(r.width=this.options.minWidth),"auto"!==this.options.maxWidth&&r.width>this.options.maxWidth&&(r.width=this.options.maxWidth),this._size=r,this._offset=a=this.offset(r),t.extend(l,r),t.extend(l,a),this.obj.css(l),y&&"fixed"==i&&(this.ie6fixed=ue.fixed({target:this.obj,left:o.left,right:o.right,top:o.top,bottom:o.bottom,height:r.height,width:r.width})),o.lock&&h(this),this.options.drag&&this.options.dragHock&&t(this.options.dragHock).length>0&&ue.easydrag&&ue.easydrag({target:this.obj,hock:this.obj.find(this.options.dragHock)}),uiDialog.list[o.id]=this},close:function(t,o){var i=this.options;this.options.beforeClose="function"==typeof t?t:i.beforeClose,this.options.afterClose="function"==typeof o?o:i.afterClose;var e=i.beforeClose.call(this);e!==!1&&(this.obj.remove(),this.options.lock&&u(this),delete d.list[i.id],i.afterClose.call(this))},show:function(){this.options.lock&&h(this),this.obj.show()},hide:function(){this.obj.hide(),this.options.lock&&u(this)},timer:function(t,o){var i=this,o="function"==typeof o?o:v;setTimeout(function(){o.call(i)},t)}},o.ue=o.ue||{},function(){function o(o){var i={relative:t(),target:"",height:"auto",width:"auto",left:"auto",top:"auto",bottom:"auto",right:"auto"};o=this.options=t.extend(i,o);var e={position:"absolute",margin:0};return"auto"==o.left&&"auto"==o.right&&(e.left=r()+(s()-o.width)/2),"auto"!=o.top&&"auto"!=o.bottom||(e.top=l()+(a()-o.height)/2),"number"==typeof o.right&&(e.left="auto",e.right=o.right),"number"==typeof o.left&&(e.left=r()+o.left,e.right="auto"),"number"==typeof o.bottom&&(e.top="auto",e.bottom=o.bottom),"number"==typeof o.top&&(e.top=l()+o.top,e.bottom="auto"),y?(n=l(),h=r(),e.position="absolute",e.margin=0,o.target.css(e)):e.position="fixed",u.push(this),u[u.length-1]}function e(){for(var t,o,e=0,d=u.length;d>e;e++)if(t=u[e]){o=t.options;var c={};o&&("auto"==o.left&&"auto"==o.right&&(c.left=r()+(s()-o.width)/2),"auto"==o.top&&"auto"==o.bottom&&(c.top=l()+(a()-o.height)/2),"number"==typeof o.right&&(c.right=o.right,o.target.css({right:r()-h+o.right})),"number"==typeof o.left&&(c.left=r()+o.left),"number"==typeof o.bottom&&(c.bottom=o.bottom,a()%2==0?l()%2==1&&(i.documentElement.scrollTop=l()+1):l()%2==0&&(i.documentElement.scrollTop=l()+1),o.target.css({bottom:l()-n+o.bottom})),"number"==typeof o.top&&(c.top=l()+o.top),o.target.stop().animate(c,500))}n=l(),h=r()}var n,h,u=[];y&&setInterval(function(){e()},800),o.prototype={remove:function(){}},ue.fixed=function(t){return new o(t)}}(),ue.dialog=ue.uiDialog=o.uiDialog=function(t){return new d(t)},uiDialog.list=d.list,function(){var o='<div class="@{theme}"><div class="ui-dialog-shadow"></div><div class="ui-dialog-custom @{type}"><div class="ui-dialog-custom-inner">@{header}<div class="ui-dialog-body clearfix">@{content}</div>@{footer}</div></div></div>',i=' <div class="ui-dialog-header"><a href="#" class="ui-dialog-close_btn"></a><h2>@{title}</h2></div>',e=' <div class="ui-dialog-footer">@{confirm_btn}@{cancel_btn}@{footer}</div>',s='<a href="#" class="ui-btn ui-btn-s ui-btn-s1 ui-dialog-cancel_btn"><span>取消</span></a>',a='<a href="#" class="ui-btn ui-btn-s ui-btn-s2 ui-dialog-confirm_btn"><span>确认</span></a>';uiDialog.custom=uiDialog.Custom=function(l){var r,h={show_header:!0,show_footer:!1,show_cancel_btn:!1,show_confirm_btn:!1,title:"来自4399.com的网页说",content:"hello world",type:"",footer:"",theme:"ui-dialog-a",lock:!1,drag:!0,dragHock:".ui-dialog-header",confirm:v,cancel:v,icon:"",init:v,delay:0};l=t.extend(h,l),r={header:l.show_header?n(i,l):"",content:l.icon?'<span class="ui-dialog-icon '+l.icon+'"></span><div class="ui-dialog-icon-text">'+l.content+"</div>":l.content,footer:l.show_footer?n(e,{footer:l.footer,cancel_btn:l.show_cancel_btn?s:"",confirm_btn:l.show_confirm_btn?a:""}):"",type:l.type,theme:l.theme},l.content=n(o,r);var u=l.init;return l.init=function(){var t=this;l.show_confirm_btn&&this.obj.find(".ui-dialog-confirm_btn").bind("click",function(){if("function"==typeof l.confirm){var o=l.confirm.call(t);o!==!1&&t.close()}return!1}),l.show_cancel_btn&&this.obj.find(".ui-dialog-cancel_btn").bind("click",function(){if("function"==typeof l.cancel){var o=l.cancel.call(t);o!==!1&&t.close()}return!1}),l.delay>0&&this.timer(l.delay,this.close),u.call(t)},uiDialog(l)}}(),uiDialog.alert=uiDialog.Alert=function(o){var i={type:"ui-dialog-alert",theme:"ui-dialog-a1 ui-dialog-a",show_header:!0,show_footer:!0,minWidth:250,maxWidth:600,lock:!0,show_confirm_btn:!0};return o=t.extend(i,o),uiDialog.Custom(o)},uiDialog.confirm=uiDialog.Confirm=function(o){var i={theme:"ui-dialog-a1 ui-dialog-a",type:"ui-dialog-confirm",show_header:!0,minWidth:250,maxWidth:600,show_footer:!0,lock:!0,show_confirm_btn:!0,show_cancel_btn:!0};return o=t.extend(i,o),uiDialog.Custom(o)},uiDialog.tip=uiDialog.Tip=function(o){var i={type:"ui-dialog-tip",show_header:!1,drag:!1,delay:2e3};return o=t.extend(i,o),uiDialog.Custom(o)};var k={LEFT:1,RIGHT:2,CENTER:4},x={TOP:8,BOTTOM:16,MIDDLE:32};uiDialog.follow=uiDialog.Follow=function(t,o,i,e){return new c(t,o,i,e)},c.prototype={reset:function(){var o,e,n=this.follow,s=this.isfollowed,a=(this.pos,this.h_pos),l=this.v_pos,r=this._h_pos,h=this._v_pos,u=this.trun,d=s.offset()||{left:0,top:0},u=u||{},c=u.x||0,f=u.y||0,p=s.outerWidth(),g=s.outerHeight(),b=n.outerWidth(),m=n.outerHeight();switch(o=d.left,e=d.top,a|l){case x.TOP|k.LEFT:e-=m;break;case x.TOP|k.RIGHT:o+=p-b,e-=m;break;case x.TOP|k.CENTER:o-=(b-p)/2,e-=m;break;case x.MIDDLE|k.LEFT:o-=b,e-=(m-g)/2;break;case x.MIDDLE|k.RIGHT:o+=p,e-=(m-g)/2;break;case x.MIDDLE|k.CENTER:e-=(m-g)/2,o-=(b-p)/2;break;case x.BOTTOM|k.LEFT:e+=g;break;case x.BOTTOM|k.RIGHT:e+=g,o+=p-b;break;case x.BOTTOM|k.CENTER:e+=g,o-=(b-p)/2}o+=c,e+=f,0>o&&(o=d.left,r="left"),o+b>t(i.body).width()&&(o=d.left+p-b,r="right"),e+m>t(i.body).height()&&(e=d.top-m,h="top"),0>e&&(e=d.top+g,h="bottom");var w=[r,h].join("_").toLowerCase();n.css({position:"absolute",left:o,top:e}).removeClass(this.pre_pos_cls||" ").addClass(w).show(),this.pre_pos_cls=w}},c.list=[],t(o).unbind("resize.follow").bind("resize.follow",function(){if(new Date-_<100)return!1;_=new Date;for(var t=0;t<c.list.length;t++)c.list[t]&&c.list[t].reset()})}(jQuery,window,document);
/* /webgame/home/js/baiduTemplate.js */
/**
 * baiduTemplate简单好用的Javascript模板引擎 1.0.6 版本
 * http://baidufe.github.com/BaiduTemplate
 * 开源协议：BSD License
 * 浏览器环境占用命名空间 baidu.template ，nodejs环境直接安装 npm install baidutemplate
 * @param str{String} dom结点ID，或者模板string
 * @param data{Object} 需要渲染的json对象，可以为空。当data为{}时，仍然返回html。
 * @return 如果无data，直接返回编译后的函数；如果有data，返回html。
 * @author wangxiao 
 * @email 1988wangxiao@gmail.com
*/

;(function(window){

    //取得浏览器环境的baidu命名空间，非浏览器环境符合commonjs规范exports出去
    //修正在nodejs环境下，采用baidu.template变量名
    var baidu = typeof module === 'undefined' ? (window.baidu = window.baidu || {}) : module.exports;

    //模板函数（放置于baidu.template命名空间下）
    baidu.template = function(str, data){

        //检查是否有该id的元素存在，如果有元素则获取元素的innerHTML/value，否则认为字符串为模板
        var fn = (function(){

            //判断如果没有document，则为非浏览器环境
            if(!window.document){
                return bt._compile(str);
            };

            //HTML5规定ID可以由任何不包含空格字符的字符串组成
            var element = document.getElementById(str);
            if (element) {
                    
                //取到对应id的dom，缓存其编译后的HTML模板函数
                if (bt.cache[str]) {
                    return bt.cache[str];
                };

                //textarea或input则取value，其它情况取innerHTML
                var html = /^(textarea|input)$/i.test(element.nodeName) ? element.value : element.innerHTML;
                return bt._compile(html);

            }else{

                //是模板字符串，则生成一个函数
                //如果直接传入字符串作为模板，则可能变化过多，因此不考虑缓存
                return bt._compile(str);
            };

        })();

        //有数据则返回HTML字符串，没有数据则返回函数 支持data={}的情况
        var result = bt._isObject(data) ? fn( data ) : fn;
        fn = null;

        return result;
    };

    //取得命名空间 baidu.template
    var bt = baidu.template;

    //标记当前版本
    bt.versions = bt.versions || [];
    bt.versions.push('1.0.6');

    //缓存  将对应id模板生成的函数缓存下来。
    bt.cache = {};
    
    //自定义分隔符，可以含有正则中的字符，可以是HTML注释开头 <! !>
    bt.LEFT_DELIMITER = bt.LEFT_DELIMITER||'<%';
    bt.RIGHT_DELIMITER = bt.RIGHT_DELIMITER||'%>';

    //自定义默认是否转义，默认为默认自动转义
    bt.ESCAPE = true;

    //HTML转义
    bt._encodeHTML = function (source) {
        return String(source)
            .replace(/&/g,'&amp;')
            .replace(/</g,'&lt;')
            .replace(/>/g,'&gt;')
            .replace(/\\/g,'&#92;')
            .replace(/"/g,'&quot;')
            .replace(/'/g,'&#39;');
    };

    //转义影响正则的字符
    bt._encodeReg = function (source) {
        return String(source).replace(/([.*+?^=!:${}()|[\]/\\])/g,'\\$1');
    };

    //转义UI UI变量使用在HTML页面标签onclick等事件函数参数中
    bt._encodeEventHTML = function (source) {
        return String(source)
            .replace(/&/g,'&amp;')
            .replace(/</g,'&lt;')
            .replace(/>/g,'&gt;')
            .replace(/"/g,'&quot;')
            .replace(/'/g,'&#39;')
            .replace(/\\\\/g,'\\')
            .replace(/\\\//g,'\/')
            .replace(/\\n/g,'\n')
            .replace(/\\r/g,'\r');
    };

    //将字符串拼接生成函数，即编译过程(compile)
    bt._compile = function(str){
        var funBody = "var _template_fun_array=[];\nvar fn=(function(__data__){\nvar _template_varName='';\nfor(var name in __data__){\n_template_varName+=('var '+name+'=__data__[\"'+name+'\"];');\n};\neval(_template_varName);\n_template_fun_array.push('"+bt._analysisStr(str)+"');\n_template_varName=null;\n})(_template_object);\nfn = null;\nreturn _template_fun_array.join('');\n";
        return new Function("_template_object",funBody);
    };

    //判断是否是Object类型
    bt._isObject = function (source) {
        return 'function' === typeof source || !!(source && 'object' === typeof source);
    };

    //解析模板字符串
    bt._analysisStr = function(str){

        //取得分隔符
        var _left_ = bt.LEFT_DELIMITER;
        var _right_ = bt.RIGHT_DELIMITER;

        //对分隔符进行转义，支持正则中的元字符，可以是HTML注释 <!  !>
        var _left = bt._encodeReg(_left_);
        var _right = bt._encodeReg(_right_);

        str = String(str)
            
            //去掉分隔符中js注释
            .replace(new RegExp("("+_left+"[^"+_right+"]*)//.*\n","g"), "$1")

            //去掉注释内容  <%* 这里可以任意的注释 *%>
            //默认支持HTML注释，将HTML注释匹配掉的原因是用户有可能用 <! !>来做分割符
            .replace(new RegExp("<!--.*?-->", "g"),"")
            .replace(new RegExp(_left+"\\*.*?\\*"+_right, "g"),"")

            //把所有换行去掉  \r回车符 \t制表符 \n换行符
            .replace(new RegExp("[\\r\\t\\n]","g"), "")

            //用来处理非分隔符内部的内容中含有 斜杠 \ 单引号 ‘ ，处理办法为HTML转义
            .replace(new RegExp(_left+"(?:(?!"+_right+")[\\s\\S])*"+_right+"|((?:(?!"+_left+")[\\s\\S])+)","g"),function (item, $1) {
                var str = '';
                if($1){

                    //将 斜杠 单引 HTML转义
                    str = $1.replace(/\\/g,"&#92;").replace(/'/g,'&#39;');
                    while(/<[^<]*?&#39;[^<]*?>/g.test(str)){

                        //将标签内的单引号转义为\r  结合最后一步，替换为\'
                        str = str.replace(/(<[^<]*?)&#39;([^<]*?>)/g,'$1\r$2')
                    };
                }else{
                    str = item;
                }
                return str ;
            });


        str = str 
            //定义变量，如果没有分号，需要容错  <%var val='test'%>
            .replace(new RegExp("("+_left+"[\\s]*?var[\\s]*?.*?[\\s]*?[^;])[\\s]*?"+_right,"g"),"$1;"+_right_)

            //对变量后面的分号做容错(包括转义模式 如<%:h=value%>)  <%=value;%> 排除掉函数的情况 <%fun1();%> 排除定义变量情况  <%var val='test';%>
            .replace(new RegExp("("+_left+":?[hvu]?[\\s]*?=[\\s]*?[^;|"+_right+"]*?);[\\s]*?"+_right,"g"),"$1"+_right_)

            //按照 <% 分割为一个个数组，再用 \t 和在一起，相当于将 <% 替换为 \t
            //将模板按照<%分为一段一段的，再在每段的结尾加入 \t,即用 \t 将每个模板片段前面分隔开
            .split(_left_).join("\t");

        //支持用户配置默认是否自动转义
        if(bt.ESCAPE){
            str = str

                //找到 \t=任意一个字符%> 替换为 ‘，任意字符,'
                //即替换简单变量  \t=data%> 替换为 ',data,'
                //默认HTML转义  也支持HTML转义写法<%:h=value%>  
                .replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'");
        }else{
            str = str
                
                //默认不转义HTML转义
                .replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':$1,'");
        };

        str = str

            //支持HTML转义写法<%:h=value%>  
            .replace(new RegExp("\\t:h=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'")

            //支持不转义写法 <%:=value%>和<%-value%>
            .replace(new RegExp("\\t(?::=|-)(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':$1,'")

            //支持url转义 <%:u=value%>
            .replace(new RegExp("\\t:u=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':encodeURIComponent($1),'")

            //支持UI 变量使用在HTML页面标签onclick等事件函数参数中  <%:v=value%>
            .replace(new RegExp("\\t:v=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':baidu.template._encodeEventHTML($1),'")

            //将字符串按照 \t 分成为数组，在用'); 将其合并，即替换掉结尾的 \t 为 ');
            //在if，for等语句前面加上 '); ，形成 ');if  ');for  的形式
            .split("\t").join("');")

            //将 %> 替换为_template_fun_array.push('
            //即去掉结尾符，生成函数中的push方法
            //如：if(list.length=5){%><h2>',list[4],'</h2>');}
            //会被替换为 if(list.length=5){_template_fun_array.push('<h2>',list[4],'</h2>');}
            .split(_right_).join("_template_fun_array.push('")

            //将 \r 替换为 \
            .split("\r").join("\\'");

        return str;
    };

})(window);

