(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this}if(typeof selector=="string"){var match=quickExpr.exec(selector);
if(match&&(match[1]||!context)){if(match[1]){selector=jQuery.clean([match[1]],context)}else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3]){return jQuery().find(selector)}return jQuery(elem)}selector=[]}}else{return jQuery(context).find(selector)}}else{if(jQuery.isFunction(selector)){return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector)}}return this.setArray(jQuery.makeArray(selector))
},jquery:"1.2.6",size:function(){return this.length},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num]},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this},each:function(callback,args){return jQuery.each(this,callback,args)},index:function(elem){var ret=-1;
return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)},attr:function(name,value,type){var options=name;if(name.constructor==String){if(value===undefined){return this[0]&&jQuery[type||"attr"](this[0],name)}else{options={};options[name]=value}}return this.each(function(i){for(name in options){jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name))}})},css:function(key,value){if((key=="width"||key=="height")&&parseFloat(value)<0){value=undefined
}return this.attr(key,value,"curCSS")},text:function(text){if(typeof text!="object"&&text!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text))}var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8){ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this])}})});return ret},wrapAll:function(html){if(this[0]){jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;
while(elem.firstChild){elem=elem.firstChild}return elem}).append(this)}return this},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html)})},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html)})},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1){this.appendChild(elem)}})},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1){this.insertBefore(elem,this.firstChild)
}})},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this)})},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})},end:function(){return this.prevObject||jQuery([])},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem)
});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems)},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0]}else{return this.cloneNode(true)}});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined){this[expando]=null
}});if(events===true){this.find("*").andSelf().each(function(i){if(this.nodeType==3){return}var events=jQuery.data(this,"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data)}}})}return ret},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i)
})||jQuery.multiFilter(selector,this))},not:function(selector){if(selector.constructor==String){if(isSimple.test(selector)){return this.pushStack(jQuery.multiFilter(selector,this,true))}else{selector=jQuery.multiFilter(selector,this)}}var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector
})},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=="string"?jQuery(selector):jQuery.makeArray(selector))))},is:function(selector){return !!selector&&jQuery.multiFilter(selector,this).length>0},hasClass:function(selector){return this.is("."+selector)},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";
if(index<0){return null}for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one){return value}values.push(value)}}return values}else{return(this[0].value||"").replace(/\r/g,"")}}return undefined}if(value.constructor==Number){value+=""}return this.each(function(){if(this.nodeType!=1){return
}if(value.constructor==Array&&/radio|checkbox/.test(this.type)){this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0)}else{if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0)});if(!values.length){this.selectedIndex=-1}}else{this.value=value
}}})},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value)},replaceWith:function(value){return this.after(value).remove()},eq:function(i){return this.slice(i,i+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)
}))},andSelf:function(){return this.add(this.prevObject)},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key)}return data===undefined&&parts[1]?this.data(parts[0]):data}else{return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value)
})}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key)})},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse){elems.reverse()}}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr")){obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"))
}var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem)}else{if(elem.nodeType==1){scripts=scripts.add(jQuery("script",elem).remove())}callback.call(obj,elem)}});scripts.each(evalScript)})}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"})
}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"")}if(elem.parentNode){elem.parentNode.removeChild(elem)}}function now(){return +new Date}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2}if(typeof target!="object"&&typeof target!="function"){target={}
}if(length==i){target=this;--i}for(;i<length;i++){if((options=arguments[i])!=null){for(var name in options){var src=target[name],copy=options[name];if(target===copy){continue}if(deep&&copy&&typeof copy=="object"&&!copy.nodeType){target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy)}else{if(copy!==undefined){target[name]=copy}}}}}return target};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};
jQuery.extend({noConflict:function(deep){window.$=_$;if(deep){window.jQuery=_jQuery}return jQuery},isFunction:function(fn){return !!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"")},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");
script.type="text/javascript";if(jQuery.browser.msie){script.text=data}else{script.appendChild(document.createTextNode(data))}head.insertBefore(script,head.firstChild);head.removeChild(script)}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id){id=elem[expando]=++uuid
}if(name&&!jQuery.cache[id]){jQuery.cache[id]={}}if(data!==undefined){jQuery.cache[id][name]=data}return name?jQuery.cache[id][name]:id},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id]){break}if(!name){jQuery.removeData(elem)}}}else{try{delete elem[expando]}catch(e){if(elem.removeAttribute){elem.removeAttribute(expando)
}}delete jQuery.cache[id]}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object){if(callback.apply(object[name],args)===false){break}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break}}}}else{if(length==undefined){for(name in object){if(callback.call(object[name],name,object[name])===false){break}}}else{for(var value=object[0];
i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}}return object},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value)){value=value.call(elem,i)}return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className)){elem.className+=(elem.className?" ":"")+className
}})},remove:function(elem,classNames){if(elem.nodeType==1){elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return !jQuery.className.has(classNames,className)}).join(" "):""}},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];
elem.style[name]=options[name]}callback.call(elem);for(var name in options){elem.style[name]=old[name]}},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;
border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0});val-=Math.round(padding+border)}if(jQuery(elem).is(":visible")){getWH()}else{jQuery.swap(elem,props,getWH)}return Math.max(0,val)}return jQuery.curCSS(elem,name,force)},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari){return false}var ret=defaultView.getComputedStyle(elem,null);
return !ret||ret.getPropertyValue("color")==""}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save}if(name.match(/float/i)){name=styleFloat}if(!force&&style&&style[name]){ret=style[name]}else{if(defaultView.getComputedStyle){if(name.match(/float/i)){name="float"
}name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem)){ret=computedStyle.getPropertyValue(name)}else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode){stack.unshift(a)}for(;i<stack.length;i++){if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block"}}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";
for(i=0;i<swap.length;i++){if(swap[i]!=null){stack[i].style.display=swap[i]}}}if(name=="opacity"&&ret==""){ret="1"}}else{if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;
style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft}}}}return ret},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document}jQuery.each(elems,function(i,elem){if(!elem){return}if(elem.constructor==Number){elem+=""}if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">"
});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];
div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--){div=div.lastChild}if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])
}}if(/^\s/.test(elem)){div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild)}}elem=jQuery.makeArray(div.childNodes)}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select"))){return}if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options){ret.push(elem)}else{ret=jQuery.merge(ret,elem)}});return ret},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined
}var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari){elem.parentNode.selectedIndex}if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode){throw"type property can't be changed"}elem[name]=value
}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)){return elem.getAttributeNode(name).nodeValue}return elem[name]}if(msie&&notxml&&name=="style"){return jQuery.attr(elem.style,"cssText",value)}if(set){elem.setAttribute(name,""+value)}var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr}if(msie&&name=="opacity"){if(set){elem.zoom=1;
elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+""=="NaN"?"":"alpha(opacity="+value*100+")")}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase()});if(set&&!(name=="zIndex"&&isNaN(value))){elem[name]=value}return elem[name]},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"")
},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call){ret[0]=array}else{while(i){ret[--i]=array[i]}}}return ret},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i}}return -1},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++]){if(elem.nodeType!=8){first[pos++]=elem
}}}else{while(elem=second[i++]){first[pos++]=elem}}return first},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i])}}}catch(e){ret=array}return ret},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++){if(!inv!=!callback(elems[i],i)){ret.push(elems[i])
}}return ret},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null){ret[ret.length]=value}}return ret.concat.apply([],ret)}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};
var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode},parents:function(elem){return jQuery.dir(elem,"parentNode")
},next:function(elem){return jQuery.nth(elem,2,"nextSibling")},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)},children:function(elem){return jQuery.sibling(elem.firstChild)},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)
}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string"){ret=jQuery.multiFilter(selector,ret)}return this.pushStack(jQuery.unique(ret))}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;
i<length;i++){jQuery(args[i])[original](this)}})}});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1){this.removeAttribute(name)}},addClass:function(classNames){jQuery.className.add(this,classNames)},removeClass:function(classNames){jQuery.className.remove(this,classNames)},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames)
},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){jQuery(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments)
}});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px")
}});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2])
},"#":function(a,i,m){return a.getAttribute("id")==m[2]},":":{lt:function(a,i,m){return i<m[3]-0},gt:function(a,i,m){return i>m[3]-0},nth:function(a,i,m){return m[3]-0==i},eq:function(a,i,m){return m[3]-0==i},first:function(a,i){return i==0},last:function(a,i,m,r){return i==r.length-1},even:function(a,i){return i%2==0},odd:function(a,i){return i%2},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a
},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a},"only-child":function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling")},parent:function(a){return a.firstChild},empty:function(a){return !a.firstChild},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"
},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"},enabled:function(a){return !a.disabled},disabled:function(a){return a.disabled},checked:function(a){return a.checked},selected:function(a){return a.selected||jQuery.attr(a,"selected")},text:function(a){return"text"==a.type},radio:function(a){return"radio"==a.type},checkbox:function(a){return"checkbox"==a.type
},file:function(a){return"file"==a.type},password:function(a){return"password"==a.type},submit:function(a){return"submit"==a.type},image:function(a){return"image"==a.type},reset:function(a){return"reset"==a.type},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button")},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},has:function(a,i,m){return jQuery.find(m[3],a).length
},header:function(a){return/h\d/i.test(a.nodeName)},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem}).length}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);
expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r)}return cur},find:function(t,context){if(typeof t!="string"){return[t]}if(context&&context.nodeType!=1&&context.nodeType!=9){return[]}context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();
for(var i=0;ret[i];i++){for(var c=ret[i].firstChild;c;c=c.nextSibling){if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName)){r.push(c)}}}ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0){continue}foundToken=true}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;
for(;n;n=n.nextSibling){if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id]){break}if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~"){merge[id]=true}r.push(n)}if(m=="+"){break}}}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0]){ret.shift()}done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length)}else{var re2=quickID;
var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]]}else{re2=quickClass;m=re2.exec(t)}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2]){oid=jQuery('[@id="'+m[2]+'"]',elem)[0]}ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[]
}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object"){tag="param"}r=jQuery.merge(r,ret[i].getElementsByTagName(tag))}if(m[1]=="."){r=jQuery.classFilter(r,m[2])}if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++){if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break}}r=tmp}ret=r}t=t.replace(re2,"")}}if(t){var val=jQuery.filter(t,r);
ret=r=val.r;t=jQuery.trim(val.t)}}if(t){ret=[]}if(ret&&context==ret[0]){ret.shift()}done=jQuery.merge(done,ret);return done},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass){tmp.push(r[i])}}return tmp},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);
if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break}}if(!m){break}if(m[1]==":"&&m[2]=="not"){r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3])}else{if(m[1]=="."){r=jQuery.classFilter(r,m[2],not)}else{if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2])){z=jQuery.attr(a,m[2])||""
}if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not){tmp.push(a)}}r=tmp}else{if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;
for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling){if(n.nodeType==1){n.nodeIndex=c++}}merge[id]=true}var add=false;if(first==0){if(node.nodeIndex==last){add=true}}else{if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0){add=true}}if(add^not){tmp.push(node)}}r=tmp
}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object"){fn=fn[m[2]]}if(typeof fn=="string"){fn=eval("false||function(a,i){return "+fn+";}")}r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r)},not)}}}}}return{r:r,t:t}},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1){matched.push(cur)}cur=cur[dir]}return matched},nth:function(cur,result,dir,elem){result=result||1;
var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType==1&&++num==result){break}}return cur},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem){r.push(n)}}return r}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8){return}if(jQuery.browser.msie&&elem.setInterval){elem=window}if(!handler.guid){handler.guid=this.guid++}if(data!=undefined){var fn=handler;
handler=this.proxy(fn,function(){return fn.apply(this,arguments)});handler.data=data}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered){return jQuery.event.handle.apply(arguments.callee.elem,arguments)}});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");
type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener){elem.addEventListener(type,handle,false)}else{if(elem.attachEvent){elem.attachEvent("on"+type,handle)}}}}handlers[handler.guid]=handler;jQuery.event.global[type]=true});elem=null},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8){return
}var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)==".")){for(var type in events){this.remove(elem,type+(types||""))}}else{if(types.type){handler=types.handler;types=types.type}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler){delete events[type][handler.guid]
}else{for(handler in events[type]){if(!parts[1]||events[type][handler].type==parts[1]){delete events[type][handler]}}}for(ret in events[type]){break}if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener){elem.removeEventListener(type,jQuery.data(elem,"handle"),false)}else{if(elem.detachEvent){elem.detachEvent("on"+type,jQuery.data(elem,"handle"))
}}}ret=null;delete events[type]}}})}for(ret in events){break}if(!ret){var handle=jQuery.data(elem,"handle");if(handle){handle.elem=null}jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle")}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true}if(!elem){if(this.global[type]){jQuery("*").add([window,document]).trigger(type,data)
}}else{if(elem.nodeType==3||elem.nodeType==8){return undefined}var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true}data[0].type=type;if(exclusive){data[0].exclusive=true}var handle=jQuery.data(elem,"handle");if(handle){val=handle.apply(elem,data)
}if((!fn||(jQuery.nodeName(elem,"a")&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false){val=false}if(event){data.shift()}if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined){val=ret}}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,"a")&&type=="click")){this.triggered=true;try{elem[type]()}catch(e){}}this.triggered=false
}return val},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;
ret=handler.apply(this,arguments);if(val!==false){val=ret}if(ret===false){event.preventDefault();event.stopPropagation()}}}return val},fix:function(event){if(event[expando]==true){return event}var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
for(var i=props.length;i;i--){event[props[i]]=originalEvent[props[i]]}event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault){originalEvent.preventDefault()}originalEvent.returnValue=false};event.stopPropagation=function(){if(originalEvent.stopPropagation){originalEvent.stopPropagation()}originalEvent.cancelBubble=true};event.timeStamp=event.timeStamp||now();if(!event.target){event.target=event.srcElement||document
}if(event.target.nodeType==3){event.target=event.target.parentNode}if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement}if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0)
}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)){event.which=event.charCode||event.keyCode}if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey}if(!event.which&&event.button){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)))}return event},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy},special:{ready:{setup:function(){bindReady();
return},teardown:function(){return}},mouseenter:{setup:function(){if(jQuery.browser.msie){return false}jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true},teardown:function(){if(jQuery.browser.msie){return false}jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true},handler:function(event){if(withinElement(event,this)){return true}event.type="mouseenter";
return jQuery.event.handle.apply(this,arguments)}},mouseleave:{setup:function(){if(jQuery.browser.msie){return false}jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true},teardown:function(){if(jQuery.browser.msie){return false}jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true},handler:function(event){if(withinElement(event,this)){return true
}event.type="mouseleave";return jQuery.event.handle.apply(this,arguments)}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data)})},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments)});return this.each(function(){jQuery.event.add(this,type,one,fn&&data)
})},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn)})},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn)})},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn)},toggle:function(fn){var args=arguments,i=1;while(i<args.length){jQuery.event.proxy(fn,args[i++])
}return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false}))},hover:function(fnOver,fnOut){return this.bind("mouseenter",fnOver).bind("mouseleave",fnOut)},ready:function(fn){bindReady();if(jQuery.isReady){fn.call(document,jQuery)}else{jQuery.readyList.push(function(){return fn.call(this,jQuery)
})}return this}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document)});jQuery.readyList=null}jQuery(document).triggerHandler("ready")}}});var readyBound=false;function bindReady(){if(readyBound){return}readyBound=true;if(document.addEventListener&&!jQuery.browser.opera){document.addEventListener("DOMContentLoaded",jQuery.ready,false)
}if(jQuery.browser.msie&&window==top){(function(){if(jQuery.isReady){return}try{document.documentElement.doScroll("left")}catch(error){setTimeout(arguments.callee,0);return}jQuery.ready()})()}if(jQuery.browser.opera){document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady){return}for(var i=0;i<document.styleSheets.length;i++){if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);
return}}jQuery.ready()},false)}if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady){return}if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return}if(numStyles===undefined){numStyles=jQuery("style, link[rel=stylesheet]").length}if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return}jQuery.ready()})()}jQuery.event.add(window,"load",jQuery.ready)
}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name)}});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem){try{parent=parent.parentNode}catch(error){parent=elem
}}return parent==elem};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind()});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!="string"){return this._load(url)}var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off)}callback=callback||function(){};var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;
params=null}else{params=jQuery.param(params);type="POST"}}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified"){self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText)}self.each(callback,[res.responseText,status,res])}});return this
},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val}
}):{name:elem.name,value:val}}).get()}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f)}});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type})},getScript:function(url,callback){return jQuery.get(url,null,callback,"script")
},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={}}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type})},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings)},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));
var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string"){s.data=jQuery.param(s.data)}if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre)){s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?"}}else{if(!s.data||!s.data.match(jsre)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?"}}s.dataType="json"}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;
if(s.data){s.data=(s.data+"").replace(jsre,"="+jsonp+"$1")}s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp]}catch(e){}if(head){head.removeChild(script)}}}if(s.dataType=="script"&&s.cache==null){s.cache=false}if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");
s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"")}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null}if(s.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart")}var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");
script.src=s.url;if(s.scriptCharset){script.charset=s.scriptCharset}if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script)}}}head.appendChild(script);return undefined}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
if(s.username){xhr.open(type,s.url,s.async,s.username,s.password)}else{xhr.open(type,s.url,s.async)}try{if(s.data){xhr.setRequestHeader("Content-Type",s.contentType)}if(s.ifModified){xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default)
}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false}if(s.global){jQuery.event.trigger("ajaxSend",[xhr,s])}var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";
if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter)}catch(e){status="parsererror"}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified")}catch(e){}if(s.ifModified&&modRes){jQuery.lastModified[s.url]=modRes}if(!jsonp){success()}}else{jQuery.handleError(s,xhr,status)}complete();if(s.async){xhr=null}}};if(s.async){var ival=setInterval(onreadystatechange,13);
if(s.timeout>0){setTimeout(function(){if(xhr){xhr.abort();if(!requestDone){onreadystatechange("timeout")}}},s.timeout)}}try{xhr.send(s.data)}catch(e){jQuery.handleError(s,xhr,null,e)}if(!s.async){onreadystatechange()}function success(){if(s.success){s.success(data,status)}if(s.global){jQuery.event.trigger("ajaxSuccess",[xhr,s])}}function complete(){if(s.complete){s.complete(xhr,status)}if(s.global){jQuery.event.trigger("ajaxComplete",[xhr,s])
}if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}}return xhr},handleError:function(s,xhr,status,e){if(s.error){s.error(xhr,status,e)}if(s.global){jQuery.event.trigger("ajaxError",[xhr,s,e])}},active:0,httpSuccess:function(xhr){try{return !xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined
}catch(e){}return false},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined}catch(e){}return false},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;
if(xml&&data.documentElement.tagName=="parsererror"){throw"parsererror"}if(filter){data=filter(data,type)}if(type=="script"){jQuery.globalEval(data)}if(type=="json"){data=eval("("+data+")")}return data},param:function(a){var s=[];if(a.constructor==Array||a.jquery){jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value))})}else{for(var j in a){if(a[j]&&a[j].constructor==Array){jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this))
})}else{s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]))}}}return s.join("&").replace(/%20/g,"+")}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");
this.style.display=elem.css("display");if(this.style.display=="none"){this.style.display="block"}elem.remove()}}).end()},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none"}).end()},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]()
})},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback)},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback)},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback)},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback)},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback)
},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback)},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1){return false}var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden){return opt.complete.call(this)
}if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow}}if(opt.overflow!=null){this.style.overflow="hidden"}opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val)){e[val=="toggle"?hidden?"show":"hide":val](prop)}else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;
if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit}if(parts[1]){end=((parts[1]=="-="?-1:1)*end)+start}e.custom(start,end,unit)}else{e.custom(start,val,"")}}});return true})},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx"}if(!type||(typeof type=="string"&&!fn)){return queue(this[0],type)
}return this.each(function(){if(fn.constructor==Array){queue(this,type,fn)}else{queue(this,type).push(fn);if(queue(this,type).length==1){fn.call(this)}}})},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue){this.queue([])}this.each(function(){for(var i=timers.length-1;i>=0;i--){if(timers[i].elem==this){if(gotoEnd){timers[i](true)}timers.splice(i,1)}}});if(!gotoEnd){this.dequeue()
}return this}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array){q=jQuery.data(elem,type+"queue",jQuery.makeArray(array))}}return q};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length){q[0].call(this)}})};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};
opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false){jQuery(this).dequeue()}if(jQuery.isFunction(opt.old)){opt.old.call(this)}};return opt},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum
}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig){options.orig={}}}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width"){this.elem.style.display="block"}},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null){return this.elem[this.prop]
}var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd)}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;
for(var i=0;i<timers.length;i++){if(!timers[i]()){timers.splice(i--,1)}}if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null}},13)}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height"){this.elem.style[this.prop]="1px"}jQuery(this.elem).show()},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);
this.options.hide=true;this.custom(this.cur(),0)},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim){if(this.options.curAnim[i]!==true){done=false}}if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;
this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){this.elem.style.display="none"}if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.attr(this.elem.style,p,this.options.orig[p])}}}if(done){this.options.complete.call(this.elem)}return false}else{var n=t-this.startTime;this.state=n/this.options.duration;
this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now},scrollTop:function(fx){fx.elem.scrollTop=fx.now},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)
},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem){with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();
add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop)}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2){border(offsetParent)
}if(!fixed&&css(offsetParent,"position")=="fixed"){fixed=true}offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display"))){add(-parent.scrollLeft,-parent.scrollTop)}if(mozilla&&css(parent,"overflow")!="visible"){border(parent)}parent=parent.parentNode
}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute")){add(-doc.body.offsetLeft,-doc.body.offsetTop)}if(fixed){add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop))}}results={top:top,left:left}}}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true))
}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0}return results};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,"marginTop");offset.left-=num(this,"marginLeft");parentOffset.top+=num(offsetParent,"borderTopWidth");
parentOffset.left+=num(offsetParent,"borderLeftWidth");results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}}return results},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,"position")=="static")){offsetParent=offsetParent.offsetParent}return jQuery(offsetParent)}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;
jQuery.fn[method]=function(val){if(!this[0]){return}return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val}):this[0]==window||this[0]==document?self[i?"pageYOffset":"pageXOffset"]||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method]}});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";
jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br)};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0)}})})();(function(E){E.ui={plugin:{add:function(I,C,A){var B=E.ui[I].prototype;for(var J in A){B.plugins[J]=B.plugins[J]||[];
B.plugins[J].push([C,A[J]])}},call:function(J,C,I){var A=J.plugins[C];if(!A){return}for(var B=0;B<A.length;B++){if(J.options[A[B][0]]){A[B][1].apply(J.element,I)}}}},cssCache:{},css:function(C){if(E.ui.cssCache[C]){return E.ui.cssCache[C]}var B=E('<div class="ui-gen">').addClass(C).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");E.ui.cssCache[C]=!!((!(/auto|default/).test(B.css("cursor"))||(/^[1-9]/).test(B.css("height"))||(/^[1-9]/).test(B.css("width"))||!(/none/).test(B.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(B.css("backgroundColor"))));
try{E("body").get(0).removeChild(B.get(0))}catch(A){}return E.ui.cssCache[C]},disableSelection:function(A){E(A).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(A){E(A).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(A,C){var H=/top/.test(C||"top")?"scrollTop":"scrollLeft",B=false;if(A[H]>0){return true}A[H]=1;B=A[H]>0?true:false;A[H]=0;return B
}};var F=E.fn.remove;E.fn.remove=function(){E("*",this).add(this).triggerHandler("remove");return F.apply(this,arguments)};function D(C,B,A){var H=E[C][B].getter||[];H=(typeof H=="string"?H.split(/,?\s+/):H);return(E.inArray(A,H)!=-1)}E.widget=function(B,C){var A=B.split(".")[0];B=B.split(".")[1];E.fn[B]=function(K){var M=(typeof K=="string"),L=Array.prototype.slice.call(arguments,1);if(M&&D(A,B,K)){var N=E.data(this[0],B);
return(N?N[K].apply(N,L):undefined)}return this.each(function(){var G=E.data(this,B);if(M&&G&&E.isFunction(G[K])){G[K].apply(G,L)}else{if(!M){E.data(this,B,new E[A][B](this,K))}}})};E[A][B]=function(J,K){var L=this;this.widgetName=B;this.widgetBaseClass=A+"-"+B;this.options=E.extend({},E.widget.defaults,E[A][B].defaults,K);this.element=E(J).bind("setData."+B,function(G,I,H){return L.setData(I,H)}).bind("getData."+B,function(G,H){return L.getData(H)
}).bind("remove",function(){return L.destroy()});this.init()};E[A][B].prototype=E.extend({},E.widget.prototype,C)};E.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(A){return this.options[A]},setData:function(B,A){this.options[B]=A;if(B=="disabled"){this.element[A?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)
},disable:function(){this.setData("disabled",true)}};E.widget.defaults={disabled:false};E.ui.mouse={mouseInit:function(){var A=this;this.element.bind("mousedown."+this.widgetName,function(B){return A.mouseDown(B)});if(E.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);
(E.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(B){(this._mouseStarted&&this.mouseUp(B));this._mouseDownEvent=B;var C=this,A=(B.which==1),H=(typeof this.options.cancel=="string"?E(B.target).parents().add(B.target).filter(this.options.cancel).length:false);if(!A||H||!this.mouseCapture(B)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){C._mouseDelayMet=true
},this.options.delay)}if(this.mouseDistanceMet(B)&&this.mouseDelayMet(B)){this._mouseStarted=(this.mouseStart(B)!==false);if(!this._mouseStarted){B.preventDefault();return true}}this._mouseMoveDelegate=function(G){return C.mouseMove(G)};this._mouseUpDelegate=function(G){return C.mouseUp(G)};E(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);
return false},mouseMove:function(A){if(E.browser.msie&&!A.button){return this.mouseUp(A)}if(this._mouseStarted){this.mouseDrag(A);return false}if(this.mouseDistanceMet(A)&&this.mouseDelayMet(A)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,A)!==false);(this._mouseStarted?this.mouseDrag(A):this.mouseUp(A))}return !this._mouseStarted},mouseUp:function(A){E(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(A)}return false},mouseDistanceMet:function(A){return(Math.max(Math.abs(this._mouseDownEvent.pageX-A.pageX),Math.abs(this._mouseDownEvent.pageY-A.pageY))>=this.options.distance)},mouseDelayMet:function(A){return this._mouseDelayMet},mouseStart:function(A){},mouseDrag:function(A){},mouseStop:function(A){},mouseCapture:function(A){return true
}};E.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(B){B.widget("ui.draggable",B.extend({},B.ui.mouse,{init:function(){var A=this.options;if(A.helper=="original"&&!(/(relative|absolute|fixed)/).test(this.element.css("position"))){this.element.css("position","relative")}this.element.addClass("ui-draggable");(A.disabled&&this.element.addClass("ui-draggable-disabled"));this.mouseInit()
},mouseStart:function(J){var A=this.options;if(this.helper||A.disabled||B(J.target).is(".ui-resizable-handle")){return false}var M=!this.options.handle||!B(this.options.handle,this.element).length?true:false;B(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==J.target){M=true}});if(!M){return false}if(B.ui.ddmanager){B.ui.ddmanager.current=this}this.helper=B.isFunction(A.helper)?B(A.helper.apply(this.element[0],[J])):(A.helper=="clone"?this.element.clone():this.element);
if(!this.helper.parents("body").length){this.helper.appendTo((A.appendTo=="parent"?this.element[0].parentNode:A.appendTo))}if(this.helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(this.helper.css("position"))){this.helper.css("position","absolute")}this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");
this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:J.pageX-this.offset.left,top:J.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var N=this.offsetParent.offset();if(this.offsetParent[0]==document.body&&B.browser.mozilla){N={top:0,left:0}}this.offset.parent={top:N.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:N.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};
var K=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:K.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:K.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(J);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};
if(A.cursorAt){if(A.cursorAt.left!=undefined){this.offset.click.left=A.cursorAt.left+this.margins.left}if(A.cursorAt.right!=undefined){this.offset.click.left=this.helperProportions.width-A.cursorAt.right+this.margins.left}if(A.cursorAt.top!=undefined){this.offset.click.top=A.cursorAt.top+this.margins.top}if(A.cursorAt.bottom!=undefined){this.offset.click.top=this.helperProportions.height-A.cursorAt.bottom+this.margins.top
}}if(A.containment){if(A.containment=="parent"){A.containment=this.helper[0].parentNode}if(A.containment=="document"||A.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,B(A.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(B(A.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]
}if(!(/^(document|window|parent)$/).test(A.containment)){var L=B(A.containment)[0];var I=B(A.containment).offset();this.containment=[I.left+(parseInt(B(L).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,I.top+(parseInt(B(L).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,I.left+Math.max(L.scrollWidth,L.offsetWidth)-(parseInt(B(L).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),I.top+Math.max(L.scrollHeight,L.offsetHeight)-(parseInt(B(L).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]
}}this.propagate("start",J);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(B.ui.ddmanager&&!A.dropBehaviour){B.ui.ddmanager.prepareOffsets(this,J)}this.helper.addClass("ui-draggable-dragging");this.mouseDrag(J);return true},convertPositionTo:function(E,A){if(!A){A=this.position}var F=E=="absolute"?1:-1;return{top:(A.top+this.offset.relative.top*F+this.offset.parent.top*F-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*F+(this.cssPosition=="fixed"?B(document).scrollTop():0)*F+this.margins.top*F),left:(A.left+this.offset.relative.left*F+this.offset.parent.left*F-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*F+(this.cssPosition=="fixed"?B(document).scrollLeft():0)*F+this.margins.left*F)}
},generatePosition:function(G){var A=this.options;var J={top:(G.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)-(this.cssPosition=="fixed"?B(document).scrollTop():0)),left:(G.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)-(this.cssPosition=="fixed"?B(document).scrollLeft():0))};
if(!this.originalPosition){return J}if(this.containment){if(J.left<this.containment[0]){J.left=this.containment[0]}if(J.top<this.containment[1]){J.top=this.containment[1]}if(J.left>this.containment[2]){J.left=this.containment[2]}if(J.top>this.containment[3]){J.top=this.containment[3]}}if(A.grid){var H=this.originalPosition.top+Math.round((J.top-this.originalPosition.top)/A.grid[1])*A.grid[1];J.top=this.containment?(!(H<this.containment[1]||H>this.containment[3])?H:(!(H<this.containment[1])?H-A.grid[1]:H+A.grid[1])):H;
var I=this.originalPosition.left+Math.round((J.left-this.originalPosition.left)/A.grid[0])*A.grid[0];J.left=this.containment?(!(I<this.containment[0]||I>this.containment[2])?I:(!(I<this.containment[0])?I-A.grid[0]:I+A.grid[0])):I}return J},mouseDrag:function(A){this.position=this.generatePosition(A);this.positionAbs=this.convertPositionTo("absolute");this.position=this.propagate("drag",A)||this.position;
if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(B.ui.ddmanager){B.ui.ddmanager.drag(this,A)}return false},mouseStop:function(E){var A=false;if(B.ui.ddmanager&&!this.options.dropBehaviour){var A=B.ui.ddmanager.drop(this,E)}if((this.options.revert=="invalid"&&!A)||(this.options.revert=="valid"&&A)||this.options.revert===true){var F=this;
B(this.helper).animate(this.originalPosition,parseInt(this.options.revert,10)||500,function(){F.propagate("stop",E);F.clear()})}else{this.propagate("stop",E);this.clear()}return false},clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.options.helper!="original"&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},plugins:{},uiHash:function(A){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options}
},propagate:function(A,D){B.ui.plugin.call(this,A,[D,this.uiHash()]);if(A=="drag"){this.positionAbs=this.convertPositionTo("absolute")}return this.element.triggerHandler(A=="drag"?A:"drag"+A,[D,this.uiHash()],this.options[A])},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable");this.mouseDestroy()}}));B.extend(B.ui.draggable,{defaults:{appendTo:"parent",axis:false,cancel:":input",delay:0,distance:1,helper:"original"}});
B.ui.plugin.add("draggable","cursor",{start:function(A,E){var F=B("body");if(F.css("cursor")){E.options._cursor=F.css("cursor")}F.css("cursor",E.options.cursor)},stop:function(A,D){if(D.options._cursor){B("body").css("cursor",D.options._cursor)}}});B.ui.plugin.add("draggable","zIndex",{start:function(A,E){var F=B(E.helper);if(F.css("zIndex")){E.options._zIndex=F.css("zIndex")}F.css("zIndex",E.options.zIndex)
},stop:function(A,D){if(D.options._zIndex){B(D.helper).css("zIndex",D.options._zIndex)}}});B.ui.plugin.add("draggable","opacity",{start:function(A,E){var F=B(E.helper);if(F.css("opacity")){E.options._opacity=F.css("opacity")}F.css("opacity",E.options.opacity)},stop:function(A,D){if(D.options._opacity){B(D.helper).css("opacity",D.options._opacity)}}});B.ui.plugin.add("draggable","iframeFix",{start:function(A,D){B(D.options.iframeFix===true?"iframe":D.options.iframeFix).each(function(){B('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(B(this).offset()).appendTo("body")
})},stop:function(A,D){B("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this)})}});B.ui.plugin.add("draggable","scroll",{start:function(F,G){var A=G.options;var H=B(this).data("draggable");A.scrollSensitivity=A.scrollSensitivity||20;A.scrollSpeed=A.scrollSpeed||20;H.overflowY=function(C){do{if(/auto|scroll/.test(C.css("overflow"))||(/auto|scroll/).test(C.css("overflow-y"))){return C
}C=C.parent()}while(C[0].parentNode);return B(document)}(this);H.overflowX=function(C){do{if(/auto|scroll/.test(C.css("overflow"))||(/auto|scroll/).test(C.css("overflow-x"))){return C}C=C.parent()}while(C[0].parentNode);return B(document)}(this);if(H.overflowY[0]!=document&&H.overflowY[0].tagName!="HTML"){H.overflowYOffset=H.overflowY.offset()}if(H.overflowX[0]!=document&&H.overflowX[0].tagName!="HTML"){H.overflowXOffset=H.overflowX.offset()
}},drag:function(F,G){var A=G.options;var H=B(this).data("draggable");if(H.overflowY[0]!=document&&H.overflowY[0].tagName!="HTML"){if((H.overflowYOffset.top+H.overflowY[0].offsetHeight)-F.pageY<A.scrollSensitivity){H.overflowY[0].scrollTop=H.overflowY[0].scrollTop+A.scrollSpeed}if(F.pageY-H.overflowYOffset.top<A.scrollSensitivity){H.overflowY[0].scrollTop=H.overflowY[0].scrollTop-A.scrollSpeed}}else{if(F.pageY-B(document).scrollTop()<A.scrollSensitivity){B(document).scrollTop(B(document).scrollTop()-A.scrollSpeed)
}if(B(window).height()-(F.pageY-B(document).scrollTop())<A.scrollSensitivity){B(document).scrollTop(B(document).scrollTop()+A.scrollSpeed)}}if(H.overflowX[0]!=document&&H.overflowX[0].tagName!="HTML"){if((H.overflowXOffset.left+H.overflowX[0].offsetWidth)-F.pageX<A.scrollSensitivity){H.overflowX[0].scrollLeft=H.overflowX[0].scrollLeft+A.scrollSpeed}if(F.pageX-H.overflowXOffset.left<A.scrollSensitivity){H.overflowX[0].scrollLeft=H.overflowX[0].scrollLeft-A.scrollSpeed
}}else{if(F.pageX-B(document).scrollLeft()<A.scrollSensitivity){B(document).scrollLeft(B(document).scrollLeft()-A.scrollSpeed)}if(B(window).width()-(F.pageX-B(document).scrollLeft())<A.scrollSensitivity){B(document).scrollLeft(B(document).scrollLeft()+A.scrollSpeed)}}}});B.ui.plugin.add("draggable","snap",{start:function(A,E){var F=B(this).data("draggable");F.snapElements=[];B(E.options.snap===true?".ui-draggable":E.options.snap).each(function(){var C=B(this);
var D=C.offset();if(this!=F.element[0]){F.snapElements.push({item:this,width:C.outerWidth(),height:C.outerHeight(),top:D.top,left:D.left})}})},drag:function(c,Y){var d=B(this).data("draggable");var a=Y.options.snapTolerance||20;var A=Y.absolutePosition.left,S=A+d.helperProportions.width,W=Y.absolutePosition.top,X=W+d.helperProportions.height;for(var e=d.snapElements.length-1;e>=0;e--){var h=d.snapElements[e].left,T=h+d.snapElements[e].width,U=d.snapElements[e].top,Z=U+d.snapElements[e].height;
if(!((h-a<A&&A<T+a&&U-a<W&&W<Z+a)||(h-a<A&&A<T+a&&U-a<X&&X<Z+a)||(h-a<S&&S<T+a&&U-a<W&&W<Z+a)||(h-a<S&&S<T+a&&U-a<X&&X<Z+a))){continue}if(Y.options.snapMode!="inner"){var b=Math.abs(U-X)<=20;var V=Math.abs(Z-W)<=20;var f=Math.abs(h-S)<=20;var g=Math.abs(T-A)<=20;if(b){Y.position.top=d.convertPositionTo("relative",{top:U-d.helperProportions.height,left:0}).top}if(V){Y.position.top=d.convertPositionTo("relative",{top:Z,left:0}).top
}if(f){Y.position.left=d.convertPositionTo("relative",{top:0,left:h-d.helperProportions.width}).left}if(g){Y.position.left=d.convertPositionTo("relative",{top:0,left:T}).left}}if(Y.options.snapMode!="outer"){var b=Math.abs(U-W)<=20;var V=Math.abs(Z-X)<=20;var f=Math.abs(h-A)<=20;var g=Math.abs(T-S)<=20;if(b){Y.position.top=d.convertPositionTo("relative",{top:U,left:0}).top}if(V){Y.position.top=d.convertPositionTo("relative",{top:Z-d.helperProportions.height,left:0}).top
}if(f){Y.position.left=d.convertPositionTo("relative",{top:0,left:h}).left}if(g){Y.position.left=d.convertPositionTo("relative",{top:0,left:T-d.helperProportions.width}).left}}}}});B.ui.plugin.add("draggable","connectToSortable",{start:function(A,E){var F=B(this).data("draggable");F.sortables=[];B(E.options.connectToSortable).each(function(){if(B.data(this,"sortable")){var C=B.data(this,"sortable");
F.sortables.push({instance:C,shouldRevert:C.options.revert});C.refreshItems();C.propagate("activate",A,F)}})},stop:function(A,E){var F=B(this).data("draggable");B.each(F.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;F.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance.mouseStop(A);this.instance.element.triggerHandler("sortreceive",[A,B.extend(this.instance.ui(),{sender:F.element})],this.instance.options.receive);
this.instance.options.helper=this.instance.options._helper}else{this.instance.propagate("deactivate",A,F)}})},drag:function(A,G){var H=B(this).data("draggable"),J=this;var I=function(C){var F=C.left,D=F+C.width,E=C.top,L=E+C.height;return(F<(this.positionAbs.left+this.offset.click.left)&&(this.positionAbs.left+this.offset.click.left)<D&&E<(this.positionAbs.top+this.offset.click.top)&&(this.positionAbs.top+this.offset.click.top)<L)
};B.each(H.sortables,function(C){if(I.call(H,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=B(J).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return G.helper[0]};A.target=this.instance.currentItem[0];this.instance.mouseCapture(A,true);
this.instance.mouseStart(A,true,true);this.instance.offset.click.top=H.offset.click.top;this.instance.offset.click.left=H.offset.click.left;this.instance.offset.parent.left-=H.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=H.offset.parent.top-this.instance.offset.parent.top;H.propagate("toSortable",A)}if(this.instance.currentItem){this.instance.mouseDrag(A)}}else{if(this.instance.isOver){this.instance.isOver=0;
this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance.mouseStop(A,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}H.propagate("fromSortable",A)}}})}});B.ui.plugin.add("draggable","stack",{start:function(A,F){var E=B.makeArray(B(F.options.stack.group)).sort(function(C,D){return(parseInt(B(C).css("zIndex"),10)||F.options.stack.min)-(parseInt(B(D).css("zIndex"),10)||F.options.stack.min)
});B(E).each(function(C){this.style.zIndex=F.options.stack.min+C});this[0].style.zIndex=F.options.stack.min+E.length}})})(jQuery);(function(B){B.widget("ui.resizable",B.extend({},B.ui.mouse,{init:function(){var a=this,Z=this.options;var W=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(W)?"relative":W});B.extend(Z,{_aspectRatio:!!(Z.aspectRatio),helper:Z.helper||Z.ghost||Z.animate?Z.helper||"proxy":null,knobHandles:Z.knobHandles===true?"ui-resizable-knob-handle":Z.knobHandles});
var f="1px solid #DEDEDE";Z.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#F2F2F2",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:f},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:f},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:f},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:f},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:f,borderBottom:f},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:f,borderLeft:f},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:f,borderTop:f},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:f,borderTop:f}};
Z.knobTheme={"ui-resizable-handle":{background:"#F2F2F2",border:"1px solid #808080",height:"8px",width:"8px"},"ui-resizable-n":{cursor:"n-resize",top:"0px",left:"45%"},"ui-resizable-s":{cursor:"s-resize",bottom:"0px",left:"45%"},"ui-resizable-e":{cursor:"e-resize",right:"0px",top:"45%"},"ui-resizable-w":{cursor:"w-resize",left:"0px",top:"45%"},"ui-resizable-se":{cursor:"se-resize",right:"0px",bottom:"0px"},"ui-resizable-sw":{cursor:"sw-resize",left:"0px",bottom:"0px"},"ui-resizable-nw":{cursor:"nw-resize",left:"0px",top:"0px"},"ui-resizable-ne":{cursor:"ne-resize",right:"0px",top:"0px"}};
Z._nodeName=this.element[0].nodeName;if(Z._nodeName.match(/canvas|textarea|input|select|button|img/i)){var l=this.element;if(/relative/.test(l.css("position"))&&B.browser.opera){l.css({position:"relative",top:"auto",left:"auto"})}l.wrap(B('<div class="ui-wrapper"	style="overflow: hidden;"></div>').css({position:l.css("position"),width:l.outerWidth(),height:l.outerHeight(),top:l.css("top"),left:l.css("left")}));
var d=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:d.css("marginLeft"),marginTop:d.css("marginTop"),marginRight:d.css("marginRight"),marginBottom:d.css("marginBottom")});d.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(B.browser.safari&&Z.preventDefault){d.css("resize","none")}Z.proportionallyResize=d.css({position:"static",zoom:1,display:"block"});
this.element.css({margin:d.css("margin")});this._proportionallyResize()}if(!Z.handles){Z.handles=!B(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}}if(Z.handles.constructor==String){Z.zIndex=Z.zIndex||1000;if(Z.handles=="all"){Z.handles="n,e,s,w,se,sw,ne,nw"
}var Y=Z.handles.split(",");Z.handles={};var g={handle:"position: absolute; display: none; overflow:hidden;",n:"top: 0pt; width:100%;",e:"right: 0pt; height:100%;",s:"bottom: 0pt; width:100%;",w:"left: 0pt; height:100%;",se:"bottom: 0pt; right: 0px;",sw:"bottom: 0pt; left: 0px;",ne:"top: 0pt; right: 0px;",nw:"top: 0pt; left: 0px;"};for(var V=0;V<Y.length;V++){var U=B.trim(Y[V]),b=Z.defaultTheme,h="ui-resizable-"+U,k=!B.ui.css(h)&&!Z.knobHandles,X=B.ui.css("ui-resizable-knob-handle"),A=B.extend(b[h],b["ui-resizable-handle"]),j=B.extend(Z.knobTheme[h],!X?Z.knobTheme["ui-resizable-handle"]:{});
var c=/sw|se|ne|nw/.test(U)?{zIndex:++Z.zIndex}:{};var e=(k?g[U]:""),i=B(['<div class="ui-resizable-handle ',h,'" style="',e,g.handle,'"></div>'].join("")).css(c);Z.handles[U]=".ui-resizable-"+U;this.element.append(i.css(k?A:{}).css(Z.knobHandles?j:{}).addClass(Z.knobHandles?"ui-resizable-knob-handle":"").addClass(Z.knobHandles))}if(Z.knobHandles){this.element.addClass("ui-resizable-knob").css(!B.ui.css("ui-resizable-knob")?{}:{})
}}this._renderAxis=function(F){F=F||this.element;for(var D in Z.handles){if(Z.handles[D].constructor==String){Z.handles[D]=B(Z.handles[D],this.element).show()}if(Z.transparent){Z.handles[D].css({opacity:0})}if(this.element.is(".ui-wrapper")&&Z._nodeName.match(/textarea|input|select|button/i)){var C=B(Z.handles[D],this.element),G=0;G=/sw|ne|nw|se|n|s/.test(D)?C.outerHeight():C.outerWidth();var E=["padding",/ne|nw|n/.test(D)?"Top":/se|sw|s/.test(D)?"Bottom":/^e$/.test(D)?"Right":"Left"].join("");
if(!Z.transparent){F.css(E,G)}this._proportionallyResize()}if(!B(Z.handles[D]).length){continue}}};this._renderAxis(this.element);Z._handles=B(".ui-resizable-handle",a.element);if(Z.disableSelection){Z._handles.each(function(D,C){B.ui.disableSelection(C)})}Z._handles.mouseover(function(){if(!Z.resizing){if(this.className){var C=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}a.axis=Z.axis=C&&C[1]?C[1]:"se"
}});if(Z.autoHide){Z._handles.hide();B(a.element).addClass("ui-resizable-autohide").hover(function(){B(this).removeClass("ui-resizable-autohide");Z._handles.show()},function(){if(!Z.resizing){B(this).addClass("ui-resizable-autohide");Z._handles.hide()}})}this.mouseInit()},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition}
},propagate:function(A,D){B.ui.plugin.call(this,A,[D,this.ui()]);if(A!="resize"){this.element.triggerHandler(["resize",A].join(""),[D,this.ui()],this.options[A])}},destroy:function(){var A=this.element,E=A.children(".ui-resizable").get(0);this.mouseDestroy();var F=function(C){B(C).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()
};F(A);if(A.is(".ui-wrapper")&&E){A.parent().append(B(E).css({position:A.css("position"),width:A.outerWidth(),height:A.outerHeight(),top:A.css("top"),left:A.css("left")})).end().remove();F(E)}},mouseStart:function(T){if(this.options.disabled){return false}var U=false;for(var W in this.options.handles){if(B(this.options.handles[W])[0]==T.target){U=true}}if(!U){return false}var O=this.options,P=this.element.position(),A=this.element,V=function(C){return parseInt(C,10)||0
},X=B.browser.msie&&B.browser.version<7;O.resizing=true;O.documentScroll={top:B(document).scrollTop(),left:B(document).scrollLeft()};if(A.is(".ui-draggable")||(/absolute/).test(A.css("position"))){var R=B.browser.msie&&!O.containment&&(/absolute/).test(A.css("position"))&&!(/relative/).test(A.parent().css("position"));var S=R?O.documentScroll.top:0,Y=R?O.documentScroll.left:0;A.css({position:"absolute",top:(P.top+S),left:(P.left+Y)})
}if(B.browser.opera&&/relative/.test(A.css("position"))){A.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var Q=V(this.helper.css("left")),Z=V(this.helper.css("top"));if(O.containment){Q+=B(O.containment).scrollLeft()||0;Z+=B(O.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:Q,top:Z};this.size=O.helper||X?{width:A.outerWidth(),height:A.outerHeight()}:{width:A.width(),height:A.height()};
this.originalSize=O.helper||X?{width:A.outerWidth(),height:A.outerHeight()}:{width:A.width(),height:A.height()};this.originalPosition={left:Q,top:Z};this.sizeDiff={width:A.outerWidth()-A.width(),height:A.outerHeight()-A.height()};this.originalMousePosition={left:T.pageX,top:T.pageY};O.aspectRatio=(typeof O.aspectRatio=="number")?O.aspectRatio:((this.originalSize.height/this.originalSize.width)||1);
if(O.preserveCursor){B("body").css("cursor",this.axis+"-resize")}this.propagate("start",T);return true},mouseDrag:function(V){var A=this.helper,O=this.options,U={},R=this,Y=this.originalMousePosition,T=this.axis;var Q=(V.pageX-Y.left)||0,S=(V.pageY-Y.top)||0;var Z=this._change[T];if(!Z){return false}var W=Z.apply(this,[V,Q,S]),X=B.browser.msie&&B.browser.version<7,P=this.sizeDiff;if(O._aspectRatio||V.shiftKey){W=this._updateRatio(W,V)
}W=this._respectSize(W,V);this.propagate("resize",V);A.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!O.helper&&O.proportionallyResize){this._proportionallyResize()}this._updateCache(W);this.element.triggerHandler("resize",[V,this.ui()],this.options.resize);return false},mouseStop:function(R){this.options.resizing=false;var V=this.options,S=function(C){return parseInt(C,10)||0
},P=this;if(V.helper){var A=V.proportionallyResize,N=A&&(/textarea/i).test(A.get(0).nodeName),M=N&&B.ui.hasScroll(A.get(0),"left")?0:P.sizeDiff.height,T=N?0:P.sizeDiff.width;var O={width:(P.size.width-T),height:(P.size.height-M)},U=(parseInt(P.element.css("left"),10)+(P.position.left-P.originalPosition.left))||null,Q=(parseInt(P.element.css("top"),10)+(P.position.top-P.originalPosition.top))||null;
if(!V.animate){this.element.css(B.extend(O,{top:Q,left:U}))}if(V.helper&&!V.animate){this._proportionallyResize()}}if(V.preserveCursor){B("body").css("cursor","auto")}this.propagate("stop",R);if(V.helper){this.helper.remove()}return false},_updateCache:function(D){var A=this.options;this.offset=this.helper.offset();if(D.left){this.position.left=D.left}if(D.top){this.position.top=D.top}if(D.height){this.size.height=D.height
}if(D.width){this.size.width=D.width}},_updateRatio:function(J,I){var H=this.options,A=this.position,K=this.size,L=this.axis;if(J.height){J.width=(K.height/H.aspectRatio)}else{if(J.width){J.height=(K.width*H.aspectRatio)}}if(L=="sw"){J.left=A.left+(K.width-J.width);J.top=null}if(L=="nw"){J.top=A.top+(K.height-J.height);J.left=A.left+(K.width-J.width)}return J},_respectSize:function(a,Z){var c=this.helper,d=this.options,U=d._aspectRatio||Z.shiftKey,V=this.axis,S=a.width&&d.maxWidth&&d.maxWidth<a.width,Y=a.height&&d.maxHeight&&d.maxHeight<a.height,A=a.width&&d.minWidth&&d.minWidth>a.width,T=a.height&&d.minHeight&&d.minHeight>a.height;
if(A){a.width=d.minWidth}if(T){a.height=d.minHeight}if(S){a.width=d.maxWidth}if(Y){a.height=d.maxHeight}var Q=this.originalPosition.left+this.originalSize.width,W=this.position.top+this.size.height;var b=/sw|nw|w/.test(V),R=/nw|ne|n/.test(V);if(A&&b){a.left=Q-d.minWidth}if(S&&b){a.left=Q-d.maxWidth}if(T&&R){a.top=W-d.minHeight}if(Y&&R){a.top=W-d.maxHeight}var X=!a.width&&!a.height;if(X&&!a.left&&a.top){a.top=null
}else{if(X&&!a.top&&a.left){a.left=null}}return a},_proportionallyResize:function(){var A=this.options;if(!A.proportionallyResize){return}var H=A.proportionallyResize,I=this.helper||this.element;if(!A.borderDif){var J=[H.css("borderTopWidth"),H.css("borderRightWidth"),H.css("borderBottomWidth"),H.css("borderLeftWidth")],G=[H.css("paddingTop"),H.css("paddingRight"),H.css("paddingBottom"),H.css("paddingLeft")];
A.borderDif=B.map(J,function(F,D){var E=parseInt(F,10)||0,C=parseInt(G[D],10)||0;return E+C})}H.css({height:(I.height()-A.borderDif[0]-A.borderDif[2])+"px",width:(I.width()-A.borderDif[1]-A.borderDif[3])+"px"})},_renderProxy:function(){var I=this.element,A=this.options;this.elementOffset=I.offset();if(A.helper){this.helper=this.helper||B('<div style="overflow:hidden;"></div>');var J=B.browser.msie&&B.browser.version<7,H=(J?1:0),G=(J?2:-1);
this.helper.addClass(A.helper).css({width:I.outerWidth()+G,height:I.outerHeight()+G,position:"absolute",left:this.elementOffset.left-H+"px",top:this.elementOffset.top-H+"px",zIndex:++A.zIndex});this.helper.appendTo("body");if(A.disableSelection){B.ui.disableSelection(this.helper.get(0))}}else{this.helper=I}},_change:{e:function(A,E,F){return{width:this.originalSize.width+E}},w:function(H,K,L){var A=this.options,J=this.originalSize,I=this.originalPosition;
return{left:I.left+K,width:J.width-K}},n:function(H,K,L){var A=this.options,J=this.originalSize,I=this.originalPosition;return{top:I.top+L,height:J.height-L}},s:function(A,E,F){return{height:this.originalSize.height+F}},se:function(A,E,F){return B.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[A,E,F]))},sw:function(A,E,F){return B.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[A,E,F]))
},ne:function(A,E,F){return B.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[A,E,F]))},nw:function(A,E,F){return B.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[A,E,F]))}}}));B.extend(B.ui.resizable,{defaults:{cancel:":input",distance:1,delay:0,preventDefault:true,transparent:false,minWidth:10,minHeight:10,aspectRatio:false,disableSelection:true,preserveCursor:true,autoHide:false,knobHandles:false}});
B.ui.plugin.add("resizable","containment",{start:function(T,R){var X=R.options,P=B(this).data("resizable"),V=P.element;var N=X.containment,W=(N instanceof B)?N.get(0):(/parent/.test(N))?V.parent().get(0):N;if(!W){return}P.containerElement=B(W);if(/document/.test(N)||N==document){P.containerOffset={left:0,top:0};P.containerPosition={left:0,top:0};P.parentData={element:B(document),left:0,top:0,width:B(document).width(),height:B(document).height()||document.body.parentNode.scrollHeight}
}else{P.containerOffset=B(W).offset();P.containerPosition=B(W).position();P.containerSize={height:B(W).innerHeight(),width:B(W).innerWidth()};var S=P.containerOffset,O=P.containerSize.height,U=P.containerSize.width,A=(B.ui.hasScroll(W,"left")?W.scrollWidth:U),Q=(B.ui.hasScroll(W)?W.scrollHeight:O);P.parentData={element:W,left:S.left,top:S.top,width:A,height:Q}}},resize:function(W,T){var Z=T.options,Q=B(this).data("resizable"),O=Q.containerSize,U=Q.containerOffset,X=Q.size,V=Q.position,S=Z._aspectRatio||W.shiftKey,P={top:0,left:0},A=Q.containerElement;
if(A[0]!=document&&/static/.test(A.css("position"))){P=Q.containerPosition}if(V.left<(Z.helper?U.left:P.left)){Q.size.width=Q.size.width+(Z.helper?(Q.position.left-U.left):(Q.position.left-P.left));if(S){Q.size.height=Q.size.width*Z.aspectRatio}Q.position.left=Z.helper?U.left:P.left}if(V.top<(Z.helper?U.top:0)){Q.size.height=Q.size.height+(Z.helper?(Q.position.top-U.top):Q.position.top);if(S){Q.size.width=Q.size.height/Z.aspectRatio
}Q.position.top=Z.helper?U.top:0}var Y=(Z.helper?Q.offset.left-U.left:(Q.position.left-P.left))+Q.sizeDiff.width,R=(Z.helper?Q.offset.top-U.top:Q.position.top)+Q.sizeDiff.height;if(Y+Q.size.width>=Q.parentData.width){Q.size.width=Q.parentData.width-Y;if(S){Q.size.height=Q.size.width*Z.aspectRatio}}if(R+Q.size.height>=Q.parentData.height){Q.size.height=Q.parentData.height-R;if(S){Q.size.width=Q.size.height/Z.aspectRatio
}}},stop:function(V,S){var N=S.options,Q=B(this).data("resizable"),U=Q.position,T=Q.containerOffset,O=Q.containerPosition,A=Q.containerElement;var X=B(Q.helper),P=X.offset(),R=X.innerWidth(),W=X.innerHeight();if(N.helper&&!N.animate&&/relative/.test(A.css("position"))){B(this).css({left:(P.left-T.left),top:(P.top-T.top),width:R,height:W})}if(N.helper&&!N.animate&&/static/.test(A.css("position"))){B(this).css({left:O.left+(P.left-T.left),top:O.top+(P.top-T.top),width:R,height:W})
}}});B.ui.plugin.add("resizable","grid",{resize:function(S,Q){var A=Q.options,O=B(this).data("resizable"),T=O.size,V=O.originalSize,U=O.originalPosition,P=O.axis,R=A._aspectRatio||S.shiftKey;A.grid=typeof A.grid=="number"?[A.grid,A.grid]:A.grid;var M=Math.round((T.width-V.width)/(A.grid[0]||1))*(A.grid[0]||1),N=Math.round((T.height-V.height)/(A.grid[1]||1))*(A.grid[1]||1);if(/^(se|s|e)$/.test(P)){O.size.width=V.width+M;
O.size.height=V.height+N}else{if(/^(ne)$/.test(P)){O.size.width=V.width+M;O.size.height=V.height+N;O.position.top=U.top-N}else{if(/^(sw)$/.test(P)){O.size.width=V.width+M;O.size.height=V.height+N;O.position.left=U.left-M}else{O.size.width=V.width+M;O.size.height=V.height+N;O.position.top=U.top-N;O.position.left=U.left-M}}}}});B.ui.plugin.add("resizable","animate",{stop:function(R,P){var U=P.options,O=B(this).data("resizable");
var V=U.proportionallyResize,N=V&&(/textarea/i).test(V.get(0).nodeName),M=N&&B.ui.hasScroll(V.get(0),"left")?0:O.sizeDiff.height,S=N?0:O.sizeDiff.width;var A={width:(O.size.width-S),height:(O.size.height-M)},T=(parseInt(O.element.css("left"),10)+(O.position.left-O.originalPosition.left))||null,Q=(parseInt(O.element.css("top"),10)+(O.position.top-O.originalPosition.top))||null;O.element.animate(B.extend(A,Q&&T?{top:Q,left:T}:{}),{duration:U.animateDuration||"slow",easing:U.animateEasing||"swing",step:function(){var C={width:parseInt(O.element.css("width"),10),height:parseInt(O.element.css("height"),10),top:parseInt(O.element.css("top"),10),left:parseInt(O.element.css("left"),10)};
if(V){V.css({width:C.width,height:C.height})}O._updateCache(C);O.propagate("animate",R)}})}});B.ui.plugin.add("resizable","ghost",{start:function(I,J){var H=J.options,L=B(this).data("resizable"),A=H.proportionallyResize,K=L.size;if(!A){L.ghost=L.element.clone()}else{L.ghost=A.clone()}L.ghost.css({opacity:0.25,display:"block",position:"relative",height:K.height,width:K.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof H.ghost=="string"?H.ghost:"");
L.ghost.appendTo(L.helper)},resize:function(H,I){var G=I.options,J=B(this).data("resizable"),A=G.proportionallyResize;if(J.ghost){J.ghost.css({position:"relative",height:J.size.height,width:J.size.width})}},stop:function(H,I){var G=I.options,J=B(this).data("resizable"),A=G.proportionallyResize;if(J.ghost&&J.helper){J.helper.get(0).removeChild(J.ghost.get(0))}}});B.ui.plugin.add("resizable","alsoResize",{start:function(G,I){var A=I.options,J=B(this).data("resizable"),H=function(C){B(C).each(function(){B(this).data("resizable-alsoresize",{width:parseInt(B(this).width(),10),height:parseInt(B(this).height(),10),left:parseInt(B(this).css("left"),10),top:parseInt(B(this).css("top"),10)})
})};if(typeof(A.alsoResize)=="object"){if(A.alsoResize.length){A.alsoResize=A.alsoResize[0];H(A.alsoResize)}else{B.each(A.alsoResize,function(D,C){H(D)})}}else{H(A.alsoResize)}},resize:function(L,M){var K=M.options,O=B(this).data("resizable"),N=O.originalSize,A=O.originalPosition;var J={height:(O.size.height-N.height)||0,width:(O.size.width-N.width)||0,top:(O.position.top-A.top)||0,left:(O.position.left-A.left)||0},P=function(D,C){B(D).each(function(){var F=B(this).data("resizable-alsoresize"),G={},E=C&&C.length?C:["width","height","top","left"];
B.each(E||["width","height","top","left"],function(R,H){var I=(F[H]||0)+(J[H]||0);if(I&&I>=0){G[H]=I||null}});B(this).css(G)})};if(typeof(K.alsoResize)=="object"){B.each(K.alsoResize,function(D,C){P(D,C)})}else{P(K.alsoResize)}},stop:function(A,D){B(this).removeData("resizable-alsoresize-start")}})})(jQuery);(function(C){C.fn.wheel=function(D){return this[D?"bind":"trigger"]("wheel",D)};var A=!C.browser.mozilla?"mousewheel":"DOMMouseScroll"+(C.browser.version<"1.9"?" mousemove":"");
function B(D){switch(D.type){case"mousemove":return C.extend(D.data,{clientX:D.clientX,clientY:D.clientY,pageX:D.pageX,pageY:D.pageY});case"DOMMouseScroll":C.extend(D,D.data);D.delta=-D.detail/3;break;case"mousewheel":D.delta=D.wheelDelta/120;if(C.browser.opera){D.delta*=1}break}D.type="wheel";return C.event.handle.call(this,D,D.delta)}C.event.special.wheel={setup:function(){C.event.add(this,A,B,{})
},teardown:function(){C.event.remove(this,A,B)}}})(jQuery);jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyInit:function(D){jQuery.historyCallback=D;var C=location.hash;jQuery.historyCurrentHash=C;if(jQuery.browser.msie){if(jQuery.historyCurrentHash==""){jQuery.historyCurrentHash="#"}$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var A=$("#jQuery_history")[0];
var B=A.contentWindow.document;B.open();B.close();B.location.hash=C}else{if($.browser.safari){jQuery.historyBackStack=[];jQuery.historyBackStack.length=history.length;jQuery.historyForwardStack=[];jQuery.isFirst=true}}jQuery.historyCallback(C.replace(/^#/,""));setInterval(jQuery.historyCheck,100)},historyAddHistory:function(A){jQuery.historyBackStack.push(A);jQuery.historyForwardStack.length=0;this.isFirst=true
},historyCheck:function(){if(jQuery.browser.msie){var A=$("#jQuery_history")[0];var D=A.contentDocument||A.contentWindow.document;var F=D.location.hash;if(F!=jQuery.historyCurrentHash){location.hash=F;jQuery.historyCurrentHash=F;jQuery.historyCallback(F.replace(/^#/,""))}}else{if($.browser.safari){if(!jQuery.dontCheck){var B=history.length-jQuery.historyBackStack.length;if(B){jQuery.isFirst=false;if(B<0){for(var C=0;
C<Math.abs(B);C++){jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop())}}else{for(var C=0;C<B;C++){jQuery.historyBackStack.push(jQuery.historyForwardStack.shift())}}var E=jQuery.historyBackStack[jQuery.historyBackStack.length-1];if(E!=undefined){jQuery.historyCurrentHash=location.hash;jQuery.historyCallback(E)}}else{if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(document.URL.indexOf("#")>=0){jQuery.historyCallback(document.URL.split("#")[1])
}else{var F=location.hash;jQuery.historyCallback("")}jQuery.isFirst=true}}}}else{var F=location.hash;if(F!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=F;jQuery.historyCallback(F.replace(/^#/,""))}}}},historyLoad:function(D){var E;if(jQuery.browser.safari){E=D}else{E="#"+D;location.hash=E}jQuery.historyCurrentHash=E;if(jQuery.browser.msie){var A=$("#jQuery_history")[0];var C=A.contentWindow.document;
C.open();C.close();C.location.hash=E;jQuery.historyCallback(D)}else{if(jQuery.browser.safari){jQuery.dontCheck=true;this.historyAddHistory(D);var B=function(){jQuery.dontCheck=false};window.setTimeout(B,200);jQuery.historyCallback(D);location.hash=E}else{jQuery.historyCallback(D)}}}});(function(){var B=window.jsonify=function(D,C){if(!(this instanceof B)){return(new B(D,C)).getJSON()}this.value=D;this.options=C||B.options;
return this};B.options={strict:false,pretty_print:false,spaces:true,indent:4};var A=A;B.prototype.getJSON=function(){var D,C=this.options;return(D=function D(F){return(((F!=A)&&F.toJSONString)||E)();function E(){switch(typeof F){case"number":return isFinite(F)?F+"":(C.strict?0:(isNaN(F)?"NaN":"Infinity"));case"boolean":return F.toString();case"string":return F.quote?F.quote():'"'+F.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(K){var J;
if((J="\b\t\n\f\t".indexOf(K))>=-1){return"\\"+"btnft".charAt(J)}return"\\u"+("0000"+charCodeAt(0).toString(16)).substr(-4)})+'"';case"object":if(!F){return"null"}var G;if((F.constructor==Array)&&(typeof F.length=="number")){G="[";for(var I=0;I<F.length;I++){G+=D(F[I])+","}if(G.length>1){G=G.substr(0,G.length-1)}return G+"]"}G="{";for(var H in F){if(!C.strict&&H.match(/^[a-z_$][a-z_$0-9]*$/gi)){G+=H+":"+D(F[H])+","
}else{G+=D(H)+":"+D(F[H])+","}}if(G.length>1){G=G.substr(0,G.length-1)}return G+"}";default:return C.strict?"null":"undefined"}}})(this.value||"")}})();var undefined=undefined;(function($){$.extend({implement:function($interface,$implementation){return $.extend({},$interface,$implementation)},chess:{lastid:0,widget:{},instance:{},skin:"default",topmost:99,activeControl:{},initialize:function(){var preloader=$("<div/>").css({position:"absolute",left:"-5000px",top:"-5000px",width:"1px",height:"1px"}).appendTo($("body"));
$.each(this.skins,function(){if(this.preloadImages){$.each(this.preloadImages,function(){preloader.append('<img src="'+this+'" />')})}})},activate:function(obj){if(this.activeControl!=obj){var o=this.activeControl;this.activeControl=obj;if(o.deactivate){o.deactivate(obj)}if($(obj).attr("widgetClass")!="window"){try{$(obj.element).parents('[widgetclass="window"]')[0]._ui.bringToFront()}catch(e){}}}},disableSelection:function(elem){$.ui.disableSelection(elem);
return elem},enableSelection:function(elem){$.ui.enableSelection(elem);return elem},transPNG:function(file,w,h,repeat){var ie6=$.browser.msie&&parseInt($.browser.version)<7,size="width:"+w+"px;height:"+h+"px";if(ie6){repeat=repeat=="repeat"?"scale":"crop";if(file.substr(0,1)!="/"){file=$("base").attr("href")+file}}return $('<div style="position:absolute;'+size+'"/>').append($('<div style="'+size+'"/>').css({background:ie6?"none":"url("+file+") "+(repeat||"no-repeat"),filter:ie6?'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+file+'",sizingMethod="'+repeat+'");':"none"}))
},class2JSON:function(element){var className=$(element).attr("class"),start,end;if((start=className.indexOf("{"))>=0&&(end=className.lastIndexOf("}"))>=0){var json;eval("json="+className.substring(start,end+1));return json||{}}return{}},timestamp:function(){var d=new Date();var ms=typeof d.getUTCMilliseconds=="function"?d.getUTCMilliseconds():d.getMilliseconds();return(d.getTime()-ms)/1000},animtimer:0,animstate:0,showAnimation:function(){$("#chess-overlay .loading").find("div div").each(function(i){$(this).css("opacity",(i+1)*0.2)
}).end().css({left:($("#chess-overlay").width()-328)/2,top:200}).fadeIn("slow");$.chess.animstate=0;$.chess.animtimer=setInterval(function(){$.chess.animstate++;$("#chess-overlay .loading div div").each(function(index){$.chess.animationFrame(this,$.chess.animstate,index)})},200)},animationFrame:function(element,animstate,index){var state=animstate%5,opacity=(index+((index<=state-1)?6-state:(state?-!!(state-1):1)))*0.2;
$(element).stop().fadeTo("fast",opacity)},hideAnimation:function(){$("#chess-overlay .loading").hide();clearInterval($.chess.animtimer)},showOverlay:function(){$("#chess-overlay").show()},hideOverlay:function(){if(App.windows.AlertBox&&App.windows.AlertBox.is(":visible")){return}$("#chess-overlay").hide();$.chess.hideAnimation()},registerWidget:function(widget,data,shortcut){this.widget[widget.name]=$.extend({},{$interface:widget.$interface,baseHTML:"<div/>",target:"#page",method:"appendTo",visible:false},data);
if(shortcut){this[widget.name]=function(options,id){return this.create(widget.name,options,id)}}},create:function(type,opts,id){var widgetClass;var options=opts||{};if(!(widgetClass=this.widget[type])){return false}if(!id&&(!(options&&(id=options.name)))){id="__"+(this.lastid++)}var object=$(widgetClass.baseHTML)[widgetClass.visible?"show":"hide"]()[widgetClass.method]($(options.parent||widgetClass.target))[type](options).attr("instanceid",id).attr("widgetClass",type);
if(widgetClass.$interface){$.each(widgetClass.$interface,function(func,val){object[func]=function(options){return $(this)[$(this).attr("widgetClass")].apply(this,[func,options])}})}this.instance[id]=object;return object},destroy:function(object){try{if(!object.jquery){object=$("[instanceid="+object+"]")[0]._ui}object[object.attr("widgetClass")]("destroy")}catch(e){}},get:function(id){return this.instance[id]||(this.instance[$(id).attr("instanceid")]||false)
},createBackgroundElements:function(){return $('<div class="chess-control-background" />').append('<div class="tl"><div/></div><div class="tr"><div/></div>').append('<div class="bl"><div/></div><div class="br"><div/></div>').append('<div class="ls"><div/></div><div class="rs"><div/></div>').append('<div class="ts"><div/></div><div class="bs"><div/></div>').append('<div class="c"/>')},switchSkin:function(skinName){$("body").removeClass(this.skin);
this.skin=skinName;$("body").addClass(this.skin);for(var id in this.instance){try{this.instance[id].onSkinChange()}catch(e){}}},getSkinMetrics:function(widget,data){try{return this.skins[this.skin][widget][data]}catch(e){}return false},registerSkin:function(name,data){var skin={};skin[name]=data;$.extend(this.skins,skin)},skins:{"default":{preloadImages:["img/default/shared-center-h.png","img/default/shared-center-d.png","img/default/glow-corners.png","img/default/glow-horisontal.png","img/default/glow-vertical.png","img/default/gamelist-hover.png","img/default/animbg.png","img/default/animfg.png","img/default/overlay-tile.png"],window:{offset:{left:12,top:12,right:12,bottom:12},captionHeight:28,small_offset:{left:12,top:12,right:12,bottom:8},small_captionHeight:18},frame:{offset:{left:4,top:4,right:4,bottom:4}},tab:{offset:{left:4,top:0,right:4,bottom:4},buttonSize:{width:170,height:21}},button:{contentSize:{width:-6,height:-6},offsetNormal:{left:8,top:8,right:8,bottom:8},offsetHover:{left:8,top:8,right:8,bottom:8},offsetDown:{left:9,top:9,right:7,bottom:7}},editbox:{inputSize:{width:-8,height:-8},offsetNormal:{left:8,top:8,right:8,bottom:8},offsetHover:{left:8,top:8,right:8,bottom:8},offsetFocus:{left:8,top:8,right:8,bottom:8}},textarea:{inputSize:{width:-8,height:-8},offsetNormal:{left:8,top:8,right:8,bottom:8},offsetHover:{left:8,top:8,right:8,bottom:8},offsetFocus:{left:8,top:8,right:8,bottom:8}},glow:{offset:{left:11,right:11,top:13,bottom:13}},label:{color:"#e7c200",fontSize:"12px",lineHeight:"12px"},checkbox:{size:{width:21,height:18},spacing:3},optionbutton:{size:{width:18,height:18},spacing:6},vscroll:{width:12,thumbOffset:{top:5,bottom:5},thumbCorners:{top:3,bottom:3},offset:{top:6,bottom:6},minThumbSize:14},textbox:{distance:8,color:"#fff",fontSize:"12px",lineHeight:"17px",padding:"2px"},list:{contentSize:{width:-10,height:-10},offset:{left:8,top:8,right:8,bottom:8},selectedPadding:{vertical:1,horisontal:0},selectedOffset:{left:4,top:4,right:4,bottom:4},selectedSpacing:3},selectbox:{offset:{left:8,top:8,right:8,bottom:8},contentOffset:{left:5,top:4,right:23,bottom:4},listOffset:{left:2,top:1}},buttonmenu:{offset:{left:8,top:8,right:8,bottom:8}}}}},sharedInterface:{setPosition:function(newpos){if((typeof newpos.left!="number")&&(typeof newpos.top!="number")){return
}var pos=this.getPosition();if(typeof newpos.top=="number"){pos.top=newpos.top}if(typeof newpos.left=="number"){pos.left=newpos.left}this.$.css({left:pos.left,top:pos.top})},getPosition:function(){return{left:parseInt(this.$.css("left")),top:parseInt(this.$.css("top"))}},setSize:function(newsize){if((typeof newsize.width!="number")&&(typeof newsize.height!="number")){return}var size=this.getSize();
if(typeof newsize.width=="number"){size.width=newsize.width}if(typeof newsize.height=="number"){size.height=newsize.height}this.$.css({width:size.width,height:size.height});this.options.width=size.width;this.options.height=size.height;this.update({newsize:size})},getSize:function(){return{width:this.options.width,height:this.options.height}},enable:function(){if(this.options.enabled){return}this.options.enabled=true;
this.$.find(">div:eq(0)").andSelf().removeClass("chess-disabled")},disable:function(overrideCheck){if(!overrideCheck&&!this.options.enabled){return}this.options.enabled=false;this.$.find(">div:eq(0)").andSelf().addClass("chess-disabled")}}});if($.browser.msie){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}window.Global=window;Global.$get=function(id){return $.chess.get(id)};
$(function(){$(document).mousedown(function(){$.chess.activate({})})})})(jQuery);(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},setClientSize:function(){},getClientSize:function(){},bringToFront:function(){},addWidget:function(){},setCaption:function(){},getCaption:function(){},appear:function(){},disappear:function(){},show:function(){},hide:function(){},onSkinChange:function(){}};
B.chess.registerWidget({name:"window",$interface:A},{visible:true},true);B.widget("ui.window",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])},setClientSize:function(D){if((typeof D.width!="number")&&(typeof D.height!="number")){return
}var C=this.getClientSize();if(typeof D.width=="number"){C.width=D.width}if(typeof D.height=="number"){C.height=D.height}C.width+=this.$$.offset.left+this.$$.offset.right;C.height+=this.$$.offset.top+this.$$.offset.bottom;if(this.options.showCaption){C.height+=this.$$.captionHeight}this.$.css({width:C.width,height:C.height});this.update({newsize:C})},getClientSize:function(){var C={width:this.$.width()-this.$$.offset.left-this.$$.offset.right,height:this.$.height()-this.$$.offset.top-this.$$.offset.bottom};
if(this.options.showCaption){C.height-=this.$$.captionHeight}return C},bringToFront:function(){var C=this.$.css("z-index");if((C!=B.chess.topmost)&&(C<100001)){this.$.css("z-index",++B.chess.topmost)}},addWidget:function(D,C){this.$$.controls[D.attr("instanceid")]=D.appendTo(this.$.find(">.chess-window-content"));if(C!=false){D.show()}try{if(D[0]._ui&&D[0]._ui.options.register){this.$[0][D.attr("instanceid")]=D;
D[0].parent=this.$[0]}}catch(E){}},setCaption:function(C){this.$.find(">.chess-window-caption").html(C);if(!this.options.showCaption){this.options.showCaption=true;this.$.find(">.chess-window-caption").show()}},getCaption:function(){return this.$.find(">.chess-window-caption").html()},appear:function(D,E){if(B.isFunction(D)){E=D;D=null}var C=this;this.$.animate({height:"show",opacity:"show"},D,function(){if(B.isFunction(E)){E.call(this)
}C.updateControls()})},disappear:function(C,D){this.$.animate({height:"hide",opacity:"hide"},C,D)},show:function(){this.$.show.apply(this.$,arguments);this.$.triggerHandler("window-show",[],this.options.onshow);this.updateControls()},hide:function(){this.$.hide.apply(this.$,arguments);this.$.triggerHandler("window-hide",[],this.options.onhide)},onSkinChange:function(){this.$$.offset=B.chess.getSkinMetrics("window",(this.$$.small?"small_":"")+"offset");
this.$$.captionHeight=B.chess.getSkinMetrics("window",(this.$$.small?"small_":"")+"captionHeight");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};this.$$.controls={};var C=this.$[0]._ui=this;var E=this.options;this.$$.small=E.small;this.$$.offset=B.chess.getSkinMetrics("window",(E.small?"small_":"")+"offset");this.$$.captionHeight=B.chess.getSkinMetrics("window",(E.small?"small_":"")+"captionHeight");
this.$.addClass("chess-control chess-window").css({left:E.left,right:E.right,top:E.top,width:E.width,height:E.height}).append(B.chess.createBackgroundElements()).append('<div class="chess-window-content" />').append('<div class="chess-window-caption"/>').find(".chess-window-caption,.chess-window-content").mousedown(function(){B.chess.activate(this);C.bringToFront()});B.chess.disableSelection(this.$.find(".chess-window-caption"));
if(E.small){C.$.addClass("chess-window-small");if(E.flip){C.$.addClass("chess-window-flipv")}}if(!E.showCaption){this.$.find(".chess-window-caption").hide()}else{if(E.caption.length){this.$.find(".chess-window-caption").html(E.caption)}}if(E.draggable){this.$.draggable(B.extend(E.draggableOptions,{handle:">.chess-window-caption",scroll:false,start:function(){B.chess.get(this).bringToFront()},drag:function(J,H){var F=H.helper.width(),I,G;
if(H.position.left<0){H.position.left=0}else{if(H.position.left+F>(G=B("#page").width())){H.position.left=G-F}}if(H.position.top<0){H.position.top=0}else{if(H.position.top>(I=B("#footer").offset().top-B("#footer").height()-C.$$.captionHeight*2)){H.position.top=I}}}}))}if(E.resizable){var D={n:this.$.find(".chess-control-background .ts").css("cursor","n-resize").find("div").addClass("ui-resizable-handle ui-resizable-n")[0],s:this.$.find(".chess-control-background .bs").css("cursor","s-resize").find("div").addClass("ui-resizable-handle ui-resizable-s")[0],w:this.$.find(".chess-control-background .ls").css("cursor","w-resize").find("div").addClass("ui-resizable-handle ui-resizable-w")[0],e:this.$.find(".chess-control-background .rs").css("cursor","e-resize").find("div").addClass("ui-resizable-handle ui-resizable-e")[0],nw:this.$.find(".chess-control-background .tl").css("cursor","nw-resize").find("div").addClass("ui-resizable-handle ui-resizable-nw")[0],ne:this.$.find(".chess-control-background .tr").css("cursor","ne-resize").find("div").addClass("ui-resizable-handle ui-resizable-ne")[0],sw:this.$.find(".chess-control-background .bl").css("cursor","sw-resize").find("div").addClass("ui-resizable-handle ui-resizable-sw")[0],se:this.$.find(".chess-control-background .br").css("cursor","se-resize").find("div").addClass("ui-resizable-handle ui-resizable-se")[0]};
B.each(E.disableHandle.split(","),function(){B(D[this]).css("cursor","default");delete D[this]});this.$.resizable(B.extend(E.resizableOptions,{handles:D,helper:"chess-window-resize-handle",start:function(){B.chess.get(this).bringToFront()},stop:function(G,F){F.element.window("update",{newsize:F.size,element:F.element})},resize:function(I,H){if(!C.$$.small){var J=B("#page").position(),F=B("#page").width();
if(H.position.left<=J.left){H.size.width+=H.position.left-J.left;H.position.left=J.left}else{if(H.position.left+H.size.width>=F+J.left){H.size.width=F-H.position.left+J.left}}if(H.position.top<0){H.size.height+=H.position.top;H.position.top=0}}else{var G=B("#header").height()+4;if(H.position.top<G){H.size.height=B(window).height()-G-B("#footer").height()-4;H.position.top=G}}}}))}if(this.options.widgets){B.each(this.options.widgets,function(){C.addWidget(this)
})}this.update();if(B.browser.msie&&B.browser.version<7){B(this.element).hide().show()}if(E.ontop){C.$.css("z-index",100001)}this.$.triggerHandler("window-init",[this],this.options.init)},update:function(E){var H=E||{};var F=H.newsize||this.getSize();if(F.width<=0||F.height<=0){return}var J=H.offset||this.$$.offset;var I=F.width-J.left-J.right;var C=F.height-J.top-J.bottom;var D=0;if(this.options.showCaption){C-=(D=this.$$.captionHeight)
}(H.element||this.$).find(">.chess-control-background .ts,>.chess-control-background .bs,>.chess-control-background .c,>.chess-window-content,>.chess-window-caption").width(I).end().find(">.chess-control-background .ls,>.chess-control-background .rs,>.chess-control-background .c").height(F.height-J.top-J.bottom).end().find(">.chess-window-content").height(C).css("top",J.top+D);var G={width:I,height:C};
this.$.triggerHandler("window-resize",[{window:F,client:G}],this.options.resize)},updateControls:function(){B.each(this.$$.controls,function(){this.setSize(this.getSize())})}}));B.ui.window.getter="getPosition getSize getClientSize getCaption";B.ui.window.defaults={width:200,height:250,small:false,flip:false,ontop:false,caption:"",showCaption:true,draggable:false,draggableOptions:{},resizable:false,resizableOptions:{},disableHandle:"",init:function(){},resize:function(){}}
})(jQuery);(function(A){var B={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},setClientSize:function(){},getClientSize:function(){},addWidget:function(){},enable:function(){},disable:function(){},onSkinChange:function(){}};A.chess.registerWidget({name:"frame",$interface:B},{},true);A.widget("ui.frame",A.implement(B,{$:null,$$:{},setPosition:function(C){A.sharedInterface.setPosition.apply(this,[C])
},getPosition:function(){return A.sharedInterface.getPosition.apply(this,[])},setSize:function(C){A.sharedInterface.setSize.apply(this,[C])},getSize:function(){return A.sharedInterface.getSize.apply(this,[])},setClientSize:function(D){if((typeof D.width!="number")&&(typeof D.height!="number")){return}var C=this.getClientSize();if(typeof D.width=="number"){C.width=D.width}if(typeof D.height=="number"){C.height=D.height
}C.width+=this.$$.offset.left+this.$$.offset.right;C.height+=this.$$.offset.top+this.$$.offset.bottom;this.$.css(C);this.update({newsize:C})},getClientSize:function(){return{width:this.$.width()-this.$$.offset.left-this.$$.offset.right,height:this.$.height()-this.$$.offset.top-this.$$.offset.bottom}},addWidget:function(D,C){this.$$.controls[D.attr("instanceid")]=D.appendTo(this.$.find(">.chess-frame-content"));
if((C!=false)){D.show()}try{if(C!=false&&!D[0]._ui.options.visible){D.hide()}if(D[0]._ui.options.register==true){this.$[0][D.attr("instanceid")]=D;D[0].parent=this.$[0]}}catch(E){}},enable:function(){A.sharedInterface.enable.apply(this,[]);A.each(this.$$.controls,function(){this.enable()})},disable:function(){A.sharedInterface.disable.apply(this,[]);A.each(this.$$.controls,function(){this.disable()
})},onSkinChange:function(){this.$$.offset=A.chess.getSkinMetrics("frame","offset");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};this.$$.controls={};var C=this.$._ui=this;var D=this.options;this.$$.offset=A.chess.getSkinMetrics("frame","offset");this.$.addClass("chess-control chess-frame").css({left:D.left,top:D.top,width:D.width,height:D.height}).append(A.chess.createBackgroundElements()).append('<div class="chess-frame-content" />').find(".c").remove();
if(this.options.widgets){A.each(this.options.widgets,function(){C.addWidget(this)})}this.update();this.$.triggerHandler("frame-init",[this],this.options.init)},update:function(D){var G=D||{};var E=G.newsize||this.getSize();if(E.width<=0||E.height<=0){return}var I=G.offset||this.$$.offset;var H=E.width-I.left-I.right;var C=E.height-I.top-I.bottom;(G.element||this.$).find(">.chess-control-background .ts,>.chess-control-background .bs,>.chess-frame-content").width(H).end().find(">.chess-control-background .ls,>.chess-control-background .rs,>.chess-frame-content").height(C).end();
var F={width:H,height:C};this.$.triggerHandler("frame-resize",[{frame:E,client:F}],this.options.resize)}}));A.ui.frame.getter="getPosition getSize getClientSize";A.ui.frame.defaults={left:0,top:0,width:200,height:250,visible:true,resize:function(){},init:function(){}}})(jQuery);(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},setCaption:function(){},getCaption:function(){},enable:function(){},disable:function(){},onSkinChange:function(){}};
B.chess.registerWidget({name:"button",$interface:A},{},true);B.widget("ui.button",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])},setCaption:function(C){this.$.find(">.chess-button-content").html(C)
},getCaption:function(){return this.$.find(">.chess-button-content").html()},enable:function(){B.sharedInterface.enable.apply(this,[])},disable:function(C){B.sharedInterface.disable.apply(this,[C])},onSkinChange:function(){this.$$.offsetNormal=B.chess.getSkinMetrics("button","offsetNormal");this.$$.offsetHover=B.chess.getSkinMetrics("button","offsetHover");this.$$.offsetDown=B.chess.getSkinMetrics("button","offsetDown");
this.$$.contentSize=B.chess.getSkinMetrics("button","contentSize");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$[0]._ui=this;var D=this.options;this.$$.offsetNormal=B.chess.getSkinMetrics("button","offsetNormal");this.$$.offsetHover=B.chess.getSkinMetrics("button","offsetHover");this.$$.offsetDown=B.chess.getSkinMetrics("button","offsetDown");this.$$.contentSize=B.chess.getSkinMetrics("button","contentSize");
this.$$.state="Normal";this.$.addClass("chess-control chess-button").css({left:D.left,right:D.right,top:D.top,bottom:D.bottom,width:D.width,height:D.height}).append(B.chess.createBackgroundElements()).append('<div class="chess-button-content" />').append('<div class="chess-mousetrap"/>').hover(function(){if(!C.options.enabled){return}B(this).addClass("chess-button-hover");C.$$.state="Hover";C.update();
C.$.triggerHandler("button-mouseenter",[{element:this}],C.options.mouseenter)},function(){C.$$.state="Normal";B(this).removeClass("chess-button-hover chess-button-down");C.update();C.$.triggerHandler("button-mouseleave",[{element:this}],C.options.mouseleave)}).mousedown(function(E){if(!C.options.enabled){return}C.$$.state="Down";B(this).addClass("chess-button-down");C.update();E.stopPropagation();B.chess.activate(C);
C.$.triggerHandler("button-mousedown",[E,{element:this}],C.options.mousedown)}).mouseup(function(E){if(!C.options.enabled){return}if(B(this).is(".chess-button-down")){C.$$.state="Hover";B(this).removeClass("chess-button-down");C.update();C.$.triggerHandler("button-mouseup",[E,{element:this}],C.options.mouseup)}}).click(function(E){if(!C.options.enabled){return}C.$.triggerHandler("button-click",[E,{element:this}],C.options.click)
});B.chess.disableSelection(this.$.find(".chess-button-content"));if(D.caption.length){this.$.find(".chess-button-content").css("font-size",D.fontSize).html(D.caption)}if(!D.enabled){this.disable(true)}this.update()},update:function(D){var F=D||{};var E=F.newsize||this.getSize();if(E.width<=0||E.height<=0){return}var H=F.offset||this.$$["offset"+this.$$.state];var G=E.width-H.left-H.right;var C=E.height-H.top-H.bottom;
(F.element||this.$).find(">.chess-control-background .ts,>.chess-control-background .bs,>.chess-control-background .c").width(G).end().find(">.chess-control-background .ls,>.chess-control-background .rs,>.chess-control-background .c").height(C).end().find(">.chess-button-content").width(E.width+this.$$.contentSize.width).height(E.height+this.$$.contentSize.height).css("line-height",(E.height+this.$$.contentSize.height)+"px");
this.$.triggerHandler("button-resize",[{size:E}],this.options.resize)}}));B.ui.button.getter="getPosition getSize getCaption";B.ui.button.defaults={width:84,height:24,caption:"",enabled:true,visible:true,fontSize:"12px",resize:function(){},click:function(){},mouseenter:function(){},mouseleave:function(){}}})(jQuery);(function(A){Global.IEditbox={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},setText:function(){},getText:function(){},enable:function(){},disable:function(){},deactivate:function(){},onSkinChange:function(){}};
A.chess.registerWidget({name:"editbox",$interface:IEditbox},{},true);A.widget("ui.editbox",A.implement(IEditbox,{$:null,$$:{},setPosition:function(B){A.sharedInterface.setPosition.apply(this,[B])},getPosition:function(){return A.sharedInterface.getPosition.apply(this,[])},setSize:function(B){A.sharedInterface.setSize.apply(this,[B])},getSize:function(){return A.sharedInterface.getSize.apply(this,[])
},enable:function(){this.$.find("input").css("opacity",1).removeAttr("disabled");A.sharedInterface.enable.apply(this,[])},disable:function(){this.$.find("input").css("opacity",0.5).attr("disabled","disabled");A.sharedInterface.disable.apply(this,[])},setText:function(B){this.$.find(">input").val(B)},getText:function(){return this.$.find(">input").val()},deactivate:function(){this.$.find(">input").blur();
this.$.triggerHandler("editbox-blur",[this],this.options.blur)},onSkinChange:function(){this.$$.offsetNormal=A.chess.getSkinMetrics("editbox","offsetNormal");this.$$.offsetHover=A.chess.getSkinMetrics("editbox","offsetHover");this.$$.offsetFocus=A.chess.getSkinMetrics("editbox","offsetFocus");this.$$.inputSize=A.chess.getSkinMetrics("editbox","inputSize");this.update()},init:function(){this.$=this.element;
this.$$=this.element[0]._$$={};var B=this.$[0]._ui=this;var C=this.options;this.$$.offsetNormal=A.chess.getSkinMetrics("editbox","offsetNormal");this.$$.offsetHover=A.chess.getSkinMetrics("editbox","offsetHover");this.$$.offsetFocus=A.chess.getSkinMetrics("editbox","offsetFocus");this.$$.inputSize=A.chess.getSkinMetrics("editbox","inputSize");this.$$.state="Normal";this.$.addClass("chess-control chess-editbox").css({left:C.left,right:C.right,top:C.top,bottom:C.bottom,width:C.width,height:C.height}).append(A.chess.createBackgroundElements()).append('<input type="'+C.type+'" value="'+C.text+'" />').hover(function(){if(!B.options.enabled){return
}A(this).addClass("chess-editbox-hover");B.$$.state="Hover";B.update();B.$.triggerHandler("editbox-mouseenter",[{element:B}],B.options.mouseenter)},function(){if(!B.options.enabled){return}B.$$.state="Normal";A(this).removeClass("chess-editbox-hover");B.update();B.$.triggerHandler("editbox-mouseleave",[{element:B}],B.options.mouseleave)}).mouseup(function(){B.$.find("input").focus()}).find("input").focus(function(D){A.chess.activate(B);
B.$.addClass("chess-editbox-focus");B.$$.state="Focus";B.update();return B.$.triggerHandler("editbox-focus",[D,{element:B}],B.options.focus)}).blur(function(D){B.$.removeClass("chess-editbox-focus");B.$$.state=B.$.is(".chess-editbox-hover")?"Hover":"Normal";B.update();if(B==A.chess.activeControl){return B.$.triggerHandler("editbox-blur",[B],B.options.blur)}}).mousedown(function(D){return B.$.triggerHandler("editbox-mousedown",[D,{element:B}],B.options.mousedown)
}).mouseup(function(D){return B.$.triggerHandler("editbox-mouseup",[D,{element:B}],B.options.mouseup)}).keyup(function(D){return B.$.triggerHandler("editbox-keyup",[D,{element:B}],B.options.keyup)}).keydown(function(D){return B.$.triggerHandler("editbox-keydown",[D,{element:B}],B.options.keydown)}).keypress(function(D){return B.$.triggerHandler("editbox-keypress",[D,{element:B}],B.options.keypress)
}).change(function(D){return B.$.triggerHandler("editbox-change",[D,{element:B}],B.options.change)}).click(function(D){return B.$.triggerHandler("editbox-click",[D,{element:B}],B.options.click)}).css({color:C.color});if(C.maxlength>0){this.$.attr("maxlength",C.maxlength)}if(C.type=="password"){this.$.addClass("chess-editbox-password")}this.update()},update:function(D){var F=D||{};var E=F.newsize||this.getSize();
if(E.width<=0||E.height<=0){return}var H=F.offset||this.$$["offset"+this.$$.state];var G=E.width-H.left-H.right;var B=E.height-H.top-H.bottom;var C=this.$.is(".chess-editbox-password");(F.element||this.$).find(">.chess-control-background .ts,>.chess-control-background .bs,>.chess-control-background .c,>.chess-frame-content").width(G).end().find(">.chess-control-background .ls,>.chess-control-background .rs,>.chess-control-background .c,>.chess-frame-content").height(B).end().find(">input").width(E.width+this.$$.inputSize.width).height(E.height+this.$$.inputSize.height+2*C).css({"line-height":(E.height+this.$$.inputSize.height)+"px","margin-top":C?-1:0});
this.$.triggerHandler("editbox-resize",[E],this.options.resize)}}));A.ui.editbox.getter="getPosition getSize getText";A.ui.editbox.defaults={width:84,height:24,type:"text",text:"",visible:true,color:"#e7c200",maxlength:-1,resize:function(){},click:function(){},focus:function(){},blur:function(){},keyup:function(){},keydown:function(){},keypress:function(){},mouseenter:function(){},mouseleave:function(){}}
})(jQuery);(function(A){A.chess.registerWidget({name:"textarea",$interface:IEditbox},{},true);A.widget("ui.textarea",A.implement(IEditbox,{$:null,$$:{},setPosition:function(B){A.sharedInterface.setPosition.apply(this,[B])},getPosition:function(){return A.sharedInterface.getPosition.apply(this,[])},setSize:function(B){A.sharedInterface.setSize.apply(this,[B])},getSize:function(){return A.sharedInterface.getSize.apply(this,[])
},setText:function(B){this.$.find(">textarea").val(B)},getText:function(){return this.$.find(">textarea").val()},deactivate:function(){this.$.find(">textarea").blur()},onSkinChange:function(){this.$$.offsetNormal=A.chess.getSkinMetrics("textarea","offsetNormal");this.$$.offsetHover=A.chess.getSkinMetrics("textarea","offsetHover");this.$$.offsetFocus=A.chess.getSkinMetrics("textarea","offsetFocus");
this.$$.inputSize=A.chess.getSkinMetrics("textarea","inputSize");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var B=this.$[0]._ui=this;var C=this.options;this.$$.offsetNormal=A.chess.getSkinMetrics("textarea","offsetNormal");this.$$.offsetHover=A.chess.getSkinMetrics("textarea","offsetHover");this.$$.offsetFocus=A.chess.getSkinMetrics("textarea","offsetFocus");this.$$.inputSize=A.chess.getSkinMetrics("textarea","inputSize");
this.$$.state="Normal";this.$.addClass("chess-control chess-textarea").css({left:C.left,top:C.top,width:C.width,height:C.height}).append(A.chess.createBackgroundElements()).append("<textarea>"+C.text+"</textarea>").hover(function(){A(this).addClass("chess-textarea-hover");B.$$.state="Hover";B.update();B.$.triggerHandler("textarea-mouseenter",[{element:B}],B.options.mouseenter)},function(){B.$$.state="Normal";
A(this).removeClass("chess-textarea-hover");B.update();B.$.triggerHandler("textarea-mouseleave",[{element:B}],B.options.mouseleave)}).mouseup(function(){B.$.find("textarea").focus()}).find("textarea").focus(function(D){A.chess.activate(B);B.$.addClass("chess-textarea-focus");B.$$.state="Focus";B.update();return B.$.triggerHandler("textarea-focus",[D,{element:B}],B.options.focus)}).blur(function(D){B.$.removeClass("chess-textarea-focus");
B.$$.state=B.$.is(".chess-textarea-hover")?"Hover":"Normal";B.update();return B.$.triggerHandler("textarea-blur",[B],B.options.blur)}).mousedown(function(D){return B.$.triggerHandler("textarea-mousedown",[D,{element:B}],B.options.mousedown)}).mouseup(function(D){return B.$.triggerHandler("textarea-mouseup",[D,{element:B}],B.options.mouseup)}).keyup(function(D){return B.$.triggerHandler("textarea-keyup",[D,{element:B}],B.options.keyup)
}).keydown(function(D){return B.$.triggerHandler("textarea-keydown",[D,{element:B}],B.options.keydown)}).keypress(function(D){return B.$.triggerHandler("textarea-keypress",[D,{element:B}],B.options.keypress)}).change(function(D){return B.$.triggerHandler("textarea-change",[D,{element:B}],B.options.change)}).click(function(D){return B.$.triggerHandler("textarea-click",[D,{element:B}],B.options.click)
});this.update()},update:function(C){var E=C||{};var D=E.newsize||this.getSize();if(D.width<=0||D.height<=0){return}var G=E.offset||this.$$["offset"+this.$$.state];var F=D.width-G.left-G.right;var B=D.height-G.top-G.bottom;(E.element||this.$).find(">.chess-control-background .ts,>.chess-control-background .bs,>.chess-control-background .c,>.chess-frame-content").width(F).end().find(">.chess-control-background .ls,>.chess-control-background .rs,>.chess-control-background .c,>.chess-frame-content").height(B).end().find(">textarea").width(D.width+this.$$.inputSize.width).height(D.height+this.$$.inputSize.height);
this.$.triggerHandler("textarea-resize",[{size:D}],this.options.resize)}}));A.ui.textarea.getter="getPosition getSize getText";A.ui.textarea.defaults={left:0,top:0,width:84,height:24,text:"",visible:true,resize:function(){},click:function(){},focus:function(){},blur:function(){},keyup:function(){},keydown:function(){},keypress:function(){},mouseenter:function(){},mouseleave:function(){}}})(jQuery);
(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},onSkinChange:function(){}};B.chess.registerWidget({name:"glow",$interface:A},{},true);B.widget("ui.glow",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])
},getSize:function(){return B.sharedInterface.getSize.apply(this,[])},onSkinChange:function(){this.$$.offset=B.chess.getSkinMetrics("glow","offset");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$[0]._ui=this;var D=this.options;this.$$.offset=B.chess.getSkinMetrics("glow","offset");this.$.addClass("chess-control chess-glow").css({left:D.left,top:D.top,width:D.width,height:this.$$.height}).append(B.chess.createBackgroundElements()).find(".c").remove();
this.update()},update:function(C){var E=C||{};var D=E.newsize||this.getSize();if(D.width<=0){return}var F=E.offset||this.$$.offset;(E.element||this.$).find(">.chess-control-background .ts,>.chess-control-background .bs").width(D.width-F.left-F.right).end().find(">.chess-control-background .ls,>.chess-control-background .rs").height(D.height-F.top-F.bottom).end()}}));B.ui.glow.getter="getPosition getSize";
B.ui.glow.defaults={left:0,top:0,width:179,height:27,visible:false}})(jQuery);(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},getText:function(){},setText:function(){},setTarget:function(){},getTarget:function(){},css:function(){}};B.chess.registerWidget({name:"label",$interface:A},{},true);B.widget("ui.label",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])
},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])},setText:function(C){this.$.find(">.chess-label-content").html(C);this.fireEvent("textchange",[C,this.$[0]])},getText:function(){return this.$.find(">.chess-label-content").html()},setTarget:function(C){this.options.target=C
},getTarget:function(){return this.options.target},css:function(){this.$.css.apply(this.$.find(">.chess-label-content"),arguments)},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$._ui=this;var D=this.options;this.$.addClass("chess-control chess-label").css({left:D.left,right:D.right,top:D.top,bottom:D.bottom,width:D.width,height:D.height}).append('<div class="chess-label-content">'+this.options.text+"</div>").find(">.chess-label-content").css({"text-align":D.align,color:D.color,"font-size":D.fontSize,"line-height":D.lineHeight}).hover(function(){C.fireEvent("mouseenter",[this.parentNode])
},function(){C.fireEvent("mouseleave",[this.parentNode])}).click(function(E){C.fireEvent("click",[E,this.parentNode])}).dblclick(function(E){C.fireEvent("dblclick",[E,this.parentNode])}).mousedown(function(E){C.fireEvent("mousedown",[E,this.parentNode])}).mouseup(function(E){C.fireEvent("mouseup",[E,this.parentNode])});B.chess.disableSelection(this.$.find(">.chess-label-content"))},fireEvent:function(C,E){if(this.options.target){try{B.chess.get(this.options.target)[0]._ui.$[C]()
}catch(D){}}else{this.$.triggerHandler("label-"+C,E,this.options[C])}},update:function(C){var F=C||{};var D=F.newsize||this.getSize();if(D.height<=0){return}var E=(F.element||this.$).find(">.chess-label-content");this.$.triggerHandler("label-resize",[{size:D}],this.options.resize)}}));B.ui.label.getter="getPosition getSize getText getTarget";B.ui.label.defaults={width:200,height:250,text:"",align:"left",color:B.chess.getSkinMetrics("label","color"),fontSize:B.chess.getSkinMetrics("label","fontSize"),lineHeight:B.chess.getSkinMetrics("label","lineHeight"),target:false,visible:true,click:function(){},dblclick:function(){},mouseenter:function(){},mouseleave:function(){},mousedown:function(){},mouseup:function(){},textchange:function(){},resize:function(){}}
})(jQuery);(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},getText:function(){},setText:function(){},setValue:function(){},getValue:function(){},isChecked:function(){},isPartialyChecked:function(){},check:function(){},uncheck:function(){},onSkinChange:function(){}};window.CHECKBOX_UNCHECKED=0;window.CHECKBOX_CHECKED=1;window.CHECKBOX_PARTIALY=2;
B.chess.registerWidget({name:"checkbox",$interface:A},{},true);B.widget("ui.checkbox",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){C.height=this.$$.size.height;B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])
},setText:function(C){this.$$.label.setText(C)},getText:function(){return this.$$.label.getText()},setValue:function(C){if((C==this.options.value)||(C<CHECKBOX_UNCHECKED||C>CHECKBOX_PARTIALY)){return}this.$.find(">.chess-checkbox-image").removeClass((["","chess-checkbox-checked","chess-checkbox-partial"])[this.options.value]);this.options.value=C;this.$.find(">.chess-checkbox-image").addClass((["","chess-checkbox-checked","chess-checkbox-partial"])[C]);
this.$.triggerHandler("checkbox-change",[C,this],this.options.change)},getValue:function(){return this.options.value},isChecked:function(){return this.getValue()==CHECKBOX_CHECKED},isPartialyChecked:function(){return this.getValue()==CHECKBOX_PARTIALY},check:function(C){this.setValue(C?CHECKBOX_PARTIALY:CHECKBOX_CHECKED)},uncheck:function(){this.setValue(CHECKBOX_UNCHECKED)},onSkinChange:function(){this.$$.size=B.chess.getSkinMetrics("checkbox","size");
this.$$.spacing=B.chess.getSkinMetrics("checkbox","spacing");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$._ui=this;var D=this.options;this.$$.size=B.chess.getSkinMetrics("checkbox","size");this.$$.spacing=B.chess.getSkinMetrics("checkbox","spacing");this.$.addClass("chess-control chess-checkbox").css({left:D.left,top:D.top,right:D.right,bottom:D.bottom,width:D.width,height:this.$$.size.height}).append('<div class="chess-checkbox-image"><div class="checkboxthumb"/></div>').append(this.$$.label=B.chess.label(B.extend({},this.options,{target:this.$})).show()).hover(function(){if(!C.options.enabled){return
}C.$.addClass("chess-checkbox-hover");C.$.triggerHandler("checkbox-mouseenter",[this],C.options.mouseenter)},function(){if(!C.options.enabled){return}C.$.removeClass("chess-checkbox-hover");C.$.triggerHandler("checkbox-mouseleave",[this],C.options.mouseleave)}).click(function(E){if(!C.options.enabled){return}C.setValue(C.options.value!=CHECKBOX_CHECKED?CHECKBOX_CHECKED:CHECKBOX_UNCHECKED);C.$.triggerHandler("checkbox-click",[E,this],C.options.click)
}).dblclick(function(E){C.$.triggerHandler("checkbox-dblclick",[E,this],C.options.dblclick)}).mousedown(function(E){if(!C.options.enabled){return}E.stopPropagation();B.chess.activate(C);C.$.triggerHandler("checkbox-mousedown",[E,this],C.options.mousedown)}).mouseup(function(E){if(C.options.enabled){C.$.triggerHandler("checkbox-mouseup",[E,this],C.options.mouseup)}});this.$.find(">.chess-checkbox-image").addClass((["","chess-checkbox-checked","chess-checkbox-partial"])[this.options.value]);
this.update()},update:function(D){var F=D||{};var E=F.newsize||this.getSize();var C;if(E.width<=0){return}this.$$.label.setPosition({left:C=this.$$.size.width+this.$$.spacing,top:3});this.$$.label.setSize({width:E.width-C,height:E.height});this.$.triggerHandler("checkbox-resize",[{size:E}],this.options.resize)}}));B.ui.checkbox.getter="getPosition getSize getText getValue isChecked isPartialyChecked";
B.ui.checkbox.defaults={width:200,height:19,text:"",align:"left",value:CHECKBOX_UNCHECKED,visible:true,enabled:true,change:function(){},click:function(){},dblclick:function(){},mouseenter:function(){},mouseleave:function(){},mousedown:function(){},mouseup:function(){},textchange:function(){},resize:function(){}}})(jQuery);(function(A){var B={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},getText:function(){},setText:function(){},setValue:function(){},getValue:function(){},enable:function(){},disable:function(){}};
A.chess.registerWidget({name:"radio",$interface:B},{},true);A.widget("ui.radio",A.implement(B,{$:null,$$:{},setPosition:function(C){A.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return A.sharedInterface.getPosition.apply(this,[])},setSize:function(C){C.height=this.$$.size.height;A.sharedInterface.setSize.apply(this,[C])},getSize:function(){return A.sharedInterface.getSize.apply(this,[])
},setText:function(C){this.$$.label.setText(C)},getText:function(){return this.$$.label.getText()},setValue:function(C){var D;if((D=!(!(C||false)))==this.options.value){return}if(this.options.value=D){A('.chess-optionbutton[option_group="'+this.options.group+'"] .chess-optionbutton-checked').parent()[0]._ui.setValue(false)}this.$.find(">.chess-optionbutton-image")[D?"addClass":"removeClass"]("chess-optionbutton-checked");
this.$.triggerHandler("optionbutton-change",[D,this],this.options.change)},getValue:function(){return this.options.value},enable:function(){A.sharedInterface.enable.apply(this,[])},disable:function(C){A.sharedInterface.disable.apply(this,[C])},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$[0]._ui=this;var D=this.options;this.$$.size=A.chess.getSkinMetrics("optionbutton","size");
this.$$.spacing=A.chess.getSkinMetrics("optionbutton","spacing");this.$.addClass("chess-control chess-optionbutton").css({left:D.left,top:D.top,width:D.width,height:this.$$.size.height}).append('<div class="chess-optionbutton-image"><div class="optionbuttonthumb"/></div>').append(this.$$.label=A.chess.label(A.extend({},this.options,{target:this.$})).show()).hover(function(){if(!C.options.enabled){return
}C.$.addClass("chess-optionbutton-hover");C.$.triggerHandler("optionbutton-mouseenter",[this],C.options.mouseenter)},function(){if(!C.options.enabled){return}C.$.removeClass("chess-optionbutton-hover");C.$.triggerHandler("optionbutton-mouseleave",[this],C.options.mouseleave)}).click(function(E){if(!C.options.enabled){return}C.setValue(true);C.$.triggerHandler("optionbutton-click",[E,this],C.options.click)
}).dblclick(function(E){if(!C.options.enabled){return}C.$.triggerHandler("optionbutton-dblclick",[E,this],C.options.dblclick)}).mousedown(function(E){if(!C.options.enabled){return}E.stopPropagation();A.chess.activate(C);C.$.triggerHandler("optionbutton-mousedown",[E,this],C.options.mousedown)}).mouseup(function(E){if(!C.options.enabled){return}C.$.triggerHandler("optionbutton-mouseup",[E,this],C.options.mouseup)
});if(this.options.value){this.$.find(">.chess-optionbutton-image").addClass("chess-optionbutton-checked")}this.$.attr("option_group",D.group);if(!D.enabled){this.disable(true)}this.update()},update:function(D){var F=D||{};var E=F.newsize||this.getSize();var C;if(E.width<=0){return}this.$$.label.setPosition({left:C=this.$$.size.width+this.$$.spacing,top:0});this.$$.label.setSize({width:E.width-C,height:E.height});
this.$.triggerHandler("optionbutton-resize",[{size:E}],this.options.resize)}}));A.ui.radio.getter="getPosition getSize getText getValue";A.ui.radio.defaults={left:0,top:0,width:200,height:19,text:"",align:"left",value:false,group:"/",enabled:true,visible:true,change:function(){},click:function(){},dblclick:function(){},mouseenter:function(){},mouseleave:function(){},mousedown:function(){},mouseup:function(){},textchange:function(){},resize:function(){}}
})(jQuery);(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},setValue:function(){},getValue:function(){},scrollTo:function(){},setMinValue:function(){},getMinValue:function(){},setMaxValue:function(){},getMaxValue:function(){},enable:function(){},disable:function(){},wheelHandler:function(){},onSkinChange:function(){}};B.chess.registerWidget({name:"vscroll",$interface:A},{},true);
B.widget("ui.vscroll",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])},setValue:function(C,D){if(!D){C=Math.max(Math.min(C,this.options.maxValue),this.options.minValue)
}if(C==this.options.value){return}this.options.value=C;this.updateThumb();this.$.triggerHandler("vscroll-change",[this.options.value],this.options.change)},getValue:function(){return this.options.value},scrollTo:function(D,C){D=Math.max(Math.min(D,this.options.maxValue),this.options.minValue);this.setValue(D,true)},setMinValue:function(C){this.options.value=this.options.minValue=C;this.update()},getMinValue:function(){return this.options.minValue
},setMaxValue:function(C){this.options.maxValue=C;this.options.value=Math.max(Math.min(this.options.value,C),this.options.minValue);this.update()},getMaxValue:function(){return this.options.maxValue},enable:function(){B.sharedInterface.enable.apply(this,[])},disable:function(C){B.sharedInterface.disable.apply(this,[C])},wheelHandler:function(E){if(this.options.enabled&&E.delta!=0&&this.$.is(":visible")){var D=this.options.maxValue-this.options.minValue+1>30?2.2:1;
var C=Math.max(Math.min(this.options.value-E.delta*D,this.options.maxValue),this.options.minValue);this.setValue(C,true);this.$.triggerHandler("vscroll-scroll",[Math.round(C),C],this.options.scroll);E.preventDefault()}},onSkinChange:function(){this.$$.width=B.chess.getSkinMetrics("vscroll","width");this.$$.minThumbSize=B.chess.getSkinMetrics("vscroll","minThumbSize");this.$$.thumbOffset=B.chess.getSkinMetrics("vscroll","thumbOffset");
this.$$.offset=B.chess.getSkinMetrics("vscroll","offset");this.$$.thumbCorners=B.chess.getSkinMetrics("vscroll","thumbCorners");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$[0]._ui=this;var D=this.options;this.$$.width=B.chess.getSkinMetrics("vscroll","width");this.$$.minThumbSize=B.chess.getSkinMetrics("vscroll","minThumbSize");this.$$.thumbOffset=B.chess.getSkinMetrics("vscroll","thumbOffset");
this.$$.offset=B.chess.getSkinMetrics("vscroll","offset");this.$$.thumbCorners=B.chess.getSkinMetrics("vscroll","thumbCorners");this.$.addClass("chess-control chess-vscroll").css({left:D.left,top:D.top,height:D.height}).append('<div class="chess-control-background"><div class="c"><div/></div><div class="t"><div/></div><div class="b"><div/></div></div><div class="chess-vscroll-thumb-background"><div class="c"><div/></div><div class="t"><div/></div><div class="b"><div/></div></div><div class="chess-vscroll-bar"><div class="chess-vscroll-thumb"/></div>').find(">.chess-vscroll-bar").hover(function(){if(!C.options.enabled){return
}C.$.addClass("chess-vscroll-hover");C.$.triggerHandler("vscroll-mouseenter",[this],C.options.mouseenter)},function(){if(!C.options.enabled){return}C.$.removeClass("chess-vscroll-hover");C.$.triggerHandler("vscroll-mouseleave",[this],C.options.mouseleave)}).click(function(E){if(C.options.enabled){C.$.triggerHandler("vscroll-click",[E,this],C.options.click);if(E.which==1&&B(E.target).is(".chess-vscroll-bar")){var F=Math.min(Math.max(E.clientY-C.$.offset().top,C.$$.thumbOffset.top),C.$$.scrollH)-C.$$.thumbOffset.top-C.$.find(".chess-vscroll-thumb").height();
C.setValue((F/C.$$.scrollH)*(C.options.maxValue+C.options.minValue)+C.options.minValue)}E.preventDefault();E.stopPropagation()}}).dblclick(function(E){C.$.triggerHandler("vscroll-dblclick",[E,this],C.options.dblclick)}).mousedown(function(E){if(!C.options.enabled){return}E.stopPropagation();B.chess.activate(C);C.$.triggerHandler("vscroll-mousedown",[E,this],C.options.mousedown)}).mouseup(function(E){if(C.options.enabled){C.$.triggerHandler("vscroll-mouseup",[E,this],C.options.mouseup)
}}).wheel(function(E){C.wheelHandler(E)});if(!D.enabled){this.disable(true)}this.update();this.makeThumbDraggable()},makeThumbDraggable:function(){var D=this.$.find(".chess-vscroll-thumb");var C=this;D.draggable({axis:"y",scroll:false,start:function(){B.chess.activate(C)},drag:function(J,I){var E=D.height();var H=C.$$.scrollH-E+C.$$.thumbOffset.top;if(I.position.top<C.$$.thumbOffset.top){I.position.top=C.$$.thumbOffset.top
}else{if(I.position.top>H){I.position.top=H}}var F=(I.position.top-C.$$.thumbOffset.top)/(H-C.$$.thumbOffset.bottom);var G=F*(C.options.maxValue-C.options.minValue)+C.options.minValue;C.options.value=G;C.$.triggerHandler("vscroll-scroll",[C.options.value,G],C.options.scroll);C.$.find(">.chess-vscroll-thumb-background").css("top",I.position.top)},end:function(F,E){C.$.triggerHandler("vscroll-change",[C.options.value],C.options.change)
}}).mousedown(function(E){E.stopPropagation();B.chess.activate(C)})},update:function(D){var F=D||{};var E=F.newsize||this.getSize();if(E.height<=0){return}this.$.find(">.chess-control-background>.c").height(E.height-this.$$.offset.top-this.$$.offset.bottom);this.$.triggerHandler("vscroll-resize",[{size:E}],this.options.resize);this.$$.scrollH=E.height-this.$$.thumbOffset.top-this.$$.thumbOffset.bottom;
var C=this.$$.scrollH/(this.options.maxValue-this.options.minValue+1);if(C<this.$$.minThumbSize){C=this.$$.minThumbSize}this.$.find(">.chess-vscroll-thumb-background,.chess-vscroll-thumb").height(C).end().find(">.chess-vscroll-thumb-background .c").height(C-this.$$.thumbCorners.top-this.$$.thumbCorners.bottom);this.updateThumb()},updateThumb:function(){var C=this.$$.scrollH-this.$.find(".chess-vscroll-thumb").height();
this.$.find(">.chess-vscroll-thumb-background,.chess-vscroll-thumb").css("top",Math.floor(((this.options.value-this.options.minValue)/(this.options.maxValue-this.options.minValue))*C+this.$$.thumbOffset.top))}}));B.ui.vscroll.getter="getPosition getSize getValue getMinValue getMaxValue";B.ui.vscroll.defaults={left:0,top:0,height:70,minValue:1,maxValue:100,value:1,enabled:true,visible:true,scroll:function(){},change:function(){},click:function(){},dblclick:function(){},mouseenter:function(){},mouseleave:function(){},mousedown:function(){},mouseup:function(){},resize:function(){}}
})(jQuery);(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},getText:function(){},setText:function(){},appendText:function(){},scrollToEnd:function(){},update:function(){},onSkinChange:function(){}};B.chess.registerWidget({name:"textbox",$interface:A},{},true);B.widget("ui.textbox",B.implement(A,{setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])
},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])},setText:function(C){this.options.text=C;this.$.find(">.chess-frame>.chess-frame-content>.chess-textbox-content>.chess-textbox-text").html(C).find("p").css("padding",this.options.padding);this.$.triggerHandler("textbox-change",[C],this.options.change);
this.update()},appendText:function(C){this.options.text+=C;this.$.find(">.chess-frame>.chess-frame-content>.chess-textbox-content>.chess-textbox-text").append(B(newtext).find("p").css("padding",this.options.padding).end());this.$.triggerHandler("textbox-change",[this.options.text],this.options.change);this.update()},getText:function(){return this.$.find(">.chess-frame>.chess-frame-content>.chess-textbox-content>.chess-textbox-text").html()
},onSkinChange:function(){this.$$.distance=B.chess.getSkinMetrics("textbox","distance");this.$$.lineHeight=parseInt(B.chess.getSkinMetrics("textbox","lineHeight"));this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={scrollToEnd:false};var C=this.$[0]._ui=this;var D=this.options;this.$$.distance=B.chess.getSkinMetrics("textbox","distance");this.$$.lineHeight=parseInt(B.chess.getSkinMetrics("textbox","lineHeight"));
this.$.addClass("chess-control chess-textbox").css({left:D.left,top:D.top,bottom:D.bottom,width:D.width,height:D.height}).hover(function(){if(C.options.enabled){C.$.triggerHandler("textbox-mouseenter",[this],C.options.mouseenter)}},function(){if(C.options.enabled){C.$.triggerHandler("textbox-mouseleave",[this],C.options.mouseleave)}}).mousedown(function(F){if(!C.options.enabled){return}F.stopPropagation();
B.chess.activate(C);C.$.triggerHandler("textbox-mousedown",[F,this],C.options.mousedown)});this.$$.content=B('<div class="chess-textbox-content"/>').append(B('<div class="chess-textbox-text">'+D.text+"</div>").css({"text-align":D.align,color:D.color,"font-size":D.fontSize,"line-height":D.lineHeight}));this.$$.frame=B.chess.frame();this.$$.content.appendTo(this.$$.frame.find(".chess-frame-content"));
var E=function(F){C.$$.content.find(">div:eq(0)").css("top",-10*F)};this.$$.scroll=B.chess.vscroll({minValue:0,scroll:function(F,G){E(G)},change:function(F){E(F)}});this.$.append(this.$$.frame.show()).append(this.$$.scroll.show());B.chess.disableSelection(this.$$.content.wheel(function(F){C.$$.scroll.wheelHandler(F)}));this.update()},scrollToEnd:function(C){this.$$.scrollToEnd=C},update:function(D,G){var I=D||{};
var E=I.newsize||this.getSize();if(E.width<=0||E.height<=0){return}var J=B.chess.getSkinMetrics("vscroll","width");var H=this.$$.content.find(">div").height();var F=this.$$.content.height();if(H<=F){this.$$.content.find(">div:eq(0)").css("top",0);this.$$.scroll.hide();this.$$.frame.setSize({width:E.width,height:E.height})}else{this.$$.scroll.css("left",E.width-J).setSize({height:E.height});this.$$.frame.setSize({width:E.width-J-this.$$.distance,height:E.height});
var C=(H-F)/10;this.$$.scroll.setMaxValue(C).setValue(this.$$.scrollToEnd?C:0).show()}if(!G){this.update(D,true)}else{this.$.triggerHandler("textbox-resize",[{size:E}],this.options.resize)}}}));B.ui.textbox.getter="getPosition getSize getText";B.ui.textbox.defaults={left:0,width:200,height:250,text:"",enabled:true,visible:true,color:B.chess.getSkinMetrics("textbox","color"),fontSize:B.chess.getSkinMetrics("textbox","fontSize"),lineHeight:B.chess.getSkinMetrics("textbox","lineHeight"),padding:B.chess.getSkinMetrics("textbox","padding"),resize:function(){},change:function(){},mouseenter:function(){},mouseleave:function(){},mousedown:function(){}}
})(jQuery);(function(A){Global.IList={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},addItem:function(){},addItems:function(){},removeItem:function(){},clear:function(){},getItem:function(){},setItem:function(){},getCount:function(){},getSelectedItem:function(){},setSelectedIndex:function(){},getSelectedIndex:function(){},scrollIntoView:function(){},enable:function(){},disable:function(){},update:function(){},onSkinChange:function(){}};
A.chess.registerWidget({name:"list",$interface:IList},{},true);A.widget("ui.list",A.implement(IList,{$:null,$$:{},setPosition:function(B){A.sharedInterface.setPosition.apply(this,[B])},getPosition:function(){return A.sharedInterface.getPosition.apply(this,[])},setSize:function(B){A.sharedInterface.setSize.apply(this,[B])},getSize:function(){return A.sharedInterface.getSize.apply(this,[])},addItem:function(B){var C=(this.$$.items.push(B)-1)*this.$$.adapter.itemHeight;
this.$$.adapter.insert(A.chess.disableSelection(A(this.$$.adapter.baseHTML).appendTo(this.$.find(".chess-list-items")).css("top",C)),B);this.update()},addItems:function(B){for(var C=0;C<B.length;C++){var D=(this.$$.items.push(B[C])-1)*this.$$.adapter.itemHeight;this.$$.adapter.insert(A.chess.disableSelection(A(this.$$.adapter.baseHTML).appendTo(this.$.find(".chess-list-items")).css("top",D)),B[C])}this.update()
},removeItem:function(C){if(C<0||C>=this.$$.items.length){return}this.$.find(".chess-list-items>*:eq("+C+")").remove();this.$$.items.splice(C,1);var B=this.$$.adapter.itemHeight;this.$.find(".chess-list-items>*:gt("+(C-1)+")").each(function(D){A(this).css("top",D*B)});if(this.$$.selectedIndex>=C){this.setSelectedIndex(this.$$.selectedIndex)}this.update()},clear:function(){this.$$.items=[];this.$.find(".chess-list-items").empty();
this.update()},getItem:function(B){return(B<0||B>=this.$$.items.length)?undefined:this.$$.items[B]},setItem:function(B,C){if(B<0||B>=this.$$.items.length){return}this.$$.items[B]=C;this.$$.adapter.update(this.$.find(".chess-list-items>*:eq("+B+")"),C)},getSelectedItem:function(){return this.$$.selectedIndex>=0?this.$$.items[this.$$.selectedIndex]:undefined},getCount:function(){return this.$$.items.length
},setSelectedIndex:function(C,E){if(!this.$$.adapter.selectable){return}if(C<0||C>=this.$$.items.length){C=-1}if(!E&&(C==this.$$.selectedIndex)){return}var D=this.$$.scroll.is(":visible")?this.$$.scroll.getValue():0;var F=(C*this.$$.adapter.itemHeight+this.$$.selectedPadding.vertical)-D*this.$$.adapter.itemHeight;var B=this;this.$$.selectedIndex=C;this.$.find(".chess-list-item-selected").show().animate({top:F},80,function(){if(C>-1){B.scrollIntoView(C);
B.$.triggerHandler("list-select",[B.$$.items[C],C],B.options.select)}})},getSelectedIndex:function(){return this.$$.selectedIndex},scrollIntoView:function(B){this.$$.scroll.scrollTo(this.$$.scroll.getMaxValue()-this.$$.items.length+B+1)},enable:function(){A.sharedInterface.enable.apply(this,[]);if(this.$$.selectedIndex>-1){this.$.find(".chess-list-item-selected *").css("opacity",1)}},disable:function(B){A.sharedInterface.disable.apply(this,[B]);
if(this.$$.selectedIndex>-1){this.$.find(".chess-list-item-selected *").css("opacity",0.5)}},onSkinChange:function(){this.$$.offset=A.chess.getSkinMetrics("list","offset");this.$$.contentSize=A.chess.getSkinMetrics("list","contentSize");this.$$.selectedPadding=A.chess.getSkinMetrics("list","selectedPadding");this.$$.selectedOffset=A.chess.getSkinMetrics("list","selectedOffset");this.$$.selectedSpacing=A.chess.getSkinMetrics("list","selectedSpacing");
this.$$.sliderW=A.chess.getSkinMetrics("vscroll","width");this.$.find(".chess-list-item-selected").height(this.$$.adapter.itemHeight-this.$$.selectedPadding.vertical*2);this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$[0]._ui=this;var D=this.options;this.$$.offset=A.chess.getSkinMetrics("list","offset");this.$$.contentSize=A.chess.getSkinMetrics("list","contentSize");
this.$$.selectedPadding=A.chess.getSkinMetrics("list","selectedPadding");this.$$.selectedOffset=A.chess.getSkinMetrics("list","selectedOffset");this.$$.selectedSpacing=A.chess.getSkinMetrics("list","selectedSpacing");this.$$.sliderW=A.chess.getSkinMetrics("vscroll","width");this.$.addClass("chess-control chess-list").css({left:D.left,top:D.top,width:D.width,height:D.height}).hover(function(){if(!C.options.enabled){return
}A(this).addClass("chess-list-hover");C.update();C.$.triggerHandler("list-mouseenter",[{element:this}],C.options.mouseenter)},function(){A(this).removeClass("chess-list-hover");C.update();C.$.triggerHandler("list-mouseleave",[{element:this}],C.options.mouseleave)}).mousedown(function(F){if(!C.options.enabled){return}F.stopPropagation();A.chess.activate(C);C.$.triggerHandler("list-mousedown",[F,{element:this}],C.options.mousedown)
}).mouseup(function(F){if(C.options.enabled){C.$.triggerHandler("list-mouseup",[F,{element:this}],C.options.mouseup)}}).click(function(F){if(C.options.enabled){C.$.triggerHandler("list-click",[F,{element:this}],C.options.click)}}).append(A.chess.createBackgroundElements()).append(A('<div class="chess-list-content"/>').append(A('<div class="chess-list-item-selected" />').append(A.chess.createBackgroundElements())).append('<div class="chess-list-items"/><div class="chess-list-mousetrap"/>'));
this.$$.adapter=A.extend({selectable:true,itemHeight:20,baseHTML:'<div class="chess-list-item"/>',insert:function(F,G){if(F){F.html(G)}},update:function(F,G){if(F){F.html(G)}}},D.adapter||{});var E=0;this.$.find(".chess-list-item-selected").height(E=this.$$.adapter.itemHeight-this.$$.selectedPadding.vertical*2).find(".ls,.rs,.c").height(E-this.$$.selectedOffset.top-this.$$.selectedOffset.bottom);var B=function(F){C.$.find(".chess-list-items").css("top",-C.$$.adapter.itemHeight*F);
if(C.$$.selectedIndex>-1){C.$.find(".chess-list-item-selected").css("top",(C.$$.selectedIndex*C.$$.adapter.itemHeight+C.$$.selectedPadding.vertical)-C.$$.scroll.getValue()*C.$$.adapter.itemHeight)}};this.$$.scroll=A.chess.vscroll({minValue:0,scroll:function(F,G){B(G)},change:function(F){B(F)}});this.$.find(".chess-list-content").append(this.$$.scroll);this.$.find(".chess-list-items,.chess-list-mousetrap").wheel(function(F){if(!C.options.enabled){return
}C.$$.scroll.wheelHandler(F);A(this).triggerHandler("mouseleave")});this.$.find(".chess-list-mousetrap").mousemove(function(K){if(!C.options.enabled||C.$$.items.length==0){return}var H=C.$$.scroll.is(":visible")?C.$$.scroll.getValue():0;var G=Math.floor((K.pageY+H*C.$$.adapter.itemHeight-A(this).offset().top)/C.$$.adapter.itemHeight);var J=(G-H)*C.$$.adapter.itemHeight;var F=C.$.find(".chess-list-items>*.chess-list-item-hover").removeClass("chess-list-item-hover");
var I=C.$.find(".chess-list-items>*:eq("+G+")").addClass("chess-list-item-hover");if(F.length){C.$.triggerHandler("list-itemmouseleave",[C.$.find(".chess-list-items>*").index(F),J],C.options.itemmouseleave)}if(I.length){C.$.triggerHandler("list-itemmouseenter",[G,J],C.options.itemmouseenter)}}).click(function(H){if(!C.options.enabled||C.$$.items.length==0){return}var G=C.$$.scroll.is(":visible")?C.$$.scroll.getValue():0;
var F=Math.floor((H.pageY-A(this).offset().top+G*C.$$.adapter.itemHeight)/C.$$.adapter.itemHeight);C.setSelectedIndex(F);C.$.triggerHandler("list-itemclick",[F],C.options.itemclick)}).bind("mouseleave",function(){var F=C.$.find(".chess-list-items>*.chess-list-item-hover").removeClass("chess-list-item-hover");if(F.length){C.$.triggerHandler("list-itemmouseleave",[C.$.find(".chess-list-items>*").index(F)],C.options.itemmouseleave)
}});this.$$.items=[];this.addItems(D.items);this.setSelectedIndex(this.$$.selectedIndex=D.selectedIndex||-1);if(!D.enabled){this.disable(true)}if(D.transbg){this.$.find(">.chess-control-background").addClass("chess-list-trans")}this.update()},update:function(M){var B=M||{};var L=B.newsize||this.getSize();if(L.width<=0||L.height<=0){return}var F=B.offset||this.$$.offset;var G=L.width-F.left-F.right;
var K=L.height-F.top-F.bottom;var D=L.height+this.$$.contentSize.height;var H=L.width+this.$$.contentSize.width;var J=this.$$.items.length*this.$$.adapter.itemHeight;var C=H;if(J>D){C-=this.$$.sliderW;var E=this.$$.items.length-D/this.$$.adapter.itemHeight;if(this.$$.scroll.getMaxValue()!=E){this.$$.scroll.setMaxValue(E);this.$$.scroll.setValue(0)}if(!this.$$.scroll.is(":visible")){this.$$.scroll.show()
}this.$$.scroll.css({left:C}).setSize({height:D})}else{this.$$.scroll.setValue(0).hide()}try{(B.element||this.$).find(">.chess-control-background>.ts,>.chess-control-background>.bs,>.chess-control-background>.c").width(G).end().find(">.chess-control-background>.ls,>.chess-control-background>.rs,>.chess-control-background>.c").height(K).end().find(">.chess-list-content").width(H).height(D).find(">.chess-list-items").height(J).width(C-this.$$.selectedSpacing*this.$$.scroll.is(":visible")).end().find(">.chess-list-item-selected").width(C-this.$$.selectedSpacing*this.$$.scroll.is(":visible")).find(".ts, .bs, .c").width(C-this.$$.selectedSpacing*this.$$.scroll.is(":visible")-this.$$.selectedOffset.left-this.$$.selectedOffset.right).end()
}catch(I){}this.$.triggerHandler("list-resize",[{size:L}],this.options.resize)}}));A.ui.list.getter="getPosition getSize getItem getCount getSelectedIndex getSelectedItem";A.ui.list.defaults={left:0,top:0,width:84,height:24,enabled:true,visible:true,items:[],transbg:true,resize:function(){},click:function(){},select:function(){},mouseenter:function(){},mouseleave:function(){},itemmouseenter:function(){},itemmouseleave:function(){},itemclick:function(){}}
})(jQuery);(function(A){A.chess.registerWidget({name:"checklist",$interface:IList},{},true);A.widget("ui.checklist",A.implement(IList,{$:null,setPosition:function(B){A.sharedInterface.setPosition.apply(this,[B])},getPosition:function(){return A.sharedInterface.getPosition.apply(this,[])},setSize:function(B){A.sharedInterface.setSize.apply(this,[B])},getSize:function(){return A.sharedInterface.getSize.apply(this)
},addItem:function(B){this.$$.list.addItem(B)},addItems:function(B){this.$$.list.addItems(B)},removeItem:function(B){this.$$.list.removeItem(arguments)},clear:function(){this.$$.list.clear()},getItem:function(B){return this.$$.list.getItem(B)},setItem:function(B,C){this.$$.list.setItem(B,C)},getCount:function(){return this.$$.list.getCount()},setSelectedIndex:function(B,C){this.$$.list.setSelectedIndex(B,C)
},getSelectedIndex:function(){return this.$$.list.getSelectedIndex()},scrollIntoView:function(B){this.$$.list.scrollIntoView()},enable:function(){this.$$.list.enable()},disable:function(){this.$$.list.disable()},onSkinChange:function(){this.$$.list.onSkinChange()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var B=this.$[0]._ui=this;var C=function(D,E){E.fullname=E.name+"";delete E.name;
A.chess.checkbox(A.extend(E,{text:E.fullname+" &lt;"+E.email+"&gt;",parent:D,left:0,top:0,width:340,change:function(F){E.value=F}})).show()};this.$$.list=A.chess.list(A.extend({},this.options,{left:0,top:0,name:this.options.name?this.options.name+".$$.list":this.options.name,adapter:{selectable:false,itemHeight:20,baseHTML:'<div class="checklist-item"/>',insert:C,update:C},resize:function(D){B.$.width(D.size.width).height(D.size.height);
B.$.triggerHandler("checklist-resize",[{size:D.size}],B.options.resize)},click:function(E,D){B.$.triggerHandler("checklist-click",[E,D],B.options.click)},mouseenter:function(D){B.$.triggerHandler("checklist-mouseenter",[D],B.options.mouseenter)},mouseleave:function(D){B.$.triggerHandler("checklist-mouseleave",[D],B.options.mouseleave)},itemmouseenter:function(D){B.$.find(".hover:eq("+D+")").show();
B.$.triggerHandler("checklist-itemmouseenter",[D],B.options.itemmouseenter)},itemmouseleave:function(D){B.$.find(".hover:eq("+D+")").hide();B.$.triggerHandler("checklist-itemmouseleave",[D],B.options.itemmouseleave)},itemclick:function(E){var D=B.$$.list.getItem(E);B.$.triggerHandler("checklist-itemclick",[E,D],B.options.itemclick)}})).appendTo(this.$.addClass("chess-control chess-friend-list").css({left:this.options.left,top:this.options.top})).show();
this.$$.list.find(".chess-list-mousetrap").remove()},update:function(B){var D=B||{};var C=D.newsize||this.getSize();if(C.width<=0||C.height<=0){return}this.$$.list.setSize(C)}}));A.ui.checklist.getter="getPosition getSize getItem getCount getSelectedIndex";A.ui.checklist.defaults={left:0,top:0,width:84,height:24,enabled:true,visible:true,items:[],resize:function(){},click:function(){},play:function(){},mouseenter:function(){},mouseleave:function(){},itemmouseenter:function(){},itemmouseleave:function(){},itemclick:function(){}}
})(jQuery);(function(B){var A=B.extend({},IList,{deactivate:function(){}});B.chess.registerWidget({name:"selectbox",$interface:A},{},true);B.widget("ui.selectbox",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])
},addItem:function(C){this.$$.list.addItem(C)},addItems:function(C){this.$$.list.addItems(C)},removeItem:function(C){this.$$.list.removeItem(C)},clear:function(){this.$$.list.clear()},getItem:function(C){return this.$$.list.getItem(C)},setItem:function(C,D){this.$$.list.setItem(C,D)},getSelectedItem:function(){return this.$$.list.getSelectedItem()},getCount:function(){return this.$$.list.getCount()
},setSelectedIndex:function(C){this.$$.list.setSelectedIndex(C)},getSelectedIndex:function(){return this.$$.list.getSelectedIndex()},scrollIntoView:function(C){this.$$.list.scrollIntoView(C)},enable:function(){B.sharedInterface.enable.apply(this,[])},disable:function(C){B.sharedInterface.disable.apply(this,[C])},deactivate:function(D){var C=this;setTimeout(function(){if(C.$$.listOpen&&(D!=C.$$.list[0]._ui)&&(D!=C.$$.list[0]._ui.$$.scroll[0]._ui)){C.$$.listOpen=false;
C.$$.list.slideUp("fast")}else{B.chess.activate({})}},5)},onSkinChange:function(){this.$$.offset=B.chess.getSkinMetrics("selectbox","offset");this.$$.contentOffset=B.chess.getSkinMetrics("selectbox","contentOffset");this.$$.listOffset=B.chess.getSkinMetrics("selectbox","listOffset");this.update()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$[0]._ui=this;var D=this.options;
this.$$.offset=B.chess.getSkinMetrics("selectbox","offset");this.$$.contentOffset=B.chess.getSkinMetrics("selectbox","contentOffset");this.$$.listOffset=B.chess.getSkinMetrics("selectbox","listOffset");this.$$.listOpen=false;this.$.addClass("chess-control chess-selectbox").css({left:D.left,top:D.top,width:D.width}).hover(function(){if(!C.options.enabled){return}B(this).addClass("chess-selectbox-hover");
C.update();C.$.triggerHandler("selectbox-mouseenter",[{element:this}],C.options.mouseenter)},function(){B(this).removeClass("chess-selectbox-hover");C.update();C.$.triggerHandler("selectbox-mouseleave",[{element:this}],C.options.mouseleave)}).mousedown(function(E){if(!C.options.enabled){return}E.stopPropagation();B.chess.activate(C);C.$.triggerHandler("selectbox-mousedown",[E,{element:this}],C.options.mousedown)
}).append(B.chess.createBackgroundElements()).append('<div class="chess-selectbox-content"/><div class="chess-selectbox-button"><div/></div><div class="chess-selectbox-mousetrap" />').find(".chess-selectbox-mousetrap").click(function(E){if(!C.options.enabled){return}if(C.$$.listOpen){C.$$.listOpen=false;C.$$.list.slideUp("fast")}else{C.$$.listOpen=true;var F=C.getPosition();C.$$.list.css({left:C.$$.listOffset.left,top:C.options.height+C.$$.listOffset.top}).slideDown(100,function(){C.$$.list.setSize(C.$$.list.getSize());
C.$$.list.scrollIntoView(C.$$.list.getSelectedIndex());C.$$.list.update()})}});B.chess.disableSelection(this.$.find(".chess-selectbox-content"));this.$$.list=B.chess.list(B.extend({},D,{width:D.listWidth||D.width,height:D.listHeight||100,transbg:false,select:function(F,E){if(C.$$.listOpen){C.$$.listOpen=false;C.$$.list.slideUp("fast")}C.$.find(".chess-selectbox-content").html(F);C.$.triggerHandler("selectbox-select",[F,E],C.options.select)
}})).css("z-index",5000).hide().appendTo(this.$.css("z-index",6000));if(D.selectedIndex>-1){this.$.find(".chess-selectbox-content").html(this.$$.list.getItem(D.selectedIndex));this.$$.list.setSelectedIndex(D.selectedIndex)}if(!D.enabled){this.disable(true)}this.update()},update:function(D){var F=D||{};var E=F.newsize||this.getSize();if(E.width<=0||E.height<=0){return}var H=F.offset||this.$$.offset;
var G=E.width-H.left-H.right;var C=E.height-H.top-H.bottom;(F.element||this.$).find(">.chess-control-background .ts,>.chess-control-background .bs,>.chess-control-background .c").width(G).end().find(">.chess-control-background .ls,>.chess-control-background .rs,>.chess-control-background .c").height(C).end().find(">.chess-selectbox-content").width(E.width-this.$$.contentOffset.left-this.$$.contentOffset.right);
this.$.triggerHandler("selectbox-resize",[{size:E}],this.options.resize)}}));B.ui.selectbox.getter="getPosition getSize getItem getCount getSelectedIndex getSelectedItem";B.ui.selectbox.defaults={left:0,top:0,width:84,height:24,enabled:true,visible:true,items:[],select:function(){},resize:function(){},click:function(){},mouseenter:function(){},mouseleave:function(){}}})(jQuery);(function(B){var A={setPosition:function(){},getPosition:function(){},setSize:function(){},getSize:function(){},enable:function(){},disable:function(){},jq:function(){}};
B.chess.registerWidget({name:"layer",$interface:A},{},true);B.widget("ui.layer",B.implement(A,{$:null,$$:{},setPosition:function(C){B.sharedInterface.setPosition.apply(this,[C])},getPosition:function(){return B.sharedInterface.getPosition.apply(this,[])},setSize:function(C){B.sharedInterface.setSize.apply(this,[C])},getSize:function(){return B.sharedInterface.getSize.apply(this,[])},enable:function(){B.sharedInterface.enable.apply(this,[])
},disable:function(C){B.sharedInterface.disable.apply(this,[C])},jq:function(){return this.$},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var C=this.$._ui=this;var E=this.options,D;this.$.addClass("chess-control chess-layer").css({position:"absolute",left:E.left,right:E.right,top:E.top,bottom:E.bottom,width:E.width,height:E.height}).html(E.html).css(E.css);if(!E.nomousetrap){this.$.append(B("<div/>").css({position:"absolute",left:0,top:0,width:"100%",height:"100%",background:"url(img/default/blank.gif) repeat"}).hover(function(){if(C.options.enabled){C.$.triggerHandler("layer-mouseenter",[{element:C.$}],C.options.mouseenter)
}},function(){if(C.options.enabled){C.$.triggerHandler("layer-mouseleave",[{element:C.$}],C.options.mouseleave)}}).mousedown(function(F){if(!C.options.enabled){return}F.stopPropagation();B.chess.activate(C);C.$.triggerHandler("layer-mousedown",[F,{element:C.$}],C.options.mousedown)}).mouseup(function(F){if(C.options.enabled){C.$.triggerHandler("layer-mouseup",[F,{element:C.$}],C.options.mouseup)}}).mousemove(function(F){if(C.options.enabled){C.$.triggerHandler("layer-mousemove",[F,{element:C.$}],C.options.mousemove)
}}).click(function(F){if(C.options.enabled){C.$.triggerHandler("layer-click",[F,{element:C.$}],C.options.click)}}).dblclick(function(F){if(C.options.enabled){C.$.triggerHandler("layer-dblclick",[F,{element:C.$}],C.options.dblclick)}}))}if(!E.enabled){this.disable(true)}},update:function(C){var E=C||{};var D=E.newsize||this.getSize();if(D.height<=0||D.width<=0){return}this.$.triggerHandler("layer-resize",[D],this.options.resize)
}}));B.ui.layer.getter="getPosition getSize jq";B.ui.layer.defaults={width:200,height:250,enabled:true,visible:true,html:"",css:{},nomousetrap:false,click:function(){},dblclick:function(){},mouseenter:function(){},mouseleave:function(){},mousedown:function(){},mouseup:function(){},mousemove:function(){},resize:function(){}}})(jQuery);(function(A){A.chess.registerWidget({name:"searchlist",$interface:IList},{},true);
A.widget("ui.searchlist",A.implement(IList,{$:null,$$:{},setPosition:function(B){A.sharedInterface.setPosition.apply(this,[B])},getPosition:function(){return A.sharedInterface.getPosition.apply(this,[])},setSize:function(B){A.sharedInterface.setSize.apply(this,[B])},getSize:function(){return A.sharedInterface.getSize.apply(this)},addItem:function(B){this.$$.list.addItem(B)},addItems:function(B){this.$$.list.addItems(B)
},removeItem:function(B){this.$$.list.removeItem(arguments)},clear:function(){this.$$.list.clear()},getItem:function(B){return this.$$.list.getItem(B)},setItem:function(B,C){this.$$.list.setItem(B,C)},getCount:function(){return this.$$.list.getCount()},setSelectedIndex:function(B,C){this.$$.list.setSelectedIndex(B,C)},getSelectedIndex:function(){return this.$$.list.getSelectedIndex()},scrollIntoView:function(B){this.$$.list.scrollIntoView(B)
},enable:function(){this.$$.list.enable()},disable:function(){this.$$.list.disable()},onSkinChange:function(){this.$$.list.onSkinChange()},init:function(){this.$=this.element;this.$$=this.element[0]._$$={};var B=this.$[0]._ui=this;var C=function(D,E){D.attr("id",E.id).find(".avatar").html(A.chess.transPNG(E.avatar,30,24)).end().find(".name").html(E.name)};this.$$.list=A.chess.list(A.copy(this.options,{left:0,top:0,width:300,height:255,transbg:false,name:this.options.name?this.options.name+".$$.list":this.options.name,adapter:{selectable:false,itemHeight:28,baseHTML:'<div class="searchlist-item"><div class="avatar"/><div class="name"/><div class="hover"/></div>',insert:C,update:C},resize:function(D){B.$.width(D.size.width).height(D.size.height);
B.$.triggerHandler("searchlist-resize",[{size:D.size}],B.options.resize)},click:function(E,D){B.$.triggerHandler("searchlist-click",[E,D],B.options.click)},mouseenter:function(D){B.$.triggerHandler("searchlist-mouseenter",[D],B.options.mouseenter)},mouseleave:function(D){B.$.triggerHandler("searchlist-mouseleave",[D],B.options.mouseleave)},itemmouseenter:function(D,E){B.$.find(".hover:visible").hide().end().find(".hover:eq("+D+")").show();
B.$.triggerHandler("searchlist-itemmouseenter",[D,E],B.options.itemmouseenter)},itemmouseleave:function(D,E){B.$.find(".hover:eq("+D+")").hide();B.$.triggerHandler("searchlist-itemmouseleave",[D,E],B.options.itemmouseleave)},itemclick:function(E){var D=B.$$.list.getItem(E);B.$.triggerHandler("searchlist-itemclick",[E,D],B.options.itemclick)}})).appendTo(this.$.addClass("chess-control chess-searchlist").css({left:this.options.left,top:this.options.top,width:this.options.width,height:this.options.height})).show();
this.update()},update:function(B){var D=B||{};var C=D.newsize||this.getSize();if(C.width<=0||C.height<=0){return}this.$$.list.setSize(C)}}));A.ui.searchlist.getter="getPosition getSize getItem getCount getSelectedIndex";A.ui.searchlist.defaults={left:0,top:0,width:84,height:24,enabled:true,visible:true,items:[],resize:function(){},click:function(){},mouseenter:function(){},mouseleave:function(){},itemmouseenter:function(){},itemmouseleave:function(){},itemclick:function(){}}
})(jQuery);Global.Alerter={create:function(){if(!("AlertBox" in App.windows)){var C,A,B;App.windows.AlertBox=$.chess.window({parent:"#ontop-container",ontop:true,small:true,draggable:true,left:305,top:100,width:370,height:170,caption:"ChessEmpires.com",resize:function(D){C.setSize(D.client)},widgets:[C=$.chess.frame({left:0,top:0,widgets:[A=$.chess.label({top:10,left:10,width:330,height:85,color:"#fff",fontSize:"14px",lineHeight:"18px"}),B=$.chess.button({left:145,bottom:5,width:56,caption:"Close",click:function(){App.windows.AlertBox.hide();
$.chess.hideOverlay();(App.windows.AlertBox.data("onclose")||function(){})()}})]})]}).hide();App.windows.AlertBox.setMessage=function(E,D){A.setText(E);B.setCaption(D);return App.windows.AlertBox};Global.alert=function(){Alerter.showMessageBox.apply(Global,arguments)};$(document).keyup(function(D){if(App.windows.AlertBox.is(":visible")&&(D.which=13||D.which==32||D.which==27)){B.click()}})}},showMessageBox:function(C,D,B,A){$.chess.showOverlay();
$.chess.hideAnimation();App.windows.AlertBox.setCaption(D||"ChessEmpires.com").data("onclose",B||function(){}).setMessage(C,A||LANG.CLOSE).show()}};(function(){Function.prototype.attach=function(B,A){if(!this.attached_listeners){this.attached_listeners=[]}this.attached_listeners.push({fn:B,context:A||this.defaultContext||this});return this.defaultContext||this};Function.prototype.invoke=function(){if(this.attached_listeners){for(var A=0;
A<this.attached_listeners.length;A++){this.attached_listeners[A].fn.apply(this.attached_listeners[A].context,arguments)}}return this.defaultContext||this};Function.prototype.invoke_apply=function(A){return this.invoke.apply(this,A)};window.ImagePreloader=function(A){if(!(this instanceof ImagePreloader)){return(new ImagePreloader(A)).load()}var F={};for(var D in ImagePreloader.options){if(D in A){F[D]=A[D]
}else{F[D]=ImagePreloader.options[D]}}var C=["complete","progress"];for(var B=0;B<C.length;B++){var E=C[B];this[E]=function(G){return arguments.callee.attach(G)};this[E].defaultContext=this;if(A[E]){this[E].attach(A[E])}}this.add(F.images)};ImagePreloader.prototype={image_list:{},last_id:0,total:0,completed:0,total_bytes:0,completed_bytes:0,succeeded:[],failed:[],load:function(){for(var C in this.image_list){if(C.length&&this.image_list[C]){this.image_list[C].start()
}}var A=this,B=setInterval(function(){A.progress.invoke(A.completed,A.total,A.completed_bytes,A.total_bytes);if(A.total==A.completed){clearInterval(B);A.complete.invoke(A.completed,A.total,A.completed_bytes,A.total_bytes)}},this.interval)},add:function(G,D){if(G.constructor==Array){for(var C=0;C<G.length;C++){this.add(G[C])}}else{if(G.constructor!=String&&("src" in G)){D=G.size||0;G=G.src}D=D||0;this.total_bytes+=D;
this.total++;var H="i"+(this.last_id++),F=G,A=D,B=this;var E=this.image_list[H]={obj:null,start:function(){E.obj=new Image();E.obj.onabort=E.obj.onerror=function(){B.completed++;B.completed_bytes+=A;B.failed.push({src:F,size:A});E.free()};E.obj.onload=function(){B.completed++;B.completed_bytes+=A;B.succeeded.push({src:F,size:A});E.free()};E.obj.src=F},free:function(){E.obj.onload=E.obj.onabort=E.obj.onerror=null;
delete E.obj;delete B.image_list[H]}}}return this}};ImagePreloader.options={images:[],interval:250,precise:false}})();window.ImageList=[{src:"img/default/animbg.png",size:739},{src:"img/default/animfg.png",size:6424},{src:"img/default/arrows.png",size:333},{src:"img/default/blank.gif",size:43},{src:"img/default/btn-corners.png",size:895},{src:"img/default/btn-horisontal.png",size:164},{src:"img/default/btn-vertical.png",size:176},{src:"img/default/chat.png",size:691},{src:"img/default/chatbg.png",size:110},{src:"img/default/chatinfo.png",size:110},{src:"img/default/chb.png",size:2463},{src:"img/default/edt-corners.png",size:647},{src:"img/default/edt-horisontal.png",size:159},{src:"img/default/edt-vertical.png",size:162},{src:"img/default/footer.png",size:128},{src:"img/default/friendlist-border.png",size:126},{src:"img/default/friendlist-hover.png",size:282},{src:"img/default/frm-corners.png",size:197},{src:"img/default/frm-horisontal.png",size:120},{src:"img/default/frm-vertical.png",size:115},{src:"img/default/gamelist-bg.png",size:245},{src:"img/default/gamelist-hover.png",size:1185},{src:"img/default/gamesbox.png",size:235},{src:"img/default/glow-corners.png",size:748},{src:"img/default/glow-horisontal.png",size:170},{src:"img/default/glow-vertical.png",size:161},{src:"img/default/header.png",size:129},{src:"img/default/hsb-corners.png",size:466},{src:"img/default/hsb-thumb.png",size:250},{src:"img/default/hsb-tile.png",size:140},{src:"img/default/ie6box.gif",size:1663},{src:"img/default/ind-rank-bg.png",size:434},{src:"img/default/ind-rank-small-bg.png",size:153},{src:"img/default/ind-rank-small.png",size:220},{src:"img/default/ind-rank.png",size:1503},{src:"img/default/logo.png",size:1866},{src:"img/default/lst-cbo-center.png",size:153},{src:"img/default/lst-cbo-corners.png",size:775},{src:"img/default/lst-cbo-horisontal.png",size:439},{src:"img/default/lst-cbo-vertical.png",size:214},{src:"img/default/lst-corners.png",size:643},{src:"img/default/lst-horisontal.png",size:427},{src:"img/default/lst-vertical.png",size:185},{src:"img/default/lsti-corners.png",size:179},{src:"img/default/lsti-tile.png",size:110},{src:"img/default/minbutton.png",size:118},{src:"img/default/opponent.png",size:2275},{src:"img/default/opt.png",size:1278},{src:"img/default/overlay-corners.png",size:234},{src:"img/default/overlay-tile.png",size:125},{src:"img/default/shared-center-d.png",size:109},{src:"img/default/shared-center-h.png",size:109},{src:"img/default/shared-center-n.png",size:109},{src:"img/default/slb-button.png",size:619},{src:"img/default/tab-buttons.png",size:583},{src:"img/default/tab-corners.png",size:184},{src:"img/default/tab-horisontal.png",size:119},{src:"img/default/tab-vertical.png",size:117},{src:"img/default/user-thumb.png",size:1630},{src:"img/default/user.png",size:12500},{src:"img/default/vsb-corners.png",size:477},{src:"img/default/vsb-thumb-corners.png",size:2829},{src:"img/default/vsb-thumb-tile.png",size:131},{src:"img/default/vsb-tile.png",size:174},{src:"img/default/wait_big.gif",size:9427},{src:"img/default/wait_small.gif",size:3498},{src:"img/default/waiting.gif",size:5665},{src:"img/default/wnd-center.png",size:109},{src:"img/default/wnd-corners.png",size:604},{src:"img/default/wnd-horisontal.png",size:133},{src:"img/default/wnd-vertical.png",size:135},{src:"img/default/wnd2-corners.png",size:529},{src:"img/default/wnd2-horisontal.png",size:135},{src:"img/default/wnd3-corners.png",size:533},{src:"img/default/wnd3-horisontal.png",size:139},{src:"img/default/x.png",size:184},{src:"img/armies.png",size:39775},{src:"img/opponent.png",size:2275},{src:"img/createacc.png",size:6570},{src:"img/smilies/01.gif",size:1045},{src:"img/smilies/02.gif",size:1049},{src:"img/smilies/03.gif",size:1046},{src:"img/smilies/04.gif",size:1044},{src:"img/smilies/05.gif",size:1048},{src:"img/smilies/06.gif",size:1041},{src:"img/smilies/07.gif",size:1050},{src:"img/smilies/08.gif",size:1044},{src:"img/smilies/09.gif",size:1048},{src:"img/smilies/10.gif",size:1050},{src:"img/smilies/11.gif",size:1046},{src:"img/smilies/12.gif",size:1050},{src:"img/smilies/13.gif",size:1033},{src:"img/smilies/14.gif",size:1036},{src:"img/smilies/15.gif",size:1048},{src:"img/smilies/16.gif",size:1049},{src:"img/default/flashbtn.png",size:408}];
Global.App={windows:{},params:{},requests:[],heartbeat:1000,timings:{chat:2,noties:2,noties_perm:8,game_ping:16,game:2,timeout:30,collector:3,friend_list:60},starttime:0,started:false,reset_counters:true,servers:[],armyName:["Carthage","Celts","Egypt","Greek","Persian","Roman"],defaults:{avatar_url:"img/default/user.png",thumb_url:"img/default/user-thumb.png"},redirect:function(A){if(A=="/logout.php"){this.clearBroadcastedCookies()
}else{if(Game.running.length+Game.waiting.length){window.open(A);return}}$("#page").hide();location.href=A},request:function(C){var A=$.copy(C);if((A.repeat>0)&&!A.failedRequests){A.failedRequests=0;A.wait=3}if(!A.skipUpdate&&(A.page=="comm.php")){this.updateQuery(A.data,A.data&&A.data.cmd)}if(!A.timestamp){A.timestamp=$.chess.timestamp()}if(App.reset_counters){A.data.reset_counters=true;App.reset_counters=false
}try{$.ajax({type:"POST",url:(App.servers[A.server]||App.servers[0])+(A.page||""),dataType:"json",data:A.data||{},cache:false,complete:function(){(A.oncomplete||function(){})();(A.complete||function(){})(A);if(!A.skipUpdate){App.startPolling()}},success:function(D){A.succeded=true;(A.success||function(){}).apply(this,arguments);if(D.cookie){$.each(D.cookie.clear||[],function(){App.writeCookie(this,"",-1)
});$.each(D.cookie.set||[],function(){if(this.name=="sid"&&App.readCookie("sid",this.value)!=this.value){$("body").triggerHandler("newsession",[]);App.clearBroadcastedCookies();App.iframe.sc("auth",'"'+App.readCookie("sid","")+'"')}App.writeCookie(this.name,this.value,this.expires,true)})}if(D.status=="OK"){if(D.data.notifications){if(D.data.notifications.offset.notify){Notifications.lastNoty=D.data.notifications.offset.notify
}if(D.data.notifications.offset.notify_perm){Notifications.lastNotyPerm=D.data.notifications.offset.notify_perm}$.each(D.data.notifications.msg,function(){if(this.type=="chat_req"){App.listen.cache.noties["id_"+this.data.msg_id]=true;Notifications.chat_req(this.data.msg_id,this.data)}App.broadcast_addNotification("id_"+this.data.msg_id,this)})}if(D.data.chats){$.each(D.data.chats,function(E){$.each(this,function(){var F,G={id:E,msg_id:this.msg_id||this.queue_id,type:this.type,sender:this.sender,data:this.data,time:this.stamp,u:((F=Chat.getSession(E))&&(F.session.user_id))||0};
Chat[this.type=="cmd"?"command":"message"](E,this.msg_id||this.queue_id,this.sender,this.data,this.stamp)})})}if(D.data.games){$.each(D.data.games,function(E){if(!E.length){return true}if(this.type.substr(0,4)=="end_"){this.status=this.type.substr(4);this.type="end_game"}if(Game[this.type]){Game[this.type](E,this)}})}if(D.data.friends){Friends.update_status(D.data.friends)}}},error:function(E,D){if(A.repeat-->0||D==0){A.failedRequests++;
(A.failed||function(){}).apply(this,arguments);A.wait+=7;setTimeout(function(){App.request(A)},A.wait*1000)}else{if((D=="timeout")||(A.failedRequests>0)){(A.timeout||function(){}).apply(this,arguments);return}}(A.error||function(){}).apply(this,arguments)},global:typeof A.global=="boolean"?A.global:true})}catch(B){(C.error||function(){})("",B);(C.oncomplete||function(){})("",B);(C.complete||function(){})("",B)
}},updateQuery:function(E,F){if(Global.Footbar==undefined){return false}var B=$.chess.timestamp()-this.starttime,A=false,C,G,D;if(F){this.stopPolling()}if(F||!this.started||B%this.timings.noties==0){E.notify=Notifications.lastNoty;A=true}if(F||!this.started||B%this.timings.noties_perm==0){E.notify_perm=Notifications.lastNotyPerm;A=true}if((F||(B%this.timings.game==0))&&((C=Game.getGameList())!==undefined)){E.game_list=C;
A=true}if((F||(B%this.timings.game_ping==0))&&((G=Game.getGamePingList())!==undefined)){E.game_ping_list=G;A=true}if((F||(B%this.timings.chat==0))&&((D=Chat.getChatList())!==undefined)){E.chat_list=D;A=true}if(Global.Friends&&(F||B%this.timings.friend_list==0)){A=E.friend_list=true}this.started=true;return A},pollTimer:false,startPolling:function(){if(Global.Footbar==undefined||this.pollTimer!==false){return
}this.pollTimer=setInterval(function(){var A={};if(App.updateQuery(A)){App.stopPolling();App.request({page:"comm.php",data:A,skipUpdate:true,oncomplete:function(){App.startPolling()}})}},this.heartbeat)},stopPolling:function(){clearInterval(this.pollTimer);this.pollTimer=false},storeValue:function(A,B){App.writeCookie(A,jsonify(B))},restoreValue:function(name){var value;eval("value="+App.readCookie(name));
return value||0},extendValue:function(A,B){var D=Array.prototype.slice.call(arguments,1),C=this.restoreValue(A)||[];if(C.constructor==Array){Array.prototype.push.apply(C,D)}else{D.unshift(C);$.extend.apply(Global,D)}this.storeValue(A,C)},readCookie:function(C,B){var A=B;$.each(document.cookie.split(";"),function(){var D=$.trim(this);if(D.indexOf(C+"=")==0){A=unescape(D.substr(C.length+1));return false
}});return A},writeCookie:function(B,F,H,E){var D=".chessempires.com",A="",C=escape(B)+"="+escape(F);if(H){var G=new Date();G.setTime(H*(E?1000:86400000));A="; expires="+G.toGMTString()}document.cookie=C+A+"; path=/; domain="+D;return F},handleError:function(A,E,D,F){if(!A||A.constructor!=String){return""}F=F||{};if(D&&D.constructor!=String&&!F){F=D;D=""}function B(G){return G[0].toUpperCase()+G.substr(1).toLowerCase()
}function C(G){return(F[G]||"%field%").replace(/%field%/g,E)}switch(A){case"INVALID_VALUE":return B(C("invalid"))+LANG.CONTAINS_INVALID_CHARS;case"INVALID_INPUT":return B(C("invalid"))+LANG.IS_NOT_VALID;case"INVALID_PARAMS":return LANG.INVALID_PARAMS;case"USER_EXISTS":return LANG.ALREADY_TAKEN.replace("%field%",E);case"NO_USER":return LANG.NO_REG_USER;case"MAIL_FAILED":return LANG.MAIL_FAILED;case"NO_GAME":return LANG.OPPONENT_CANCELED_REQUEST;
case"PASS_DONT_MATCH":return LANG.PASS_DONT_MATCH;case"OVER_MAX_LENGTH":return B(C("max_length"))+LANG.TOO_LONG;case"UNDER_MIN_LENGTH":return B(C("min_length"))+LANG.TOO_SHORT;case"OVER_MAX_VALUE":return B(C("max_value"))+LANG.TOO_BIG;case"UNDER_MIN_VALUE":return B(C("min_value"))+LANG.TOO_SMALL;case"REQUIRED_FIELD":return LANG.REQUIRED_FIELD.replace("%field%",C("required"));case"LOGIN_FAILED":return LANG.LOGIN_FAILED;
case"ACCOUNT_DISABLED":return LANG.ACCOUNT_DISABLED;case"LOGIN_REQ":return LANG.LOGIN_REQUIRED;case"DB_ERROR":return LANG.DATABASE_ERROR;case"INTERNAL_ERROR":return LANG.INTERNAL_ERROR;case"WRONG_PASS":return LANG.WRONG_PASSWORD;case"UNEXPECTED_ERROR":default:return LANG.UNEXPECTED_ERROR}},disappearOthers:function(){this._hideOthers("appear","disappear",arguments)},hideOthers:function(){this._hideOthers("show","hide",arguments)
},_hideOthers:function(A,C,E){var F=$.copy(App.windows);for(var B=0;B<E.length;B++){if(!(E[B] in F)){continue}F[E[B]][A]();delete F[E[B]]}for(var D in F){F[D][C]()}},show:function(){this._show("show",arguments)},appear:function(){this._show("appear",arguments)},_show:function(A,C){for(var B=0;B<C.length;B++){if(!(C[B] in App.windows)){continue}App.windows[C[B]][A]()}},filterString:function(A){var C=[/:\)(?!\))/g,"=)",/:(\){2,}|D+)/gi,":(",";)",/:o/gi,":-)",":|",/:(\/(?!\/)|\\)/g,/:p/gi,":'(",/:x/gi,/8\)(?!\))/g,/8(\){2,}|D+)/gi,":'",/o\)/gi];
for(var B=0;B<C.length;B++){A=A.replace(C[B],'<img src="img/smilies/'+("00"+(B+1)).substr(-2)+'.gif" width="16" height="16" />')}return A.replace(/\b((?:(f|ht)tps?\:\/\/)[\w\$\-\.\+\!\*\'\(\),%:\/]+\.[a-z]{2,6})\b/gi,'<a href="$1" target="_blank">$1</a>').replace(/\b((?:www\.)[\w\$\-\.\+\!\*\'\(\),%:\/]+\.[a-z]{2,6})\b/gi,'<a href="http://$1" target="_blank">$1</a>').replace(/\b([\w\-.\+]+@[\w.\-]+\.[a-z]{2,6})\b/gi,'<a href="mailto:$1">$1</a>')
},iframe:null,broadcast_queue:{},initIFrame:function(){var C=$('<iframe name="owen" id="owen" src="/owen/cookies.php" />').css({position:"absolute",left:-100,top:-100,width:"1px",height:"1px"}).appendTo("body")[0];var A=null,B=function(){clearTimeout(A);A=null;if(C.contentWindow&&C.contentWindow.ok){App.iframe=C.contentWindow;$.each(App.broadcast_queue,function(F){if(F.length){App.broadcast(F,this)
}});App.broadcast_queue={};if(location.href.match(/index\.php/)){App.clearBroadcastedCookies()}else{App.iframe.sc("auth",'"'+App.readCookie("sid","")+'"')}if(location.href.match(/\?act=([0-9]+)$/i)){var E,D=App.receive(E="a"+RegExp.$1,{cmd:"unknown"});switch(D.cmd){case"join_game":Game.joinGame(D.data);break;case"wait_for_game":D.data.wait_item=WaitList.addItem('<a href="javascript:User.viewProfile('+D.data.opponent.id+'")>'+D.data.opponent.name.split(/\s/)[0]+"</a>"+LANG.WAITING_TO_ACCEPT_INVITATION);
Game.newGame(D.data);break}App.iframe.sc(E,"",true)}}else{A=setTimeout(B,10)}};A=setTimeout(B,10)},broadcast:function(A,C,B){if(this.iframe){this.iframe.sc(A,B?C:jsonify(C))}else{this.broadcast_queue[A]=C}},delayTimer:null,delayGCExecution:function(A){this.allowCollecting=false;if(this.delayTimer!=null){clearTimeout(this.delayTimer)}this.delayTimer=setTimeout(function(){App.allowCollecting=true;App.delayTimer=null
},(A||3)*1000)},receive:function(name,defaultValue){if(this.iframe){var v;eval("v="+this.iframe.gc(name,jsonify(defaultValue)));return v||defaultValue}return this.broadcast_queue[name]||defaultValue},clearBroadcastedCookies:function(){if(!(this.iframe&&this.iframe.sc)){return}$.each(this.receive("nlist","").split(","),function(){App.iframe.sc("n"+this,"",true)});App.iframe.sc("nlist","",true);$.each(this.receive("nremlist","").split(","),function(){App.iframe.sc("n"+this,"",true)
});App.iframe.sc("nremlist","",true);App.iframe.sc("clist","",true)},broadcast_addNotification:function(A,B){var C=this.receive("nlist","");if(!C.match(new RegExp("(^|,)"+A+"(,|$)"))){this.delayGCExecution();this.broadcast("nlist",C+(C.length?",":"")+A);this.broadcast("n"+A,B)}},broadcast_removeNotification:function(B,E){var D=this.receive("nlist","");var C=new RegExp("(^|,)"+B+"(,|$)");if(D.match(C)){var A=this.receive("nremlist","");
if(!A.match(C)){this.delayGCExecution();this.broadcast("nlist",D.replace(C,"$2").replace(/^,/,""));this.broadcast("nremlist",A+(A.length?",":"")+B);this.broadcast("n"+B,E)}}},broadcast_addChat:function(D,A){var C=this.receive("clist","");var B=new RegExp("(^|,)"+D+":[0-9]+(,|$)");if(!C.match(B)){this.delayGCExecution();this.broadcast("clist",C+(C.length?",":"")+D+":"+A)}},broadcast_removeChat:function(C){var B=this.receive("clist","");
var A=new RegExp("(^|,)"+C+":[0-9]+(,|$)");if(B.match(A)){this.delayGCExecution();this.broadcast("clist",B.replace(A,"$2").replace(/^,/,""))}},broadcast_action:function(B,A){var C=this.starttime+""+Math.ceil(Math.random()*100001);this.delayGCExecution();this.broadcast("a"+C,{cmd:B,data:A});return C},garbageCollectCookies:function(){if(!App.allowCollecting){return}A("nlist");A("nremlist");function A(B){$.each(App.receive(B,"").split(","),function(){App.iframe.sc("n"+this,"",true)
});App.iframe.sc(B,"",true)}},collectorTimer:null,allowCollecting:true,startGC:function(){App.collectorTimer=setInterval(function(){App.garbageCollectCookies()},App.heartbeat*App.timings.collector)},stopGC:function(){clearInterval(App.collectorTimer);App.collectorTimer=null},listen:function(){var A;if(App.receive("auth")!=(A=App.readCookie("sid",""))){App.clearBroadcastedCookies();App.iframe.sc("auth",'"'+A+'"');
return}var B;if(!("cache" in arguments.callee)){B=arguments.callee.cache={noties:{},deleted:{}}}else{B=arguments.callee.cache}var D=App.receive("nlist","");$.each(D.split(","),function(){if(this.length&&!(this in B.noties)){B.noties[this]=true;var E=App.receive("n"+this,{type:"unknown",data:{}});if(Notifications[E.type]){Notifications[E.type](this,E.data)}}});var C=App.receive("nremlist","");$.each(C.split(","),function(){if(this.length&&!(this in B.deleted)&&(this in B.noties)){delete B.noties[this];
B.deleted[this]=true;Notifications.markAsRead(this,App.receive("n"+this,""))}});$.each(App.receive("clist","").split(","),function(){if(!this.length||this.indexOf(":")==-1){return true}Chat.joinSession(this.split(":")[1],this.split(":")[0])})},run:function(){$.ajaxSetup({timeout:this.timings.timeout*this.heartbeat});if(Global.BotList){Global.Bots={};for(var B=0;B<BotList.length;B++){Bots["id_"+BotList[B].id]=B;
if(!BotList[B].avatar.length){BotList[B].avatar=App.defaults.thumb_url}else{if(!BotList[B].avatar.match(/-thumb\.png$/i)){BotList[B].avatar=BotList[B].avatar.substr(0,BotList[B].avatar.length-4)+"-thumb.png"}}BotList[B].image=BotList[B].avatar;BotList[B].short_name=BotList[B].name+=' <span style="color:#ddd;font-size:9px;letter-spacing:0.6px;padding-left:3px;"> (CPU)</span>'}}this.initIFrame();if($.historyInit){$.historyInit(function(E){$("body").triggerHandler("history",[E,false])
})}$.chess.initialize();$("#header").show();if(Global.User){User.short_name=User.name.split(/\s/)[0];if(!User.avatar.length){User.avatar=this.defaults.avatar_url}}Alerter.create();(Global.main||function(){})();$("#static-html").remove();if($.historyInit&&(location.hash.length>1)){$("body").triggerHandler("history",[location.hash.substr(1),true])}this.starttime=$.chess.timestamp();if(Global.Friends){if(typeof UserFriendList=="undefined"){UserFriendList=undefined
}Friends.add(UserFriendList);var C=App.restoreValue("x_sessions"),A=App.restoreValue("x_chatbar");if(C.length){$.each(C,function(){if(Friends.get(this.user).online){Chat.joinSession(this.user,this.id,A.selected!=this.user)}})}if(Global.Dashboard){Dashboard.updateRankings()}}this.startPolling();if(Global.Notifications&&Global.Chat){setInterval(this.listen,this.heartbeat);App.startGC()}var D;if(!(D=$("#footerwrapper")).is(".static")){D.prependTo("body")
}}};if($.browser.msie){String.prototype.substr_native=String.prototype.substr;String.prototype.substr=function(D,C){if(D>=0){return this.substr_native(D,C)}if(this.length==0||C==0){return""}var B=this.length+D,A=(!isNaN(C)*C||this.length)+B;return this.substring(B,A)}}$.extend({date:function(M,C,E){var O=new Date;if(E){O.setTime(Date.parse(C.replace(/-/g,"/")))}else{if(C){O.setTime(C*1000)}}function B(T){var S=T.getYear()%100;
return S+1900+100*(S<38)}function J(U,T){var V="";T=T||2;for(var S=0;S<T;S++){V+="0"}return(V+U).substr(-T)}var Q=O.getDate(),K=O.getDay(),R=O.getMonth(),F=B(O),N=O.getHours(),I=O.getMinutes(),G=O.getSeconds(),H=N>=12?"pm":"am";var D=[LANG.MONTH_JAN,LANG.MONTH_FEB,LANG.MONTH_MAR,LANG.MONTH_APR,LANG.MONTH_MAY,LANG.MONTH_JUN,LANG.MONTH_JUL,LANG.MONTH_AUG,LANG.MONTH_SEP,LANG.MONTH_OCT,LANG.MONTH_NOV,LANG.MONTH_DEC],L=[LANG.DAY_SUN,LANG.DAY_MON,LANG.DAY_TUE,LANG.DAY_WED,LANG.DAY_THU,LANG.DAY_FRI,LANG.DAY_SAT];
function P(S){return S.replace("|","%PP")}function A(S){return S.replace("%PP","|")}return A(P(M).replace(/([aAgGhHisYyFmMndDjlNSw])/g,"|$1|").replace("|a|",H).replace("|A|",H.toUpperCase()).replace("|g|",N>12?N-12:N).replace("|G|",N).replace("|h|",J(N>12?N-12:N)).replace("|H|",J(N)).replace("|i|",J(I)).replace("|s|",J(G)).replace("|Y|",F).replace("|y|",(F+"").substr(-2)).replace("|F|",D[R]).replace("|m|",J(R+1)).replace("|M|",D[R].substr(0,3)).replace("|n|",R+1).replace("|d|",J(Q)).replace("|D|",L[K].substr(0,3)).replace("|j|",Q).replace("|l|",L[K]).replace("|N|",K+7*!K).replace("|S|",Q>3?"th":["st","nd","rd"][Q-1]).replace("|w|",K))
},copy:function(){Array.prototype.unshift.call(arguments,{});return this.extend.apply(this,arguments)},plural:function(A,C,B){A=parseInt(A);return(A==11||A%10!=1)?C||"":B||""},param:function(A){var D=[];function E(F,G){if(G.constructor==Boolean){G=1*G}D[D.length]=encodeURIComponent(F)+"="+encodeURIComponent(G)}function C(F,H){if(H==undefined){return}if(H.constructor==Array||H.constructor==Object){for(var G in H){C(F+"["+G+"]",H[G])
}}else{E(F,H)}}if(A.constructor==Array||A.jquery){jQuery.each(A,function(){E(this.name,this.value)})}else{for(var B in A){C(B,A[B])}}return D.join("&")}});$(function(){if(!window.opera&&document.compatMode&&document.all&&(typeof document.documentElement.style.maxHeight=="undefined")){App.run();$.chess.showOverlay();$("<div/>").css({margin:"90px auto",width:441,height:265,background:"url(img/default/ie6box.gif) no-repeat",position:"relative"}).append($("<h2>"+LANG.OLD_IE_TITLE+"</h2>").css({color:"#f9d300","font-size":"21px",width:"100%","text-align":"center","font=weight":"normal","margin-bottom":"30px"})).append($("<p>"+LANG.OLD_IE_MESSAGE+"</p>").css({color:"#fff","font-size":"14px","text-align":"left","line-height":"20px",padding:"0 25px","font=weight":"normal"})).append($('<p><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">'+LANG.UPGRADE_IE+'</a><br /><a href="http://www.firefox.com">'+LANG.SWITCH_TO_FIREFOX+'</a><br /><a href="http://www.apple.com/safari">'+LANG.SWITCH_TO_SAFARI+"</a></p>").css({"font-size":"14px","text-align":"left","line-height":"22px",padding:"12px 25px 0 25px","font=weight":"normal"})).appendTo("#ontop-container")
}else{if("error_msg" in window){Alerter.create();alert(App.handleError(window.error_msg)+"\n\n"+LANG.CLICK_OK_TO_CONTINUE,LANG.ERROR,function(){location.href="/index.php"},LANG.OK)}else{if(window.RunPreloader&&!$.browser.msie){$("body>*").hide();var A=$('<div id="preloader"><div id="preloader-logo" /><div id="preloader-text">'+LANG.LOADING+'</div><div id="preloader-border"><div id="preloader-bar" /></div></div>').css({width:180,height:90,margin:"210px auto 0 auto",position:"relative"}).appendTo("body").find(">#preloader-logo").css({position:"absolute",left:15,top:4,width:149,height:35,background:"url(img/default/logo.png) no-repeat"}).end().find(">#preloader-text").css({position:"absolute",left:0,bottom:0,width:180,height:20,"line-height":"20px","font-size":"12px","text-align":"center",color:"#eadb00"}).end().find(">#preloader-border").css({position:"absolute",left:6,top:51,width:166,height:9,border:"1px solid #eadb00"}).find(">#preloader-bar").css({position:"absolute",left:1,top:1,width:1,height:7,background:"#eadb00",overflow:"hidden"}).append($("<div/>").css({position:"absolute",right:0,top:0,width:44,height:7,background:"url(img/loadgrad.png) repeat-y"}));
var B=$("base").attr("href");$.each(ImageList,function(D){ImageList[D].src=B+ImageList[D].src});ImageList.push({src:B+"img/bg0.jpg",size:271284});ImagePreloader({images:ImageList,precise:true,progress:function(F,G,E,D){A.stop().animate({width:(E/D)*164},100)},complete:function(F,G,E,D){setTimeout(function(){$("body>#preloader").remove();$("body>#page,body>#footerwrapper").show();$("body").addClass("bg0");
try{delete window.ImageList;window.ImageList=null}catch(H){}App.run()},500)}})}else{try{delete window.ImageList;window.ImageList=null}catch(C){}$("body").addClass("bg0");App.run()}}}});Global.Invite={wnd:null,box1:null,box2:null,box3:null,create:function(){var A,G,D,F,C,E,B;Invite.wnd=$.chess.window({parent:"#ontop-container",ontop:true,draggable:true,left:276,top:100,width:428,height:272,caption:LANG.WND_INVITE_FRIENDS_TITLE,resize:function(H){Invite.box1.setSize(H.client);
Invite.box2.setSize(H.client);Invite.box3.setSize(H.client)},widgets:[this.box1=$.chess.frame({left:0,top:0,widgets:[$.chess.label({left:8,top:8,width:388,height:85,color:"#fff",fontSize:"14px",lineHeight:"17px",text:LANG.WND_INVITE_FRIENDS_TEXT}),$.chess.label({left:18,top:96,text:LANG.WND_INVITE_FRIENDS_EMAIL}),A=$.chess.editbox({left:142,top:92,width:240,keyup:function(H){if(H.which==13){G.find("input").focus()
}}}),$.chess.label({left:18,top:136,text:LANG.WND_INVITE_FRIENDS_PASSWORD}),G=$.chess.editbox({left:142,top:132,width:240,type:"password",keyup:function(H){if(H.which==13){D.click()}}}),D=$.chess.button({right:14,bottom:14,width:70,caption:LANG.WND_INVITE_FRIENDS_BTN_SUBMIT,click:function(){Invite.wnd.hide();$.chess.showAnimation();App.request({page:"invitations.php",data:{login:A.getText(),pass:G.getText()},success:function(H){$.chess.hideAnimation();
if(H.status=="OK"){for(var I=0;I<H.data.length;I++){H.data[I].value=CHECKBOX_CHECKED}F.clear().addItems(H.data);Invite.wnd.show();Invite.show_box(2)}else{if(H.data=="UNSUPPORTED_ERR"){Invite.wnd.show();Invite.show_box(3)}else{if(H.data=="FAILED_LOGIN_ERR"){alert(LANG.WND_INVITE_FRIENDS_LOGIN_FAILED,LANG.ERROR,Invite.show)}else{alert(LANG.WND_INVITE_FRIENDS_CANT_FETCH_ADDRESSBOOK,LANG.ERROR,Invite.show)
}}}},error:function(){$.chess.hideAnimation();alert(LANG.WND_INVITE_FRIENDS_SERVER_ERROR)}})}}),$.chess.button({right:94,bottom:14,width:70,caption:LANG.CANCEL,click:function(){Invite.wnd.hide();$.chess.hideOverlay()}}),$.chess.label({left:10,top:172,fontSize:"11px",lineHeight:"14px",color:"#ccc",text:LANG.WND_INVITE_FRIENDS_DISCLAIMER})]}),this.box2=$.chess.frame({left:0,top:0,widgets:[$.chess.label({left:8,top:8,width:388,color:"#fff",fontSize:"14px",lineHeight:"17px",text:LANG.WND_INVITE_FRIENDS_SELECT_EMAILS}),F=$.chess.checklist({left:12,top:55,width:370,height:98,items:[]}),C=$.chess.button({right:14,bottom:14,width:70,caption:LANG.WND_INVITE_FRIENDS_BTN_SUBMIT,click:function(){Invite.wnd.hide();
$.chess.showAnimation();var K=[],H=F.getCount();for(var I=0;I<H;I++){var J=F.getItem(I);if(J.value){K.push(J.email)}}App.request({page:"invitations.php",data:{invites:K},complete:function(){$.chess.hideAnimation();alert(LANG.WND_INVITE_FRIENDS_SUCCESS)}})}}),$.chess.button({right:94,bottom:14,width:70,caption:LANG.CANCEL,click:function(){Invite.wnd.hide();$.chess.hideOverlay()}})]}),this.box3=$.chess.frame({left:0,top:0,widgets:[$.chess.label({left:8,top:8,width:388,height:85,color:"#fff",fontSize:"14px",lineHeight:"17px",text:LANG.WND_INVITE_FRIENDS_NOT_SUPPORTED}),E=$.chess.textarea({left:12,top:88,width:370,height:72}),B=$.chess.button({right:14,bottom:14,width:70,caption:LANG.WND_INVITE_FRIENDS_BTN_SUBMIT,click:function(){Invite.wnd.hide();
$.chess.showAnimation();var J=[],I=E.getText().match(/([\w\-.\+]+@[\w.\-]+\.[a-z]{2,6})([\n\r\s,;]+|$)/ig);if(I&&I.length){for(var H=0;H<I.length;H++){J.push(I[H].replace(/[\n\r\s,;]*$/,""))}App.request({page:"invitations.php",data:{invites:J},complete:function(){$.chess.hideAnimation();alert(LANG.WND_INVITE_FRIENDS_SUCCESS)}})}}}),$.chess.label({left:18,top:172,fontSize:"11px",lineHeight:"14px",color:"#ccc",text:LANG.WND_INVITE_FRIENDS_COMMA_INFO}),$.chess.button({right:94,bottom:14,width:70,caption:LANG.CANCEL,click:function(){Invite.wnd.hide();
$.chess.hideOverlay()}})]})]}).hide();this.box2.hide();this.box3.hide()},show:function(){$.chess.showOverlay();Invite.show_box(1);Invite.wnd.show()},show_box:function(A){Invite.box1[A==1?"show":"hide"]();Invite.box2[A==2?"show":"hide"]();Invite.box3[A==3?"show":"hide"]()}};Global.Header={create:function(){var A=$("#board").length>0,F=A?null:function(){App.redirect("/dashboard.php")},J=A?{}:{cursor:"pointer"};
$.chess.layer({parent:"#header",left:50,top:3,width:149,height:35,css:J,html:$.chess.transPNG("img/default/logo.png",149,35),click:F}).show();var K=App.readCookie("sid","").length==35,Q,G,L,C,E=function(T){if(T&&T.which==13){if(Q.getText().length>=1){L.click()}}else{var S=$.trim(Q.getText().toLowerCase()),R=[];if(S.length<1){L.disable();G.hide();return}L.enable();if(!K){return}$.each(Friends.friends,function(){if(this.name.length==0){return
}var V=$.trim(this.name.toLowerCase()).split(/\s+/g),U=S.split(/\s+/g);if(V.length>2){V=[V[0],V.slice(1).join(" ")]}if(U.length>2){U=[U[0],U.slice(1).join(" ")]}if((V[0].substr(0,U[0].length)==U[0])||((V.length==2)&&(U.length==1)&&(V[1].substr(0,U[0].length)==U[0]))||((V.length==2)&&(U.length==2)&&((V[1].substr(0,U[1].length)==U[1])||(V[0].substr(0,U[1].length)==U[1])))){R.push({name:this.name,id:this.id,avatar:this.avatar})
}});R.sort(function(V,U){if(X==W){return 0}var X=V.name.toLowerCase(),W=U.name.toLowerCase();return[X,W].sort()[0]==X?-1:+1});if(!R.length){G.clear().hide()}else{G.setSize({height:R.length<6?R.length*28+10:178}).clear().addItems(R).show()}}};if(K){Invite.create();var M=LANG.FIND_PEOPLE;Q=$.chess.editbox({right:400,top:10,width:300,height:24,parent:"#header",text:M,focus:function(){if(Q.getText()==M){Q.setText("")
}E();L.show();buffer=""},blur:function(){if($.chess.activeControl.$&&($.chess.activeControl.$[0]==G[0]._$$.list[0]||$.chess.activeControl.$[0]==L[0])){return}if(Q.getText().length==0){Q.setText(M)}L.hide();G.hide()},keyup:function(V){if(V.which==38||V.which==40){if(G.is(":visible")){var W=V.which-39,S=G.find(".searchlist-item"),U=S.find(".hover").index(S.find(".hover:visible")[0]||null);U=U==-1?(W+1?0:S.length-1):U+W;
if(U<0){U=S.length-1}else{if(U>=S.length){U=0}}G[S.length<6?"enable":"scrollIntoView"](U).find(".hover:visible").hide().end().find(".hover:eq("+U+")").show();V.preventDefault();return}}else{if(V.which==13){var T;if((T=G.find(".hover:visible")).length){var R=G.getItem(G.find(".hover").index(T[0]));Q.find(">input").blur();User.viewProfile(R.id,true);return}}}E(V)},resize:function(){if(Q){var R=Q.find(">input");
R.width(R.width()-52)}}}).show();Q.find(">input").css({"font-style":"normal",color:"#e7c200","padding-left":"5px"});G=$.chess.searchlist({left:340,top:-11,width:300,height:50,itemclick:function(S,R){User.viewProfile(R.id)}}).css("z-index",100000).hide();L=$.chess.button({right:394,top:-34,width:49,height:20,caption:LANG.BTN_SEARCH,fontSize:"10px",parent:"#header",click:function(){location.href="/search.php?srch="+Q.getText()
}}).hide().disable()}var P=[];var I=false;if(K){var H,D,O,B;Global.toggleQuickPlay=function(){App.windows.QuickPlay.toggle();if(App.windows.QuickPlay.is(":visible")){H.click()}};P.push([LANG.BTN_QUICK_PLAY,"javascript:void(toggleQuickPlay())"]);P.push([LANG.BTN_INVITE_FRIENDS,"javascript:void(Invite.show())"]);if(!("QuickPlay" in App.windows)){App.windows.QuickPlay=$.chess.window({small:true,parent:"#header",right:5,top:54,width:410,height:300,ontop:true,resizable:true,resizableOptions:{minHeight:220,minWidth:410,maxWidth:490},disableHandle:"e,n,ne,se,nw",caption:LANG.USERS_FOR_QUICK_PLAY,resize:function(R){B.setSize({width:R.client.width,height:R.client.height-34})
},widgets:[B=$.chess.quickplaylist({left:0,top:0,play:function(R){User.startGame(R.id,R.name,true)}}),$.chess.button({bottom:3,right:0,width:64,height:22,caption:LANG.CLOSE,click:function(){App.windows.QuickPlay.hide()}}),H=$.chess.button({bottom:3,right:75,width:66,height:22,caption:LANG.REFRESH,click:function(){N(0)}}),D=$.chess.checkbox({left:0,bottom:5,width:160,text:LANG.SIMILIAR_SKILLS,fontSize:"12px"}),O=$.chess.checkbox({left:145,bottom:5,width:100,text:LANG.MY_FRIENDS,fontSize:"12px"})]}).hide();
setInterval(function(){H.click()},30000);function N(S){var R=S;App.request({page:"quick_play.php",data:{cmd:"fetch",show_similiar:D.isChecked(),show_friends:O.isChecked(),page:S},success:function(T){if(T.status=="OK"){B.clear().addItems(T.data.users);if(S==0&&Global.BotList){B.addItems(BotList)}if(T.data.total>T.data.users.length){}if(R>0){}}}})}}}if(K){A?P.push([LANG.BTN_PROFILE,"javascript:void(App.redirect('/user/profile.php'))"]):P.push([LANG.BTN_MAIN,"/dashboard.php"]);
if(A){window.onbeforeunload=function(){if(Game.running.length+Game.waiting.length){return LANG.CLOSE_WARNNING}}}window.onunload=function(){}}if(K||!location.href.match(/index\.php/)||!location.href.match(/\.php/)){K?P.push([LANG.BTN_LOGOUT,"/user/logout.php"]):P.push([LANG.BTN_LOGIN_REGISTER,"/"])}$('<div id="linkbar">'+$.map(P,function(R){return'<a href="'+R[1]+'">'+R[0]+"</a>"}).join(" - ")+"</div>").appendTo("#header")
}};
