PageSourceSearch

https://schaaksite.nl/wp-content/cache/wpfc-minified/dhw0c40g/g1660.js

js schaaksite.nl collected 2026-09-24 10:00:40 UTC 552,641 bytes, 6 lines download raw bytes

1function getLocale(){if(navigator)return navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||void 0}function init_gettext(){"undefined"!=typeof json_locale_data&&(gt=new Gettext({domain:"js-messages",locale_data:json_locale_data}))}function _js(e){return gt?gt.gettext(e):e}function _has_translation(e){var t=getLocale();return!t||"en"==t.substring(0,2)||e!=_js(e)}function __js(e,t){for(var e=_js(e),i=0;i<t.length;i++){var s=new RegExp("{"+t[i][0]+"}","g");e=e.replace(s,t[i][1])}return e}function _jn(e,t,i){return gt?gt.ngettext(e,t,i):0==i||1<i?t:e}function __jn(e,t,i,s){return __gt_expand (_jn(e,t,i),s)}function __gt_expand (e,t){for(var i=0;i<t.length;i++){var s=new RegExp("{"+t[i][0]+"}","g");e=e.replace(s,t[i][1])}return e}Gettext=function(e){this.domain="messages",this.locale_data=void 0;var t=["domain","locale_data"];if(this.isValidObject(e))for(var i in e)for(var s=0;s<t.length;s++)i==t[s]&&this.isValidObject(e[i])&&(this[i]=e[i]);return this.try_load_lang(),this},Gettext.context_glue="�",Gettext._locale_data={},Gettext.prototype.try_load_lang=function(){if(void 0!==this.locale_data){var e=this.locale_data;if(this.locale_data=void 0,this.parse_locale_data(e),void 0===Gettext._locale_data[this.domain])throw new Error("Error: Gettext 'locale_data' does not contain the domain '"+this.domain+"'")}var t=this.get_lang_refs();if("object"==typeof t&&0<t.length)for(var i=0;i<t.length;i++){var s=t[i];if("application/json"==s.type){if(!this.try_load_lang_json(s.href))throw new Error("Error: Gettext 'try_load_lang_json' failed. Unable to exec xmlhttprequest for link ["+s.href+"]")}else{if("application/x-po"!=s.type)throw new Error("TODO: link type ["+s.type+"] found, and support is planned, but not implemented at this time.");if(!this.try_load_lang_po(s.href))throw new Error("Error: Gettext 'try_load_lang_po' failed. Unable to exec xmlhttprequest for link ["+s.href+"]")}}},Gettext.prototype.parse_locale_data=function(e){for(var t in void 0===Gettext._locale_data&&(Gettext._locale_data={}),e)if(e.hasOwnProperty(t)&&this.isValidObject(e[t])){var i,s=!1;for(i in e[t]){s=!0;break}if(s){var o,n=e[t];for(o in""==t&&(t="messages"),this.isValidObject(Gettext._locale_data[t])||(Gettext._locale_data[t]={}),this.isValidObject(Gettext._locale_data[t].head)||(Gettext._locale_data[t].head={}),this.isValidObject(Gettext._locale_data[t].msgs)||(Gettext._locale_data[t].msgs={}),n)if(""==o){var r,a=n[o];for(r in a){var l=r.toLowerCase();Gettext._locale_data[t].head[l]=a[r]}}else Gettext._locale_data[t].msgs[o]=n[o]}}for(var t in Gettext._locale_data)if(this.isValidObject(Gettext._locale_data[t].head["plural-forms"])&&void 0===Gettext._locale_data[t].head.plural_func){var h=Gettext._locale_data[t].head["plural-forms"];if(!new RegExp("^(\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;a-zA-Z0-9_()])+)","m").test(h))throw new Error("Syntax error in language file. Plural-Forms header is invalid ["+h+"]");h=Gettext._locale_data[t].head["plural-forms"];/;\s*$/.test(h)||(h=h.concat(";"));h="var plural; var nplurals; "+h+' return { "nplural":nplurals, "plural":(plural===true ? 1:plural ? plural:0) };';Gettext._locale_data[t].head.plural_func=new Function("n",h)}else void 0===Gettext._locale_data[t].head.plural_func&&(Gettext._locale_data[t].head.plural_func=function(e){return{nplural:2,plural:1!=e?1:0}})},Gettext.prototype.try_load_lang_po=function(e){var t=this.sjax(e);if(t){var i=this.uri_basename(e),e=this.parse_po(t),t={};return e&&(e[""]||(e[""]={}),e[""].domain||(e[""].domain=i),t[i=e[""].domain]=e,this.parse_locale_data(t)),1}},Gettext.prototype.uri_basename=function(e){var t;return(t=e.match(/^(.*\/)?(.*)/))?(e=t[2].match(/^(.*)\..+$/))?e[1]:t[2]:""},Gettext.prototype.parse_po=function(e){for(var t={},i={},s="",o=[],n=e.split("\n"),r=0;r<n.length;r++)if(n[r]=n[r].replace(/(\n|\r)+$/,""),/^$/.test(n[r])){if(void 0!==i.msgid){var a=void 0!==i.msgctxt&&i.msgctxt.length?i.msgctxt+Gettext.context_glue+i.msgid:i.msgid,l=void 0!==i.msgid_plural&&i.msgid_plural.length?i.msgid_plural:null,h=[];
1for(u in i)(c=u.match(/^msgstr_(\d+)/))&&(h[parseInt(c[1])]=i[u]);h.unshift(l),1<h.length&&(t[a]=h),i={},s=""}}else/^#/.test(n[r])||((c=n[r].match(/^msgctxt\s+(.*)/))?i[s="msgctxt"]=this.parse_po_dequote(c[1]):(c=n[r].match(/^msgid\s+(.*)/))?i[s="msgid"]=this.parse_po_dequote(c[1]):(c=n[r].match(/^msgid_plural\s+(.*)/))?i[s="msgid_plural"]=this.parse_po_dequote(c[1]):(c=n[r].match(/^msgstr\s+(.*)/))||(c=n[r].match(/^msgstr\[0\]\s+(.*)/))?i[s="msgstr_0"]=this.parse_po_dequote(c[1]):(c=n[r].match(/^msgstr\[(\d+)\]\s+(.*)/))?i[s="msgstr_"+c[1]]=this.parse_po_dequote(c[2]):/^"/.test(n[r])?i[s]+=this.parse_po_dequote(n[r]):o.push("Strange line ["+r+"]:"+n[r]));if(void 0!==i.msgid){var u,c,a=void 0!==i.msgctxt&&i.msgctxt.length?i.msgctxt+Gettext.context_glue+i.msgid:i.msgid,l=void 0!==i.msgid_plural&&i.msgid_plural.length?i.msgid_plural:null,h=[];for(u in i)(c=u.match(/^msgstr_(\d+)/))&&(h[parseInt(c[1])]=i[u]);h.unshift(l),1<h.length&&(t[a]=h),i={},s=""}if(t[""]&&t[""][1]){for(var d,m,p={},g=t[""][1].split(/\\n/),r=0;r<g.length;r++)g.length&&(-1!=(d=g[r].indexOf(":",0))?(m=g[r].substring(0,d),d=g[r].substring(d+1),p[m=m.toLowerCase()]&&p[m].length?o.push("SKIPPING DUPLICATE HEADER LINE: "+g[r]):/#-#-#-#-#/.test(m)?o.push("SKIPPING ERROR MARKER IN HEADER: "+g[r]):(d=d.replace(/^\s+/,""),p[m]=d)):(o.push("PROBLEM LINE IN HEADER: "+g[r]),p[g[r]]=""));t[""]=p}else t[""]={};return t},Gettext.prototype.parse_po_dequote=function(e){var t;return(t=e.match(/^"(.*)"/))&&(e=t[1]),e.replace(/\\"/,"")},Gettext.prototype.try_load_lang_json=function(e){e=this.sjax(e);if(e){e=this.JSON(e);return this.parse_locale_data(e),1}},Gettext.prototype.get_lang_refs=function(){for(var e=new Array,t=document.getElementsByTagName("link"),i=0;i<t.length;i++)if("gettext"==t[i].rel&&t[i].href){if(void 0===t[i].type||""==t[i].type)if(/\.json$/i.test(t[i].href))t[i].type="application/json";else if(/\.js$/i.test(t[i].href))t[i].type="application/json";else if(/\.po$/i.test(t[i].href))t[i].type="application/x-po";else{if(!/\.mo$/i.test(t[i].href))throw new Error("LINK tag with rel=gettext found, but the type and extension are unrecognized.");t[i].type="application/x-mo"}if(t[i].type=t[i].type.toLowerCase(),"application/json"==t[i].type)t[i].type="application/json";else if("text/javascript"==t[i].type)t[i].type="application/json";else if("application/x-po"==t[i].type)t[i].type="application/x-po";else{if("application/x-mo"!=t[i].type)throw new Error("LINK tag with rel=gettext found, but the type attribute ["+t[i].type+"] is unrecognized.");t[i].type="application/x-mo"}e.push(t[i])}return e},Gettext.prototype.textdomain=function(e){return e&&e.length&&(this.domain=e),this.domain},Gettext.prototype.gettext=function(e){return this.dcnpgettext(null,void 0,e,void 0,void 0,void 0)},Gettext.prototype.dgettext=function(e,t){return this.dcnpgettext(e,void 0,t,void 0,void 0,void 0)},Gettext.prototype.dcgettext=function(e,t,i){return this.dcnpgettext(e,void 0,t,void 0,void 0,i)},Gettext.prototype.ngettext=function(e,t,i){return this.dcnpgettext(null,void 0,e,t,i,void 0)},Gettext.prototype.dngettext=function(e,t,i,s){return this.dcnpgettext(e,void 0,t,i,s,void 0)},Gettext.prototype.dcngettext=function(e,t,i,s,o){return this.dcnpgettext(e,void 0,t,i,s,o,o)},Gettext.prototype.pgettext=function(e,t){return this.dcnpgettext(null,e,t,void 0,void 0,void 0)},Gettext.prototype.dpgettext=function(e,t,i){return this.dcnpgettext(e,t,i,void 0,void 0,void 0)},Gettext.prototype.dcpgettext=function(e,t,i,s){return this.dcnpgettext(e,t,i,void 0,void 0,s)},Gettext.prototype.npgettext=function(e,t,i,s){return this.dcnpgettext(null,e,t,i,s,void 0)},Gettext.prototype.dnpgettext=function(e,t,i,s,o){return this.dcnpgettext(e,t,i,s,o,void 0)},Gettext.prototype.dcnpgettext=function(e,t,i,s,o,n){if(!this.isValidObject(i))return"";var r=this.isValidObject(s),a=this.isValidObject(t)?t+Gettext.context_glue+i:i,e=this.isValidObject(e)?e:this.isValidObject(this.domain)?this.domain:"messages",l=new Array;if(void 0!==Gettext._locale_data&&this.isValidObject(Gettext._locale_data[e]))l.push(Gettext._locale_data[e]);else if(void 0!==Gettext._locale_data)for(var h in Gettext._locale_data)l.pu
1sh(Gettext._locale_data[h]);var u,c=[],d=!1;if(l.length)for(var m=0;m<l.length;m++){var p=l[m];if(this.isValidObject(p.msgs[a])){for(var g=0;g<p.msgs[a].length;g++)c[g]=p.msgs[a][g];if(c.shift(),u=p,d=!0,0<c.length&&0!=c[0].length)break}}0!=c.length&&0!=c[0].length||(c=[i,s]);s=c[0];return r&&(o=d&&this.isValidObject(u.head.plural_func)?((r=u.head.plural_func(o)).plural||(r.plural=0),r.nplural||(r.nplural=0),r.nplural<=r.plural&&(r.plural=0),r.plural):1!=o?1:0,this.isValidObject(c[o])&&(s=c[o])),s},Gettext.strargs=function(e,t){null==t||void 0===t?t=[]:t.constructor!=Array&&(t=[t]);for(var i="";;){var s,o,n=e.indexOf("%");if(-1==n){i+=e;break}i+=e.substr(0,n),e="%%"==e.substr(n,2)?(i+="%",e.substr(n+2)):(o=e.substr(n).match(/^%(\d+)/))?(s=parseInt(o[1]),o=o[1].length,0<s&&null!=t[s-1]&&void 0!==t[s-1]&&(i+=t[s-1]),e.substr(n+1+o)):(i+="%",e.substr(n+1))}return i},Gettext.prototype.strargs=function(e,t){return Gettext.strargs(e,t)},Gettext.prototype.isArray=function(e){return this.isValidObject(e)&&e.constructor==Array},Gettext.prototype.isValidObject=function(e){return null!=e&&void 0!==e},Gettext.prototype.sjax=function(e){var t;if(!(t=window.XMLHttpRequest?new XMLHttpRequest:-1!=navigator.userAgent.toLowerCase().indexOf("msie 5")?new ActiveXObject("Microsoft.XMLHTTP"):new ActiveXObject("Msxml2.XMLHTTP")))throw new Error("Your browser doesn't do Ajax. Unable to support external language files.");t.open("GET",e,!1);try{t.send(null)}catch(e){return}var i=t.status;if(200==i||0==i)return t.responseText;i=t.statusText+" (Error "+t.status+")";return t.responseText.length&&(i+="\n"+t.responseText),void alert(i)},Gettext.prototype.JSON=function(data){return eval("("+data+")")},CTSound=function(e){this.sounds=[],this.soundPath=e.soundPath,(myAudioTag=document.createElement("audio")).canPlayType;e=null;"undefined"!=typeof Audio&&(e=new Audio("")),this.haveAudio=e&&!!e.canPlayType,this.haveAudio&&(this.canPlayOgg="no"!=e.canPlayType("audio/ogg")&&""!=e.canPlayType("audio/ogg"),this.canPlayMp3="no"!=e.canPlayType("audio/mpeg")&&""!=e.canPlayType("audio/mpeg"),this.canPlayWav="no"!=e.canPlayType("audio/wav")&&""!=e.canPlayType("audio/wav"))},CTSound.prototype.createSound=function(e,t){var i,s;this.haveAudio&&(i=null,s="",this.canPlayOgg?s=this.soundPath+"/"+e+".ogg":this.canPlayWav&&(s=this.soundPath+"/"+e+".wav"),s&&(i=new Audio(s)),i&&(i.id=t+"-"+e,this.sounds[e]=i,t&&(this.sounds[t]=i)))},CTSound.prototype.playSound=function(e){e=this.sounds[e];e&&e.play()};var gt=null,YAHOO;init_gettext(),void 0!==YAHOO&&YAHOO||(YAHOO={}),YAHOO.namespace=function(){for(var e,t,i=arguments,s=null,o=0;o<i.length;o+=1)for(t=(""+i[o]).split("."),s=YAHOO,e="YAHOO"==t[0]?1:0;e<t.length;e+=1)s[t[e]]=s[t[e]]||{},s=s[t[e]];return s},YAHOO.log=function(e,t,i){var s=YAHOO.widget.Logger;return!(!s||!s.log)&&s.log(e,t,i)},YAHOO.register=function(e,t,i){var s,o,n,r=YAHOO.env.modules;for(r[e]||(r[e]={versions:[],builds:[]}),s=r[e],r=i.version,i=i.build,o=YAHOO.env.listeners,s.name=e,s.version=r,s.build=i,s.versions.push(r),s.builds.push(i),s.mainClass=t,n=0;n<o.length;n+=1)o[n](s);t?(t.VERSION=r,t.BUILD=i):YAHOO.log("mainClass is undefined for module "+e,"warn")},YAHOO.env=YAHOO.env||{modules:[],listeners:[]},YAHOO.env.getVersion=function(e){return YAHOO.env.modules[e]||null},YAHOO.env.ua=function(){function e(e){var t=0;return parseFloat(e.replace(/\./g,function(){return 1==t++?"":"."}))}var t={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:navigator.cajaVersion,secure:!1,os:null},i=navigator&&navigator.userAgent,s=window&&window.location,s=s&&s.href;return t.secure=s&&0===s.toLowerCase().indexOf("https"),i&&(/windows|win32/i.test(i)?t.os="windows":/macintosh/i.test(i)&&(t.os="macintosh"),/KHTML/.test(i)&&(t.webkit=1),(s=i.match(/AppleWebKit\/([^\s]*)/))&&s[1]&&(t.webkit=e(s[1]),/ Mobile\//.test(i)?t.mobile="Apple":(s=i.match(/NokiaN[^\/]*/))&&(t.mobile=s[0]),(s=i.match(/AdobeAIR\/([^\s]*)/))&&(t.air=s[0])),t.webkit||((s=i.match(/Opera[\s\/]([^\s]*)/))&&s[1]?(t.opera=e(s[1]),(s=i.match(/Opera Mini[^;]*/))&&(t.mobile=s[0])):(s=i.match(/MSIE\s([^;]*)/))&&s[1]?t.ie=e(s[1]):(s=i.match(/Gecko\/([^\s]*)/))&&(t.gecko=1,(s=i.match(/rv:([^\s\)]*)/))&&s[1]&&(t.gecko=e(s[1]))))),t}(),function(){if(YAHOO.namespace("util","widget","example"),"undefined"!=typeof YAHOO_config){var e,t=YAHOO_config.listener,i=YAHOO.env.listeners,s=!0;if(t){for(e=0;e<i.length;e++)if(i[e]==t){s=!1;break}s&&i.push(t)}}}(),YAHOO.lang=YAHOO.lang||{},function(){var c=YAHOO.lang,n=Object.prototype,l=[],r=["toString","valueOf"],e={isArray:function(e){return"[object Array]"===n.toString.apply(e)},isBoolean:function(e){return"boolean"==typeof e},isFunction:function(e){return"function"==typeof e||"[object Function]"===n.toString.apply(e)},isNull:function(e){return null===e},isNumber:function(e){return"number"==typeof e&&isFinite(e)},isObject:function(e){return e&&("object"==typeof e||c.isFunction(e))||!1},isString:function(e){return"string"==typeof e},isUndefined:function(e){return void 0===e},_IEEnumFix:YAHOO.env.ua.ie?function(e,t){for(var i,s,o=0;o<r.length;o+=1)s=t[i=r[o]],c.isFunction(s)&&s!=n[i]&&(e[i]=s)}:function(){},extend:function(e,t,i){if(!t||!e)throw new Error("extend failed, please check that all dependencies are included.");function s(){}if(s.prototype=t.prototype,e.prototype=new s,(e.prototype.constructor=e).superclass=t.prototype,t.prototype.constructor==n.constructor&&(t.prototype.constructor=t),i){for(var o in i)c.hasOwnProperty(i,o)&&(e.prototype[o]=i[o]);
1c._IEEnumFix(e.prototype,i)}},augmentObject:function(e,t){if(!t||!e)throw new Error("Absorb failed, verify dependencies.");var i,s,o=arguments,n=o[2];if(n&&!0!==n)for(i=2;i<o.length;i+=1)e[o[i]]=t[o[i]];else{for(s in t)!n&&s in e||(e[s]=t[s]);c._IEEnumFix(e,t)}},augmentProto:function(e,t){if(!t||!e)throw new Error("Augment failed, verify dependencies.");for(var i=[e.prototype,t.prototype],s=2;s<arguments.length;s+=1)i.push(arguments[s]);c.augmentObject.apply(this,i)},dump:function(e,t){var i,s,o=[];if(!c.isObject(e))return e+"";if(e instanceof Date||"nodeType"in e&&"tagName"in e)return e;if(c.isFunction(e))return"f(){...}";if(t=c.isNumber(t)?t:3,c.isArray(e)){for(o.push("["),i=0,s=e.length;i<s;i+=1)c.isObject(e[i])?o.push(0<t?c.dump(e[i],t-1):"{...}"):o.push(e[i]),o.push(", ");1<o.length&&o.pop(),o.push("]")}else{for(i in o.push("{"),e)c.hasOwnProperty(e,i)&&(o.push(i+"=> "),c.isObject(e[i])?o.push(0<t?c.dump(e[i],t-1):"{...}"):o.push(e[i]),o.push(", "));1<o.length&&o.pop(),o.push("}")}return o.join("")},substitute:function(e,t,i){for(var s,o,n,r,a,l,h,u=[];!((s=e.lastIndexOf("{"))<0)&&!((o=e.indexOf("}",s))<=s+1);)r=null,-1<(l=(h=a=e.substring(s+1,o)).indexOf(" "))&&(r=h.substring(l+1),h=h.substring(0,l)),n=t[h],i&&(n=i(h,n,r)),c.isObject(n)?n=c.isArray(n)?c.dump(n,parseInt(r,10)):(-1<(l=(r=r||"").indexOf("dump"))&&(r=r.substring(4)),"[object Object]"===(h=n.toString())||-1<l?c.dump(n,parseInt(r,10)):h):c.isString(n)||c.isNumber(n)||(n="~-"+u.length+"-~",u[u.length]=a),e=e.substring(0,s)+n+e.substring(o+1);for(s=u.length-1;0<=s;--s)e=e.replace(new RegExp("~-"+s+"-~"),"{"+u[s]+"}","g");return e},trim:function(t){try{return t.replace(/^\s+|\s+$/g,"")}catch(e){return t}},merge:function(){for(var e={},t=arguments,i=t.length,s=0;s<i;s+=1)c.augmentObject(e,t[s],!0);return e},later:function(e,t,i,s,o){e=e||0,t=t||{};var n,r=i,a=s;if(c.isString(i)&&(r=t[i]),!r)throw new TypeError("method undefined");return a&&!c.isArray(a)&&(a=[s]),s=function(){r.apply(t,a||l)},n=(o?setInterval:setTimeout)(s,e),{interval:o,cancel:function(){(this.interval?clearInterval:clearTimeout)(n)}}},isValue:function(e){return c.isObject(e)||c.isString(e)||c.isNumber(e)||c.isBoolean(e)}};c.hasOwnProperty=n.hasOwnProperty?function(e,t){return e&&e.hasOwnProperty(t)}:function(e,t){return!c.isUndefined(e[t])&&e.constructor.prototype[t]!==e[t]},e.augmentObject(c,e,!0),(YAHOO.util.Lang=c).augment=c.augmentProto,YAHOO.augment=c.augmentProto,YAHOO.extend=c.extend}(),YAHOO.register("yahoo",YAHOO,{version:"2.8.1",build:"19"}),function(){YAHOO.env._id_counter=YAHOO.env._id_counter||0;var c=YAHOO.util,o=YAHOO.lang,l=YAHOO.env.ua,r=YAHOO.lang.trim,t={},i={},n=/^t(?:able|d|h)$/i,s=/color$/i,d=window.document,a=d.documentElement,h="ownerDocument",u="defaultView",m="documentElement",p="compatMode",g="offsetLeft",v="offsetTop",f="parentNode",b="nodeType",y="tagName",O="getBoundingClientRect",_="getComputedStyle",C="currentStyle",A="CSS1Compat",S="BackCompat",E="class",w="className",M=" ",P="position",D="relative",H="left",T="borderLeftWidth",I="borderTopWidth",N=l.opera,Y=l.webkit,x=l.gecko,k=l.ie;c.Dom={CUSTOM_ATTRIBUTES:a.hasAttribute?{htmlFor:"for",className:E}:{for:"htmlFor",class:w},DOT_ATTRIBUTES:{},get:function(e){var t,i,s,o,n,r;if(e){if(e[b]||e.item)return e;if("string"==typeof e){if(t=e,r=(e=d.getElementById(e))?e.attributes:null,e&&r&&r.id&&r.id.value===t)return e;if(e&&d.all)for(e=null,o=0,n=(i=d.all[t]).length;o<n;++o)if(i[o].id===t)return i[o];return e}if(YAHOO.util.Element&&e instanceof YAHOO.util.Element&&(e=e.get("element")),"length"in e){for(s=[],o=0,n=e.length;o<n;++o)s[s.length]=c.Dom.get(e[o]);return s}return e}return null},getComputedStyle:function(e,t){return window[_]?e[h][u][_](e,null)[t]:e[C]?c.Dom.IE_ComputedStyle.get(e,t):void 0},getStyle:function(e,t){return c.Dom.batch(e,c.Dom._getStyle,t)},_getStyle:window[_]?function(e,t){t="float"===t?t="cssFloat":c.Dom._toCamel(t);var i=e.style[t];return i||(e=e[h][u][_](e,null))&&(i=e[t]),i}:a[C]?function(t,e){var i;switch(e){case"opacity":i=100;try{i=t.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(e){try{i=t.filters("alpha").opacity}catch(e){}}return i/100;case"float":e="styleFloat";default:return e=c.Dom._toCamel(e),i=t[C]?t[C][e]:null,t.style[e]||i}}:void 0,setStyle:function(e,t,i){c.Dom.batch(e,c.Dom._setStyle,{prop:t,val:i})},_setStyle:k?function(e,t){var i=c.Dom._toCamel(t.prop),s=t.val;if(e)switch(i){case"opacity":o.isString(e.style.filter)&&(e.style.filter="alpha(opacity="+100*s+")",e[C]&&e[C].hasLayout||(e.style.zoom=1));break;case"float":i="styleFloat";default:e.style[i]=s}}:function(e,t){var i=c.Dom._toCamel(t.prop),t=t.val;e&&("float"==i&&(i="cssFloat"),e.style[i]=t)},getXY:function(e){return c.Dom.batch(e,c.Dom._getXY)},_canPosition:function(e){return"none"!==c.Dom._getStyle(e,"display")&&
1c.Dom._inDoc(e)},_getXY:d[m][O]?function(e){var t,i,s,o,n,r=Math.floor,a=!1;return c.Dom._canPosition(e)&&(o=e[O](),n=e[h],t=c.Dom.getDocumentScrollLeft(n),i=c.Dom.getDocumentScrollTop(n),a=[r(o[H]),r(o.top)],k&&l.ie<8&&(e=s=2,o=n[p],6===l.ie&&o!==S&&(e=s=0),o===S&&(o=L(n[m],T),n=L(n[m],I),"medium"!==o&&(s=parseInt(o,10)),"medium"!==n&&(e=parseInt(n,10))),a[0]-=s,a[1]-=e),(i||t)&&(a[0]+=t,a[1]+=i),a[0]=r(a[0]),a[1]=r(a[1])),a}:function(e){var t,i,s,o,n,r=!1,a=e;if(c.Dom._canPosition(e)){for(r=[e[g],e[v]],t=c.Dom.getDocumentScrollLeft(e[h]),i=c.Dom.getDocumentScrollTop(e[h]),n=!!(x||519<l.webkit);a=a.offsetParent;)r[0]+=a[g],r[1]+=a[v],n&&(r=c.Dom._calcBorders(a,r));if("fixed"!==c.Dom._getStyle(e,P)){for(a=e;(a=a[f])&&a[y];)s=a.scrollTop,o=a.scrollLeft,x&&"visible"!==c.Dom._getStyle(a,"overflow")&&(r=c.Dom._calcBorders(a,r)),(s||o)&&(r[0]-=o,r[1]-=s);r[0]+=t,r[1]+=i}else N?(r[0]-=t,r[1]-=i):(Y||x)&&(r[0]+=t,r[1]+=i);r[0]=Math.floor(r[0]),r[1]=Math.floor(r[1])}return r},getX:function(e){return c.Dom.batch(e,function(e){return c.Dom.getXY(e)[0]},c.Dom,!0)},getY:function(e){return c.Dom.batch(e,function(e){return c.Dom.getXY(e)[1]},c.Dom,!0)},setXY:function(e,t,i){c.Dom.batch(e,c.Dom._setXY,{pos:t,noRetry:i})},_setXY:function(e,t){var i=c.Dom._getStyle(e,P),s=c.Dom.setStyle,o=t.pos,n=t.noRetry,r=[parseInt(c.Dom.getComputedStyle(e,H),10),parseInt(c.Dom.getComputedStyle(e,"top"),10)];if("static"==i&&s(e,P,i=D),t=c.Dom._getXY(e),!o||!1===t)return!1;isNaN(r[0])&&(r[0]=i==D?0:e[g]),isNaN(r[1])&&(r[1]=i==D?0:e[v]),null!==o[0]&&s(e,H,o[0]-t[0]+r[0]+"px"),null!==o[1]&&s(e,"top",o[1]-t[1]+r[1]+"px"),n||(n=c.Dom._getXY(e),(null!==o[0]&&n[0]!=o[0]||null!==o[1]&&n[1]!=o[1])&&c.Dom._setXY(e,{pos:o,noRetry:!0}))},setX:function(e,t){c.Dom.setXY(e,[t,null])},setY:function(e,t){c.Dom.setXY(e,[null,t])},getRegion:function(e){return c.Dom.batch(e,function(e){var t=!1;return c.Dom._canPosition(e)&&(t=c.Region.getRegion(e)),t},c.Dom,!0)},getClientWidth:function(){return c.Dom.getViewportWidth()},getClientHeight:function(){return c.Dom.getViewportHeight()},getElementsByClassName:function(e,t,i,s,o,n){if(t=t||"*",!(i=i?c.Dom.get(i):d))return[];for(var r=[],a=i.getElementsByTagName(t),l=c.Dom.hasClass,h=0,u=a.length;h<u;++h)l(a[h],e)&&(r[r.length]=a[h]);return s&&c.Dom.batch(r,s,o,n),r},hasClass:function(e,t){return c.Dom.batch(e,c.Dom._hasClass,t)},_hasClass:function(e,t){var i=!1;return e&&t&&(e=c.Dom._getAttribute(e,w)||"",i=t.exec?t.test(e):t&&-1<(M+e+M).indexOf(M+t+M)),i},addClass:function(e,t){return c.Dom.batch(e,c.Dom._addClass,t)},_addClass:function(e,t){var i,s=!1;return e&&t&&(i=c.Dom._getAttribute(e,w)||"",c.Dom._hasClass(e,t)||(c.Dom.setAttribute(e,w,r(i+M+t)),s=!0)),s},removeClass:function(e,t){return c.Dom.batch(e,c.Dom._removeClass,t)},_removeClass:function(e,t){var i,s=!1;return e&&t&&(i=c.Dom._getAttribute(e,w)||"",c.Dom.setAttribute(e,w,i.replace(c.Dom._getClassRegex(t),"")),i!==(i=c.Dom._getAttribute(e,w))&&(c.Dom.setAttribute(e,w,r(i)),s=!0,""===c.Dom._getAttribute(e,w)&&(i=e.hasAttribute&&e.hasAttribute(E)?E:w,e.removeAttribute(i)))),s},replaceClass:function(e,t,i){return c.Dom.batch(e,c.Dom._replaceClass,{from:t,to:i})},_replaceClass:function(e,t){var i,s,o,n=!1;return e&&t&&(i=t.from,(s=t.to)?i?i!==s&&(o=c.Dom._getAttribute(e,w)||"",(i=(M+o.replace(c.Dom._getClassRegex(i),M+s)).split(c.Dom._getClassRegex(s))).splice(1,0,M+s),c.Dom.setAttribute(e,w,r(i.join(""))),n=!0):n=c.Dom._addClass(e,t.to):n=!1),n},generateId:function(e,i){i=i||"yui-gen";function t(e){if(e&&e.id)return e.id;var t=i+YAHOO.env._id_counter++;if(e){if(e[h]&&e[h].getElementById(t))return c.Dom.generateId(e,t+i);e.id=t}return t}return c.Dom.batch(e,t,c.Dom,!0)||t.apply(c.Dom,arguments)},isAncestor:function(e,t){e=c.Dom.get(e),t=c.Dom.get(t);var i=!1;return e&&t&&e[b]&&t[b]&&(e.contains&&e!==t?i=e.contains(t):e.compareDocumentPosition&&(i=!!(16&e.compareDocumentPosition(t)))),i},inDocument:function(e,t){return c.Dom._inDoc(c.Dom.get(e),t)},_inDoc:function(e,t){var i=!1;return e&&e[y]&&(t=t||e[h],i=c.Dom.isAncestor(t[m],e)),i},getElementsBy:function(e,t,i,s,o,n,r){if(t=t||"*",!(i=i?c.Dom.get(i):d))return[];for(var a=[],l=i.getElementsByTagName(t),h=0,u=l.length;h<u;++h)if(e(l[h])){if(r){a=l[h];break}a[a.length]=l[h]}return s&&c.Dom.batch(a,s,o,n),a},getElementBy:function(e,t,i){return c.Dom.getElementsBy(e,t,i,null,null,null,!0)},batch:function(e,t,i,s){var o=[],n=s?i:window;if(!(e=e&&(e[y]||e.item)?e:c.Dom.get(e))||!t)return!1;if(e[y]||void 0===e.length)return t.call(n,e,i);for(var r=0;r<e.length;++r)o[o.length]=t.call(n,e[r],i);return o},getDocumentHeight:function(){var e=(d[p]!=A||Y?d.body:a).scrollHeight;
1return Math.max(e,c.Dom.getViewportHeight())},getDocumentWidth:function(){var e=(d[p]!=A||Y?d.body:a).scrollWidth;return Math.max(e,c.Dom.getViewportWidth())},getViewportHeight:function(){var e=self.innerHeight,t=d[p];return!t&&!k||N||(e=(t==A?a:d.body).clientHeight),e},getViewportWidth:function(){var e=self.innerWidth,t=d[p];return(t||k)&&(e=(t==A?a:d.body).clientWidth),e},getAncestorBy:function(e,t){for(;e=e[f];)if(c.Dom._testElement(e,t))return e;return null},getAncestorByClassName:function(e,t){if(!(e=c.Dom.get(e)))return null;return c.Dom.getAncestorBy(e,function(e){return c.Dom.hasClass(e,t)})},getAncestorByTagName:function(e,t){if(!(e=c.Dom.get(e)))return null;return c.Dom.getAncestorBy(e,function(e){return e[y]&&e[y].toUpperCase()==t.toUpperCase()})},getPreviousSiblingBy:function(e,t){for(;e;)if(e=e.previousSibling,c.Dom._testElement(e,t))return e;return null},getPreviousSibling:function(e){return(e=c.Dom.get(e))?c.Dom.getPreviousSiblingBy(e):null},getNextSiblingBy:function(e,t){for(;e;)if(e=e.nextSibling,c.Dom._testElement(e,t))return e;return null},getNextSibling:function(e){return(e=c.Dom.get(e))?c.Dom.getNextSiblingBy(e):null},getFirstChildBy:function(e,t){return(c.Dom._testElement(e.firstChild,t)?e.firstChild:null)||c.Dom.getNextSiblingBy(e.firstChild,t)},getFirstChild:function(e,t){return(e=c.Dom.get(e))?c.Dom.getFirstChildBy(e):null},getLastChildBy:function(e,t){return e?(c.Dom._testElement(e.lastChild,t)?e.lastChild:null)||c.Dom.getPreviousSiblingBy(e.lastChild,t):null},getLastChild:function(e){return e=c.Dom.get(e),c.Dom.getLastChildBy(e)},getChildrenBy:function(e,t){var e=c.Dom.getFirstChildBy(e,t),i=e?[e]:[];return c.Dom.getNextSiblingBy(e,function(e){return t&&!t(e)||(i[i.length]=e),!1}),i},getChildren:function(e){return e=c.Dom.get(e),c.Dom.getChildrenBy(e)},getDocumentScrollLeft:function(e){return e=e||d,Math.max(e[m].scrollLeft,e.body.scrollLeft)},getDocumentScrollTop:function(e){return e=e||d,Math.max(e[m].scrollTop,e.body.scrollTop)},insertBefore:function(e,t){return e=c.Dom.get(e),t=c.Dom.get(t),e&&t&&t[f]?t[f].insertBefore(e,t):null},insertAfter:function(e,t){return e=c.Dom.get(e),t=c.Dom.get(t),e&&t&&t[f]?t.nextSibling?t[f].insertBefore(e,t.nextSibling):t[f].appendChild(e):null},getClientRegion:function(){var e=c.Dom.getDocumentScrollTop(),t=c.Dom.getDocumentScrollLeft(),i=c.Dom.getViewportWidth()+t,s=c.Dom.getViewportHeight()+e;return new c.Region(e,i,s,t)},setAttribute:function(e,t,i){c.Dom.batch(e,c.Dom._setAttribute,{attr:t,val:i})},_setAttribute:function(e,t){var i=c.Dom._toCamel(t.attr),t=t.val;e&&e.setAttribute&&(c.Dom.DOT_ATTRIBUTES[i]?e[i]=t:(i=c.Dom.CUSTOM_ATTRIBUTES[i]||i,e.setAttribute(i,t)))},getAttribute:function(e,t){return c.Dom.batch(e,c.Dom._getAttribute,t)},_getAttribute:function(e,t){var i;return t=c.Dom.CUSTOM_ATTRIBUTES[t]||t,e&&e.getAttribute&&(i=e.getAttribute(t,2)),i},_toCamel:function(e){return t[e]||(t[e]=-1===e.indexOf("-")?e:e.replace(/-([a-z])/gi,function(e,t){return t.toUpperCase()}))},_getClassRegex:function(e){var t;return void 0!==e&&(e.exec?t=e:(t=i[e])||(e=e.replace(c.Dom._patterns.CLASS_RE_TOKENS,"\\$1"),t=i[e]=new RegExp("(?:^|\\s)"+e+"(?=|$)","g"))),t},_patterns:{ROOT_TAG:/^body|html$/i,CLASS_RE_TOKENS:/([\.\(\)\^\$\*\+\?\|\[\]\{\}\\])/g},_testElement:function(e,t){return e&&1==e[b]&&(!t||t(e))},_calcBorders:function(e,t){var i=parseInt(c.Dom[_](e,I),10)||0,s=parseInt(c.Dom[_](e,T),10)||0;return x&&n.test(e[y])&&(s=i=0),t[0]+=s,t[1]+=i,t}};var L=c.Dom[_];l.opera&&(c.Dom[_]=function(e,t){e=L(e,t);return s.test(t)&&(e=c.Dom.Color.toRGB(e)),e}),l.webkit&&(c.Dom[_]=function(e,t){t=L(e,t);return"rgba(0, 0, 0, 0)"===t&&(t="transparent"),t}),l.ie&&8<=l.ie&&d.documentElement.hasAttribute&&(c.Dom.DOT_ATTRIBUTES.type=!0)}(),YAHOO.util.Region=function(e,t,i,s){this.top=e,this.y=e,this[1]=e,this.right=t,this.bottom=i,this.left=s,this.x=s,this[0]=s,this.width=this.right-this.left,this.height=this.bottom-this.top},YAHOO.util.Region.prototype.contains=function(e){return e.left>=this.left&&e.right<=this.right&&e.top>=this.top&&e.bottom<=this.bottom},YAHOO.util.Region.prototype.getArea=function(){return(this.bottom-this.top)*(this.right-this.left)},YAHOO.util.Region.prototype.intersect=function(e){var t=Math.max(this.top,e.top),i=Math.min(this.right,e.right),s=Math.min(this.bottom,e.bottom),e=Math.max(this.left,e.left);return t<=s&&e<=i?new YAHOO.util.Region(t,i,s,e):null},YAHOO.util.Region.prototype.union=function(e){var t=Math.min(this.top,e.top),i=Math.max(this.right,e.right),s=Math.max(this.bottom,e.bottom),e=Math.min(this.left,e.left);return new YAHOO.util.Region(t,i,s,e)},YAHOO.util.Region.prototype.toString=function(){return"Region {top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+", height: "+this.height+", width: "+this.width+"}"},YAHOO.util.Region.getRegion=function(e){var t=YAHOO.util.Dom.getXY(e),i=t[1],s=t[0]+e.offsetWidth,e=t[1]+e.offsetHeight,t=t[0];return new YAHOO.util.Region(i,s,e,t)},YAHOO.util.Point=function(e,t){YAHOO.lang.isArray(e)&&(t=e[1],e=e[0]),YAHOO.util.Point.superclass.constructor.call(this,t,e,t,e)},YAHOO.extend(YAHOO.util.Point,YAHOO.util.Region),function(){var s=YAHOO.util,o="clientTop",n="clientLeft",r="right",a="px",l="opacity",h="auto",u="borderLeftWidth",c="borderTopWidth",d="borderRightWidth",m="borderBottomWidth",p="style",g="currentStyle",v=/^width|height$/,f=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,e={get:function(e,t){var i=e[g][t];return t===l?s.Dom.getStyle(e,l):!i||i.indexOf&&-1<i.indexOf(a)?i:s.Dom.IE_COMPUTED[t]?s.Dom.IE_COMPUTED[t](e,t):f.test(i)?s.Dom.IE.ComputedStyle.getPixel(e,t):i},getOffset:function(e,t){var i=e[g][t],s=t.charAt(0).toUpperCase()+t.substr(1),o="offset"+s,n="pixel"+s,r="";return i==h?(void 0===(s=e[o])&&(r=0),r=s,v.test(t)&&(e[p][t]=s,e[o]>s&&(r=s-(e[o]-s)),e[p][t]=h)):(e[p][n]||e[p][t]||(e[p][t]=i),r=e[p][n]),r+a},getBorderWidth:function(e,t){var i=null;switch(e[g].hasLayout||(e[p].zoom=1),t){case c:i=e[o];break;case m:i=e.offsetHeight-e.clientHeight-e[o];break;case u:i=e[n];break;case d:i=e.offsetWidth-e.clientWidth-e[n]}return i+a},getPixel:function(e,t){var i,s=e[g][r],t=e[g][t];return e[p][r]=t,i=e[p].pixelRight,e[p][r]=s,i+a},getMargin:function(e,t){t=e[g][t]==h?0+a:s.Dom.IE.ComputedStyle.getPixel(e,t);return t},getVisibility:function(e,t){for(var i;(i=e[g])&&"inherit"==i[t];)e=e.parentNode;return i?i[t]:"visible"},getColor:function(e,t){return s.Dom.Color.toRGB(e[g][t])||"transparent"},getBorderColor:function(e,t){e=e[g],e=e[t]||e.color;return s.Dom.Color.toRGB(s.Dom.Color.toHex(e))}},t={};t.top=t.right=t.bottom=t.left=t.width=t.height=e.getOffset,t.color=e.getColor,t[c]=t[d]=t[m]=t[u]=e.getBorderWidth,t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=e.getMargin,t.visibility=e.getVisibility,t.borderColor=t.borderTopColor=t.borderRightColor=t.borderBottomColor=t.borderLeftColor=e.getBorderColor,s.Dom.IE_COMPUTED=t,s.Dom.IE_ComputedStyle=e}(),function(){var o="toString",t=parseInt,n=RegExp,r=YAHOO.util;r.Dom.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},re_RGB:/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,re_hex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,re_hex3:/([0-9A-F])/gi,toRGB:function(e){return r.Dom.Color.re_RGB.test(e)||(e=r.Dom.Color.toHex(e)),r.Dom.Color.re_hex.exec(e)&&(e="rgb("+[t(n.$1,16),t(n.$2,16),t(n.$3,16)].join(", ")+")"),e},toHex:function(e){var t,i,s;return e=r.Dom.Color.KEYWORDS[e]||e,r.Dom.Color.re_RGB.exec(e)&&(t=1===n.$1.length?"0"+n.$1:Number(n.$1),i=1===n.$2.length?"0"+n.$2:Number(n.$2),s=1===n.$3.length?"0"+n.$3:Number(n.$3),e=[t[o](16),i[o](16),s[o](16)].join("")),e.length<6&&(e=e.replace(r.Dom.Color.re_hex3,"$1$1")),"transparent"!==e&&e.indexOf("#")<0&&(e="#"+e),e.toLowerCase()}}}(),YAHOO.register("dom",YAHOO.util.Dom,{version:"2.8.1",build:"19"}),YAHOO.util.CustomEvent=function(e,t,i,s,o){this.type=e,this.scope=t||window,this.silent=i,this.fireOnce=o,this.fired=!1,this.firedWith=null,this.signature=s||YAHOO.util.CustomEvent.LIST,this.subscribers=[],this.silent;s="_YUICEOnSubscribe";
1e!==s&&(this.subscribeEvent=new YAHOO.util.CustomEvent(s,this,!0)),this.lastError=null},YAHOO.util.CustomEvent.LIST=0,YAHOO.util.CustomEvent.FLAT=1,YAHOO.util.CustomEvent.prototype={subscribe:function(e,t,i){if(!e)throw new Error("Invalid callback for subscriber to '"+this.type+"'");this.subscribeEvent&&this.subscribeEvent.fire(e,t,i);i=new YAHOO.util.Subscriber(e,t,i);this.fireOnce&&this.fired?this.notify(i,this.firedWith):this.subscribers.push(i)},unsubscribe:function(e,t){if(!e)return this.unsubscribeAll();for(var i=!1,s=0,o=this.subscribers.length;s<o;++s){var n=this.subscribers[s];n&&n.contains(e,t)&&(this._delete(s),i=!0)}return i},fire:function(){this.lastError=null;var e=this.subscribers.length,t=[].slice.call(arguments,0),i=!0;if(this.fireOnce){if(this.fired)return!0;this.firedWith=t}if(this.fired=!0,!e&&this.silent)return!0;this.silent;for(var s=this.subscribers.slice(),o=0;o<e;++o){var n=s[o];if(n){if(!1===(i=this.notify(n,t))){this.silent;break}}else;}return!1!==i},notify:function(e,t){var i,s=null,o=e.getScope(this.scope),n=YAHOO.util.Event.throwErrors;if(this.silent,this.signature==YAHOO.util.CustomEvent.FLAT){0<t.length&&(s=t[0]);try{i=e.fn.call(o,s,e.obj)}catch(e){if(this.lastError=e,n)throw e}}else try{i=e.fn.call(o,this.type,t,e.obj)}catch(e){if(this.lastError=e,n)throw e}return i},unsubscribeAll:function(){for(var e=this.subscribers.length,t=e-1;-1<t;t--)this._delete(t);return this.subscribers=[],e},_delete:function(e){var t=this.subscribers[e];t&&(delete t.fn,delete t.obj),this.subscribers.splice(e,1)},toString:function(){return"CustomEvent: '"+this.type+"', context: "+this.scope}},YAHOO.util.Subscriber=function(e,t,i){this.fn=e,this.obj=YAHOO.lang.isUndefined(t)?null:t,this.overrideContext=i},YAHOO.util.Subscriber.prototype.getScope=function(e){return this.overrideContext?!0===this.overrideContext?this.obj:this.overrideContext:e},YAHOO.util.Subscriber.prototype.contains=function(e,t){return t?this.fn==e&&this.obj==t:this.fn==e},YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", overrideContext: "+(this.overrideContext||"no")+" }"},YAHOO.util.Event||(YAHOO.util.Event=function(){var l=!1,m=[],p=[],h=0,u=[],i=0,t={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},e=YAHOO.env.ua.ie,r="focusin",a="focusout";return{POLL_RETRYS:500,POLL_INTERVAL:40,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:e,_interval:null,_dri:null,_specialTypes:{focusin:e?"focusin":"focus",focusout:e?"focusout":"blur"},DOMReady:!1,throwErrors:!1,startInterval:function(){this._interval||(this._interval=YAHOO.lang.later(this.POLL_INTERVAL,this,this._tryPreloadAttach,null,!0))},onAvailable:function(e,t,i,s,o){for(var n=YAHOO.lang.isString(e)?[e]:e,r=0;r<n.length;r+=1)u.push({id:n[r],fn:t,obj:i,overrideContext:s,checkReady:o});h=this.POLL_RETRYS,this.startInterval()},onContentReady:function(e,t,i,s){this.onAvailable(e,t,i,s,!0)},onDOMReady:function(){this.DOMReadyEvent.subscribe.apply(this.DOMReadyEvent,arguments)},_addListener:function(t,i,s,o,e,n){if(!s||!s.call)return!1;if(this._isValidCollection(t)){for(var r=!0,a=0,l=t.length;a<l;++a)r=this.on(t[a],i,s,o,e)&&r;return r}if(YAHOO.lang.isString(t)){var h=this.getEl(t);if(!h)return this.onAvailable(t,function(){YAHOO.util.Event._addListener(t,i,s,o,e,n)}),!0;t=h}if(!t)return!1;if("unload"==i&&o!==this)return p[p.length]=[t,i,s,o,e],!0;var u=t;e&&(u=!0===e?o:e);function c(e){return s.call(u,YAHOO.util.Event.getEvent(e,t),o)}var d=[t,i,s,c,u,o,e,n],h=m.length;m[h]=d;try{this._simpleAdd(t,i,c,n)}catch(e){return this.lastError=e,this.removeListener(t,i,s),!1}return!0},_getType:function(e){return this._specialTypes[e]||e},addListener:function(e,t,i,s,o){var n=!(t!=r&&t!=a||YAHOO.env.ua.ie);return this._addListener(e,this._getType(t),i,s,o,n)},addFocusListener:function(e,t,i,s){return this.on(e,r,t,i,s)},removeFocusListener:function(e,t){return this.removeListener(e,r,t)},addBlurListener:function(e,t,i,s){return this.on(e,a,t,i,s)},removeBlurListener:function(e,t){return this.removeListener(e,a,t)},removeListener:function(e,t,i){var s;if(t=this._getType(t),"string"==typeof e)e=this.getEl(e);else if(this._isValidCollection(e)){for(var o=!0,n=e.length-1;-1<n;n--)o=this.removeListener(e[n],t,i)&&o;return o}if(!i||!i.call)return this.purgeElement(e,!1,t);if("unload"==t){for(n=p.length-1;-1<n;n--)if((s=p[n])&&s[0]==e&&s[1]==t&&s[2]==i)return p.splice(n,1),!0;return!1}var r=null,a=arguments[3];if(void 0===a&&(a=this._getCacheIndex(m,e,t,i)),0<=a&&(r=m[a]),!e||!r)return!1;var l=!0===r[this.CAPTURE];try{this._simpleRemove(e,t,r[this.WFN],l)}catch(e){return this.lastError=e,!1}return delete m[a][this.WFN],delete m[a][this.FN],m.splice(a,1),!0},getTarget:function(e,t){e=e.target||e.srcElement;return this.resolveTextNode(e)},resolveTextNode:function(e){try{if(e&&3==e.nodeType)return e.parentNode}catch(e){}return e},getPageX:function(e){var t=e.pageX;return t||0===t||(t=e.clientX||0,this.isIE&&(t+=this._getScrollLeft())),t},getPageY:function(e){var t=e.pageY;return t||0===t||(t=e.clientY||0,this.isIE&&(t+=this._getScrollTop())),t}
1,getXY:function(e){return[this.getPageX(e),this.getPageY(e)]},getRelatedTarget:function(e){var t=e.relatedTarget;return t||("mouseout"==e.type?t=e.toElement:"mouseover"==e.type&&(t=e.fromElement)),this.resolveTextNode(t)},getTime:function(e){if(!e.time){var t=(new Date).getTime();try{e.time=t}catch(e){return this.lastError=e,t}}return e.time},stopEvent:function(e){this.stopPropagation(e),this.preventDefault(e)},stopPropagation:function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},preventDefault:function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},getEvent:function(e,t){var i=e||window.event;if(!i)for(var s=this.getEvent.caller;s&&(!(i=s.arguments[0])||Event!=i.constructor);)s=s.caller;return i},getCharCode:function(e){e=e.keyCode||e.charCode||0;return YAHOO.env.ua.webkit&&e in t&&(e=t[e]),e},_getCacheIndex:function(e,t,i,s){for(var o=0,n=e.length;o<n;o+=1){var r=e[o];if(r&&r[this.FN]==s&&r[this.EL]==t&&r[this.TYPE]==i)return o}return-1},generateId:function(e){var t=e.id;return t||(t="yuievtautoid-"+i,++i,e.id=t),t},_isValidCollection:function(e){try{return e&&"string"!=typeof e&&e.length&&!e.tagName&&!e.alert&&void 0!==e[0]}catch(e){return!1}},elCache:{},getEl:function(e){return"string"==typeof e?document.getElementById(e):e},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",YAHOO,0,0,1),_load:function(e){var t;l||(l=!0,(t=YAHOO.util.Event)._ready(),t._tryPreloadAttach())},_ready:function(e){var t=YAHOO.util.Event;t.DOMReady||(t.DOMReady=!0,t.DOMReadyEvent.fire(),t._simpleRemove(document,"DOMContentLoaded",t._ready))},_tryPreloadAttach:function(){if(0===u.length)return h=0,void(this._interval&&(this._interval.cancel(),this._interval=null));if(!this.locked)if(!this.isIE||this.DOMReady){this.locked=!0;function e(e,t){t.overrideContext&&(e=!0===t.overrideContext?t.obj:t.overrideContext),t.fn.call(e,t.obj)}for(var t,i,s=(s=!l)||0<h&&0<u.length,o=[],n=[],r=0,a=u.length;r<a;r+=1)(t=u[r])&&((i=this.getEl(t.id))?t.checkReady?!l&&!i.nextSibling&&s||(n.push(t),u[r]=null):(e(i,t),u[r]=null):o.push(t));for(r=0,a=n.length;r<a;r+=1)t=n[r],e(this.getEl(t.id),t);if(h--,s){for(r=u.length-1;-1<r;r--)(t=u[r])&&t.id||u.splice(r,1);this.startInterval()}else this._interval&&(this._interval.cancel(),this._interval=null);this.locked=!1}else this.startInterval()},purgeElement:function(e,t,i){var s,o,n=YAHOO.lang.isString(e)?this.getEl(e):e,r=this.getListeners(n,i);if(r)for(s=r.length-1;-1<s;s--){var a=r[s];this.removeListener(n,a.type,a.fn)}if(t&&n&&n.childNodes)for(s=0,o=n.childNodes.length;s<o;++s)this.purgeElement(n.childNodes[s],t,i)},getListeners:function(e,t){for(var i=[],s=t?"unload"===t?[p]:(t=this._getType(t),[m]):[m,p],o=YAHOO.lang.isString(e)?this.getEl(e):e,n=0;n<s.length;n+=1){var r=s[n];if(r)for(var a=0,l=r.length;a<l;++a){var h=r[a];!h||h[this.EL]!==o||t&&t!==h[this.TYPE]||i.push({type:h[this.TYPE],fn:h[this.FN],obj:h[this.OBJ],adjust:h[this.OVERRIDE],scope:h[this.ADJ_SCOPE],index:a})}}return i.length?i:null},_unload:function(e){for(var t,i,s,o=YAHOO.util.Event,n=p.slice(),r=0,a=p.length;r<a;++r)(i=n[r])&&(s=window,i[o.ADJ_SCOPE]&&(s=!0===i[o.ADJ_SCOPE]?i[o.UNLOAD_OBJ]:i[o.ADJ_SCOPE]),i[o.FN].call(s,o.getEvent(e,i[o.EL]),i[o.UNLOAD_OBJ]),n[r]=null);if(p=s=i=null,m){for(t=m.length-1;-1<t;t--)(i=m[t])&&o.removeListener(i[o.EL],i[o.TYPE],i[o.FN],t);i=null}o._simpleRemove(window,"unload",o._unload)},_getScrollLeft:function(){return this._getScroll()[1]},_getScrollTop:function(){return this._getScroll()[0]},_getScroll:function(){var e=document.documentElement,t=document.body;return e&&(e.scrollTop||e.scrollLeft)?[e.scrollTop,e.scrollLeft]:t?[t.scrollTop,t.scrollLeft]:[0,0]},regCE:function(){},_simpleAdd:window.addEventListener?function(e,t,i,s){e.addEventListener(t,i,s)}:window.attachEvent?function(e,t,i,s){e.attachEvent("on"+t,i)}:function(){},_simpleRemove:window.removeEventListener?function(e,t,i,s){e.removeEventListener(t,i,s)}:window.detachEvent?function(e,t,i){e.detachEvent("on"+t,i)}:function(){}}}(),function(){var e,t=YAHOO.util.Event;t.on=t.addListener,t.onFocus=t.addFocusListener,t.onBlur=t.addBlurListener,t.isIE?self!==self.top?document.onreadystatechange=function(){"complete"==document.readyState&&(document.onreadystatechange=null,t._ready())}:(YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,!0),e=document.createElement("p"),t._dri=setInterval(function(){try{e.doScroll("left"),clearInterval(t._dri),t._dri=null,t._ready(),e=null}catch(e){}},t.POLL_INTERVAL)):t.webkit&&t.webkit<525?t._dri=setInterval(function(){var e=document.readyState;"loaded"!=e&&"complete"!=e||(clearInterval(t._dri),t._dri=null,t._ready())},t.POLL_INTERVAL):t._simpleAdd(document,"DOMContentLoaded",t._ready),t._simpleAdd(window,"load",t._load),t._simpleAdd(window,"unload",t._unload),t._tryPreloadAttach()}()),YAHOO.util.EventProvider=function(){},YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,
1subscribe:function(e,t,i,s){this.__yui_events=this.__yui_events||{};var o=this.__yui_events[e];o?o.subscribe(t,i,s):(this.__yui_subscribers=this.__yui_subscribers||{},(o=this.__yui_subscribers)[e]||(o[e]=[]),o[e].push({fn:t,obj:i,overrideContext:s}))},unsubscribe:function(e,t,i){this.__yui_events=this.__yui_events||{};var s=this.__yui_events;if(!e){var o,n=!0;for(o in s)YAHOO.lang.hasOwnProperty(s,o)&&(n=n&&s[o].unsubscribe(t,i));return n}e=s[e];return!!e&&e.unsubscribe(t,i)},unsubscribeAll:function(e){return this.unsubscribe(e)},createEvent:function(e,t){this.__yui_events=this.__yui_events||{};var i,s=t||{},t=this.__yui_events;if(!t[e]){i=new YAHOO.util.CustomEvent(e,s.scope||this,s.silent,YAHOO.util.CustomEvent.FLAT,s.fireOnce),t[e]=i,s.onSubscribeCallback&&i.subscribeEvent.subscribe(s.onSubscribeCallback),this.__yui_subscribers=this.__yui_subscribers||{};var o=this.__yui_subscribers[e];if(o)for(var n=0;n<o.length;++n)i.subscribe(o[n].fn,o[n].obj,o[n].overrideContext)}return t[e]},fireEvent:function(e){this.__yui_events=this.__yui_events||{};var t=this.__yui_events[e];if(!t)return null;for(var i=[],s=1;s<arguments.length;++s)i.push(arguments[s]);return t.fire.apply(t,i)},hasEvent:function(e){return!(!this.__yui_events||!this.__yui_events[e])}},function(){var a=YAHOO.util.Event,o=YAHOO.lang;YAHOO.util.KeyListener=function(e,n,t,i){i=i||YAHOO.util.KeyListener.KEYDOWN;var r=new YAHOO.util.CustomEvent("keyPressed");function s(e,t){if(n.shift||(n.shift=!1),n.alt||(n.alt=!1),n.ctrl||(n.ctrl=!1),e.shiftKey==n.shift&&e.altKey==n.alt&&e.ctrlKey==n.ctrl){var i,s=n.keys;if(YAHOO.lang.isArray(s)){for(var o=0;o<s.length;o++)if(s[o]==(i=a.getCharCode(e))){r.fire(i,e);break}}else s==(i=a.getCharCode(e))&&r.fire(i,e)}}this.enabledEvent=new YAHOO.util.CustomEvent("enabled"),this.disabledEvent=new YAHOO.util.CustomEvent("disabled"),o.isString(e)&&(e=document.getElementById(e)),o.isFunction(t)?r.subscribe(t):r.subscribe(t.fn,t.scope,t.correctScope),this.enable=function(){this.enabled||(a.on(e,i,s),this.enabledEvent.fire(n)),this.enabled=!0},this.disable=function(){this.enabled&&(a.removeListener(e,i,s),this.disabledEvent.fire(n)),this.enabled=!1},this.toString=function(){return"KeyListener ["+n.keys+"] "+e.tagName+(e.id?"["+e.id+"]":"")}};var e=YAHOO.util.KeyListener;e.KEYDOWN="keydown",e.KEYUP="keyup",e.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38}}(),YAHOO.register("event",YAHOO.util.Event,{version:"2.8.1",build:"19"}),YAHOO.register("yahoo-dom-event",YAHOO,{version:"2.8.1",build:"19"}),function(){var u=YAHOO.util.Event,c=YAHOO.lang,h=[],d=function(e,t,i){i=!(!e||e===i)&&(YAHOO.util.Selector.test(e,t)?e:d(e.parentNode,t,i));return i};c.augmentObject(u,{_createDelegate:function(r,a,l,h){return function(e){var t,i=this,s=u.getTarget(e),o=a,n=9===i.nodeType;if(c.isFunction(a)?t=a(s):c.isString(a)&&(n||(o=((n="#"+(i.id||u.generateId(i))+" ")+a).replace(/,/gi,","+n)),YAHOO.util.Selector.test(s,o)?t=s:YAHOO.util.Selector.test(s,o.replace(/,/gi," *,")+" *")&&(t=d(s,o,i))),t)return o=h?!0===h?l:h:t,r.call(o,e,t,i,l)}},delegate:function(e,t,i,s,o,n){var r,a,l=t;if(c.isString(s)&&!YAHOO.util.Selector)return!1;if("mouseenter"==t||"mouseleave"==t){if(!u._createMouseDelegate)return!1;l=u._getType(t),r=u._createMouseDelegate(i,o,n),a=u._createDelegate(function(e,t,i){return r.call(t,e,i)},s,o,n)}else a=u._createDelegate(i,s,o,n);return h.push([e,l,i,a]),u.on(e,l,a)},removeDelegate:function(e,t,i){var s,o=t,n=!1;return"mouseenter"!=t&&"mouseleave"!=t||(o=u._getType(t)),0<=(i=u._getCacheIndex(h,e,o,i))&&(s=h[i]),e&&s&&(n=u.removeListener(s[0],s[1],s[3]))&&(delete h[i][2],delete h[i][3],h.splice(i,1)),n}})}(),YAHOO.register("event-delegate",YAHOO.util.Event,{version:"2.8.1",build:"19"}),function(){var m=YAHOO.util;m.Selector={_foundCache:[],_regexCache:{},_re:{nth:/^(?:([-]?\d*)(n){1}|(odd|even)$)*([-+]?\d*)$/,attr:/(\[.*\])/g,urls:/^(?:href|src)/},document:window.document,attrAliases:{},shorthand:{"\\#(-?[_a-z]+[-\\w]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w]*)":"[class~=$1]"},operators:{"=":function(e,t){return e===t},"!=":function(e,t){return e!==t},"~=":function(e,t){return-1<(" "+e+" ").indexOf(" "+t+" ")},"|=":function(e,t){return e===t||e.slice(0,t.length+1)===t+"-"},"^=":function(e,t){return 0===e.indexOf(t)},"$=":function(e,t){return e.slice(-t.length)===t},"*=":function(e,t){return-1<e.indexOf(t)},"":function(e,t){return e}},pseudos:{root:function(e){return e===e.ownerDocument.documentElement},"nth-child":function(e,t){return m.Selector._getNth(e,t)},"nth-last-child":function(e,t){return m.Selector._getNth(e,t,null,!0)},"nth-of-type":function(e,t){return m.Selector._getNth(e,t,e.tagName)},"nth-last-of-type":function(e,t){return m.Selector._getNth(e,t,e.tagName,!0)},"first-child":function(e){return m.Selector._getChildren(e.parentNode)[0]===e},"last-child":function(e){var t=m.Selector._getChildren(e.parentNode);return t[t.length-1]===e},"first-of-type":function(e,t){return m.Selector._getChildren(e.parentNode,e.tagName)[0]},"last-of-type":function(e,t){e=m.Selector._getChildren(e.parentNode,e.tagName);return e[e.length-1]},"only-child":function(e){var t=m.Selector._getChildren(e.parentNode);return 1===t.length&&t[0]===e},"only-of-type":function(e){return 1===m.Selector._getChildren(e.parentNode,e.tagName).length},empty:function(e){return 0===e.childNodes.length},not:function(e,t){return!m.Selector.test(e,t)},contains:function(e,t){return-1<(e.innerText||e.textContent||"").indexOf(t)},checked:function(e){return!0===e.checked}},test:function(e,t){if(!(e=m.Selector.document.getElementById(e)||e))return!1;var i=t?t.split(","):[];if(i.length){for(var s=0,o=i.length;s<o;++s)if(m.Selector._test(e,i[s]))return!0;return!1}return m.Selector._test(e,t)},_test:function(e,t,i,s){if(i=i||m.Selector._tokenize(t).pop()||{},!e.tagName||"*"!==i.tag&&e.tagName!==i.tag||s&&e._found)return!1;if(i.attributes.length){var o,n=m.Selector._re.urls;if(!e.attributes||!e.attributes.length)return!1;for(var r,a=0;r=i.attributes[a++];){if(o=n.test(r[0])?2:0,null==(o=e.getAttribute(r[0],o)))return!1;if(m.Selector.operators[r[1]]&&!m.Selector.operators[r[1]](o,r[2]))return!1}}if(i.pseudos.length)for(var a=0,l=i.pseudos.length;a<l;++a)if(m.Selector.pseudos[i.pseudos[a][0]]&&!m.Selector.pseudos[i.pseudos[a][0]](e,i.pseudos[a][1]))return!1;return!i.previous||","===i.previous.combinator||m.Selector._combinators[i.previous.combinator](e,i)},filter:function(e,t){e=e||[];var i;m.Selector._tokenize(t);if(!e.item)for(var s=0,o=e.length;s<o;++s)e[s].tagName||(i=m.Selector.document.getElementById(e[s]))&&(e[s]=i);return m.Selector._filter(e,m.Selector._tokenize(t)[0])},_filter:function(e,t,i,s){for(var o=i?null:[],n=m.Selector._foundCache,r=0,a=e.length;r<a;r++)if(m.Selector._test(e[r],"",t,s)){if(i)return e[r];if(s){if(e[r]._found)continue;e[r]._found=!0,n[n.length]=e[r]}o[o.length]=e[r]}return o},query:function(e,t,i){return m.Selector._query(e,t,i)},_query:function(e,t,i,s){var o,n=i?null:[];
1if(!e)return n;var r=e.split(",");if(1<r.length){for(var a,l=0,h=r.length;l<h;++l)a=m.Selector._query(r[l],t,i,!0),n=i?a:n.concat(a);return m.Selector._clearFoundCache(),n}if(t&&!t.nodeName&&!(t=m.Selector.document.getElementById(t)))return n;"#document"!==(t=t||m.Selector.document).nodeName&&(m.Dom.generateId(t),e=t.tagName+"#"+t.id+" "+e,t=(o=t).ownerDocument);var u,c=m.Selector._tokenize(e),d=c[m.Selector._getIdTokenIndex(c)],e=[],c=c.pop()||{};if(d&&(u=m.Selector._getId(d.attributes)),u){if(!(o=o||m.Selector.document.getElementById(u))||"#document"!==t.nodeName&&!m.Dom.isAncestor(t,o))return n;m.Selector._test(o,null,d)&&(d===c?e=[o]:" "!==d.combinator&&">"!==d.combinator||(t=o))}return t&&!e.length&&(e=t.getElementsByTagName(c.tag)),e.length&&(n=m.Selector._filter(e,c,i,s)),n},_clearFoundCache:function(){for(var t=m.Selector._foundCache,i=0,e=t.length;i<e;++i)try{delete t[i]._found}catch(e){t[i].removeAttribute("_found")}t=[]},_getRegExp:function(e,t){var i=m.Selector._regexCache;return i[e+(t=t||"")]||(i[e+t]=new RegExp(e,t)),i[e+t]},_getChildren:document.documentElement.children&&document.documentElement.children.tags?function(e,t){return t?e.children.tags(t):e.children||[]}:function(e,t){for(var i=[],s=e.childNodes,o=0,n=s.length;o<n;++o)s[o].tagName&&(t&&s[o].tagName!==t||i.push(s[o]));return i},_combinators:{" ":function(e,t){for(;e=e.parentNode;)if(m.Selector._test(e,"",t.previous))return!0;return!1},">":function(e,t){return m.Selector._test(e.parentNode,null,t.previous)},"+":function(e,t){for(var i=e.previousSibling;i&&1!==i.nodeType;)i=i.previousSibling;return!(!i||!m.Selector._test(i,null,t.previous))},"~":function(e,t){for(var i=e.previousSibling;i;){if(1===i.nodeType&&m.Selector._test(i,null,t.previous))return!0;i=i.previousSibling}return!1}},_getNth:function(e,t,i,s){m.Selector._re.nth.test(t);var o=parseInt(RegExp.$1,10),n=RegExp.$2,r=RegExp.$3,t=parseInt(RegExp.$4,10)||0,a=m.Selector._getChildren(e.parentNode,i);if(r?(o=2,n="n",t="odd"===r?1:0):isNaN(o)&&(o=n?1:0),0===o)return s&&(t=a.length-t+1),a[t-1]===e;if(o<0&&(s=!!s,o=Math.abs(o)),s){for(l=a.length-t,h=a.length;0<=l;l-=o)if(l<h&&a[l]===e)return!0}else for(var l=t-1,h=a.length;l<h;l+=o)if(0<=l&&a[l]===e)return!0;return!1},_getId:function(e){for(var t=0,i=e.length;t<i;++t)if("id"==e[t][0]&&"="===e[t][1])return e[t][2]},_getIdTokenIndex:function(e){for(var t=0,i=e.length;t<i;++t)if(m.Selector._getId(e[t].attributes))return t;return-1},_patterns:{tag:/^((?:-?[_a-z]+[\w-]*)|\*)/i,attributes:/^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,pseudos:/^:([-\w]+)(?:\(['"]?(.+)['"]?\))*/i,combinator:/^\s*([>+~]|\s)\s*/},_tokenize:function(e){var t,i={},s=[],o=!1,n=m.Selector._patterns;e=m.Selector._replaceShorthand (e);do{for(var r in o=!1,n)YAHOO.lang.hasOwnProperty(n,r)&&("tag"!=r&&"combinator"!=r&&(i[r]=i[r]||[]),(t=n[r].exec(e))&&(o=!0,"tag"!=r&&"combinator"!=r?("attributes"===r&&"id"===t[1]&&(i.id=t[3]),i[r].push(t.slice(1))):i[r]=t[1],e=e.replace(t[0],""),"combinator"!==r&&e.length||(i.attributes=m.Selector._fixAttributes(i.attributes),i.pseudos=i.pseudos||[],i.tag=i.tag?i.tag.toUpperCase():"*",s.push(i),i={previous:i})))}while(o);return s},_fixAttributes:function(e){for(var t=m.Selector.attrAliases,i=0,s=(e=e||[]).length;i<s;++i)t[e[i][0]]&&(e[i][0]=t[e[i][0]]),e[i][1]||(e[i][1]="");return e},_replaceShorthand:function(e){var t,i=m.Selector.shorthand,s=e.match(m.Selector._re.attr);for(t in s&&(e=e.replace(m.Selector._re.attr,"REPLACED_ATTRIBUTE")),i)YAHOO.lang.hasOwnProperty(i,t)&&(e=e.replace(m.Selector._getRegExp(t,"gi"),i[t]));if(s)for(var o=0,n=s.length;o<n;++o)e=e.replace("REPLACED_ATTRIBUTE",s[o]);return e}},YAHOO.env.ua.ie&&YAHOO.env.ua.ie<8&&(m.Selector.attrAliases.class="className",m.Selector.attrAliases.for="htmlFor")}(),YAHOO.register("selector",YAHOO.util.Selector,{version:"2.8.1",build:"19"}),YAHOO.util.Connect={_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_http_headers:{},_has_http_headers:!1,_use_default_post_header:!0,_default_post_header:"application/x-www-form-urlencoded; charset=UTF-8",_default_form_header:"application/x-www-form-urlencoded",_use_default_xhr_header:!0,_default_xhr_header:"XMLHttpRequest",_has_default_headers:!0,_default_headers:{},_poll:{},_timeOut:{}
1,_polling_interval:50,_transaction_id:0,startEvent:new YAHOO.util.CustomEvent("start"),completeEvent:new YAHOO.util.CustomEvent("complete"),successEvent:new YAHOO.util.CustomEvent("success"),failureEvent:new YAHOO.util.CustomEvent("failure"),abortEvent:new YAHOO.util.CustomEvent("abort"),_customEvents:{onStart:["startEvent","start"],onComplete:["completeEvent","complete"],onSuccess:["successEvent","success"],onFailure:["failureEvent","failure"],onUpload:["uploadEvent","upload"],onAbort:["abortEvent","abort"]},setProgId:function(e){this._msxml_progid.unshift(e)},setDefaultPostHeader:function(e){"string"==typeof e?this._default_post_header=e:"boolean"==typeof e&&(this._use_default_post_header=e)},setDefaultXhrHeader:function(e){"string"==typeof e?this._default_xhr_header=e:this._use_default_xhr_header=e},setPollingInterval:function(e){"number"==typeof e&&isFinite(e)&&(this._polling_interval=e)},createXhrObject:function(t){var i,s;try{i={conn:new XMLHttpRequest,tId:t,xhr:!0}}catch(e){for(s=0;s<this._msxml_progid.length;++s)try{i={conn:new ActiveXObject(this._msxml_progid[s]),tId:t,xhr:!0};break}catch(e){}}finally{return i}},getConnectionObject:function(e){var t,i=this._transaction_id;try{e?(t={tId:i},"xdr"===e?(t.conn=this._transport,t.xdr=!0):"upload"===e&&(t.upload=!0)):t=this.createXhrObject(i),t&&this._transaction_id++}catch(e){}return t},asyncRequest:function(e,t,i,s){var o,n=i&&i.argument?i.argument:null;if(this._isFileUpload?o="upload":i.xdr&&(o="xdr"),o=this.getConnectionObject(o)){if(i&&i.customevents&&this.initCustomEvents(o,i),this._isFormSubmit){if(this._isFileUpload)return this.uploadFile(o,i,t,s),o;"GET"==e.toUpperCase()?0!==this._sFormData.length&&(t+=(-1==t.indexOf("?")?"?":"&")+this._sFormData):"POST"==e.toUpperCase()&&(s=s?this._sFormData+"&"+s:this._sFormData)}return("GET"==e.toUpperCase()&&i&&!1===i.cache&&(t+=(-1==t.indexOf("?")?"?":"&")+"rnd="+(new Date).valueOf().toString()),this._use_default_xhr_header&&(this._default_headers["X-Requested-With"]||this.initHeader("X-Requested-With",this._default_xhr_header,!0)),"POST"===e.toUpperCase()&&this._use_default_post_header&&!1===this._isFormSubmit&&this.initHeader("Content-Type",this._default_post_header),o.xdr)?(this.xdr(o,e,t,i,s),o):(o.conn.open(e,t,!0),(this._has_default_headers||this._has_http_headers)&&this.setHeader(o),this.handleReadyState(o,i),o.conn.send(s||""),!0===this._isFormSubmit&&this.resetFormState(),this.startEvent.fire(o,n),o.startEvent&&o.startEvent.fire(o,n),o)}return null},initCustomEvents:function(e,t){for(var i in t.customevents)this._customEvents[i][0]&&(e[this._customEvents[i][0]]=new YAHOO.util.CustomEvent(this._customEvents[i][1],t.scope||null),e[this._customEvents[i][0]].subscribe(t.customevents[i]))},handleReadyState:function(e,t){var i=this,s=t&&t.argument?t.argument:null;t&&t.timeout&&(this._timeOut[e.tId]=window.setTimeout(function(){i.abort(e,t,!0)},t.timeout)),this._poll[e.tId]=window.setInterval(function(){e.conn&&4===e.conn.readyState&&(window.clearInterval(i._poll[e.tId]),delete i._poll[e.tId],t&&t.timeout&&(window.clearTimeout(i._timeOut[e.tId]),delete i._timeOut[e.tId]),i.completeEvent.fire(e,s),e.completeEvent&&e.completeEvent.fire(e,s),i.handleTransactionResponse(e,t))},this._polling_interval)},handleTransactionResponse:function(e,t,i){var s,o,n=t&&t.argument?t.argument:null,r=!(!e.r||"xdr:success"!==e.r.statusText),a=!(!e.r||"xdr:failure"!==e.r.statusText),l=i;try{s=void 0!==e.conn.status&&0!==e.conn.status||r?e.conn.status:a&&!l?0:13030}catch(e){s=13030}if(200<=s&&s<300||1223===s||r)o=e.xdr?e.r:this.createResponseObject(e,n),t&&t.success&&(t.scope?t.success.apply(t.scope,[o]):t.success(o)),this.successEvent.fire(o),e.successEvent&&e.successEvent.fire(o);else{switch(s){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:o=this.createExceptionObject(e.tId,n,i||!1),t&&t.failure&&(t.scope?t.failure.apply(t.scope,[o]):t.failure(o));break;default:o=e.xdr?e.response:this.createResponseObject(e,n),t&&t.failure&&(t.scope?t.failure.apply(t.scope,[o]):t.failure(o))}this.failureEvent.fire(o),e.failureEvent&&e.failureEvent.fire(o)}this.releaseObject(e),o=null},createResponseObject:function(e,t){var i,s,o,n,r={},a={};try{for(o=(s=e.conn.getAllResponseHeaders()).split("\n"),i=0;i<o.length;i++)-1!=(n=o[i].indexOf(":"))&&(a[o[i].substring(0,n)]=YAHOO.lang.trim(o[i].substring(n+2)))}catch(e){}return r.tId=e.tId,r.status=1223==e.conn.status?204:e.conn.status,r.statusText=1223==e.conn.status?"No Content":e.conn.statusText,r.getResponseHeader=a,r.getAllResponseHeaders=s,r.responseText=e.conn.responseText,r.responseXML=e.conn.responseXML,t&&(r.argument=t),r},createExceptionObject:function(e,t,i){var s={};return s.tId=e,i?(s.status=-1,s.statusText="transaction aborted"):(s.status=0,s.statusText="communication failure"),t&&(s.argument=t),s},initHeader:function(e,t,i){(i?this._default_headers:this._http_headers)[e]=t,i?this._has_default_headers=!0:this._has_http_headers=!0},setHeader:function(e){if(this._has_default_headers)for(var t in this._default_headers)YAHOO.lang.hasOwnProperty(this._default_headers,t)&&e.conn.setRequestHeader(t,this._default_headers[t]);if(this._has_http_headers){for(t in this._http_headers)YAHOO.lang.hasOwnProperty(this._http_headers,t)&&e.conn.setRequestHeader(t,this._http_headers[t]);this._http_headers={},this._has_http_headers=!1}},resetDefaultHeaders:function(){this._default_headers={},this._has_default_headers=!1},abort:function(e,t,i){var s,o,n=t&&t.argument?t.argument:null;return(e=e||{}).conn?e.xhr?this.isCallInProgress(e)&&(e.conn.abort(),window.clearInterval(this._poll[e.tId]),delete this._poll[e.tId],i&&(window.clearTimeout(this._timeOut[e.tId]),delete this._timeOut[e.tId]),s=!0):e.xdr&&(e.conn.abort(e.tId),s=!0):e.upload?(o="yuiIO"+e.tId,(o=document.getElementById(o))&&(YAHOO.util.Event.removeListener(o,"load"),document.body.removeChild(o),i&&(window.clearTimeout(this._timeOut[e.tId]),delete this._timeOut[e.tId]),s=!0)):s=!1,!0===s&&(this.abortEvent.fire(e,n),e.abortEvent&&e.abortEvent.fire(e,n),this.handleTransactionResponse(e,t,!0)),s},isCallInProgress:function(e){return(e=e||{}).xhr&&e.conn?4!==e.conn.readyState&&0!==e.conn.readyState:e.xdr&&e.conn?e.conn.isCallInProgress(e.tId):!0===e.upload&&!!document.getElementById("yuiIO"+e.tId)},releaseObject:function(e){e&&e.conn&&(e.conn=null,e=null)}},function(){var n=YAHOO.util.Connect,r={};
1function t(e){var t='<object id="YUIConnectionSwf" type="application/x-shockwave-flash" data="'+e+'" width="0" height="0"><param name="movie" value="'+e+'"><param name="allowScriptAccess" value="always"></object>',e=document.createElement("div");document.body.appendChild(e),e.innerHTML=t}n.xdr=function(e,t,i,s,o){r[parseInt(e.tId)]={o:e,c:s},o&&(s.method=t,s.data=o),e.conn.send(i,s,e.tId)},n.swf=t,n.transport=function(e){t(e),n._transport=document.getElementById("YUIConnectionSwf")},n.xdrReadyEvent=new YAHOO.util.CustomEvent("xdrReady"),n.xdrReady=function(){n.xdrReadyEvent.fire()},n.handleXdrResponse=function(e){var t,i,s=r[e.tId].o,o=r[e.tId].c;if("xdr:start"===e.statusText)return i=o,void((t=s)&&(n.startEvent.fire(t,i.argument),t.startEvent&&t.startEvent.fire(t,i.argument)));e.responseText=decodeURI(e.responseText),s.r=e,o.argument&&(s.r.argument=o.argument),this.handleTransactionResponse(s,o,"xdr:abort"===e.statusText),delete r[e.tId]}}(),function(){var i=YAHOO.util.Connect,v=YAHOO.util.Event;i._isFormSubmit=!1,i._isFileUpload=!1,i._formNode=null,i._sFormData=null,i._submitElementValue=null,i.uploadEvent=new YAHOO.util.CustomEvent("upload"),i._hasSubmitListener=!!v&&(v.addListener(document,"click",function(e){var t=v.getTarget(e),e=t.nodeName.toLowerCase();"input"!==e&&"button"!==e||!t.type||"submit"!=t.type.toLowerCase()||(i._submitElementValue=encodeURIComponent(t.name)+"="+encodeURIComponent(t.value))}),!0),i.setForm=function(e,t,i){var s,o,n,r,a,l,h,u,c,d,m=!1,p=[],g=0;if(this.resetFormState(),"string"==typeof e)s=document.getElementById(e)||document.forms[e];else{if("object"!=typeof e)return;s=e}if(t)return this.createFrame(i||null),this._isFormSubmit=!0,this._isFileUpload=!0,void(this._formNode=s);for(l=0,h=s.elements.length;l<h;++l)if(a=(o=s.elements[l]).disabled,n=o.name,!a&&n)switch(n=encodeURIComponent(n)+"=",r=encodeURIComponent(o.value),o.type){case"select-one":-1<o.selectedIndex&&(d=o.options[o.selectedIndex],p[g++]=n+encodeURIComponent(d.attributes.value&&d.attributes.value.specified?d.value:d.text));break;case"select-multiple":if(-1<o.selectedIndex)for(u=o.selectedIndex,c=o.options.length;u<c;++u)(d=o.options[u]).selected&&(p[g++]=n+encodeURIComponent(d.attributes.value&&d.attributes.value.specified?d.value:d.text));break;case"radio":case"checkbox":o.checked&&(p[g++]=n+r);break;case"file":case void 0:case"reset":case"button":break;case"submit":!1===m&&(this._hasSubmitListener&&this._submitElementValue&&(p[g++]=this._submitElementValue),m=!0);break;default:p[g++]=n+r}return this._isFormSubmit=!0,this._sFormData=p.join("&"),this.initHeader("Content-Type",this._default_form_header),this._sFormData},i.resetFormState=function(){this._isFormSubmit=!1,this._isFileUpload=!1,this._formNode=null,this._sFormData=""},i.createFrame=function(e){var t,i="yuiIO"+this._transaction_id;YAHOO.env.ua.ie?(t=document.createElement('<iframe id="'+i+'" name="'+i+'" />'),"boolean"==typeof e&&(t.src="javascript:false")):((t=document.createElement("iframe")).id=i,t.name=i),t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",document.body.appendChild(t)},i.appendPostData=function(e){for(var t,i=[],s=e.split("&"),o=0;o<s.length;o++)-1!=(t=s[o].indexOf("="))&&(i[o]=document.createElement("input"),i[o].type="hidden",i[o].name=decodeURIComponent(s[o].substring(0,t)),i[o].value=decodeURIComponent(s[o].substring(t+1)),this._formNode.appendChild(i[o]));return i},i.uploadFile=function(e,t,i,s){var o,n,r,a,l,h="yuiIO"+e.tId,u="multipart/form-data",c=document.getElementById(h),d=!(!document.documentMode||8!==document.documentMode),m=this,p=t&&t.argument?t.argument:null,g={action:this._formNode.getAttribute("action"),method:this._formNode.getAttribute("method"),target:this._formNode.getAttribute("target")};if(this._formNode.setAttribute("action",i),this._formNode.setAttribute("method","POST"),this._formNode.setAttribute("target",h),YAHOO.env.ua.ie&&!d?this._formNode.setAttribute("encoding",u):this._formNode.setAttribute("enctype",u),s&&(o=this.appendPostData(s)),this._formNode.submit(),this.startEvent.fire(e,p),e.startEvent&&e.startEvent.fire(e,p),t&&t.timeout&&(this._timeOut[e.tId]=window.setTimeout(function(){m.abort(e,t,!0)},t.timeout)),o&&0<o.length)for(n=0;n<o.length;n++)this._formNode.removeChild(o[n]);for(r in g)YAHOO.lang.hasOwnProperty(g,r)&&(g[r]?this._formNode.setAttribute(r,g[r]):this._formNode.removeAttribute(r));this.resetFormState(),l=function(){t&&t.timeout&&(window.clearTimeout(m._timeOut[e.tId]),delete m._timeOut[e.tId]),m.completeEvent.fire(e,p),e.completeEvent&&e.completeEvent.fire(e,p),a={tId:e.tId,argument:t.argument};try{a.responseText=c.contentWindow.document.body?c.contentWindow.document.body.innerHTML:c.contentWindow.document.documentElement.textContent,a.responseXML=c.contentWindow.document.XMLDocument||c.contentWindow.document}catch(e){}t&&t.upload&&(t.scope?t.upload.apply(t.scope,[a]):t.upload(a)),m.uploadEvent.fire(a),e.uploadEvent&&e.uploadEvent.fire(a),v.removeListener(c,"load",l),setTimeout(function(){document.body.removeChild(c),m.releaseObject(e)},100)},v.addListener(c,"load",l)}}(),YAHOO.register("connection",YAHOO.util.Connect,{version:"2.8.1",build:"19"}),YAHOO.util.Attribute=function(e,t){t&&(this.owner=t,this.configure(e,!0))},YAHOO.util.Attribute.prototype={name:void 0,value:null,owner:null,readOnly:!1,writeOnce:!1,_initialConfig:null,_written:!1,method:null,
1setter:null,getter:null,validator:null,getValue:function(){var e=this.value;return this.getter&&(e=this.getter.call(this.owner,this.name,e)),e},setValue:function(e,t){var i=this.owner,s=this.name,o={type:s,prevValue:this.getValue(),newValue:e};return!(this.readOnly||this.writeOnce&&this._written)&&(!(this.validator&&!this.validator.call(i,e))&&(!(!t&&!1===i.fireBeforeChangeEvent(o))&&(this.setter&&(e=this.setter.call(i,e,this.name)),this.method&&this.method.call(i,e,this.name),this.value=e,this._written=!0,o.type=s,t||this.owner.fireChangeEvent(o),!0)))},configure:function(e,t){for(var i in e=e||{},t&&(this._written=!1),this._initialConfig=this._initialConfig||{},e)e.hasOwnProperty(i)&&(this[i]=e[i],t&&(this._initialConfig[i]=e[i]))},resetValue:function(){return this.setValue(this._initialConfig.value)},resetConfig:function(){this.configure(this._initialConfig,!0)},refresh:function(e){this.setValue(this.value,e)}},function(){var n=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){},YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(e){this._configs=this._configs||{};var t=this._configs[e];return t&&this._configs.hasOwnProperty(e)?t.getValue():null},set:function(e,t,i){this._configs=this._configs||{};e=this._configs[e];return!!e&&e.setValue(t,i)},getAttributeKeys:function(){this._configs=this._configs;var e,t=[];for(e in this._configs)n.hasOwnProperty(this._configs,e)&&!n.isUndefined(this._configs[e])&&(t[t.length]=e);return t},setAttributes:function(e,t){for(var i in e)n.hasOwnProperty(e,i)&&this.set(i,e[i],t)},resetValue:function(e,t){return this._configs=this._configs||{},!!this._configs[e]&&(this.set(e,this._configs[e]._initialConfig.value,t),!0)},refresh:function(e,t){this._configs=this._configs||{};for(var i=this._configs,s=0,o=(e=(n.isString(e)?[e]:e)||this.getAttributeKeys()).length;s<o;++s)i.hasOwnProperty(e[s])&&this._configs[e[s]].refresh(t)},register:function(e,t){this.setAttributeConfig(e,t)},getAttributeConfig:function(e){this._configs=this._configs||{};var t=this._configs[e]||{},i={};for(e in t)n.hasOwnProperty(t,e)&&(i[e]=t[e]);return i},setAttributeConfig:function(e,t,i){this._configs=this._configs||{},t=t||{},this._configs[e]?this._configs[e].configure(t,i):(t.name=e,this._configs[e]=this.createAttribute(t))},configureAttribute:function(e,t,i){this.setAttributeConfig(e,t,i)},resetAttributeConfig:function(e){this._configs=this._configs||{},this._configs[e].resetConfig()},subscribe:function(e,t){this._events=this._events||{},e in this._events||(this._events[e]=this.createEvent(e)),YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments)},on:function(){this.subscribe.apply(this,arguments)},addListener:function(){this.subscribe.apply(this,arguments)},fireBeforeChangeEvent:function(e){var t="before";return t+=e.type.charAt(0).toUpperCase()+e.type.substr(1)+"Change",e.type=t,this.fireEvent(e.type,e)},fireChangeEvent:function(e){return e.type+="Change",this.fireEvent(e.type,e)},createAttribute:function(e){return new YAHOO.util.Attribute(e,this)}},YAHOO.augment(YAHOO.util.AttributeProvider,YAHOO.util.EventProvider)}(),function(){function n(e,t){this.init.apply(this,arguments)}var r=YAHOO.util.Dom,o=YAHOO.util.AttributeProvider,a={mouseenter:!0,mouseleave:!0};n.DOM_EVENTS={click:!0,dblclick:!0,keydown:!0,keypress:!0,keyup:!0,mousedown:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,mouseenter:!0,mouseleave:!0,focus:!0,blur:!0,submit:!0,change:!0},n.prototype={DOM_EVENTS:null,DEFAULT_HTML_SETTER:function(e,t){var i=this.get("element");return i&&(i[t]=e),e},DEFAULT_HTML_GETTER:function(e){var t,i=this.get("element");return i&&(t=i[e]),t},appendChild:function(e){return e=e.get?e.get("element"):e,this.get("element").appendChild(e)},getElementsByTagName:function(e){return this.get("element").getElementsByTagName(e)},hasChildNodes:function(){return this.get("element").hasChildNodes()},insertBefore:function(e,t){return e=e.get?e.get("element"):e,t=t&&t.get?t.get("element"):t,this.get("element").insertBefore(e,t)},removeChild:function(e){return e=e.get?e.get("element"):e,this.get("element").removeChild(e)},replaceChild:function(e,t){return e=e.get?e.get("element"):e,t=t.get?t.get("element"):t,this.get("element").replaceChild(e,t)},initAttributes:function(e){},addListener:function(i,e,t,s){s=s||this;var o=YAHOO.util.Event,n=this.get("element")||this.get("id"),r=this;return!(a[i]&&!o._createMouseDelegate)&&(this._events[i]||(n&&this.DOM_EVENTS[i]&&o.on(n,i,function(e,t){e.srcElement&&!e.target&&(e.target=e.srcElement),(e.toElement&&!e.relatedTarget||e.fromElement&&!e.relatedTarget)&&(e.relatedTarget=
1o.getRelatedTarget(e)),e.currentTarget||(e.currentTarget=n),r.fireEvent(i,e,t)},t,s),this.createEvent(i,{scope:this})),YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments))},on:function(){return this.addListener.apply(this,arguments)},subscribe:function(){return this.addListener.apply(this,arguments)},removeListener:function(e,t){return this.unsubscribe.apply(this,arguments)},addClass:function(e){r.addClass(this.get("element"),e)},getElementsByClassName:function(e,t){return r.getElementsByClassName(e,t,this.get("element"))},hasClass:function(e){return r.hasClass(this.get("element"),e)},removeClass:function(e){return r.removeClass(this.get("element"),e)},replaceClass:function(e,t){return r.replaceClass(this.get("element"),e,t)},setStyle:function(e,t){return r.setStyle(this.get("element"),e,t)},getStyle:function(e){return r.getStyle(this.get("element"),e)},fireQueue:function(){for(var e=this._queue,t=0,i=e.length;t<i;++t)this[e[t][0]].apply(this,e[t][1])},appendTo:function(e,t){e=e.get?e.get("element"):r.get(e),this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:e}),t=t&&t.get?t.get("element"):r.get(t);var i=this.get("element");return!!i&&(!!e&&(i.parent!=e&&(t?e.insertBefore(i,t):e.appendChild(i)),this.fireEvent("appendTo",{type:"appendTo",target:e}),i))},get:function(e){var t=this._configs||{},i=t.element;return!i||t[e]||YAHOO.lang.isUndefined(i.value[e])||this._setHTMLAttrConfig(e),o.prototype.get.call(this,e)},setAttributes:function(e,t){for(var i,s={},o=this._configOrder,n=0,r=o.length;n<r;++n)void 0!==e[o[n]]&&(s[o[n]]=!0,this.set(o[n],e[o[n]],t));for(i in e)e.hasOwnProperty(i)&&!s[i]&&this.set(i,e[i],t)},set:function(e,t,i){var s=this.get("element");return s?(this._configs[e]||YAHOO.lang.isUndefined(s[e])||this._setHTMLAttrConfig(e),o.prototype.set.apply(this,arguments)):(this._queue[this._queue.length]=["set",arguments],void(this._configs[e]&&(this._configs[e].value=t)))},setAttributeConfig:function(e,t,i){this._configOrder.push(e),o.prototype.setAttributeConfig.apply(this,arguments)},createEvent:function(e,t){return this._events[e]=!0,o.prototype.createEvent.apply(this,arguments)},init:function(e,t){this._initElement(e,t)},destroy:function(){var e=this.get("element");YAHOO.util.Event.purgeElement(e,!0),this.unsubscribeAll(),e&&e.parentNode&&e.parentNode.removeChild(e),this._queue=[],this._events={},this._configs={},this._configOrder=[]},_initElement:function(e,t){this._queue=this._queue||[],this._events=this._events||{},this._configs=this._configs||{},this._configOrder=[],(t=t||{}).element=t.element||e||null;var i,s=!1,o=n.DOM_EVENTS;for(i in this.DOM_EVENTS=this.DOM_EVENTS||{},o)o.hasOwnProperty(i)&&(this.DOM_EVENTS[i]=o[i]);"string"==typeof t.element&&this._setHTMLAttrConfig("id",{value:t.element}),r.get(t.element)&&(s=!0,this._initHTMLElement(t),this._initContent(t)),YAHOO.util.Event.onAvailable(t.element,function(){s||this._initHTMLElement(t),this.fireEvent("available",{type:"available",target:r.get(t.element)})},this,!0),YAHOO.util.Event.onContentReady(t.element,function(){s||this._initContent(t),this.fireEvent("contentReady",{type:"contentReady",target:r.get(t.element)})},this,!0)},_initHTMLElement:function(e){this.setAttributeConfig("element",{value:r.get(e.element),readOnly:!0})},_initContent:function(e){this.initAttributes(e),this.setAttributes(e,!0),this.fireQueue()},_setHTMLAttrConfig:function(e,t){var i=this.get("element");(t=t||{}).name=e,t.setter=t.setter||this.DEFAULT_HTML_SETTER,t.getter=t.getter||this.DEFAULT_HTML_GETTER,t.value=t.value||i[e],this._configs[e]=new YAHOO.util.Attribute(t,this)}},YAHOO.augment(n,o),YAHOO.util.Element=n}(),YAHOO.register("element",YAHOO.util.Element,{version:"2.8.1",build:"19"}),function(){var lang=YAHOO.lang,util=YAHOO.util,Ev=util.Event;util.DataSourceBase=function(e,t){if(null!=e){if(this.liveData=e,this._oQueue={interval:null,conn:null,requests:[]},this.responseSchema={},t&&t.constructor==Object)for(var i in t)i&&(this[i]=t[i]);e=this.maxCacheEntries;(!lang.isNumber(e)||e<0)&&(e=0),this._aIntervals=[],this.createEvent("cacheRequestEvent"),this.createEvent("cacheResponseEvent"),this.createEvent("requestEvent"),this.createEvent("responseEvent"),this.createEvent("responseParseEvent"),this.createEvent("responseCac
1heEvent"),this.createEvent("dataErrorEvent"),this.createEvent("cacheFlushEvent");e=util.DataSourceBase;this._sName="DataSource instance"+e._nIndex,e._nIndex++}};var DS=util.DataSourceBase;lang.augmentObject(DS,{TYPE_UNKNOWN:-1,TYPE_JSARRAY:0,TYPE_JSFUNCTION:1,TYPE_XHR:2,TYPE_JSON:3,TYPE_XML:4,TYPE_TEXT:5,TYPE_HTMLTABLE:6,TYPE_SCRIPTNODE:7,TYPE_LOCAL:8,ERROR_DATAINVALID:"Invalid data",ERROR_DATANULL:"Null data",_nIndex:0,_nTransactionId:0,_getLocationValue:function(e,t){var i,s,o=e.locator||e.key||e,n=t.ownerDocument||t,r=null;try{if(lang.isUndefined(n.evaluate))n.setProperty("SelectionLanguage","XPath"),r=(i=t.selectNodes(o)[0]).value||i.text||null;else for(i=n.evaluate(o,t,n.createNSResolver((t.ownerDocument||t).documentElement),0,null);s=i.iterateNext();)r=s.textContent;return r}catch(e){}},issueCallback:function(e,t,i,s){var o;lang.isFunction(e)?e.apply(s,t):lang.isObject(e)&&(s=e.scope||s||window,o=e.success,i&&(o=e.failure),o&&o.apply(s,t.concat([e.argument])))},parseString:function(e){if(!lang.isValue(e))return null;e+="";return lang.isString(e)?e:null},parseNumber:function(e){if(!lang.isValue(e)||""===e)return null;e=+e;return lang.isNumber(e)?e:null},convertNumber:function(e){return DS.parseNumber(e)},parseDate:function(e){var t=null;return e instanceof Date?e:(t=new Date(e))instanceof Date?t:null},convertDate:function(e){return DS.parseDate(e)}}),DS.Parser={string:DS.parseString,number:DS.parseNumber,date:DS.parseDate},DS.prototype={_sName:null,_aCache:null,_oQueue:null,_aIntervals:null,maxCacheEntries:0,liveData:null,dataType:DS.TYPE_UNKNOWN,responseType:DS.TYPE_UNKNOWN,responseSchema:null,useXPath:!1,toString:function(){return this._sName},getCachedResponse:function(e,t,i){var s=this._aCache;if(0<this.maxCacheEntries)if(s){var o=s.length;if(0<o){var n=null;this.fireEvent("cacheRequestEvent",{request:e,callback:t,caller:i});for(var r=o-1;0<=r;r--){var a=s[r];if(this.isCacheHit(e,a.request)){n=a.response,this.fireEvent("cacheResponseEvent",{request:e,response:n,callback:t,caller:i}),r<o-1&&(s.splice(r,1),this.addToCache(e,n)),n.cached=!0;break}}return n}}else this._aCache=[];else s&&(this._aCache=null);return null},isCacheHit:function(e,t){return e===t},addToCache:function(e,t){var i=this._aCache;if(i){for(;i.length>=this.maxCacheEntries;)i.shift();var s={request:e,response:t};i[i.length]=s,this.fireEvent("responseCacheEvent",{request:e,response:t})}},flushCache:function(){this._aCache&&(this._aCache=[],this.fireEvent("cacheFlushEvent"))},setInterval:function(e,t,i,s){if(lang.isNumber(e)&&0<=e){var o=this,e=setInterval(function(){o.makeConnection(t,i,s)},e);return this._aIntervals.push(e),e}},clearInterval:function(e){for(var t=this._aIntervals||[],i=t.length-1;-1<i;i--)t[i]===e&&(t.splice(i,1),clearInterval(e))},clearAllIntervals:function(){for(var e=this._aIntervals||[],t=e.length-1;-1<t;t--)clearInterval(e[t]);e=[]},sendRequest:function(e,t,i){var s=this.getCachedResponse(e,t,i);return s?(DS.issueCallback(t,[e,s],!1,i),null):this.makeConnection(e,t,i)},makeConnection:function(e,t,i){var s=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:s,request:e,callback:t,caller:i});var o=this.liveData;return this.handleResponse(e,o,t,i,s),s},handleResponse:function(oRequest,oRawResponse,oCallback,oCaller,tId){this.fireEvent("responseEvent",{tId:tId,request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller});var xhr=this.dataType==DS.TYPE_XHR,oParsedResponse=null,oFullResponse=oRawResponse,ctype,el;switch(this.responseType===DS.TYPE_UNKNOWN&&(ctype=oRawResponse&&oRawResponse.getResponseHeader?oRawResponse.getResponseHeader["Content-Type"]:null,ctype?-1<ctype.indexOf("text/xml")?this.responseType=DS.TYPE_XML:-1<ctype.indexOf("application/json")?this.responseType=DS.TYPE_JSON:-1<ctype.indexOf("text/plain")&&(this.responseType=DS.TYPE_TEXT):YAHOO.lang.isArray(oRawResponse)?this.responseType=DS.TYPE_JSARRAY:oRawResponse&&oRawResponse.nodeType&&(9===oRawResponse.nodeType||1===oRawResponse.nodeType||11===oRawResponse.nodeType)?this.responseType=DS.TYPE_XML:oRawResponse&&oRawResponse.nodeName&&"table"==oRawResponse.nodeName.toLowerCase()?this.responseType=DS.TYPE_HTMLTABLE:YAHOO.lang.isObject(oRawResponse)?this.responseType=DS.TYPE_JSON:YAHOO.lang.isString(oRawResponse)&&(this.responseType=DS.TYPE_TEXT)),this.responseType){case DS.TYPE_JSARRAY:xhr&&oRawResponse&&oRawResponse.responseText&&(oFullResponse=oRawResponse.responseText);try{if(lang.isString(oFullResponse)){var parseArgs=[oFullResponse].concat(this.parseJSONArgs),arrayEnd,oFullResponse;if(lang.JSON)oFullResponse=lang.JSON.parse.apply(lang.JSON,parseArgs);else if(window.JSON&&JSON.parse)oFullResponse=JSON.parse.apply(JSON,parseArgs);else if(oFullResponse.parseJSON)oFullResponse=oFullResponse.parseJSON.apply(oFullResponse,parseArgs.slice(1));else{for(;0<oFullResponse.length&&"{"!=oFullResponse.charAt(0)&&"["!=oFullResponse.charAt(0);)oFullResponse=oFullResponse.substring(1,oFullResponse.length);0<oFullResponse.length&&(arrayEnd=Math.max(oFullResponse.lastIndexOf("]"),o
1FullResponse.lastIndexOf("}")),oFullResponse=oFullResponse.substring(0,arrayEnd+1),oFullResponse=eval("("+oFullResponse+")"))}}}catch(e1){}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback),oParsedResponse=this.parseArrayData(oRequest,oFullResponse);break;case DS.TYPE_JSON:xhr&&oRawResponse&&oRawResponse.responseText&&(oFullResponse=oRawResponse.responseText);try{if(lang.isString(oFullResponse)){var parseArgs=[oFullResponse].concat(this.parseJSONArgs),objEnd;if(lang.JSON)oFullResponse=lang.JSON.parse.apply(lang.JSON,parseArgs);else if(window.JSON&&JSON.parse)oFullResponse=JSON.parse.apply(JSON,parseArgs);else if(oFullResponse.parseJSON)oFullResponse=oFullResponse.parseJSON.apply(oFullResponse,parseArgs.slice(1));else{for(;0<oFullResponse.length&&"{"!=oFullResponse.charAt(0)&&"["!=oFullResponse.charAt(0);)oFullResponse=oFullResponse.substring(1,oFullResponse.length);0<oFullResponse.length&&(objEnd=Math.max(oFullResponse.lastIndexOf("]"),oFullResponse.lastIndexOf("}")),oFullResponse=oFullResponse.substring(0,objEnd+1),oFullResponse=eval("("+oFullResponse+")"))}}}catch(e){}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback),oParsedResponse=this.parseJSONData(oRequest,oFullResponse);break;case DS.TYPE_HTMLTABLE:xhr&&oRawResponse.responseText&&(el=document.createElement("div"),el.innerHTML=oRawResponse.responseText,oFullResponse=el.getElementsByTagName("table")[0]),oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback),oParsedResponse=this.parseHTMLTableData(oRequest,oFullResponse);break;case DS.TYPE_XML:xhr&&oRawResponse.responseXML&&(oFullResponse=oRawResponse.responseXML),oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback),oParsedResponse=this.parseXMLData(oRequest,oFullResponse);break;case DS.TYPE_TEXT:xhr&&lang.isString(oRawResponse.responseText)&&(oFullResponse=oRawResponse.responseText),oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback),oParsedResponse=this.parseTextData(oRequest,oFullResponse);break;default:oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback),oParsedResponse=this.parseData(oRequest,oFullResponse)}oParsedResponse=oParsedResponse||{},oParsedResponse.results||(oParsedResponse.results=[]),oParsedResponse.meta||(oParsedResponse.meta={}),oParsedResponse.error?(oParsedResponse.error=!0,this.fireEvent("dataErrorEvent",{request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller,message:DS.ERROR_DATANULL})):(oParsedResponse=this.doBeforeCallback(oRequest,oFullResponse,oParsedResponse,oCallback),this.fireEvent("responseParseEvent",{request:oRequest,response:oParsedResponse,callback:oCallback,caller:oCaller}),this.addToCache(oRequest,oParsedResponse)),oParsedResponse.tId=tId,DS.issueCallback(oCallback,[oRequest,oParsedResponse],oParsedResponse.error,oCaller)},doBeforeParseData:function(e,t,i){return t},doBeforeCallback:function(e,t,i,s){return i},parseData:function(e,t){return lang.isValue(t)?{results:t,meta:{}}:null},parseArrayData:function(e,t){if(lang.isArray(t)){var i,s,o,n=[];if(lang.isArray(this.responseSchema.fields)){for(var r=this.responseSchema.fields,a=r.length-1;0<=a;--a)"object"!=typeof r[a]&&(r[a]={key:r[a]});var l,h={};for(a=r.length-1;0<=a;--a)(l=("function"==typeof r[a].parser?r[a].parser:DS.Parser[r[a].parser+""])||r[a].converter)&&(h[r[a].key]=l);var u=lang.isArray(t[0]);for(a=t.length-1;-1<a;a--){var c,d={};if("object"==typeof(c=t[a]))for(i=r.length-1;-1<i;i--)s=r[i],o=u?c[i]:c[s.key],h[s.key]&&(o=h[s.key].call(this,o)),void 0===o&&(o=null),d[s.key]=o;else if(lang.isString(c))for(i=r.length-1;-1<i;i--)o=c,h[(s=r[i]).key]&&(o=h[s.key].call(this,o)),void 0===o&&(o=null),d[s.key]=o;n[a]=d}}else n=t;return{results:n}}return null},parseTextData:function(e,t){if(lang.isString(t)&&lang.isString(this.responseSchema.recordDelim)&&lang.isString(this.responseSchema.fieldDelim)){var i={results:[]},s=this.responseSchema.recordDelim,o=this.responseSchema.fieldDelim;if(0<t.length){var n=t.length-s.length;if(t.substr(n)==s&&(t=t.substr(0,n)),0<t.length)for(var r=t.split(s),a=0,l=r.length,h=0;a<l;++a){var u=!1,c=r[a];if(lang.isString(c)&&0<c.length){var d=r[a].split(o),m={};if(lang.isArray(this.responseSchema.fields))for(var p=this.responseSchema.fields,g=p.length-1;-1<g;g--)try{var v,f,b=d[g];
1lang.isString(b)?('"'==b.charAt(0)&&(b=b.substr(1)),'"'==b.charAt(b.length-1)&&(b=b.substr(0,b.length-1)),f=p[g],v=lang.isValue(f.key)?f.key:f,!f.parser&&f.converter&&(f.parser=f.converter),(f="function"==typeof f.parser?f.parser:DS.Parser[f.parser+""])&&(b=f.call(this,b)),void 0===b&&(b=null),m[v]=b):u=!0}catch(e){u=!0}else m=d;u||(i.results[h++]=m)}}}return i}return null},parseXMLResult:function(e){var t={},i=this.responseSchema;try{for(var s=i.fields.length-1;0<=s;s--){var o=i.fields[s],n=lang.isValue(o.key)?o.key:o,r=null;if(this.useXPath)r=YAHOO.util.DataSource._getLocationValue(o,e);else{var a=e.attributes.getNamedItem(n);if(a)r=a.value;else{a=e.getElementsByTagName(n);if(a&&a.item(0)){var l=a.item(0);if(!(r=l&&(l.text||l.textContent)||null)){for(var h=[],u=0,c=l.childNodes.length;u<c;u++)l.childNodes[u].nodeValue&&(h[h.length]=l.childNodes[u].nodeValue);0<h.length&&(r=h.join(""))}}}}null===r&&(r=""),!o.parser&&o.converter&&(o.parser=o.converter);o="function"==typeof o.parser?o.parser:DS.Parser[o.parser+""];o&&(r=o.call(this,r)),void 0===r&&(r=null),t[n]=r}}catch(e){}return t},parseXMLData:function(e,t){var i,s,o,n,r=!1,a=this.responseSchema,l={meta:{}},h=null,u=a.metaNode,c=a.metaFields||{};try{if(this.useXPath)for(s in c)l.meta[s]=YAHOO.util.DataSource._getLocationValue(c[s],t);else if(u=u?t.getElementsByTagName(u)[0]:t)for(s in c)lang.hasOwnProperty(c,s)&&(o=c[s],n=(n=u.getElementsByTagName(o)[0])?n.firstChild.nodeValue:(n=u.attributes.getNamedItem(o))&&n.value,lang.isValue(n)&&(l.meta[s]=n));h=a.resultNode?t.getElementsByTagName(a.resultNode):null}catch(e){}if(h&&lang.isArray(a.fields))for(l.results=[],i=h.length-1;0<=i;--i){var d=this.parseXMLResult(h.item(i));l.results[i]=d}else r=!0;return r&&(l.error=!0),l},parseJSONData:function(e,t){var i={results:[],meta:{}};if(lang.isObject(t)&&this.responseSchema.resultsList){function s(e){var t=null,s=[],o=0;if(e&&(e=e.replace(/\[(['"])(.*?)\1\]/g,function(e,t,i){return s[o]=i,".@"+o++}).replace(/\[(\d+)\]/g,function(e,t){return s[o]=0|parseInt(t,10),".@"+o++}).replace(/^\./,""),!/[^\w\.\$@]/.test(e)))for(t=e.split("."),o=t.length-1;0<=o;--o)"@"===t[o].charAt(0)&&(t[o]=s[parseInt(t[o].substr(1),10)]);return t}function o(e,t){for(var i=t,s=0,o=e.length;s<o&&i;++s)i=i[e[s]];return i}var n,r,a,l=this.responseSchema,h=l.fields,u=t,c=[],d=l.metaFields||{},m=[],p=[],g=[],v=!1,f=s(l.resultsList);if(f&&void 0!==(u=o(f,t))||(v=!0),u=u||[],lang.isArray(u)||(u=[u]),v)i.error=!0;else{if(l.fields){for(var b,y=0,O=h.length;y<O;y++)a=(b=h[y]).key||b,b=("function"==typeof b.parser?b.parser:DS.Parser[b.parser+""])||b.converter,f=s(a),b&&(m[m.length]={key:a,parser:b}),f&&(1<f.length?p[p.length]={key:a,path:f}:g[g.length]={key:a,path:f[0]});for(y=u.length-1;0<=y;--y){var _=u[y],C={};if(_){for(n=g.length-1;0<=n;--n)C[g[n].key]=void 0!==_[g[n].path]?_[g[n].path]:_[n];for(n=p.length-1;0<=n;--n)C[p[n].key]=o(p[n].path,_);for(n=m.length-1;0<=n;--n){var A=m[n].key;C[A]=m[n].parser(C[A]),void 0===C[A]&&(C[A]=null)}}c[y]=C}}else c=u;for(a in d)lang.hasOwnProperty(d,a)&&(f=s(d[a]))&&(r=o(f,t),i.meta[a]=r)}i.results=c}else i.error=!0;return i},parseHTMLTableData:function(e,t){var i=!1,s=t,o=this.responseSchema.fields,n={results:[]};if(lang.isArray(o))for(var r=0;r<s.tBodies.length;r++)for(var a=s.tBodies[r],l=a.rows.length-1;-1<l;l--){for(var h=a.rows[l],u={},c=o.length-1;-1<c;c--){var d=o[c],m=lang.isValue(d.key)?d.key:d,p=h.cells[c].innerHTML;!d.parser&&d.converter&&(d.parser=d.converter);d="function"==typeof d.parser?d.parser:DS.Parser[d.parser+""];d&&(p=d.call(this,p)),void 0===p&&(p=null),u[m]=p}n.results[l]=u}else i=!0;return i&&(n.error=!0),n}},lang.augmentProto(DS,util.EventProvider),util.LocalDataSource=function(e,t){this.dataType=DS.TYPE_LOCAL,e?YAHOO.lang.isArray(e)?this.responseType=DS.TYPE_JSARRAY:e.nodeType&&9==e.nodeType?this.responseType=DS.TYPE_XML:e.nodeName&&"table"==e.nodeName.toLowerCase()?(this.responseType=DS.TYPE_HTMLTABLE,e=e.cloneNode(!0)):YAHOO.lang.isString(e)?this.responseType=DS.TYPE_TEXT:YAHOO.lang.isObject(e)&&(this.responseType=DS.TYPE_JSON):(e=[],this.responseType=DS.TYPE_JSARRAY),util.LocalDataSource.superclass.constructor.call(this,e,t)},lang.extend(util.LocalDataSource,DS),lang.augmentObject(util.LocalDataSource,DS),util.FunctionDataSource=function(e,t){this.dataType=DS.TYPE_JSFUNCTION,e=e||function(){},util.FunctionDataSource.superclass.constructor.call(this,e,t)},lang.extend(util.FunctionDataSource,DS,{scope:null,makeConnection:function(e,t,i){var s=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:s,request:e,callback:t,caller:i});var o=this.scope?this.liveData.call(this.scope,e,this):this.liveData(e);return this.responseType===DS.TYPE_UNKNOWN&&(YAHOO.lang.isArray(o)?this.responseType=DS.TYPE_JSARRAY:o&&o.nodeType&&9==o.nodeType?this.responseType=DS.TYPE_XML:o&&o.nodeName&&"table"==o.nodeName.toLowerCase()?this.responseType=DS.TYPE_HTMLTABLE:YAHOO.lang.isObject(o)?this.responseType=DS.TYPE_JSON:YAHOO.lang.isString(o)&&(this.responseType=DS.TYPE_TEXT)),this.handleResponse(e,o,t,i,s),s}}),lang.augmentObject(util.FunctionDataSource,DS),util.ScriptNodeDataSource=function(e,t){this.dataType=DS.TYPE_SCRIPTNODE,e=e||"",util.ScriptNodeDataSource.superclass.constructor.call(this,e,t)},lang.extend(util.ScriptNodeDataSource,DS,{getUtility:util.Get,asyncMode:"allowAll",scriptCallbackParam:"callback",generateRequestCallback:function(e){return"&"+this.scriptCallbackParam+"=YAHOO.util.ScriptNodeDataSource.callbacks["+e+"]"},doBeforeGetScriptNode:function(e){return e},makeConnection:function(t,i,s){var o=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:o,request:t,callback:i,caller:s}),0===util.ScriptNodeDataSource._nPending&&(util.ScriptNodeDataSource.callbacks=[],util.ScriptNodeDataSource._nId=0);var n=util.ScriptNodeDataSource._nId;util.ScriptNodeDataSource._nId++;var r=this;
1util.ScriptNodeDataSource.callbacks[n]=function(e){"ignoreStaleResponses"===r.asyncMode&&n!==util.ScriptNodeDataSource.callbacks.length-1||(r.responseType===DS.TYPE_UNKNOWN&&(YAHOO.lang.isArray(e)?r.responseType=DS.TYPE_JSARRAY:e.nodeType&&9==e.nodeType?r.responseType=DS.TYPE_XML:e.nodeName&&"table"==e.nodeName.toLowerCase()?r.responseType=DS.TYPE_HTMLTABLE:YAHOO.lang.isObject(e)?r.responseType=DS.TYPE_JSON:YAHOO.lang.isString(e)&&(r.responseType=DS.TYPE_TEXT)),r.handleResponse(t,e,i,s,o)),delete util.ScriptNodeDataSource.callbacks[n]},util.ScriptNodeDataSource._nPending++;var e=this.liveData+t+this.generateRequestCallback(n),e=this.doBeforeGetScriptNode(e);return this.getUtility.script(e,{autopurge:!0,onsuccess:util.ScriptNodeDataSource._bumpPendingDown,onfail:util.ScriptNodeDataSource._bumpPendingDown}),o}}),lang.augmentObject(util.ScriptNodeDataSource,DS),lang.augmentObject(util.ScriptNodeDataSource,{_nId:0,_nPending:0,callbacks:[]}),util.XHRDataSource=function(e,t){this.dataType=DS.TYPE_XHR,this.connMgr=this.connMgr||util.Connect,e=e||"",util.XHRDataSource.superclass.constructor.call(this,e,t)},lang.extend(util.XHRDataSource,DS,{connMgr:null,connXhrMode:"allowAll",connMethodPost:!1,connTimeout:0,makeConnection:function(i,s,o){var n=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:n,request:i,callback:s,caller:o});var e,t,r,a,l,h,u=this.connMgr,c=this._oQueue,d={success:function(e){return e&&"ignoreStaleResponses"==this.connXhrMode&&e.tId!=c.conn.tId?null:e?(this.responseType!==DS.TYPE_UNKNOWN||(t=e.getResponseHeader?e.getResponseHeader["Content-Type"]:null)&&(-1<t.indexOf("text/xml")?this.responseType=DS.TYPE_XML:-1<t.indexOf("application/json")?this.responseType=DS.TYPE_JSON:-1<t.indexOf("text/plain")&&(this.responseType=DS.TYPE_TEXT)),void this.handleResponse(i,e,s,o,n)):(this.fireEvent("dataErrorEvent",{request:i,response:null,callback:s,caller:o,message:DS.ERROR_DATANULL}),DS.issueCallback(s,[i,{error:!0}],!0,o),null);var t},failure:function(e){return this.fireEvent("dataErrorEvent",{request:i,response:e,callback:s,caller:o,message:DS.ERROR_DATAINVALID}),lang.isString(this.liveData)&&lang.isString(i)&&this.liveData.lastIndexOf("?")!==this.liveData.length-1&&i.indexOf("?"),(e=e||{}).error=!0,DS.issueCallback(s,[i,e],!0,o),null},scope:this};return lang.isNumber(this.connTimeout)&&(d.timeout=this.connTimeout),"cancelStaleRequests"==this.connXhrMode&&c.conn&&u.abort&&(u.abort(c.conn),c.conn=null),u&&u.asyncRequest?(e=this.liveData,t=this.connMethodPost,r=t?"POST":"GET",a=t||!lang.isValue(i)?e:e+i,l=t?i:null,"queueRequests"==this.connXhrMode&&c.conn?((h=c.requests).push({request:i,callback:d}),c.interval||(c.interval=setInterval(function(){u.isCallInProgress(c.conn)||(0<h.length?(a=t||!lang.isValue(h[0].request)?e:e+h[0].request,l=t?h[0].request:null,c.conn=u.asyncRequest(r,a,h[0].callback,l),h.shift()):(clearInterval(c.interval),c.interval=null))},50))):c.conn=u.asyncRequest(r,a,d,l)):DS.issueCallback(s,[i,{error:!0}],!0,o),n}}),lang.augmentObject(util.XHRDataSource,DS),util.DataSource=function(e,t){var i=(t=t||{}).dataType;if(i){if(i==DS.TYPE_LOCAL)return lang.augmentObject(util.DataSource,util.LocalDataSource),new util.LocalDataSource(e,t);if(i==DS.TYPE_XHR)return lang.augmentObject(util.DataSource,util.XHRDataSource),new util.XHRDataSource(e,t);if(i==DS.TYPE_SCRIPTNODE)return lang.augmentObject(util.DataSource,util.ScriptNodeDataSource),new util.ScriptNodeDataSource(e,t);if(i==DS.TYPE_JSFUNCTION)return lang.augmentObject(util.DataSource,util.FunctionDataSource),new util.FunctionDataSource(e,t)}return YAHOO.lang.isString(e)?(lang.augmentObject(util.DataSource,util.XHRDataSource),new util.XHRDataSource(e,t)):YAHOO.lang.isFunction(e)?(lang.augmentObject(util.DataSource,util.FunctionDataSource),new util.FunctionDataSource(e,t)):(lang.augmentObject(util.DataSource,util.LocalDataSource),new util.LocalDataSource(e,t))},lang.augmentObject(util.DataSource,DS)}(),YAHOO.util.Number={format:function(e,t){if(!isFinite(+e))return"";e=isFinite(+e)?+e:0,t=YAHOO.lang.merge(YAHOO.util.Number.format.defaults,t||{});var i,s=e<0,o=Math.abs(e),n=t.decimalPlaces,e=t.thousandsSeparator,r=n<0?0<(i=(r=o-o%1+"").length+n)?Number("."+r).toFixed(i).slice(2)+new Array(r.length-i+1).join("0"):"0":o<1&&.5<=o&&!n?"1":o.toFixed(n);return 1e3<o&&(i=(o=r.split(/\D/))[0].length%3||3,o[0]=o[0].slice(0,i)+o[0].slice(i).replace(/(\d{3})/g,e+"$1"),r=o.join(t.decimalSeparator)),r=t.prefix+r+t.suffix,s?t.negativeFormat.replace(/#/,r):r}},YAHOO.util.Number.format.defaults={decimalSeparator:".",decimalPlaces:null,thousandsSeparator:"",prefix:"",suffix:"",negativeFormat:"-#"},function(){function r(e,t,i){for(void 0===i&&(i=10);parseInt(e,10)<i&&1<i;i/=10)e=t.toString()+e;return e.toString()}var a={formats:{a:function(e,t){return t.a[e.getDay()]},A:function(e,t){return t.A[e.getDay()]},b:function(e,t){return t.b[e.getMonth()]},B:function(e,t){return t.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(a.formats.G(e)%100,10),0)},G:function(e){var t=e.getFullYear(),i=parseInt(a.formats.V(e),10),e=parseInt(a.formats.W(e),10);return i<e?t++:0===e&&52<=i&&t--,t},H:["getHours","0"],I:function(e){e=e.getHours()%12;return r(0==e?12:e,0)},j:function(e){var t=new Date(e.getFullYear()+"/1/1 GMT"),e=new Date(e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()+" GMT"),t=parseInt((e-t)/6e4/60/24,10)+1;return r(t,0,100)},k:["getHours"," "],l:function(e){e=e.getHours()%12;return r(0==e?12:e," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e,t){return t.p[12<=e.getHours()?1:0]},P:function(e,t){return t.P[12<=e.getHours()?1:0]},s:function(e,t){return parseInt(e.getTime()/1e3,10)},S:["getSeconds","0"],u:function(e){e=e.getDay();return 0===e?7:e},U:function(e){var t=parseInt(a.formats.j(e),10),e=6-e.getDay(),e=parseInt((t+e)/7,10);return r(e,0)},V:function(e){var t=parseInt(a.formats.W(e),10),i=new Date(e.getFullYear()+"/1/1").getDay(),i=t+(4<i||i<=1?0:1);return 53===i&&new Date(e.getFullYear()+"/12/31").getDay()<4?i=1:0===i&&(i=a.formats.V(new Date(e.getFullYear()-1+"/12/31"))),r(i,0)},w:"getDay",W:function(e){var t=parseInt(a.formats.j(e),10),e=7-a.formats.u(e),e=parseInt((t+e)/7,10);return r(e,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){e=e.getTimezoneOffset();
1return(0<e?"-":"+")+r(parseInt(Math.abs(e/60),10),0)+r(Math.abs(e%60),0)},Z:function(e){var t=e.toString().replace(/^.*:\d\d(GMT[+-]\d+)? \(?([A-Za-z ]+)\)?\d*$/,"$2").replace(/[a-z ]/g,"");return 4<t.length&&(t=a.formats.z(e)),t},"%":function(e){return"%"}},aggregates:{c:"locale",D:"%m/%d/%y",F:"%Y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"},format:function(s,e,t){if(e=e||{},!(s instanceof Date))return YAHOO.lang.isValue(s)?s:"";var i=e.format||"%m/%d/%Y";"YYYY/MM/DD"===i?i="%Y/%m/%d":"DD/MM/YYYY"===i?i="%d/%m/%Y":"MM/DD/YYYY"===i&&(i="%m/%d/%Y"),(t=t||"en")in YAHOO.util.DateLocale||(t=t.replace(/-[a-zA-Z]+$/,"")in YAHOO.util.DateLocale?t.replace(/-[a-zA-Z]+$/,""):"en");for(var o=YAHOO.util.DateLocale[t],n=function(e,t){var i=a.aggregates[t];return"locale"===i?o[t]:i};i.match(/%[cDFhnrRtTxX]/);)i=i.replace(/%([cDFhnrRtTxX])/g,n);n=void 0;return i.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var i=a.formats[t];return"string"==typeof i?s[i]():"function"==typeof i?i.call(s,s,o):"object"==typeof i&&"string"==typeof i[0]?r(s[i[0]](),i[1]):t})}};YAHOO.namespace("YAHOO.util"),YAHOO.util.Date=a,YAHOO.util.DateLocale={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%d/%m/%y",X:"%T"},YAHOO.util.DateLocale.en=YAHOO.lang.merge(YAHOO.util.DateLocale,{}),YAHOO.util.DateLocale["en-US"]=YAHOO.lang.merge(YAHOO.util.DateLocale.en,{c:"%a %d %b %Y %I:%M:%S %p %Z",x:"%m/%d/%Y",X:"%I:%M:%S %p"}),YAHOO.util.DateLocale["en-GB"]=YAHOO.lang.merge(YAHOO.util.DateLocale.en,{r:"%l:%M:%S %P %Z"}),YAHOO.util.DateLocale["en-AU"]=YAHOO.lang.merge(YAHOO.util.DateLocale.en)}(),YAHOO.register("datasource",YAHOO.util.DataSource,{version:"2.8.1",build:"19"}),YAHOO.widget.LogMsg=function(e){if(this.msg=this.time=this.category=this.source=this.sourceDetail=null,e&&e.constructor==Object)for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])},YAHOO.widget.LogWriter=function(e){e?this._source=e:YAHOO.log("Could not instantiate LogWriter due to invalid source.","error","LogWriter")},YAHOO.widget.LogWriter.prototype.toString=function(){return"LogWriter "+this._sSource},YAHOO.widget.LogWriter.prototype.log=function(e,t){YAHOO.widget.Logger.log(e,t,this._source)},YAHOO.widget.LogWriter.prototype.getSource=function(){return this._source},YAHOO.widget.LogWriter.prototype.setSource=function(e){e?this._source=e:YAHOO.log("Could not set source due to invalid source.","error",this.toString())},YAHOO.widget.LogWriter.prototype._source=null,YAHOO.widget.Logger||(YAHOO.widget.Logger={loggerEnabled:!0,_browserConsoleEnabled:!1,categories:["info","warn","error","time","window"],sources:["global"],_stack:[],maxStackEntries:2500,_startTime:(new Date).getTime(),_lastTime:null,_windowErrorsHandled:!1,_origOnWindowError:null},YAHOO.widget.Logger.log=function(e,t,i){if(this.loggerEnabled){t?(t=t.toLocaleLowerCase(),this._isNewCategory(t)&&this._createNewCategory(t)):t="info";var s,o="global",n=null;i&&(0<(s=i.indexOf(" "))?(o=i.substring(0,s),n=i.substring(s,i.length)):o=i,this._isNewSource(o)&&this._createNewSource(o));i=new Date,t=new YAHOO.widget.LogMsg({msg:e,time:i,category:t,source:o,sourceDetail:n}),o=this._stack,n=this.maxStackEntries;return n&&!isNaN(n)&&o.length>=n&&o.shift(),o.push(t),this.newLogEvent.fire(t),this._browserConsoleEnabled&&this._printToBrowserConsole(t),!0}return!1},YAHOO.widget.Logger.reset=function(){this._stack=[],this._startTime=(new Date).getTime(),this.loggerEnabled=!0,this.log("Logger reset"),this.logResetEvent.fire()},YAHOO.widget.Logger.getStack=function(){return this._stack},YAHOO.widget.Logger.getStartTime=function(){return this._startTime},YAHOO.widget.Logger.disableBrowserConsole=function(){YAHOO.log("Logger output to the function console.log() has been disabled."),this._browserConsoleEnabled=!1},YAHOO.widget.Logger.enableBrowserConsole=function(){this._browserConsoleEnabled=!0,YAHOO.log("Logger output to the function console.log() has been enabled.")},YAHOO.widget.Logger.handleWindowErrors=function(){YAHOO.widget.Logger._windowErrorsHandled?YAHOO.log("Logger handling of window.onerror had already been enabled."):(window.error&&(YAHOO.widget.Logger._origOnWindowError=window.onerror),window.onerror=YAHOO.widget.Logger._onWindowError,YAHOO.widget.Logger._windowErrorsHandled=!0,YAHOO.log("Logger handling of window.onerror has been enabled."))},YAHOO.widget.Logger.unhandleWindowErrors=function(){YAHOO.widget.Logger._windowErrorsHandled?(YAHOO.widget.Logger._origOnWindowError?(window.onerror=YAHOO.widget.Logger._origOnWindowError,YAHOO.widget.Logger._origOnWindowError=null):window.onerror=null,YAHOO.widget.Logger._windowErrorsHandled=!1,YAHOO.log("Logger handling of window.onerror has been disabled.")):YAHOO.log("Logger handling of window.onerror had already been disabled.")}
1,YAHOO.widget.Logger.categoryCreateEvent=new YAHOO.util.CustomEvent("categoryCreate",this,!0),YAHOO.widget.Logger.sourceCreateEvent=new YAHOO.util.CustomEvent("sourceCreate",this,!0),YAHOO.widget.Logger.newLogEvent=new YAHOO.util.CustomEvent("newLog",this,!0),YAHOO.widget.Logger.logResetEvent=new YAHOO.util.CustomEvent("logReset",this,!0),YAHOO.widget.Logger._createNewCategory=function(e){this.categories.push(e),this.categoryCreateEvent.fire(e)},YAHOO.widget.Logger._isNewCategory=function(e){for(var t=0;t<this.categories.length;t++)if(e==this.categories[t])return!1;return!0},YAHOO.widget.Logger._createNewSource=function(e){this.sources.push(e),this.sourceCreateEvent.fire(e)},YAHOO.widget.Logger._isNewSource=function(e){if(e){for(var t=0;t<this.sources.length;t++)if(e==this.sources[t])return!1;return!0}},YAHOO.widget.Logger._printToBrowserConsole=function(e){var t,i,s;window.console&&console.log&&(e.category,e.category.substring(0,4).toUpperCase(),t=(s=e.time).toLocaleTimeString?s.toLocaleTimeString():s.toString(),i=s.getTime(),s=YAHOO.widget.Logger._lastTime?i-YAHOO.widget.Logger._lastTime:0,YAHOO.widget.Logger._lastTime=i,s=t+" ("+s+"ms): "+e.source+": ",YAHOO.env.ua.webkit&&(s+=e.msg),console.log(s,e.msg))},YAHOO.widget.Logger._onWindowError=function(e,t,i){try{YAHOO.widget.Logger.log(e+" ("+t+", line "+i+")","window"),YAHOO.widget.Logger._origOnWindowError&&YAHOO.widget.Logger._origOnWindowError()}catch(e){return!1}},YAHOO.widget.Logger.log("Logger initialized")),function(){var s=YAHOO.widget.Logger,e=YAHOO.util,o=e.Dom,n=e.Event,g=document;function r(e,t){if(e=g.createElement(e),t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function a(e,t){this._sName=a._index,a._index++,this._init.apply(this,arguments),!1!==this.autoRender&&this.render()}YAHOO.lang.augmentObject(a,{_index:0,ENTRY_TEMPLATE:r("pre",{className:"yui-log-entry"}),VERBOSE_TEMPLATE:"<p><span class='{category}'>{label}</span> {totalTime}ms (+{elapsedTime}){localTime}:</p><p>{sourceAndDetail}</p><p>{message}</p>",BASIC_TEMPLATE:"<p><span class='{category}'>{label}</span> {totalTime}ms (+{elapsedTime}){localTime}: {sourceAndDetail}: {message}</p>"}),a.prototype={logReaderEnabled:!0,width:null,height:null,top:null,left:null,right:null,bottom:null,fontSize:null,footerEnabled:!0,verboseOutput:!0,entryFormat:null,newestOnTop:!0,outputBuffer:100,thresholdMax:500,thresholdMin:100,isCollapsed:!1,isPaused:!1,draggable:!0,toString:function(){return"LogReader instance"+this._sName},pause:function(){this.isPaused=!0,this._timeout=null,this.logReaderEnabled=!1,this._btnPause&&(this._btnPause.value="Resume")},resume:function(){this.isPaused=!1,this.logReaderEnabled=!0,this._printBuffer(),this._btnPause&&(this._btnPause.value="Pause")},render:function(){this.rendered||(this._initContainerEl(),this._initHeaderEl(),this._initConsoleEl(),this._initFooterEl(),this._initCategories(),this._initSources(),this._initDragDrop(),s.newLogEvent.subscribe(this._onNewLog,this),s.logResetEvent.subscribe(this._onReset,this),s.categoryCreateEvent.subscribe(this._onCategoryCreate,this),s.sourceCreateEvent.subscribe(this._onSourceCreate,this),this.rendered=!0,this._filterLogs())},destroy:function(){n.purgeElement(this._elContainer,!0),this._elContainer.innerHTML="",this._elContainer.parentNode.removeChild(this._elContainer),this.rendered=!1},hide:function(){this._elContainer.style.display="none"},show:function(){this._elContainer.style.display="block"},collapse:function(){this._elConsole.style.display="none",this._elFt&&(this._elFt.style.display="none"),this._btnCollapse.value="Expand",this.isCollapsed=!0},expand:function(){this._elConsole.style.display="block",this._elFt&&(this._elFt.style.display="block"),this._btnCollapse.value="Collapse",this.isCollapsed=!1},getCheckbox:function(e){return this._filterCheckboxes[e]},getCategories:function(){return this._categoryFilters},showCategory:function(e){var t=this._categoryFilters;if(t.indexOf){if(-1<t.indexOf(e))return}else for(var i=0;i<t.length;i++)if(t[i]===e)return;this._categoryFilters.push(e),this._filterLogs();var s=this.getCheckbox(e);s&&(s.checked=!0)},hideCategory:function(e){for(var t=this._categoryFilters,i=0;i<t.length;i++)if(e==t[i]){t.splice(i,1);break}this._filterLogs();var s=this.getCheckbox(e);s&&(s.checked=!1)},getSources:function(){return this._sourceFilters},showSource:function(e){var t=this._sourceFilters;if(t.indexOf){if(-1<t.indexOf(e))return}else for(var i=0;i<t.length;i++)if(e==t[i])return;t.push(e),this._filterLogs();var s=this.getCheckbox(e);s&&(s.checked=!0)},hideSource:function(e){for(var t=this._sourceFilters,i=0;i<t.length;i++)if(e==t[i]){t.splice(i,1);break}this._filterLogs();var s=this.getCheckbox(e);s&&(s.checked=!1)},clearConsole:function(){this._timeout=null,this._buffer=[],this._consoleMsgCount=0,this._elConsole.innerHTML=""},setTitle:function(e){this._title.innerHTML=this.html2Text(e)},getLastTime:function(){return this._lastTime},formatMsg:function(e){var t=this.entryFormat||(this.verboseOutput?a.VERBOSE_TEMPLATE:a.BASIC_TEMPLATE),i={category:e.category,label:e.category.substring(0,4).toUpperCase(),sourceAndDetail:e.sourceDetail?e.source+" "+e.sourceDetail
1:e.source,message:this.html2Text(e.msg||e.message||"")};e.time&&e.time.getTime&&(i.localTime=e.time.toLocaleTimeString?e.time.toLocaleTimeString():e.time.toString(),i.elapsedTime=e.time.getTime()-this.getLastTime(),i.totalTime=e.time.getTime()-s.getStartTime());e=a.ENTRY_TEMPLATE.cloneNode(!0);return this.verboseOutput&&(e.className+=" yui-log-verbose"),e.innerHTML=t.replace(/\{(\w+)\}/g,function(e,t){return t in i?i[t]:""}),e},html2Text:function(e){return e?(e+="").replace(/&/g,"&#38;").replace(/</g,"&#60;").replace(/>/g,"&#62;"):""},_sName:null,_buffer:null,_consoleMsgCount:0,_lastTime:null,_timeout:null,_filterCheckboxes:null,_categoryFilters:null,_sourceFilters:null,_elContainer:null,_elHd:null,_elCollapse:null,_btnCollapse:null,_title:null,_elConsole:null,_elFt:null,_elBtns:null,_elCategoryFilters:null,_elSourceFilters:null,_btnPause:null,_btnClear:null,_init:function(e,t){if(this._buffer=[],this._filterCheckboxes={},this._lastTime=s.getStartTime(),t&&t.constructor==Object)for(var i in t)t.hasOwnProperty(i)&&(this[i]=t[i]);this._elContainer=o.get(e),YAHOO.log("LogReader initialized",null,this.toString())},_initContainerEl:function(){this._elContainer&&/div$/i.test(this._elContainer.tagName)||(this._elContainer=g.body.insertBefore(r("div"),g.body.firstChild),o.addClass(this._elContainer,"yui-log-container")),o.addClass(this._elContainer,"yui-log");for(var e,t=this._elContainer.style,i=["width","right","top","fontSize"],s=i.length-1;0<=s;--s)this[e=i[s]]&&(t[e]=this[e]);this.left&&(t.left=this.left,t.right="auto"),this.bottom&&(t.bottom=this.bottom,t.top="auto"),YAHOO.env.ua.opera&&(g.body.style+="")},_initHeaderEl:function(){this._elHd&&(n.purgeElement(this._elHd,!0),this._elHd.innerHTML=""),this._elHd=r("div",{id:"yui-log-hd"+this._sName,className:"yui-log-hd"}),this._elCollapse=r("div",{className:"yui-log-btns"}),this._btnCollapse=r("input",{type:"button",className:"yui-log-button",value:"Collapse"}),n.on(this._btnCollapse,"click",this._onClickCollapseBtn,this),this._title=r("h4",{innerHTML:"Logger Console"}),this._elCollapse.appendChild(this._btnCollapse),this._elHd.appendChild(this._elCollapse),this._elHd.appendChild(this._title),this._elContainer.appendChild(this._elHd)},_initConsoleEl:function(){this._elConsole&&(n.purgeElement(this._elConsole,!0),this._elConsole.innerHTML=""),this._elConsole=r("div",{className:"yui-log-bd"}),this.height&&(this._elConsole.style.height=this.height),this._elContainer.appendChild(this._elConsole)},_initFooterEl:function(){this.footerEnabled&&(this._elFt&&(n.purgeElement(this._elFt,!0),this._elFt.innerHTML=""),this._elFt=r("div",{className:"yui-log-ft"}),this._elBtns=r("div",{className:"yui-log-btns"}),this._btnPause=r("input",{type:"button",className:"yui-log-button",value:"Pause"}),n.on(this._btnPause,"click",this._onClickPauseBtn,this),this._btnClear=r("input",{type:"button",className:"yui-log-button",value:"Clear"}),n.on(this._btnClear,"click",this._onClickClearBtn,this),this._elCategoryFilters=r("div",{className:"yui-log-categoryfilters"}),this._elSourceFilters=r("div",{className:"yui-log-sourcefilters"}),this._elBtns.appendChild(this._btnPause),this._elBtns.appendChild(this._btnClear),this._elFt.appendChild(this._elBtns),this._elFt.appendChild(this._elCategoryFilters),this._elFt.appendChild(this._elSourceFilters),this._elContainer.appendChild(this._elFt))},_initDragDrop:function(){e.DD&&this.draggable&&this._elHd&&(new e.DD(this._elContainer).setHandleElId(this._elHd.id),this._elHd.style.cursor="move")},_initCategories:function(){this._categoryFilters=[];for(var e=s.categories,t=0;t<e.length;t++){var i=e[t];this._categoryFilters.push(i),this._elCategoryFilters&&this._createCategoryCheckbox(i)}},_initSources:function(){this._sourceFilters=[];for(var e=s.sources,t=0;t<e.length;t++){var i=e[t];this._sourceFilters.push(i),this._elSourceFilters&&this._createSourceCheckbox(i)}},_createCategoryCheckbox:function(e){var t,i,s;this._elFt&&(t=r("span",{className:"yui-log-filtergrp"}),i=r("input",{id:"yui-log-filter-"+e+this._sName,className:"yui-log-filter-"+e,type:"checkbox",category:e}),s=r("label",{htmlFor:i.id,className:e,innerHTML:e}),n.on(i,"click",this._onCheckCategory,this),this._filterCheckboxes[e]=i,t.appendChild(i),t.appendChild(s),this._elCategoryFilters.appendChild(t),i.checked=!0)},_createSourceCheckbox:function(e){var t,i,s;this._elFt&&(t=r("span",{className:"yui-log-filtergrp"}),i=r("input",{id:"yui-log-filter-"+e+this._sName,className:"yui-log-filter-"+e,type:"checkbox",source:e}),s=r("label",{htmlFor:i.id,className:e,innerHTML:e}),n.on(i,"click",this._onCheckSource,this),this._filterCheckboxes[e]=i,t.appendChild(i),t.appendChild(s),this._elSourceFilters.appendChild(t),i.checked=!0)},_filterLogs:function(){null!==this._elConsole&&(this.clearConsole(),this._printToConsole(s.getStack()))},_printBuffer:function(){if((this._timeout=null)!==this._elConsole){var e=(e=this.thresholdMax)&&!isNaN(e)?e:500;if(this._consoleMsgCount<e){for(var t=[],i=0;i<this._buffer.length;i++)t[i]=this._buffer[i];this._buffer=[],this._printToConsole(t)}else this._filterLogs();this.newestOnTop||(this._elConsole.scrollTop=this._elConsole.scrollHeight)}},_printToConsole:function(e){var t,i,s=e.length,o=g.createDocumentFragment(),n=[],r=this.thresholdMin,a=this._sourceFilters.length,l=this._categoryFilters.length;for((isNaN(r)||r>this.thresholdMax)&&(r=0),t=r<s?s-r:0;t<s;
1t++){for(var h=!1,u=!1,c=e[t],d=c.source,m=c.category,p=0;p<a;p++)if(d==this._sourceFilters[p]){u=!0;break}if(u)for(p=0;p<l;p++)if(m==this._categoryFilters[p]){h=!0;break}h&&(0===this._consoleMsgCount&&(this._lastTime=c.time.getTime()),"string"==typeof(i=this.formatMsg(c))?n[n.length]=i:o.insertBefore(i,this.newestOnTop&&o.firstChild||null),this._consoleMsgCount++,this._lastTime=c.time.getTime())}n.length?(n.splice(0,0,this._elConsole.innerHTML),this._elConsole.innerHTML=(this.newestOnTop?n.reverse():n).join("")):o.firstChild&&this._elConsole.insertBefore(o,this.newestOnTop&&this._elConsole.firstChild||null)},_onCategoryCreate:function(e,t,i){t=t[0];i._categoryFilters.push(t),i._elFt&&i._createCategoryCheckbox(t)},_onSourceCreate:function(e,t,i){t=t[0];i._sourceFilters.push(t),i._elFt&&i._createSourceCheckbox(t)},_onCheckCategory:function(e,t){var i=this.category;this.checked?t.showCategory(i):t.hideCategory(i)},_onCheckSource:function(e,t){var i=this.source;this.checked?t.showSource(i):t.hideSource(i)},_onClickCollapseBtn:function(e,t){t.isCollapsed?t.expand ():t.collapse()},_onClickPauseBtn:function(e,t){t.isPaused?t.resume():t.pause()},_onClickClearBtn:function(e,t){t.clearConsole()},_onNewLog:function(e,t,i){t=t[0];i._buffer.push(t),!0===i.logReaderEnabled&&null===i._timeout&&(i._timeout=setTimeout(function(){i._printBuffer()},i.outputBuffer))},_onReset:function(e,t,i){i._filterLogs()}},YAHOO.widget.LogReader=a}(),YAHOO.register("logger",YAHOO.widget.Logger,{version:"2.8.1",build:"19"}),function(){YAHOO.util.Config=function(e){e&&this.init(e)};var f=YAHOO.lang,i=YAHOO.util.CustomEvent,o=YAHOO.util.Config;o.CONFIG_CHANGED_EVENT="configChanged",o.BOOLEAN_TYPE="boolean",o.prototype={owner:null,queueInProgress:!1,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(e){this.owner=e,this.configChangedEvent=this.createEvent(o.CONFIG_CHANGED_EVENT),this.configChangedEvent.signature=i.LIST,this.queueInProgress=!1,this.config={},this.initialConfig={},this.eventQueue=[]},checkBoolean:function(e){return typeof e==o.BOOLEAN_TYPE},checkNumber:function(e){return!isNaN(e)},fireEvent:function(e,t){e=this.config[e];e&&e.event&&e.event.fire(t)},addProperty:function(e,t){e=e.toLowerCase(),(this.config[e]=t).event=this.createEvent(e,{scope:this.owner}),t.event.signature=i.LIST,t.key=e,t.handler&&t.event.subscribe(t.handler,this.owner),this.setProperty(e,t.value,!0),t.suppressEvent||this.queueProperty(e,t.value)},getConfig:function(){var e,t,i={},s=this.config;for(e in s)f.hasOwnProperty(s,e)&&(t=s[e])&&t.event&&(i[e]=t.value);return i},getProperty:function(e){e=this.config[e.toLowerCase()];if(e&&e.event)return e.value},resetProperty:function(e){e=e.toLowerCase();var t=this.config[e];return!(!t||!t.event)&&(this.initialConfig[e]&&!f.isUndefined(this.initialConfig[e])?(this.setProperty(e,this.initialConfig[e]),!0):void 0)},setProperty:function(e,t,i){var s;return e=e.toLowerCase(),this.queueInProgress&&!i?(this.queueProperty(e,t),!0):!(!(s=this.config[e])||!s.event)&&(!(s.validator&&!s.validator(t))&&(s.value=t,i||(this.fireEvent(e,t),this.configChangedEvent.fire([e,t])),!0))},queueProperty:function(e,t){e=e.toLowerCase();var i,s,o,n,r,a,l,h,u,c,d,m,p,g=this.config[e],v=!1;if(g&&g.event){if(!f.isUndefined(t)&&g.validator&&!g.validator(t))return!1;for(f.isUndefined(t)?t=g.value:g.value=t,v=!1,i=this.eventQueue.length,d=0;d<i;d++)if(s=this.eventQueue[d],s&&(o=s[0],n=s[1],o==e)){this.eventQueue[d]=null,this.eventQueue.push([e,f.isUndefined(t)?n:t]),v=!0;break}if(v||f.isUndefined(t)||this.eventQueue.push([e,t]),g.supercedes)for(r=g.supercedes.length,m=0;m<r;m++)for(a=g.supercedes[m],l=this.eventQueue.length,p=0;p<l;p++)if(h=this.eventQueue[p],h&&(u=h[0],c=h[1],u==a.toLowerCase())){this.eventQueue.push([u,c]),this.eventQueue[p]=null;break}return!0}return!1},refireEvent:function(e){e=e.toLowerCase();var t=this.config[e];t&&t.event&&!f.isUndefined(t.value)&&(this.queueInProgress?this.queueProperty(e):this.fireEvent(e,t.value))},applyConfig:function(e,t){var i,s;if(t){for(i in s={},e)f.hasOwnProperty(e,i)&&(s[i.toLowerCase()]=e[i]);this.initialConfig=s}for(i in e)f.hasOwnProperty(e,i)&&this.queueProperty(i,e[i])},refresh:function(){for(var e in this.config)f.hasOwnProperty(this.config,e)&&this.refireEvent(e)},fireQueue:function(){var e,t,i;for(this.queueInProgress=!0,e=0;e<this.eventQueue.length;e++)(i=this.eventQueue[e])&&(t=i[0],i=i[1],this.config[t].value=i,this.eventQueue[e]=null,this.fireEvent(t,i));this.queueInProgress=!1,this.eventQueue=[]},subscribeToConfigEvent:function(e,t,i,s){e=this.config[e.toLowerCase()];return!(!e||!e.event)&&(o.alreadySubscribed(e.event,t,i)||e.event.subscribe(t,i,s),!0)},unsubscribeFromConfigEvent:function(e,t,i){e=this.config[e.toLowerCase()];return!(!e||!e.event)&&e.event.unsubscribe(t,i)},toString:function(){var e="Config";return this.owner&&(e+=" ["+this.owner.toString()+"]"),e},outputEventQueue:function(){for(var e,t="",i=this.eventQueue.length,s=0;s<i;s++)(e=this.eventQueue[s])&&(t+=e[0]+"="+e[1]+", ");return t},destroy:function(){var e,t,i=this.config;for(e in i)f.hasOwnProperty(i,e)&&((t=i[e]).event.unsubscribeAll(),t.event=null);this.configChangedEvent.unsubscribeAll(),this.configChangedEvent=null,this.owner=null,this.config=null,this.initialConfig=null,this.eventQueue=null}},o.alreadySubscribed=function(e,t,i){var s,o,n=e.subscribers.length;if(0<n){o=n-1;do{if((s=e.subscribers[o])&&s.obj==i&&s.fn==t)return!0}while(o--)}return!1},YAHOO.lang.augmentProto(o,YAHOO.util.EventProvider)}(),function(){YAHOO.widget.Module=function(e,t){e&&this.init(e,t)};var e,t,i,s,o,a=YAHOO.util.Dom,l=YAHOO.util.Config,n=YAHOO.util.Event,r=YAHOO.util.CustomEvent,h=YAHOO.widget.Module,u=YAHOO.env.ua,c="beforeInit",d="init",m="append",p="beforeRender",g="render",v="changeHeader",f="changeBody",b="changeFooter",y="changeContent",O="destroy",_="beforeShow",C="show",A="beforeHide",S="hide",E={VISIBLE:{key:"visible",value:!0,validator:YAHOO.lang.isBoolean}
1,EFFECT:{key:"effect",suppressEvent:!0,supercedes:["visible"]},MONITOR_RESIZE:{key:"monitorresize",value:!0},APPEND_TO_DOCUMENT_BODY:{key:"appendtodocumentbody",value:!1}};function w(){return e||((e=document.createElement("div")).innerHTML='<div class="'+h.CSS_HEADER+'"></div><div class="'+h.CSS_BODY+'"></div><div class="'+h.CSS_FOOTER+'"></div>',t=e.firstChild,i=t.nextSibling,s=i.nextSibling),e}function M(){return t||w(),t.cloneNode(!1)}function P(){return i||w(),i.cloneNode(!1)}function D(){return s||w(),s.cloneNode(!1)}h.IMG_ROOT=null,h.IMG_ROOT_SSL=null,h.CSS_MODULE="yui-module",h.CSS_HEADER="hd",h.CSS_BODY="bd",h.CSS_FOOTER="ft",h.RESIZE_MONITOR_SECURE_URL="javascript:false;",h.RESIZE_MONITOR_BUFFER=1,h.textResizeEvent=new r("textResize"),h.forceDocumentRedraw=function(){var e=document.documentElement;e&&(e.className+=" ",e.className=YAHOO.lang.trim(e.className))},h.prototype={constructor:h,element:null,header:null,body:null,footer:null,id:null,imageRoot:h.IMG_ROOT,initEvents:function(){var e=r.LIST;this.beforeInitEvent=this.createEvent(c),this.beforeInitEvent.signature=e,this.initEvent=this.createEvent(d),this.initEvent.signature=e,this.appendEvent=this.createEvent(m),this.appendEvent.signature=e,this.beforeRenderEvent=this.createEvent(p),this.beforeRenderEvent.signature=e,this.renderEvent=this.createEvent(g),this.renderEvent.signature=e,this.changeHeaderEvent=this.createEvent(v),this.changeHeaderEvent.signature=e,this.changeBodyEvent=this.createEvent(f),this.changeBodyEvent.signature=e,this.changeFooterEvent=this.createEvent(b),this.changeFooterEvent.signature=e,this.changeContentEvent=this.createEvent(y),this.changeContentEvent.signature=e,this.destroyEvent=this.createEvent(O),this.destroyEvent.signature=e,this.beforeShowEvent=this.createEvent(_),this.beforeShowEvent.signature=e,this.showEvent=this.createEvent(C),this.showEvent.signature=e,this.beforeHideEvent=this.createEvent(A),this.beforeHideEvent.signature=e,this.hideEvent=this.createEvent(S),this.hideEvent.signature=e},platform:-1!=(o=navigator.userAgent.toLowerCase()).indexOf("windows")||-1!=o.indexOf("win32")?"windows":-1!=o.indexOf("macintosh")&&"mac",browser:-1!=(o=navigator.userAgent.toLowerCase()).indexOf("opera")?"opera":-1!=o.indexOf("msie 7")?"ie7":-1!=o.indexOf("msie")?"ie":-1!=o.indexOf("safari")?"safari":-1!=o.indexOf("gecko")&&"gecko",isSecure:0===window.location.href.toLowerCase().indexOf("https"),initDefaultConfig:function(){this.cfg.addProperty(E.VISIBLE.key,{handler:this.configVisible,value:E.VISIBLE.value,validator:E.VISIBLE.validator}
1),this.cfg.addProperty(E.EFFECT.key,{suppressEvent:E.EFFECT.suppressEvent,supercedes:E.EFFECT.supercedes}),this.cfg.addProperty(E.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:E.MONITOR_RESIZE.value}),this.cfg.addProperty(E.APPEND_TO_DOCUMENT_BODY.key,{value:E.APPEND_TO_DOCUMENT_BODY.value})},init:function(e,t){var i,s;if(this.initEvents(),this.beforeInitEvent.fire(h),this.cfg=new l(this),this.isSecure&&(this.imageRoot=h.IMG_ROOT_SSL),"string"==typeof e&&(i=e,(e=document.getElementById(e))||((e=w().cloneNode(!1)).id=i)),this.id=a.generateId(e),this.element=e,s=this.element.firstChild)for(var o=!1,n=!1,r=!1;1==s.nodeType&&(!o&&a.hasClass(s,h.CSS_HEADER)?(this.header=s,o=!0):!n&&a.hasClass(s,h.CSS_BODY)?(this.body=s,n=!0):!r&&a.hasClass(s,h.CSS_FOOTER)&&(this.footer=s,r=!0)),s=s.nextSibling;);this.initDefaultConfig(),a.addClass(this.element,h.CSS_MODULE),t&&this.cfg.applyConfig(t,!0),l.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)||this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,!0),this.initEvent.fire(h)},initResizeMonitor:function(){var e;u.gecko&&"windows"==this.platform?(e=this,setTimeout(function(){e._initResizeMonitor()},0)):this._initResizeMonitor()},_initResizeMonitor:function(){var e,t,i,s;function o(){h.textResizeEvent.fire()}u.opera||(e=a.get("_yuiResizeMonitor"),t=this._supportsCWResize(),e||(e=document.createElement("iframe"),this.isSecure&&h.RESIZE_MONITOR_SECURE_URL&&u.ie&&(e.src=h.RESIZE_MONITOR_SECURE_URL),t||(s=["<html><head><script ",'type="text/javascript">',"window.onresize=function(){window.parent.","YAHOO.widget.Module.textResizeEvent.","fire();};<","/script></head>","<body></body></html>"].join(""),e.src="data:text/html;charset=utf-8,"+encodeURIComponent(s)),e.id="_yuiResizeMonitor",e.title="Text Resize Monitor",e.style.position="absolute",e.style.visibility="hidden",(s=(i=document.body).firstChild)?i.insertBefore(e,s):i.appendChild(e),e.style.backgroundColor="transparent",e.style.borderWidth="0",e.style.width="2em",e.style.height="2em",e.style.left="0",e.style.top=-1*(e.offsetHeight+h.RESIZE_MONITOR_BUFFER)+"px",e.style.visibility="visible",u.webkit&&((i=e.contentWindow.document).open(),i.close())),e&&e.contentWindow&&(h.textResizeEvent.subscribe(this.onDomResize,this,!0),h.textResizeInitialized||(t&&(n.on(e.contentWindow,"resize",o)||n.on(e,"resize",o)),h.textResizeInitialized=!0),this.resizeMonitor=e))},_supportsCWResize:function(){var e=!0;return u.gecko&&u.gecko<=1.8&&(e=!1),e},onDomResize:function(e,t){var i=-1*(this.resizeMonitor.offsetHeight+h.RESIZE_MONITOR_BUFFER);this.resizeMonitor.style.top=i+"px",this.resizeMonitor.style.left="0"},setHeader:function(e){var t=this.header||(this.header=M());e.nodeName?(t.innerHTML="",t.appendChild(e)):t.innerHTML=e,this._rendered&&this._renderHeader(),this.changeHeaderEvent.fire(e),this.changeContentEvent.fire()},appendToHeader:function(e){(this.header||(this.header=M())).appendChild(e),this.changeHeaderEvent.fire(e),this.changeContentEvent.fire()},setBody:function(e){var t=this.body||(this.body=P());e.nodeName?(t.innerHTML="",t.appendChild(e)):t.innerHTML=e,this._rendered&&this._renderBody(),this.changeBodyEvent.fire(e),this.changeContentEvent.fire()},appendToBody:function(e){(this.body||(this.body=P())).appendChild(e),this.changeBodyEvent.fire(e),this.changeContentEvent.fire()},setFooter:function(e){var t=this.footer||(this.footer=D());e.nodeName?(t.innerHTML="",t.appendChild(e)):t.innerHTML=e,this._rendered&&this._renderFooter(),this.changeFooterEvent.fire(e),this.changeContentEvent.fire()},appendToFooter:function(e){(this.footer||(this.footer=D())).appendChild(e),this.changeFooterEvent.fire(e),this.changeContentEvent.fire()},render:function(e,t){var i,s=this;if(this.beforeRenderEvent.fire(),t=t||this.element,e)"string"==typeof(i=e)&&(i=document.getElementById(i)),i&&(s._addToParent(i,s.element),s.appendEvent.fire());else if(!a.inDocument(this.element))return!1;return this._renderHeader(t),this._renderBody(t),this._renderFooter(t),this._rendered=!0,this.renderEvent.fire(),!0},_renderHeader:function(e){var t;e=e||this.element,this.header&&!a.inDocument(this.header)&&((t=e.firstChild)?e.insertBefore(this.header,t):e.appendChild(this.header))},_renderBody:function(e){e=e||this.element,this.body&&!a.inDocument(this.body)&&(this.footer&&a.isAncestor(e,this.footer)?e.insertBefore(this.body,this.footer):e.appendChild(this.body))},_renderFooter:function(e){e=e||this.element,this.footer&&!a.inDocument(this.footer)&&e.a
1ppendChild(this.footer)},destroy:function(){var e;this.element&&(n.purgeElement(this.element,!0),e=this.element.parentNode),e&&e.removeChild(this.element),this.element=null,this.header=null,this.body=null,this.footer=null,h.textResizeEvent.unsubscribe(this.onDomResize,this),this.cfg.destroy(),this.cfg=null,this.destroyEvent.fire()},show:function(){this.cfg.setProperty("visible",!0)},hide:function(){this.cfg.setProperty("visible",!1)},configVisible:function(e,t,i){t[0]?(this.beforeShowEvent.fire(),a.setStyle(this.element,"display","block"),this.showEvent.fire()):(this.beforeHideEvent.fire(),a.setStyle(this.element,"display","none"),this.hideEvent.fire())},configMonitorResize:function(e,t,i){t[0]?this.initResizeMonitor():(h.textResizeEvent.unsubscribe(this.onDomResize,this,!0),this.resizeMonitor=null)},_addToParent:function(e,t){!this.cfg.getProperty("appendtodocumentbody")&&e===document.body&&e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)},toString:function(){return"Module "+this.id}},YAHOO.lang.augmentProto(h,YAHOO.util.EventProvider)}(),function(){YAHOO.widget.Overlay=function(e,t){YAHOO.widget.Overlay.superclass.constructor.call(this,e,t)};var o,l=YAHOO.lang,i=YAHOO.util.CustomEvent,h=YAHOO.widget.Module,t=YAHOO.util.Event,f=YAHOO.util.Dom,b=YAHOO.util.Config,y=YAHOO.env.ua,g=YAHOO.widget.Overlay,u="unsubscribe",s="beforeMove",n="move",r={X:{key:"x",validator:l.isNumber,suppressEvent:!0,supercedes:["iframe"]},Y:{key:"y",validator:l.isNumber,suppressEvent:!0,supercedes:["iframe"]},XY:{key:"xy",suppressEvent:!0,supercedes:["iframe"]},CONTEXT:{key:"context",suppressEvent:!0,supercedes:["iframe"]},FIXED_CENTER:{key:"fixedcenter",value:!1,supercedes:["iframe","visible"]},WIDTH:{key:"width",suppressEvent:!0,supercedes:["context","fixedcenter","iframe"]},HEIGHT:{key:"height",suppressEvent:!0,supercedes:["context","fixedcenter","iframe"]},AUTO_FILL_HEIGHT:{key:"autofillheight",supercedes:["height"],value:"body"},ZINDEX:{key:"zindex",value:null},CONSTRAIN_TO_VIEWPORT:{key:"constraintoviewport",value:!1,validator:l.isBoolean,supercedes:["iframe","x","y","xy"]},IFRAME:{key:"iframe",value:6==y.ie,validator:l.isBoolean,supercedes:["zindex"]},PREVENT_CONTEXT_OVERLAP:{key:"preventcontextoverlap",value:!1,validator:l.isBoolean,supercedes:["constraintoviewport"]}};g.IFRAME_SRC="javascript:false;",g.IFRAME_OFFSET=3,g.VIEWPORT_OFFSET=10,g.TOP_LEFT="tl",g.TOP_RIGHT="tr",g.BOTTOM_LEFT="bl",g.BOTTOM_RIGHT="br",g.PREVENT_OVERLAP_X={tltr:!0,blbr:!0,brbl:!0,trtl:!0},g.PREVENT_OVERLAP_Y={trbr:!0,tlbl:!0,bltl:!0,brtr:!0},g.CSS_OVERLAY="yui-overlay",g.CSS_HIDDEN="yui-overlay-hidden",g.CSS_IFRAME="yui-overlay-iframe",g.STD_MOD_RE=/^\s*?(body|footer|header)\s*?$/i,g.windowScrollEvent=new i("windowScroll"),g.windowResizeEvent=ne
1w i("windowResize"),g.windowScrollHandler=function(e){e=t.getTarget(e);e&&e!==window&&e!==window.document||(y.ie?(window.scrollEnd||(window.scrollEnd=-1),clearTimeout(window.scrollEnd),window.scrollEnd=setTimeout(function(){g.windowScrollEvent.fire()},1)):g.windowScrollEvent.fire())},g.windowResizeHandler=function(e){y.ie?(window.resizeEnd||(window.resizeEnd=-1),clearTimeout(window.resizeEnd),window.resizeEnd=setTimeout(function(){g.windowResizeEvent.fire()},100)):g.windowResizeEvent.fire()},(g._initialized=null)===g._initialized&&(t.on(window,"scroll",g.windowScrollHandler),t.on(window,"resize",g.windowResizeHandler),g._initialized=!0),g._TRIGGER_MAP={windowScroll:g.windowScrollEvent,windowResize:g.windowResizeEvent,textResize:h.textResizeEvent},YAHOO.extend(g,h,{CONTEXT_TRIGGERS:[],init:function(e,t){g.superclass.init.call(this,e),this.beforeInitEvent.fire(g),f.addClass(this.element,g.CSS_OVERLAY),t&&this.cfg.applyConfig(t,!0),"mac"==this.platform&&y.gecko&&(b.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)||this.showEvent.subscribe(this.showMacGeckoScrollbars,this,!0),b.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)||this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,!0)),this.initEvent.fire(g)},initEvents:function(){g.superclass.initEvents.call(this);var e=i.LIST;this.beforeMoveEvent=this.createEvent(s),this.beforeMoveEvent.signature=e,this.moveEvent=this.createEvent(n),this.moveEvent.signature=e},initDefaultConfig:function(){g.superclass.initDefaultConfig.call(this);var e=this.cfg;
1e.addProperty(r.X.key,{handler:this.configX,validator:r.X.validator,suppressEvent:r.X.suppressEvent,supercedes:r.X.supercedes}),e.addProperty(r.Y.key,{handler:this.configY,validator:r.Y.validator,suppressEvent:r.Y.suppressEvent,supercedes:r.Y.supercedes}),e.addProperty(r.XY.key,{handler:this.configXY,suppressEvent:r.XY.suppressEvent,supercedes:r.XY.supercedes}),e.addProperty(r.CONTEXT.key,{handler:this.configContext,suppressEvent:r.CONTEXT.suppressEvent,supercedes:r.CONTEXT.supercedes}),e.addProperty(r.FIXED_CENTER.key,{handler:this.configFixedCenter,value:r.FIXED_CENTER.value,validator:r.FIXED_CENTER.validator,supercedes:r.FIXED_CENTER.supercedes}),e.addProperty(r.WIDTH.key,{handler:this.configWidth,suppressEvent:r.WIDTH.suppressEvent,supercedes:r.WIDTH.supercedes}),e.addProperty(r.HEIGHT.key,{handler:this.configHeight,suppressEvent:r.HEIGHT.suppressEvent,supercedes:r.HEIGHT.supercedes}),e.addProperty(r.AUTO_FILL_HEIGHT.key,{handler:this.configAutoFillHeight,value:r.AUTO_FILL_HEIGHT.value,validator:this._validateAutoFill,supercedes:r.AUTO_FILL_HEIGHT.supercedes}),e.addProperty(r.ZINDEX.key,{handler:this.configzIndex,value:r.ZINDEX.value}),e.addProperty(r.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:r.CONSTRAIN_TO_VIEWPORT.value,validator:r.CONSTRAIN_TO_VIEWPORT.validator,supercedes:r.CONSTRAIN_TO_VIEWPORT.supercedes}),e.addProperty(r.IFRAME.key,{handler:this.configIframe,value:r.IFRAME.value,validator:r.IFRAME.validator,supercedes:r.IFRAME.supercedes}),e.addProperty(r.PREVENT_CONTEXT_OVERLAP.key,{value:r.PREVENT_CONTEXT_OVERLAP.value,validator:r.PREVENT_CONTEXT_OVERLAP.validator,supercedes:r.PREVENT_CONTEXT_OVERLAP.supercedes})},moveTo:function(e,t){this.cfg.setProperty("xy",[e,t])},hideMacGeckoScrollbars:function(){f.replaceClass(this.element,"show-scrollbars","hide-scrollbars")},showMacGeckoScrollbars:function(){f.replaceClass(this.element,"hide-scrollbars","show-scrollbars")},_setDomVisibility:function(e){f.setStyle(this.element,"visibility",e?"visible":"hidden");var t=g.CSS_HIDDEN;e?f.removeClass(this.element,t):f.addClass(this.element,t)},configVisible:function(e,t,i){var s,o,n,r,a,l,h,u,c,d=t[0],m=f.getStyle(this.element,"visibility"),p=this.cfg.getProperty("effect"),g=[],t="mac"==this.platform&&y.gecko,v=b.alreadySubscribed;if("inherit"==m){for(n=this.element.parentNode;9!=n.nodeType&&11!=n.nodeType&&"inherit"==(m=f.getStyle(n,"visibility"));)n=n.parentNode;"inherit"==m&&(m="visible")}if(p)if(p instanceof Array)for(u=p.length,r=0;r<u;r++)s=p[r],g[g.length]=s.effect(this,s.duration);else g[g.length]=p.effect(this,p.duration);if(d)if(t&&this.showMacGeckoScrollbars(),p){if(d&&("visible"!=m||""===m))for(this.beforeShowEvent.fire(),c=g.length,a=0;a<c;a++)o=g[a],0!==a||v(o.animateInCompleteEvent,this.showEvent.fire,this.showEvent)||o.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,!0),o.animateIn()}else"visible"!=m||""===m?(this.beforeShowEvent.fire(),this._setDomVisibility(!0),this.cfg.refireEvent("iframe"),this.showEvent.fire()):this._setDomVisibility(!0);else if(t&&this.hideMacGeckoScrollbars(),p)if("visible"==m)for(this.beforeHideEvent.fire(),c=g.length,l=0;l<c;l++)h=g[l],0!==l||v(h.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)||h.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,!0),h.animateOut();else""===m&&this._setDomVisibility(!1);else"visible"==m||""===m?(this.beforeHideEvent.fire(),this._setDomVisibility(!1),this.hideEvent.fire()):this._setDomVisibility(!1)},doCenterOnDOMEvent:function(){var e=this.cfg,t=e.getProperty("fixedcenter");e.getProperty("visible")&&t&&("contained"!==t||this.fitsInViewport())&&this.center()},fitsInViewport:function(){var e=g.VIEWPORT_OFFSET,t=this.element,i=t.offsetWidth,s=t.offsetHeight,o=f.getViewportWidth(),t=f.getViewportHeight();return i+e<o&&s+e<t},configFixedCenter:function(e,t,i){var s=t[0],o=b.alreadySubscribed,n=g.windowResizeEvent,t=g.windowScrollEvent;s?(this.center(),o(this.beforeShowEvent,this.center)||this.beforeShowEvent.subscribe(this.center),o(n,this.doCenterOnDOMEvent,this)||n.subscribe(this.doCenterOnDOMEvent,this,!0),o(t,this.doCenterOnDOMEvent,this)||t.subscribe(this.doCenterOnDOMEvent,this,!0)):(this.beforeShowEvent.unsubscribe(this.center),n.unsubscribe(this.doCenterOnDOMEvent,this),t.unsubscribe(this.doCenterOnDOMEvent,this))},configHeight:function(e,t,i){var s=t[0],t=this.element;f.setStyle(t,"height",s),this.cfg.refireEvent("iframe")},configAutoFillHeight:function(e,t,i){var s=t[0],o=this.cfg,n="autofillheight",r="height",a=o.getProperty(n),t=this._autoFillOnHeightChange;o.unsubscribeFromConfigEvent(r,t),h.textResizeEvent.unsubscribe(t),this.changeContentEvent.unsubscribe(t),a&&s!==a&&this[a]&&f.setStyle(this[a],r,""),s&&(s=l.trim(s.toLowerCase()),o.subscribeToConfigEvent(r,t,this[s],this),h.textResizeEvent.subscribe(t,this[s],this),this.changeContentEvent.subscribe(t,this[s],this),o.setProperty(n,s,!0))},configWidth:function(e,t,i){var s=t[0],t=this.element;f.setStyle(t,"width",s),this.cfg.refireEvent("iframe")},configzIndex:function(e,t,i){var s=t[0],t=this.element;s||(s=f.getStyle(t,"zIndex"))&&!isNaN(s)||(s=0),(this.iframe||!0===this.cfg.getProperty("iframe"))&&s<=0&&(s=1),f.setStyle(t,"zIndex",s),this.cfg.setProperty("zIndex",s,!0),this.iframe&&this.stackIframe()},configXY:function(e,t,i){var s=t[0],t=s[0],s=s[1];this.cfg.setProperty("x",t),this.cfg.setProperty("y",s),this.beforeMoveEvent.fire([t,s]),t=this.cfg.getProperty("x"),s=this.cfg.getProperty("y"),this.cfg.refireEvent("iframe"),this.moveEvent.fire([t,s])},configX:function(e,t,i){var s=t[0],t=this.cfg.getProperty("y");this.cfg.setProperty("x",s,!0),this.cfg.setProperty("y",t,!0),this.beforeMoveEvent.fire([s,t]),s=this.cfg.getProperty("x"),t=this.cfg.getProperty("y"),f.setX(this.element,s,!0),this.cfg.setProperty("xy",[s,t],!0),this.cfg.refireEvent("iframe"),this.moveEvent.fire([s,t])},configY:function(e,t,i){var s=this.cfg.getProperty("x"),t=t[0];this.cfg.setProperty("x",s,!0),this.cfg.setProperty("y",t,!0),this.beforeMoveEvent.fire([s,t]),s=this.cfg.getProperty("x"),t=this.cfg.getProperty("y"),f.setY(this.element,t,!0),this.cfg.setProperty("xy",[s,t],!0),this.cfg.refireEvent("iframe"),this.moveEvent.fire([s,t])},showIframe:function(){var e,t=this.iframe;t&&((e=this.element.parentNode)!=t.parentNode&&this._addToParent(e,t),t.style.display="block")},hideIframe:function(){this.iframe&&(this.iframe.style.display="none")},syncIframe:function(){var e=this.iframe,t=this.element,i=g.IFRAME_OFFSET,s=2*i;e&&(e.style.width=t.offsetWidth+s+"px",e.style.height=t.offsetHeight+s+"px",s=this.cfg.getProperty("xy"),l.isArray(s)&&!isNaN(s[0])&&!isNaN(s[1])||(this.syncPosition(),s=this.cfg.getProperty("xy")),f.setXY(e,[s[0]-i,s[1]-i]))},stackIframe:function(){var e;this.iframe&&(e=f.getStyle(this.element,"zIndex"),YAHOO.lang.isUndefined(e)||isNaN(e)||f.setStyle(this.iframe,"zIndex",e-1))},configIframe:function(e,t,i){function s(){var e=this.iframe,t=this.element;e||(o||(o=document.createElement("iframe"),this.isSecure&&(o.src=g.IFRAME_SRC),y.ie?(o.style.filter="alpha(opacity=0)",o.frameBorder=0):o.style.opacity="0",o.style.position="absolute",o.style.border="none",o.style.margin="0",o.style.padding="0",o.style.display="none",o.tabIndex=-1,o.className=g.CSS_IFRAME),(e=o.cloneNode(!1)).id=this.id+"_f",t=t.parentNode||document.body,this._addToParent(t,e),this.iframe=e),this.showIframe(),this.syncIframe(),this.stackIframe(),this._hasIframeEventListeners||(this.showEvent.subscribe(this.showIframe),this.hideEvent.subscribe(this.hideIframe),this.changeContentEvent.subscribe(this.syncIframe),this._hasIframeEventListeners=!0)}t[0]?this.cfg.getProperty("visible")?s.call(this):this._iframeDeferred||(this.beforeShowEvent.subscribe(function e(){s.call(this),this.beforeShowEvent.unsubscribe(e),this._iframeDeferred=!1}),this._iframeDeferred=!0):(this.hideIframe(),this._hasIframeEventListeners&&(this.showEvent.unsubscribe(this.showIframe),this.hideEvent.unsubscribe(this.hideIframe),this.changeContentEvent.unsubscribe(this.syncIframe),this._hasIframeEventListeners=!1))},_primeXYFromDOM:function(){YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))&&(this.syncPosition(),this.cfg.refireEvent("xy"),this.beforeShowEvent.unsubscribe(this._primeXYFromDOM))},configConstrainToViewport:function(e,t,i){t[0]?(b.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)||this.beforeMoveEvent.subscribe(this.enforceConstraints,this,!0),b.alreadySubscribed(this.beforeShowEvent,this._primeXYFromDOM)||this.beforeShowEvent.subscribe(this._primeXYFromDOM)):(this.beforeShowEvent.unsubscribe(this._primeXYFromDOM),this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this))},configContext:function(e,t,i){var s,o,n,r=t[0],a=this.CONTEXT_TRIGGERS;r&&(s=r[0],o=r[1],n=r[2],t=r[3],r=r[4],a&&0<a.length&&(t=(t||[]).concat(a)),s&&("string"==typeof s&&this.cfg.setProperty("context",[document.getElementById(s),o,n,t,r],!0),o&&n&&this.align(o,n,r),this._contextTriggers&&this._processTriggers(this._contextTriggers,u,this._alignOnTrigger),t&&(this._processTriggers(t,"
1subscribe",this._alignOnTrigger),this._contextTriggers=t)))},_alignOnTrigger:function(e,t){this.align()},_findTriggerCE:function(e){var t=null;return e instanceof i?t=e:g._TRIGGER_MAP[e]&&(t=g._TRIGGER_MAP[e]),t},_processTriggers:function(e,t,i){for(var s,o,n=0,r=e.length;n<r;++n)s=e[n],(o=this._findTriggerCE(s))?o[t](i,this,!0):this[t](s,i)},align:function(o,e,n){var t,r,i,s=this.cfg.getProperty("context"),a=this;function l(e,t){var i=null,s=null;switch(o){case g.TOP_LEFT:i=t,s=e;break;case g.TOP_RIGHT:i=t-r.offsetWidth,s=e;break;case g.BOTTOM_LEFT:i=t,s=e-r.offsetHeight;break;case g.BOTTOM_RIGHT:i=t-r.offsetWidth,s=e-r.offsetHeight}null!==i&&null!==s&&(n&&(i+=n[0],s+=n[1]),a.moveTo(i,s))}if(s&&(t=s[0],r=this.element,a=this,o=o||s[1],e=e||s[2],!n&&s[4]&&(n=s[4]),r&&t))switch(i=f.getRegion(t),e){case g.TOP_LEFT:l(i.top,i.left);break;case g.TOP_RIGHT:l(i.top,i.right);break;case g.BOTTOM_LEFT:l(i.bottom,i.left);break;case g.BOTTOM_RIGHT:l(i.bottom,i.right)}},enforceConstraints:function(e,t,i){t=t[0],t=this.getConstrainedXY(t[0],t[1]);this.cfg.setProperty("x",t[0],!0),this.cfg.setProperty("y",t[1],!0),this.cfg.setProperty("xy",t,!0)},_getConstrainedPos:function(e,t){var i=this.element,s=g.VIEWPORT_OFFSET,o="x"==e,n=o?i.offsetWidth:i.offsetHeight,r=o?f.getViewportWidth():f.getViewportHeight(),a=o?f.getDocumentScrollLeft():f.getDocumentScrollTop(),l=o?g.PREVENT_OVERLAP_X:g.PREVENT_OVERLAP_Y,h=this.cfg.getProperty("context"),u=n+s<r,i=this.cfg.getProperty("preventcontextoverlap")&&h&&l[h[1]+h[2]],o=a+s,l=a+r-n-s,s=t;return(t<o||l<t)&&(i?s=this._preventOverlap(e,h[0],n,r,a):!u||t<o?s=o:l<t&&(s=l)),s},_preventOverlap:function(t,e,i,s,o){function n(){var e=l.cfg.getProperty(t)-o>h?h-i:h+u;return l.cfg.setProperty(t,e+o,!0),e}var r="x"==t,a=g.VIEWPORT_OFFSET,l=this,h=(r?f.getX(e):f.getY(e))-o,u=r?e.offsetWidth:e.offsetHeight,c=h-a,d=s-(h+u)-a,m=!1,p=function(){var e;return(l.cfg.getProperty(t)-o>h?d:c)<i&&(m?n():(n(),m=!0,e=p())),e};return p(),this.cfg.getProperty(t)},getConstrainedX:function(e){return this._getConstrainedPos("x",e)},getConstrainedY:function(e){return this._getConstrainedPos("y",e)},getConstrainedXY:function(e,t){return[this.getConstrainedX(e),this.getConstrainedY(t)]},center:function(){var e=g.VIEWPORT_OFFSET,t=this.element.offsetWidth,i=this.element.offsetHeight,s=f.getViewportWidth(),o=f.getViewportHeight(),t=t<s?s/2-t/2+f.getDocumentScrollLeft():e+f.getDocumentScrollLeft(),e=i<o?o/2-i/2+f.getDocumentScrollTop():e+f.getDocumentScrollTop();this.cfg.setProperty("xy",[parseInt(t,10),parseInt(e,10)]),this.cfg.refireEvent("iframe"),y.webkit&&this.forceContainerRedraw()},syncPosition:function(){var e=f.getXY(this.element);this.cfg.setProperty("x",e[0],!0),this.cfg.setProperty("y",e[1],!0),this.cfg.setProperty("xy",e,!0)},onDomResize:function(e,t){var i=this;g.superclass.onDomResize.call(this,e,t),setTimeout(function(){i.syncPosition(),i.cfg.refireEvent("iframe"),i.cfg.refireEvent("context")},0)},_getComputedHeight:document.defaultView&&document.defaultView.getComputedStyle?function(e){var t=null;return e.ownerDocument&&e.ownerDocument.defaultView&&((e=e.ownerDocument.defaultView.getComputedStyle(e,""))&&(t=parseInt(e.height,10))),l.isNumber(t)?t:null}:function(e){var t=null;return e.style.pixelHeight&&(t=e.style.pixelHeight),l.isNumber(t)?t:null},_validateAutoFillHeight:function(e){return!e||l.isString(e)&&g.STD_MOD_RE.test(e)},_autoFillOnHeightChange:function(e,t,i){var s=this.cfg.getProperty("height");(s&&"auto"!==s||0===s)&&this.fillHeight(i)},_getPreciseHeight:function(e){var t=e.offsetHeight;return e.getBoundingClientRect&&(t=(e=e.getBoundingClientRect()).bottom-e.top),t},fillHeight:function(e){if(e){for(var t,i=this.innerElement||this.element,s=[this.header,this.body,this.footer],o=0,n=0,r=0,a=!1,l=0,h=s.length;l<h;l++)(t=s[l])&&(e!==t?n+=this._getPreciseHeight(t):a=!0);a&&((y.ie||y.opera)&&f.setStyle(e,"height","0px"),null===(o=this._getComputedHeight(i))&&(f.addClass(i,"yui-override-padding"),o=i.clientHeight,f.removeClass(i,"yui-override-padding")),r=Math.max(o-n,0),f.setStyle(e,"height",r+"px"),e.offsetHeight!=r&&(r=Math.max(r-(e.offsetHeight-r),0)),f.setStyle(e,"height",r+"px"))}},bringToTop:function(){var s=[],o=this.element;f.getElementsBy(function(e){var t=f.hasClass(e,g.CSS_OVERLAY),i=YAHOO.widget.Panel;t&&!f.isAncestor(o,e)&&(i&&f.hasClass(e,i.CSS_PANEL)?s[s.length]=e.parentNode:s[s.length]=e)},"DIV",document.body),s.sort(function(e,t){return e=f.getStyle(e,"zIndex"),t=f.getStyle(t,"zIndex"),e=!e||isNaN(e)?0:parseInt(e,10),(t=!t||isNaN(t)?0:parseInt(t,10))<e?-1:e<t?1:0});var e,t,i=s[0];i&&(t=f.getStyle(i,"zIndex"),isNaN(t)||(e=!1,i!=o?e=!0:1<s.length&&(i=f.getStyle(s[1],"zIndex"),isNaN(i)||t!=i||(e=!0)),e&&this.cfg.setProperty("zindex",parseInt(t,10)+2)))},destroy:function(){this.iframe&&this.iframe.parentNode.removeChild(this.iframe),this.iframe=null,g.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this),g.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this),h.textResizeEvent.unsubscribe(this._autoFillOnHeightChange),this._contextTriggers&&this._processTriggers(this._contextTriggers,u,this._alignOnTrigger),g.superclass.destroy.call(this)},forceContainerRedraw:function(){var e=this;
1f.addClass(e.element,"yui-force-redraw"),setTimeout(function(){f.removeClass(e.element,"yui-force-redraw")},0)},toString:function(){return"Overlay "+this.id}})}(),function(){YAHOO.widget.OverlayManager=function(e){this.init(e)};var a=YAHOO.widget.Overlay,o=YAHOO.util.Event,n=YAHOO.util.Dom,t=YAHOO.util.Config,i=YAHOO.util.CustomEvent,r=YAHOO.widget.OverlayManager;r.CSS_FOCUSED="focused",r.prototype={constructor:r,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:!0}),this.cfg.addProperty("focusevent",{value:"mousedown"})},init:function(e){this.cfg=new t(this),this.initDefaultConfig(),e&&this.cfg.applyConfig(e,!0),this.cfg.fireQueue();var s=null;this.getActive=function(){return s},this.focus=function(e){e=this.find(e);e&&e.focus()},this.remove=function(e){var t,i=this.find(e);i&&(s==i&&(s=null),(e=null===i.element&&null===i.cfg)||(t=n.getStyle(i.element,"zIndex"),i.cfg.setProperty("zIndex",-1e3,!0)),this.overlays.sort(this.compareZIndexDesc),this.overlays=this.overlays.slice(0,this.overlays.length-1),i.hideEvent.unsubscribe(i.blur),i.destroyEvent.unsubscribe(this._onOverlayDestroy,i),i.focusEvent.unsubscribe(this._onOverlayFocusHandler,i),i.blurEvent.unsubscribe(this._onOverlayBlurHandler,i),e||(o.removeListener(i.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus),i.cfg.setProperty("zIndex",t,!0),i.cfg.setProperty("manager",null)),i.focusEvent._managed&&(i.focusEvent=null),i.blurEvent._managed&&(i.blurEvent=null),i.focus._managed&&(i.focus=null),i.blur._managed&&(i.blur=null))},this.blurAll=function(){var e,t=this.overlays.length;if(0<t)for(e=t-1;this.overlays[e].blur(),e--;);},this._manageBlur=function(e){var t=!1;return s==e&&(n.removeClass(s.element,r.CSS_FOCUSED),t=!(s=null)),t},this._manageFocus=function(e){var t=!1;return s!=e&&(s&&s.blur(),s=e,this.bringToTop(s),n.addClass(s.element,r.CSS_FOCUSED),t=!0),t};e=this.cfg.getProperty("overlays");this.overlays||(this.overlays=[]),e&&(this.register(e),this.overlays.sort(this.compareZIndexDesc))},_onOverlayElementFocus:function(e){var t=o.getTarget(e),e=this.close;e&&(t==e||n.isAncestor(e,t))?this.blur():this.focus()},_onOverlayDestroy:function(e,t,i){this.remove(i)},_onOverlayFocusHandler:function(e,t,i){this._manageFocus(i)},_onOverlayBlurHandler:function(e,t,i){this._manageBlur(i)},_bindFocus:function(e){var t=this;e.focusEvent?e.focusEvent.subscribe(t._onOverlayFocusHandler,e,t):(e.focusEvent=e.createEvent("focus"),e.focusEvent.signature=i.LIST,e.focusEvent._managed=!0),e.focus||(o.on(e.element,t.cfg.getProperty("focusevent"),t._onOverlayElementFocus,null,e),e.focus=function(){t._manageFocus(this)&&(this.cfg.getProperty("visible")&&this.focusFirst&&this.focusFirst(),this.focusEvent.fire())},e.focus._managed=!0)},_bindBlur:function(e){var t=this;e.blurEvent?e.blurEvent.subscribe(t._onOverlayBlurHandler,e,t):(e.blurEvent=e.createEvent("blur"),e.blurEvent.signature=i.LIST,e.focusEvent._managed=!0),e.blur||(e.blur=function(){t._manageBlur(this)&&this.blurEvent.fire()},e.blur._managed=!0),e.hideEvent.subscribe(e.blur)},_bindDestroy:function(e){e.destroyEvent.subscribe(this._onOverlayDestroy,e,this)},_syncZIndex:function(e){var t=n.getStyle(e.element,"zIndex");isNaN(t)?e.cfg.setProperty("zIndex",0):e.cfg.setProperty("zIndex",parseInt(t,10))},register:function(e){var t,i,s=!1;if(e instanceof a)e.cfg.addProperty("manager",{value:this}),this._bindFocus(e),this._bindBlur(e),this._bindDestroy(e),this._syncZIndex(e),this.overlays.push(e),this.bringToTop(e),s=!0;else if(e instanceof Array)for(t=0,i=e.length;t<i;t++)s=this.register(e[t])||s;return s},bringToTop:function(e){var t,i,s,o=this.find(e);o&&((s=this.overlays).sort(this.compareZIndexDesc),(t=s[0])&&(i=n.getStyle(t.element,"zIndex"),isNaN(i)||(e=!1,t!==o?e=!0:1<s.length&&(t=n.getStyle(s[1].element,"zIndex"),isNaN(t)||i!=t||(e=!0)),e&&o.cfg.setProperty("zindex",parseInt(i,10)+2)),s.sort(this.compareZIndexDesc)))},find:function(e){var t,i,s=e instanceof a,o=this.overlays,n=o.length,r=null;if(s||"string"==typeof e)for(i=n-1;0<=i;i--)if(t=o[i],s&&t===e||t.id==e){r=t;break}return r},compareZIndexDesc:function(e,t){e=e.cfg?e.cfg.getProperty("zIndex"):null,t=t.cfg?t.cfg.getProperty("zIndex"):null;return null===e&&null===t?0:null===e?1:null===t||t<e?-1:e<t?1:0},showAll:function(){for(var e=this.overlays,t=e.length-1;0<=t;t--)e[t].show()},hideAll:function(){for(var e=this.overlays,t=e.length-1;0<=t;t--)e[t].hide()},toString:function(){return"OverlayManager"}}}(),function(){YAHOO.widget.Tooltip=function(e,t){YAHOO.widget.Tooltip.superclass.constructor.call(this,e,t)};var a,e=YAHOO.lang,l=YAHOO.util.Event,t=YAHOO.util.CustomEvent,h=YAHOO.util.Dom,i=YAHOO.widget.Tooltip,u=YAHOO.env.ua,c=u.ie&&(u.ie<=6||"BackCompat"==document.compatMode),s={PREVENT_OVERLAP:{key:"preventoverlap",value:!0,validator:e.isBoolean,supercedes:["x","y","xy"]},SHOW_DELAY:{key:"showdelay",value:200,validator:e.isNumber}
1,AUTO_DISMISS_DELAY:{key:"autodismissdelay",value:5e3,validator:e.isNumber},HIDE_DELAY:{key:"hidedelay",value:250,validator:e.isNumber},TEXT:{key:"text",suppressEvent:!0},CONTAINER:{key:"container"},DISABLED:{key:"disabled",value:!1,suppressEvent:!0},XY_OFFSET:{key:"xyoffset",value:[0,25],suppressEvent:!0}},o="contextMouseOver",n="contextMouseOut",r="contextTrigger";function d(e,t){"_originalWidth"in this&&function(e,t){var i=this.cfg;i.getProperty("width")==t&&i.setProperty("width",e)}.call(this,this._originalWidth,this._forcedWidth);var i,s,o=document.body,n=this.cfg,r=n.getProperty("width");r&&"auto"!=r||!(n.getProperty("container")!=o||n.getProperty("x")>=h.getViewportWidth()||n.getProperty("y")>=h.getViewportHeight())||((s=this.element.cloneNode(!0)).style.visibility="hidden",s.style.top="0px",s.style.left="0px",o.appendChild(s),i=s.offsetWidth+"px",o.removeChild(s),s=null,n.setProperty("width",i),n.refireEvent("xy"),this._originalWidth=r||"",this._forcedWidth=i)}function m(e,t,i){this.render(i)}function p(){l.onDOMReady(m,this.cfg.getProperty("container"),this)}i.CSS_TOOLTIP="yui-tt",YAHOO.extend(i,YAHOO.widget.Overlay,{init:function(e,t){i.superclass.init.call(this,e),this.beforeInitEvent.fire(i),h.addClass(this.element,i.CSS_TOOLTIP),t&&this.cfg.applyConfig(t,!0),this.cfg.queueProperty("visible",!1),this.cfg.queueProperty("constraintoviewport",!0),this.setBody(""),this.subscribe("changeContent",d),this.subscribe("init",p),this.subscribe("render",this.onRender),this.initEvent.fire(i)},initEvents:function(){i.superclass.initEvents.call(this);var e=t.LIST;this.contextMouseOverEvent=this.createEvent(o),this.contextMouseOverEvent.signature=e,this.contextMouseOutEvent=this.createEvent(n),this.contextMouseOutEvent.signature=e,this.contextTriggerEvent=this.createEvent(r),this.contextTriggerEvent.signature=e},initDefaultConfig:function(){i.superclass.initDefaultConfig.call(this),this.cfg.addProperty(s.PREVENT_OVERLAP.key,{value:s.PREVENT_OVERLAP.value,validator:s.PREVENT_OVERLAP.validator,supercedes:s.PREVENT_OVERLAP.supercedes}),this.cfg.addProperty(s.SHOW_DELAY.key,{handler:this.configShowDelay,value:200,validator:s.SHOW_DELAY.validator}),this.cfg.addProperty(s.AUTO_DISMISS_DELAY.key,{handler:this.configAutoDismissDelay,value:s.AUTO_DISMISS_DELAY.value,validator:s.AUTO_DISMISS_DELAY.validator}),this.cfg.addProperty(s.HIDE_DELAY.key,{handler:this.configHideDelay,value:s.HIDE_DELAY.value,validator:s.HIDE_DELAY.validator}),this.cfg.addProperty(s.TEXT.key,{handler:this.configText,suppressEvent:s.TEXT.suppressEvent}),this.cfg.addProperty(s.CONTAINER.key,{handler:this.configContainer,value:document.body}),this.cfg.addProperty(s.DISABLED.key,{handler:this.configContainer,value:s.DISABLED.value,supressEvent:s.DISABLED.suppressEvent}),this.cfg.addProperty(s.XY_OFFSET.key,{value:s.XY_OFFSET.value.concat(),supressEvent:s.XY_OFFSET.suppressEvent})},configText:function(e,t,i){t=t[0];t&&this.setBody(t)},configContainer:function(e,t,i){t=t[0];"string"==typeof t&&this.cfg.setProperty("container",document.getElementById(t),!0)},_removeEventListeners:function(){var e,t,i,s=this._context;if(s&&0<(e=s.length))for(i=e-1;t=s[i],l.removeListener(t,"mouseover",this.onContextMouseOver),l.removeListener(t,"mousemove",this.onContextMouseMove),l.removeListener(t,"mouseout",this.onContextMouseOut),i--;);},configContext:function(e,t,i){var s,o,n,r,t=t[0];if(t&&(t instanceof Array||("string"==typeof t?this.cfg.setProperty("context",[document.getElementById(t)],!0):this.cfg.setProperty("context",[t],!0),t=this.cfg.getProperty("context")),this._removeEventListeners(),this._context=t,s=this._context,s&&0<(o=s.length)))for(r=o-1;n=s[r],l.on(n,"mouseover",this.onContextMouseOver,this),l.on(n,"mousemove",this.onContextMouseMove,this),l.on(n,"mouseout",this.onContextMouseOut,this),r--;);},onContextMouseMove:function(e,t){t.pageX=l.getPageX(e),t.pageY=l.getPageY(e)},onContextMouseOver:function(e,t){var i=this;i.title&&(t._tempTitle=i.title,i.title=""),!1===t.fireEvent("contextMouseOver",i,e)||t.cfg.getProperty("disabled")||(t.hideProcId&&(clearTimeout(t.hideProcId),t.hideProcId=null),l.on(i,"mousemove",t.onContextMouseMove,t),t.showProcId=t.doShow(e,i))},onContextMouseOut:function(e,t){t._tempTitle&&(this.title=t._tempTitle,t._tempTitle=null),t.showProcId&&(clearTimeout(t.showProcId),t.showProcId=null),t.hideProcId&&(clearTimeout(t.hideProcId),t.hideProcId=null),t.fireEvent("contextMouseOut",this,e),t.hideProcId=setTimeout(function(){t.hide()},t.cfg.getProperty("hidedelay"))},doShow:function(e,t){var i=this.cfg.getProperty("xyoffset"),s=i[0],o=i[1],n=this;return u.opera&&t.tagName&&"A"==t.tagName.toUpperCase()&&(o+=12),setTimeout(function(){var e=n.cfg.getProperty("text");n._tempTitle&&(""===e||YAHOO.lang.isUndefined(e)||YAHOO.lang.isNull(e))?n.setBody(n._tempTitle):n.cfg.refireEvent("text"),n.moveTo(n.pageX+s,n.pageY+o),n.cfg.getProperty("preventoverlap")&&n.preventOverlap(n.pageX,n.pageY),l.removeListener(t,"mousemove",n.onContextMouseMove),n.contextTriggerEvent.fire(t),n.show(),n.hideProcId=n.doHide()},this.cfg.getProperty("showdelay"))},doHide:function(){var e=this;return setTimeout(function(){e.hide()},this.cfg.getProperty("autodismissdelay"))},preventOverlap:function(e,t){var i=this.element.offsetHeight,s=new YAHOO.util.Point(e,t),e=h.getRegion(this.element);e.top-=5,e.left-=5,e.right+=5,e.bottom+=5,e.contains(s)&&this.cfg.setProperty("y",t-i-5)},onRender:function(e,t){function o(){var e=this.element,t=this.underlay;t&&(t.style.width=e.offsetWidth+6+"px",t.style.height=e.offsetHeight+1+"px")}function n(){h.addClass(this.underlay,"yui-tt-shadow-visible"),u.ie&&this.forceUnderlayRedraw()}function r(){h.removeClass(this.underlay,"yui-tt-shadow-visible")}function i(){var e,t,i,s=this.underlay;s||(e=this.element,t=YAHOO.widget.Module,u.ie,i=this,a||((a=document.createElement("div")).className="yui-tt-shadow"),s=a.cloneNode(!1),e.appendChild(s),this.underlay=s,this._shadow=this.underlay,n.call(this),this.subscribe("beforeShow",n),this.subscribe("hide",r),c&&
1(window.setTimeout(function(){o.call(i)},0),this.cfg.subscribeToConfigEvent("width",o),this.cfg.subscribeToConfigEvent("height",o),this.subscribe("changeContent",o),t.textResizeEvent.subscribe(o,this,!0),this.subscribe("destroy",function(){t.textResizeEvent.unsubscribe(o,this)})))}this.cfg.getProperty("visible")?i.call(this):this.subscribe("beforeShow",function e(){i.call(this),this.unsubscribe("beforeShow",e)})},forceUnderlayRedraw:function(){var e=this;h.addClass(e.underlay,"yui-force-redraw"),setTimeout(function(){h.removeClass(e.underlay,"yui-force-redraw")},0)},destroy:function(){this._removeEventListeners(),i.superclass.destroy.call(this)},toString:function(){return"Tooltip "+this.id}})}(),function(){YAHOO.widget.Panel=function(e,t){YAHOO.widget.Panel.superclass.constructor.call(this,e,t)};var t,h,n,s=null,o=YAHOO.lang,r=YAHOO.util,u=r.Dom,a=r.Event,i=r.CustomEvent,l=YAHOO.util.KeyListener,c=r.Config,d=YAHOO.widget.Overlay,m=YAHOO.widget.Panel,p=YAHOO.env.ua,g=p.ie&&(p.ie<=6||"BackCompat"==document.compatMode),v="showMask",f="hideMask",b="drag",y={CLOSE:{key:"close",value:!0,validator:o.isBoolean,supercedes:["visible"]},DRAGGABLE:{key:"draggable",value:!!r.DD,validator:o.isBoolean,supercedes:["visible"]},DRAG_ONLY:{key:"dragonly",value:!1,validator:o.isBoolean,supercedes:["draggable"]},UNDERLAY:{key:"underlay",value:"shadow",supercedes:["visible"]},MODAL:{key:"modal",value:!1,validator:o.isBoolean,supercedes:["visible","zindex"]},KEY_LISTENERS:{key:"keylisteners",suppressEvent:!0,supercedes:["visible"]},STRINGS:{key:"strings",supercedes:["close"],validator:o.isObject,value:{close:"Close"}}};function O(e,t){!this.header&&this.cfg.getProperty("draggable")&&this.setHeader("&#160;")}function _(e,t,i){var s=i[0],o=i[1],n=this.cfg;n.getProperty("width")==o&&n.setProperty("width",s),this.unsubscribe("hide",_,i)}function C(e,t){var i,s,o;g&&((s=(i=this.cfg).getProperty("width"))&&"auto"!=s||(o=this.element.offsetWidth+"px",i.setProperty("width",o),this.subscribe("hide",_,[s||"",o])))}m.CSS_PANEL="yui-panel",m.CSS_PANEL_CONTAINER="yui-panel-container",m.FOCUSABLE=["a","button","select","textarea","input","iframe"],YAHOO.extend(m,d,{init:function(e,t){m.superclass.init.call(this,e),this.beforeInitEvent.fire(m),u.addClass(this.element,m.CSS_PANEL),this.buildWrapper(),t&&this.cfg.applyConfig(t,!0),this.subscribe("showMask",this._addFocusHandlers),this.subscribe("hideMask",this._removeFocusHandlers),this.subscribe("beforeRender",O),this.subscribe("render",function(){this.setFirstLastFocusable(),this.subscribe("changeContent",this.setFirstLastFocusable)}),this.subscribe("show",this.focusFirst),this.initEvent.fire(m)},_onElementFocus:function(e){if(s===this){var t=a.getTarget(e),i=t!==document.documentElement&&t!==window;if(i&&t!==this.element&&t!==this.mask&&!u.isAncestor(this.element,t))try{(this.firstElement||this._modalFocus||this.innerElement).focus()}catch(e){try{i&&t!==document.body&&t.blur()}catch(e){}}}},_addFocusHandlers:function(e,t){this.firstElement||(p.webkit||p.opera?this._modalFocus||this._createHiddenFocusElement():this.innerElement.tabIndex=0),this.setTabLoop(this.firstElement,this.lastElement),a.onFocus(document.documentElement,this._onElementFocus,this,!0),s=this},_createHiddenFocusElement:function(){var e=document.createElement("button");e.style.height="1px",e.style.width="1px",e.style.position="absolute",e.style.left="-10000em",e.style.opacity=0,e.tabIndex=-1,this.innerElement.appendChild(e),this._modalFocus=e},_removeFocusHandlers:function(e,t){a.removeFocusListener(document.documentElement,this._onElementFocus,this),s==this&&(s=null)},focusFirst:function(e,t,i){var s=this.firstElement;if(t&&t[1]&&a.stopEvent(t[1]),s)try{s.focus()}catch(e){}},focusLast:function(e,t,i){var s=this.lastElement;if(t&&t[1]&&a.stopEvent(t[1]),s)try{s.focus()}catch(e){}},setTabLoop:function(e,t){var i=this.preventBackTab,s=this.preventTabOut,o=this.showEvent,n=this.hideEvent;i&&(i.disable(),o.unsubscribe(i.enable,i),n.unsubscribe(i.disable,i),i=this.preventBackTab=null),s&&(s.disable(),o.unsubscribe(s.enable,s),n.unsubscribe(s.disable,s),s=this.preventTabOut=null),e&&(this.preventBackTab=new l(e,{shift:!0,keys:9},{fn:this.focusLast,scope:this,correctScope:!0}),i=this.preventBackTab,o.subscribe(i.enable,i,!0),n.subscribe(i.disable,i,!0)),t&&(this.preventTabOut=new l(t,{shift:!1,keys:9},{fn:this.focusFirst,scope:this,correctScope:!0}),s=this.preventTabOut,o.subscribe(s.enable,s,!0),n.subscribe(s.disable,s,!0))},getFocusableElements:function(e){e=e||this.innerElement;for(var t={},i=0;i<m.FOCUSABLE.length;i++)t[m.FOCUSABLE[i]]=!0;return u.getElementsBy(function(e){return!(!e.focus||"hidden"===e.type||e.disabled||!t[e.tagName.toLowerCase()])},null,e)},setFirstLastFocusable:function(){this.firstElement=null,this.lastElement=null;var e=this.getFocusableElements();0<(this.focusableElements=e).length&&(this.firstElement=e[0],this.lastElement=e[e.length-1]),this.cfg.getProperty("modal")&&this.setTabLoop(this.firstElement,this.lastElement)},initEvents:function(){m.superclass.initEvents.call(this);var e=i.LIST;this.showMaskEvent=this.createEvent(v),this.showMaskEvent.signature=e,this.hideMaskEvent=this.createEvent(f),this.hideMaskEvent.signature=e,this.dragEvent=this.createEvent(b),this.dragEvent.signature=e},initDefaultConfig:function(){m.superclass.initDefaultConfig.call(this),this.cfg.addProperty(y.CLOSE.key,{handler:this.configClose,value:y.CLOSE.value,validator:y.CLOSE.validator,supercedes:y.CLOSE.supercedes}),this.cfg.addProperty(y.DRAGGABLE.key,{handler:this.configDraggable,value:!!r.DD,validator:y.DRAGGABLE.validator,supercedes:y.DRAGGABLE.supercedes}),this.cfg.addProperty(y.DRAG_ONLY.key,{value:y.DRAG_ONLY.value,validator:y.DRAG_ONLY.validator,supercedes:y.DRAG_ONLY.supercedes}),this.cfg.addProperty(y.UNDERLAY.key,{handler:this.configUnderlay,value:y.UNDERLAY.value,supercedes:y.UNDERLAY.supercedes}),this.cfg.addProperty(y.MODAL.key,{handler:this.configModal,value:y.MODAL.value,validator:y.MODAL.validator,supercedes:y.MODAL.supercedes}),this.cfg.addProperty(y.KEY_LISTENERS.key,{handler:this.configKeyListeners,suppressEvent:y.KEY_LISTENERS.suppressEvent,supercedes:y.KEY_LISTENERS.supercedes}),this.cfg.addProperty(y.STRINGS.key,{value:y.STRINGS.value,handler:this.configStr
1ings,validator:y.STRINGS.validator,supercedes:y.STRINGS.supercedes})},configClose:function(e,t,i){var s=t[0],o=this.close,t=this.cfg.getProperty("strings");s?o?o.style.display="block":(n||((n=document.createElement("a")).className="container-close",n.href="#"),o=n.cloneNode(!0),this.innerElement.appendChild(o),o.innerHTML=t&&t.close?t.close:"&#160;",a.on(o,"click",this._doClose,this,!0),this.close=o):o&&(o.style.display="none")},_doClose:function(e){a.preventDefault(e),this.hide()},configDraggable:function(e,t,i){t[0]?r.DD?(this.header&&(u.setStyle(this.header,"cursor","move"),this.registerDragDrop()),this.subscribe("beforeShow",C)):this.cfg.setProperty("draggable",!1):(this.dd&&this.dd.unreg(),this.header&&u.setStyle(this.header,"cursor","auto"),this.unsubscribe("beforeShow",C))},configUnderlay:function(e,t,i){var s="mac"==this.platform&&p.gecko,t=t[0].toLowerCase(),o=this.underlay,n=this.element;function r(){o||(h||((h=document.createElement("div")).className="underlay"),o=h.cloneNode(!1),this.element.appendChild(o),this.underlay=o,g&&(this.sizeUnderlay(),this.cfg.subscribeToConfigEvent("width",this.sizeUnderlay),this.cfg.subscribeToConfigEvent("height",this.sizeUnderlay),this.changeContentEvent.subscribe(this.sizeUnderlay),YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay,this,!0)),p.webkit&&p.webkit<420&&this.changeContentEvent.subscribe(this.forceUnderlayRedraw))}function a(){!r.call(this)&&g&&this.sizeUnderlay(),this._underlayDeferred=!1,this.beforeShowEvent.unsubscribe(a)}function l(){this._underlayDeferred&&(this.beforeShowEvent.unsubscribe(a),this._underlayDeferred=!1),o&&(this.cfg.unsubscribeFromConfigEvent("width",this.sizeUnderlay),this.cfg.unsubscribeFromConfigEvent("height",this.sizeUnderlay),this.changeContentEvent.unsubscribe(this.sizeUnderlay),this.changeContentEvent.unsubscribe(this.forceUnderlayRedraw),YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay,this,!0),this.element.removeChild(o),this.underlay=null)}switch(t){case"shadow":u.removeClass(n,"matte"),u.addClass(n,"shadow");break;case"matte":s||l.call(this),u.removeClass(n,"shadow"),u.addClass(n,"matte");break;default:s||l.call(this),u.removeClass(n,"shadow"),u.removeClass(n,"matte")}("shadow"==t||s&&!o)&&(this.cfg.getProperty("visible")?!r.call(this)&&g&&this.sizeUnderlay():this._underlayDeferred||(this.beforeShowEvent.subscribe(a),this._underlayDeferred=!0))},configModal:function(e,t,i){t[0]?this._hasModalityEventListeners||(this.subscribe("beforeShow",this.buildMask),this.subscribe("beforeShow",this.bringToTop),this.subscribe("beforeShow",this.showMask),this.subscribe("hide",this.hideMask),d.windowResizeEvent.subscribe(this.sizeMask,this,!0),this._hasModalityEventListeners=!0):this._hasModalityEventListeners&&(this.cfg.getProperty("visible")&&(this.hideMask(),this.removeMask()),this.unsubscribe("beforeShow",this.buildMask),this.unsubscribe("beforeShow",this.bringToTop),this.unsubscribe("beforeShow",this.showMask),this.unsubscribe("hide",this.hideMask),d.windowResizeEvent.unsubscribe(this.sizeMask,this),this._hasModalityEventListeners=!1)},removeMask:function(){var e,t=this.mask;t&&(this.hideMask(),(e=t.parentNode)&&e.removeChild(t),this.mask=null)},configKeyListeners:function(e,t,i){var s,o,n,r=t[0];if(r)if(r instanceof Array)for(o=r.length,n=0;n<o;n++)s=r[n],c.alreadySubscribed(this.showEvent,s.enable,s)||this.showEvent.subscribe(s.enable,s,!0),c.alreadySubscribed(this.hideEvent,s.disable,s)||(this.hideEvent.subscribe(s.disable,s,!0),this.destroyEvent.subscribe(s.disable,s,!0));else c.alreadySubscribed(this.showEvent,r.enable,r)||this.showEvent.subscribe(r.enable,r,!0),c.alreadySubscribed(this.hideEvent,r.disable,r)||(this.hideEvent.subscribe(r.disable,r,!0),this.destroyEvent.subscribe(r.disable,r,!0))}
1,configStrings:function(e,t,i){t=o.merge(y.STRINGS.value,t[0]);this.cfg.setProperty(y.STRINGS.key,t,!0)},configHeight:function(e,t,i){var s=t[0],t=this.innerElement;u.setStyle(t,"height",s),this.cfg.refireEvent("iframe")},_autoFillOnHeightChange:function(e,t,i){var s;m.superclass._autoFillOnHeightChange.apply(this,arguments),g&&(s=this,setTimeout(function(){s.sizeUnderlay()},0))},configWidth:function(e,t,i){var s=t[0],t=this.innerElement;u.setStyle(t,"width",s),this.cfg.refireEvent("iframe")},configzIndex:function(e,t,i){m.superclass.configzIndex.call(this,e,t,i),!this.mask&&!0!==this.cfg.getProperty("modal")||((i=u.getStyle(this.element,"zIndex"))&&!isNaN(i)||(i=0),0===i?this.cfg.setProperty("zIndex",1):this.stackMask())},buildWrapper:function(){var e=this.element.parentNode,t=this.element,i=document.createElement("div");i.className=m.CSS_PANEL_CONTAINER,i.id=t.id+"_c",e&&e.insertBefore(i,t),i.appendChild(t),this.element=i,this.innerElement=t,u.setStyle(this.innerElement,"visibility","inherit")},sizeUnderlay:function(){var e,t=this.underlay;t&&(e=this.element,t.style.width=e.offsetWidth+"px",t.style.height=e.offsetHeight+"px")},registerDragDrop:function(){var e,a=this;this.header&&r.DD&&(e=!0===this.cfg.getProperty("dragonly"),this.dd=new r.DD(this.element.id,this.id,{dragOnly:e}),this.header.id||(this.header.id=this.id+"_h"),this.dd.startDrag=function(){var e,t,i,s,o,n,r;6==YAHOO.env.ua.ie&&u.addClass(a.element,"drag"),a.cfg.getProperty("constraintoviewport")?(e=d.VIEWPORT_OFFSET,t=a.element.offsetHeight,i=a.element.offsetWidth,s=u.getViewportWidth(),o=u.getViewportHeight(),n=u.getDocumentScrollLeft(),r=u.getDocumentScrollTop(),t+e<o?(this.minY=r+e,this.maxY=r+o-t-e):(this.minY=r+e,this.maxY=r+e),i+e<s?(this.minX=n+e,this.maxX=n+s-i-e):(this.minX=n+e,this.maxX=n+e),this.constrainX=!0,this.constrainY=!0):(this.constrainX=!1,this.constrainY=!1),a.dragEvent.fire("startDrag",arguments)},this.dd.onDrag=function(){a.syncPosition(),a.cfg.refireEvent("iframe"),"mac"==this.platform&&YAHOO.env.ua.gecko&&this.showMacGeckoScrollbars(),a.dragEvent.fire("onDrag",arguments)},this.dd.endDrag=function(){6==YAHOO.env.ua.ie&&u.removeClass(a.element,"drag"),a.dragEvent.fire("endDrag",arguments),a.moveEvent.fire(a.cfg.getProperty("xy"))},this.dd.setHandleElId(this.header.id),this.dd.addInvalidHandleType("INPUT"),this.dd.addInvalidHandleType("SELECT"),this.dd.addInvalidHandleType("TEXTAREA"))},buildMask:function(){var e=this.mask;e||(t||((t=document.createElement("div")).className="mask",t.innerHTML="&#160;"),(e=t.cloneNode(!0)).id=this.id+"_mask",document.body.insertBefore(e,document.body.firstChild),this.mask=e,YAHOO.env.ua.gecko&&"mac"==this.platform&&u.addClass(this.mask,"block-scrollbars"),this.stackMask())},hideMask:function(){this.cfg.getProperty("modal")&&this.mask&&(this.mask.style.display="none",u.removeClass(document.body,"masked"),this.hideMaskEvent.fire())},showMask:function(){this.cfg.getProperty("modal")&&this.mask&&(u.addClass(document.body,"masked"),this.sizeMask(),this.mask.style.display="block",this.showMaskEvent.fire())},sizeMask:function(){var e,t,i;this.mask&&(e=this.mask,t=u.getViewportWidth(),i=u.getViewportHeight(),e.offsetHeight>i&&(e.style.height=i+"px"),e.offsetWidth>t&&(e.style.width=t+"px"),e.style.height=u.getDocumentHeight()+"px",e.style.width=u.getDocumentWidth()+"px")},stackMask:function(){var e;this.mask&&(e=u.getStyle(this.element,"zIndex"),YAHOO.lang.isUndefined(e)||isNaN(e)||u.setStyle(this.mask,"zIndex",e-1))},render:function(e){return m.superclass.render.call(this,e,this.innerElement)},_renderHeader:function(e){e=e||this.innerElement,m.superclass._renderHeader.call(this,e)},_renderBody:function(e){e=e||this.innerElement,m.superclass._renderBody.call(this,e)},_renderFooter:function(e){e=e||this.innerElement,m.superclass._renderFooter.call(this,e)},destroy:function(){d.windowResizeEvent.unsubscribe(this.sizeMask,this),this.removeMask(),this.close&&a.purgeElement(this.close),m.superclass.destroy.call(this)}
1,forceUnderlayRedraw:function(){var e=this.underlay;u.addClass(e,"yui-force-redraw"),setTimeout(function(){u.removeClass(e,"yui-force-redraw")},0)},toString:function(){return"Panel "+this.id}})}(),function(){YAHOO.widget.Dialog=function(e,t){YAHOO.widget.Dialog.superclass.constructor.call(this,e,t)};var d=YAHOO.util.Event,t=YAHOO.util.CustomEvent,b=YAHOO.util.Dom,o=YAHOO.widget.Dialog,m=YAHOO.lang,i="beforeSubmit",s="submit",n="manualSubmit",r="asyncSubmit",a="formSubmit",l="cancel",e={POST_METHOD:{key:"postmethod",value:"async"},POST_DATA:{key:"postdata",value:null},BUTTONS:{key:"buttons",value:"none",supercedes:["visible"]},HIDEAFTERSUBMIT:{key:"hideaftersubmit",value:!0}};function p(){var e,t,i,s=this._aButtons;if(m.isArray(s)&&0<(e=s.length))for(i=e-1;t=s[i],YAHOO.widget.Button&&t instanceof YAHOO.widget.Button?t.destroy():"BUTTON"==t.tagName.toUpperCase()&&(d.purgeElement(t),d.purgeElement(t,!1)),i--;);}o.CSS_DIALOG="yui-dialog",YAHOO.extend(o,YAHOO.widget.Panel,{form:null,initDefaultConfig:function(){o.superclass.initDefaultConfig.call(this),this.callback={success:null,failure:null,argument:null},this.cfg.addProperty(e.POST_METHOD.key,{handler:this.configPostMethod,value:e.POST_METHOD.value,validator:function(e){return"form"==e||"async"==e||"none"==e||"manual"==e}}),this.cfg.addProperty(e.POST_DATA.key,{value:e.POST_DATA.value}),this.cfg.addProperty(e.HIDEAFTERSUBMIT.key,{value:e.HIDEAFTERSUBMIT.value}),this.cfg.addProperty(e.BUTTONS.key,{handler:this.configButtons,value:e.BUTTONS.value,supercedes:e.BUTTONS.supercedes})},initEvents:function(){o.superclass.initEvents.call(this);var e=t.LIST;this.beforeSubmitEvent=this.createEvent(i),this.beforeSubmitEvent.signature=e,this.submitEvent=this.createEvent(s),this.submitEvent.signature=e,this.manualSubmitEvent=this.createEvent(n),this.manualSubmitEvent.signature=e,this.asyncSubmitEvent=this.createEvent(r),this.asyncSubmitEvent.signature=e,this.formSubmitEvent=this.createEvent(a),this.formSubmitEvent.signature=e,this.cancelEvent=this.createEvent(l),this.cancelEvent.signature=e},init:function(e,t){o.superclass.init.call(this,e),this.beforeInitEvent.fire(o),b.addClass(this.element,o.CSS_DIALOG),this.cfg.setProperty("visible",!1),t&&this.cfg.applyConfig(t,!0),this.showEvent.subscribe(this.focusFirst,this,!0),this.beforeHideEvent.subscribe(this.blurButtons,this,!0),this.subscribe("changeBody",this.registerForm),this.initEvent.fire(o)},doSubmit:function(){var e,t,i,s=YAHOO.util.Connect,o=this.form,n=!1,r=!1;switch(this.cfg.getProperty("postmethod")){case"async":if(0<(a=(e=o.elements).length)){t=a-1;do{if("file"==e[t].type){n=!0;break}}while(t--)}n&&YAHOO.env.ua.ie&&this.isSecure&&(r=!0),i=this._getFormAttributes(o),s.setForm(o,n,r);var a=this.cfg.getProperty("postdata"),a=s.asyncRequest(i.method,i.action,this.callback,a);this.asyncSubmitEvent.fire(a);break;case"form":o.submit(),this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire()}},_getFormAttributes:function(e){var t,i,s={method:null,action:null};return e&&(e.getAttributeNode?(t=e.getAttributeNode("action"),i=e.getAttributeNode("method"),t&&(s.action=t.value),i&&(s.method=i.value)):(s.action=e.getAttribute("action"),s.method=e.getAttribute("method"))),s.method=(m.isString(s.method)?s.method:"POST").toUpperCase(),s.action=m.isString(s.action)?s.action:"",s},registerForm:function(){var e=this.element.getElementsByTagName("form")[0];if(this.form){if(this.form==e&&b.isAncestor(this.element,this.form))return;d.purgeElement(this.form),this.form=null}e||((e=document.createElement("form")).name="frm_"+this.id,this.body.appendChild(e)),e&&(this.form=e,d.on(e,"submit",this._submitHandler,this,!0))},_submitHandler:function(e){d.stopEvent(e),this.submit(),this.form.blur()},setTabLoop:function(e,t){e=e||this.firstButton,t=this.lastButton||t,o.superclass.setTabLoop.call(this,e,t)},setFirstLastFocusable:function(){o.superclass.setFirstLastFocusable.call(this);var e,t,i,s=this.focusableElements;if(this.firstFormElement=null,this.lastFormElement=null,this.form&&s&&0<s.length){for(t=s.length,e=0;e<t;++e)if(i=s[e],this.form===i.form){this.firstFormElement=i;break}for(e=t-1;0<=e;--e)if(i=s[e],this.form===i.form){this.lastFormElement=i;break}}},configClose:function(e,t,i){o.superclass.configClose.apply(this,arguments)},_doClose:function(e){d.preventDefault(e),this.cancel()},configButtons:function(e,t,i){var s,o,n,r,a,l,h,u=YAHOO.widget.Button,c=t[0],t=this.innerElement;if(p.call(this),this._aButtons=null,m.isArray(c)){for((a=document.createElement("span")).className="button-group",r=c.length,this._aButtons=[],this.defaultHtmlButton=null,h=0;h<r;h++)s=c[h],u?((n=new u({label:s.text})).appendTo(a),o=n.get("element"),s.isDefault&&(n.addClass("default"),this.defaultHtmlButton=o),m.isFunction(s.handler)?n.set("onclick",{fn:s.handler,obj:this,scope:this}
1):m.isObject(s.handler)&&m.isFunction(s.handler.fn)&&n.set("onclick",{fn:s.handler.fn,obj:m.isUndefined(s.handler.obj)?this:s.handler.obj,scope:s.handler.scope||this}),this._aButtons[this._aButtons.length]=n):((o=document.createElement("button")).setAttribute("type","button"),s.isDefault&&(o.className="default",this.defaultHtmlButton=o),o.innerHTML=s.text,m.isFunction(s.handler)?d.on(o,"click",s.handler,this,!0):m.isObject(s.handler)&&m.isFunction(s.handler.fn)&&d.on(o,"click",s.handler.fn,m.isUndefined(s.handler.obj)?this:s.handler.obj,s.handler.scope||this),a.appendChild(o),this._aButtons[this._aButtons.length]=o),s.htmlButton=o,0===h&&(this.firstButton=o),h==r-1&&(this.lastButton=o);this.setFooter(a),l=this.footer,b.inDocument(this.element)&&!b.isAncestor(t,l)&&t.appendChild(l),this.buttonSpan=a}else a=this.buttonSpan,l=this.footer,a&&l&&(l.removeChild(a),this.buttonSpan=null,this.firstButton=null,this.lastButton=null,this.defaultHtmlButton=null);this.changeContentEvent.fire()},getButtons:function(){return this._aButtons||null},focusFirst:function(e,t,i){var s=this.firstFormElement;if(t&&t[1]&&d.stopEvent(t[1]),s)try{s.focus()}catch(e){}else this.defaultHtmlButton?this.focusDefaultButton():this.focusFirstButton()},focusLast:function(e,t,i){var s=this.cfg.getProperty("buttons"),o=this.lastFormElement;if(t&&t[1]&&d.stopEvent(t[1]),s&&m.isArray(s))this.focusLastButton();else if(o)try{o.focus()}catch(e){}},_getButton:function(e){var t=YAHOO.widget.Button;return t&&e&&e.nodeName&&e.id&&(e=t.getButton(e.id)||e),e},focusDefaultButton:function(){var e=this._getButton(this.defaultHtmlButton);if(e)try{e.focus()}catch(e){}},blurButtons:function(){var e,t,i,s,o=this.cfg.getProperty("buttons");if(o&&m.isArray(o)&&0<(e=o.length)){s=e-1;do{if(t=o[s],t&&(i=this._getButton(t.htmlButton)))try{i.blur()}catch(e){}}while(s--)}},focusFirstButton:function(){var e,t=this.cfg.getProperty("buttons");if(t&&m.isArray(t)&&(t=t[0],t&&(e=this._getButton(t.htmlButton))))try{e.focus()}catch(e){}},focusLastButton:function(){var e,t,i=this.cfg.getProperty("buttons");if(i&&m.isArray(i)&&(e=i.length,0<e&&(e=i[e-1],e&&(t=this._getButton(e.htmlButton)))))try{t.focus()}catch(e){}},configPostMethod:function(e,t,i){this.registerForm()},validate:function(){return!0},submit:function(){return!!this.validate()&&(!!this.beforeSubmitEvent.fire()&&(this.doSubmit(),this.submitEvent.fire(),this.cfg.getProperty("hideaftersubmit")&&this.hide(),!0))},cancel:function(){this.cancelEvent.fire(),this.hide()},getData:function(){var e,t,i,s,o,n,r,a,l,h,u,c,d,m,p,g,v=this.form;function f(e){var t=e.tagName.toUpperCase();return("INPUT"==t||"TEXTAREA"==t||"SELECT"==t)&&e.name==s}if(v)for(t=(e=v.elements).length,i={},p=0;p<t;p++)if(s=e[p].name,0<(n=(o=b.getElementsBy(f,"*",v)).length))if(1==n)switch(r=(o=o[0]).type,o.tagName.toUpperCase()){case"INPUT":"checkbox"==r?i[s]=o.checked:"radio"!=r&&(i[s]=o.value);break;case"TEXTAREA":i[s]=o.value;break;case"SELECT":for(l=(a=o.options).length,h=[],g=0;g<l;g++)(u=a[g]).selected&&(m=u.attributes.value,h[h.length]=m&&m.specified?u.value:u.text);i[s]=h}else switch(r=o[0].type){case"radio":for(g=0;g<n;g++)if((c=o[g]).checked){i[s]=c.value;break}break;case"checkbox":for(h=[],g=0;g<n;g++)(d=o[g]).checked&&(h[h.length]=d.value);i[s]=h}return i},destroy:function(){p.call(this),this._aButtons=null;var e,t=this.element.getElementsByTagName("form");0<t.length&&(e=t[0])&&(d.purgeElement(e),e.parentNode&&e.parentNode.removeChild(e),this.form=null),o.superclass.destroy.call(this)},toString:function(){return"Dialog "+this.id}})}(),function(){YAHOO.widget.SimpleDialog=function(e,t){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,e,t)};var l=YAHOO.util.Dom,h=YAHOO.widget.SimpleDialog,e={ICON:{key:"icon",value:"none",suppressEvent:!0},TEXT:{key:"text",value:"",suppressEvent:!0,supercedes:["icon"]}};h.ICON_BLOCK="blckicon",h.ICON_ALARM="alrticon",h.ICON_HELP="hlpicon",h.ICON_INFO="infoicon",h.ICON_WARN="warnicon",h.ICON_TIP="tipicon",h.ICON_CSS_CLASSNAME="yui-icon",h.CSS_SIMPLEDIALOG="yui-simple-dialog",YAHOO.extend(h,YAHOO.widget.Dialog,{initDefaultConfig:function(){h.superclass.initDefaultConfig.call(this),this.cfg.addProperty(e.ICON.key,{handler:this.configIcon,value:e.ICON.value,suppressEvent:e.ICON.suppressEvent}),this.cfg.addProperty(e.TEXT.key,{handler:this.configText,value:e.TEXT.value,suppressEvent:e.TEXT.suppressEvent,supercedes:e.TEXT.supercedes})},init:function(e,t){h.superclass.init.call(this,e),this.beforeInitEvent.fire(h),l.addClass(this.element,h.CSS_SIMPLEDIALOG),this.cfg.queueProperty("postmethod","manual"),t&&this.cfg.applyConfig(t,!0),this.beforeRenderEvent.subscribe(function(){this.body||this.setBody("")},this,!0),this.initEvent.fire(h)},registerForm:function(){h.superclass.registerForm.call(this),this.form.innerHTML+='<input type="hidden" name="'+this.id+'" value=""/>'},configIcon:function(e,t,i){var s,o,n=t[0],r=this.body,a=h.ICON_CSS_CLASSNAME;n&&"none"!=n&&(1===(t=l.getElementsByClassName(a,"*",r)).length&&(o=(s=t[0]).parentNode)&&(o.removeChild(s),s=null),-1==n.indexOf(".")?((s=document.createElement("span")).className=a+" "+n,s.innerHTML="&#160;"):((s=document.createElement("img")).src=this.imageRoot+n,s.className=a),s&&r.insertBefore(s,r.firstChild))},configText:function(e,t,i){t=t[0];t&&(this.setBody(t),this.cfg.refireEvent("icon"))},toString:function(){return"SimpleDialog "+this.id}})}(),function(){YAHOO.widget.ContainerEffect=function(e,t,i,s,o){o=o||YAHOO.util.Anim,this.overlay=e,this.attrIn=t,this.attrOut=i,this.targetElement=s||e.element,this.animClass=o};var l=YAHOO.util.Dom,e=YAHOO.util.CustomEvent,h=YAHOO.widget.ContainerEffect;h.FADE=function(t,e){var i=YAHOO.util.Easing,s={attributes:{opacity:{from:0,to:1}},duration:e,method:i.easeIn},i={attributes:{opacity:{to:0}},duration:e,method:i.easeOut},i=new h(t,s,i,t.element);return i.handleUnderlayStart=function(){var e=this.overlay.underlay;e&&YAHOO.env.ua.ie&&e.filters&&0<e.filters.length&&l.addClass(t.element,"yui-effect-fade")},i.handleUnderlayComplete=function(){this.overlay.underlay&&YAHOO.env.ua.ie&&l.removeClass(t.element,"yui-effect-fade")},i.handleStartAnimateIn=function(e,t,i){l.addClass(i.overlay.element,"hide-select"),i.overlay.underlay||i.overlay.cfg.refireEvent("underlay"),i.handleUnderlayStart(),i.overlay._setDomVisibility(!0),l.setStyle(i.overlay.element,"opacity",0)},i.handleCompleteAnimateIn=function(e,t,i){l.removeClass(i.overlay.element,"hide-select"),i.overlay.element.style.filter&&(i.overlay.element.style.filter=null),i.handleUnderlayComplete(),i.overlay.cfg.refireEvent("iframe"),i.animateInCompleteEvent.fire()},i.handleStartAnimateOut=function(e,t,i){l.addClass(i.overlay.element,"hide-select"),i.handleUnderlayStart()},i.handleCompleteAnimateOut=function(e,t,i){l.removeClass(i.overlay.element,"hide-select"),i.overlay.element.style.filter&&(i.overlay.element.style.filter=null),i.overlay._setDomVisibility(!1),l.setStyle(i.overlay.element,"opacity",1),i.handleUnderlayComplete(),i.overlay.cfg.refireEvent("iframe"),i.animateOutCompleteEvent.fire()},i.init(),i},h.SLIDE=function(e,t){var i=YAHOO.util.Easing,n=e.cfg.getProperty("x")||l.getX(e.element),s=e.cfg.getProperty("y")||l.getY(e.element),o=l.getClientWidth(),r=e.element.offsetWidth,a={attributes:{points:{to:[n,s]}},duration:t,method:i.easeIn},i={attributes:{points:{to:[o+25,s]}},duration:t,method:i.easeOut},e=new h(e,a,i,e.element,YAHOO.util.Motion);return e.handleStartAnimateIn=function(e,t,i){i.overlay.element.style.left=-25-r+"px",i.overlay.element.style.top=s+"px"},e.handleTweenAnimateIn=function(e,t,i){var s=l.getXY(i.overlay.element),o=s[0],s=s[1];"hidden"==l.getStyle(i.overlay.element,"visibility")&&o<n&&i.overlay._setDomVisibility(!0),i.overlay.cfg.setProperty("xy",[o,s],!0),i.overlay.cfg.refireEvent("iframe")},e.handleCompleteAnimateIn=function(e,t,i){i.overlay.cfg.setProperty("xy",[n,s],!0),i.startX=n,i.startY=s,i.overlay.cfg.refireEvent("iframe"),i.animateInCompleteEvent.fire()},e.handleStartAnimateOut=function(e,t,i){var s=l.getViewportWidth(),o=l.getXY(i.overlay.element)[1];i.animOut.attributes.points.to=[s+25,o]},e.handleTweenAnimateOut=function(e,t,i){var s=l.getXY(i.overlay.element),o=s[0],s=s[1];i.overlay.cfg.setProperty("xy",[o,s],!0),i.overlay.cfg.refireEvent("iframe")},e.handleCompleteAnimateOut=function(e,t,i){i.overlay._setDomVisibility(!1),i.overlay.cfg.setProperty("xy",[n,s]),i.animateOutCompleteEvent.fire()}
1,e.init(),e},h.prototype={init:function(){this.beforeAnimateInEvent=this.createEvent("beforeAnimateIn"),this.beforeAnimateInEvent.signature=e.LIST,this.beforeAnimateOutEvent=this.createEvent("beforeAnimateOut"),this.beforeAnimateOutEvent.signature=e.LIST,this.animateInCompleteEvent=this.createEvent("animateInComplete"),this.animateInCompleteEvent.signature=e.LIST,this.animateOutCompleteEvent=this.createEvent("animateOutComplete"),this.animateOutCompleteEvent.signature=e.LIST,this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method),this.animIn.onStart.subscribe(this.handleStartAnimateIn,this),this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this),this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this),this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method),this.animOut.onStart.subscribe(this.handleStartAnimateOut,this),this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this),this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this)},animateIn:function(){this.beforeAnimateInEvent.fire(),this.animIn.animate()},animateOut:function(){this.beforeAnimateOutEvent.fire(),this.animOut.animate()},handleStartAnimateIn:function(e,t,i){},handleTweenAnimateIn:function(e,t,i){},handleCompleteAnimateIn:function(e,t,i){},handleStartAnimateOut:function(e,t,i){},handleTweenAnimateOut:function(e,t,i){},handleCompleteAnimateOut:function(e,t,i){},toString:function(){var e="ContainerEffect";return this.overlay&&(e+=" ["+this.overlay.toString()+"]"),e}},YAHOO.lang.augmentProto(h,YAHOO.util.EventProvider)}(),YAHOO.register("container",YAHOO.widget.Module,{version:"2.8.1",build:"19"}),function(){var c=YAHOO.util.Dom,d=YAHOO.util.Event,m=YAHOO.lang,p=YAHOO.env.ua,g=YAHOO.widget.Overlay,v=YAHOO.widget.Menu,f={},b=null,l=null,i=null;function h(e,t,i,s){var o;return m.isString(e)&&m.isString(t)&&(p.ie?(o='<input type="'+e+'" name="'+t+'"',s&&(o+=" checked"),o+=">",o=document.createElement(o)):((o=document.createElement("input")).name=t,o.type=e,s&&(o.checked=!0)),o.value=i),o}function n(t,i){var s,e,o=t.nodeName.toUpperCase(),n=this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME;function r(e){e in i||(s=t.getAttributeNode(e))&&"value"in s&&(i[e]=s.value)}function a(){r("type"),"button"==i.type&&(i.type="push"),"disabled"in i||(i.disabled=t.disabled),r("name"),r("value"),r("title")}switch(o){case"A":i.type="link",r("href"),r("target");break;case"INPUT":a(),"checked"in i||(i.checked=t.checked);break;case"BUTTON":a(),e=t.parentNode.parentNode,c.hasClass(e,n+"-checked")&&(i.checked=!0),c.hasClass(e,n+"-disabled")&&(i.disabled=!0),t.removeAttribute("value"),t.setAttribute("type","button")}t.removeAttribute("id"),t.removeAttribute("name"),"tabindex"in i||(i.tabindex=t.tabIndex),"label"in i||(o="INPUT"==o?t.value:t.innerHTML)&&0<o.length&&(i.label=o)}function r(e){var t=e.attributes,i=t.srcelement,s=i.nodeName.toUpperCase(),o=this;if(s==this.NODE_NAME)e.element=i,e.id=i.id,c.getElementsBy(function(e){switch(e.nodeName.toUpperCase()){case"BUTTON":case"A":case"INPUT":n.call(o,e,t)}},"*",i);else switch(s){case"BUTTON":case"A":case"INPUT":n.call(this,i,t)}}YAHOO.widget.Button=function(e,t){!g&&YAHOO.widget.Overlay&&(g=YAHOO.widget.Overlay),!v&&YAHOO.widget.Menu&&(v=YAHOO.widget.Menu);var i,s,o=YAHOO.widget.Button.superclass.constructor;1!=arguments.length||m.isString(e)||e.nodeName?(i={element:null,attributes:t||{}},m.isString(e)?(s=c.get(e))&&(i.attributes.id||(i.attributes.id=e),i.attributes.srcelement=s,r.call(this,i),i.element||(i.element=this.createButtonElement(i.attributes.type)),o.call(this,i.element,i.attributes)):e.nodeName&&(i.attributes.id||(e.id?i.attributes.id=e.id:i.attributes.id=c.generateId()),i.attributes.srcelement=e,r.call(this,i),i.element||(i.element=this.createButtonElement(i.attributes.type)),o.call(this,i.element,i.attributes))):(e.id||(e.id=c.generateId()),o.call(this,this.createButtonElement(e.type),e))},YAHOO.extend(YAHOO.widget.Button,YAHOO.util.Element,{_button:null,_menu:null,_hiddenFields:null,_onclickAttributeValue:null,_activationKeyPressed:!1,_activationButtonPressed:!1,_hasKeyEventHandlers:!1,_hasMouseEventHandlers:!1,_nOptionRegionX:0,CLASS_NAME_PREFIX:"yui-",NODE_NAME:"SPAN",CHECK_ACTIVATION_KEYS:[32],ACTIVATION_KEYS:[13,32],OPTION_AREA_WIDTH:20,CSS_CLASS_NAME:"button",_setType:function(e){"split"==e&&this.on("option",this._onOption)},_setLabel:function(e){this._button.innerHTML=e;var e=p.gecko;e&&e<1.9&&c.inDocument(this.get("element"))&&(e=this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME,this.removeClass(e),m.later(0,this,this.addClass,e))},_setTabIndex:function(e){this._button.tabIndex=e},_setTitle:function(e){"link"!=this.get("type")&&(this._button.title=e)},_setDisabled:function(e){"link"!=this.get("type")&&(e?(this._menu&&this._menu.hide(),this.hasFocus()&&this.blur(),this._button.setAttribute("disabled","disabled"),this.addStateCSSClasse
1s("disabled"),this.removeStateCSSClasses("hover"),this.removeStateCSSClasses("active"),this.removeStateCSSClasses("focus")):(this._button.removeAttribute("disabled"),this.removeStateCSSClasses("disabled")))},_setHref:function(e){"link"==this.get("type")&&(this._button.href=e)},_setTarget:function(e){"link"==this.get("type")&&this._button.setAttribute("target",e)},_setChecked:function(e){var t=this.get("type");"checkbox"!=t&&"radio"!=t||(e?this.addStateCSSClasses("checked"):this.removeStateCSSClasses("checked"))},_setMenu:function(e){var t,i,s,o,n=this.get("lazyloadmenu"),r=this.get("element"),a=!1;function l(){i.render(r.parentNode),this.removeListener("appendTo",l)}function h(){i.cfg.queueProperty("container",r.parentNode),this.removeListener("appendTo",h)}function u(){var e;i&&(c.addClass(i.element,this.get("menuclassname")),c.addClass(i.element,this.CLASS_NAME_PREFIX+this.get("type")+"-button-menu"),i.showEvent.subscribe(this._onMenuShow,null,this),i.hideEvent.subscribe(this._onMenuHide,null,this),i.renderEvent.subscribe(this._onMenuRender,null,this),v&&i instanceof v?(n&&((e=this.get("container"))?i.cfg.queueProperty("container",e):this.on("appendTo",h)),i.cfg.queueProperty("clicktohide",!1),i.keyDownEvent.subscribe(this._onMenuKeyDown,this,!0),i.subscribe("click",this._onMenuClick,this,!0),this.on("selectedMenuItemChange",this._onSelectedMenuItemChange),(o=i.srcElement)&&"SELECT"==o.nodeName.toUpperCase()&&(o.style.display="none",o.parentNode.removeChild(o))):g&&i instanceof g&&(b=b||new YAHOO.widget.OverlayManager).register(i),this._menu=i,a||n||(c.inDocument(r)?i.render(r.parentNode):this.on("appendTo",l)))}g&&(v&&(t=v.prototype.CSS_CLASS_NAME),e&&v&&e instanceof v?(i=e,a=!0,u.call(this)):g&&e&&e instanceof g?(a=!0,(i=e).cfg.queueProperty("visible",!1),u.call(this)):v&&m.isArray(e)?(i=new v(c.generateId(),{lazyload:n,itemdata:e}),this._menu=i,this.on("appendTo",u)):m.isString(e)?(s=c.get(e))&&(v&&c.hasClass(s,t)||"SELECT"==s.nodeName.toUpperCase()?(i=new v(e,{lazyload:n}),u.call(this)):g&&(i=new g(e,{visible:!1}),u.call(this))):e&&e.nodeName&&(v&&c.hasClass(e,t)||"SELECT"==e.nodeName.toUpperCase()?(i=new v(e,{lazyload:n}),u.call(this)):g&&(e.id||c.generateId(e),i=new g(e,{visible:!1}),u.call(this))))},_setOnClick:function(e){this._onclickAttributeValue&&this._onclickAttributeValue!=e&&(this.removeListener("click",this._onclickAttributeValue.fn),this._onclickAttributeValue=null),!this._onclickAttributeValue&&m.isObject(e)&&m.isFunction(e.fn)&&(this.on("click",e.fn,e.obj,e.scope),this._onclickAttributeValue=e)},_isActivationKey:function(e){var t,i=this.get("type"),s="checkbox"==i||"radio"==i?this.CHECK_ACTIVATION_KEYS:this.ACTIVATION_KEYS,i=s.length,o=!1;if(0<i){t=i-1;do{if(e==s[t]){o=!0;break}}while(t--)}return o},_isSplitButtonOptionKey:function(e){var t=40==d.getCharCode(e),i=function(e){d.preventDefault(e),this.removeListener("keypress",i)};return t&&(p.opera&&this.on("keypress",i),d.preventDefault(e)),t},_addListenersToForm:function(){var e,t,i,s,o,n=this.getForm(),r=YAHOO.widget.Button.onFormKeyPress;if(n&&(d.on(n,"reset",this._onFormReset,null,this),d.on(n,"submit",this._onFormSubmit,null,this),t=this.get("srcelement"),"submit"==this.get("type")||t&&"submit"==t.type)){if(i=d.getListeners(n,"keypress"),e=!1,i&&0<(s=i.length)){o=s-1;do{if(i[o].fn==r){e=!0;break}}while(o--)}e||d.on(n,"keypress",r)}},_showMenu:function(e){YAHOO.widget.MenuManager&&YAHOO.widget.MenuManager.hideVisible(),b&&b.hideAll();var t=this._menu,i=this.get("menualignment"),s=this.get("focusmenu");this._renderedMenu?(t.cfg.setProperty("context",[this.get("element"),i[0],i[1]]),t.cfg.setProperty("preventcontextoverlap",!0),t.cfg.setProperty("constraintoviewport",!0)):(t.cfg.queueProperty("context",[this.get("element"),i[0],i[1]]),t.cfg.queueProperty("preventcontextoverlap",!0),t.cfg.queueProperty("constraintoviewport",!0)),this.focus(),v&&t&&t instanceof v?(i=t.focus,t.focus=function(){},this._renderedMenu?(t.cfg.setProperty("minscrollheight",this.get("menuminscrollheight")),t.cfg.setProperty("maxheight",this.get("menumaxheight"))):(t.cfg.queueProperty("minscrollheight",this.get("menuminscrollheight")),t.cfg.queueProperty("maxheight",this.get("menumaxheight"))),t.show(),t.focus=i,t.align(),"mousedown"==e.type&&d.stopPropagation(e),s&&t.focu
1s()):g&&t&&t instanceof g&&(this._renderedMenu||t.render(this.get("element").parentNode),t.show(),t.align())},_hideMenu:function(){var e=this._menu;e&&e.hide()},_onMouseOver:function(e){var t,i=this.get("type");"split"===i&&(t=this.get("element"),t=c.getX(t)+(t.offsetWidth-this.OPTION_AREA_WIDTH),this._nOptionRegionX=t),this._hasMouseEventHandlers||("split"===i&&this.on("mousemove",this._onMouseMove),this.on("mouseout",this._onMouseOut),this._hasMouseEventHandlers=!0),this.addStateCSSClasses("hover"),"split"===i&&d.getPageX(e)>t&&this.addStateCSSClasses("hoveroption"),this._activationButtonPressed&&this.addStateCSSClasses("active"),this._bOptionPressed&&this.addStateCSSClasses("activeoption"),(this._activationButtonPressed||this._bOptionPressed)&&d.removeListener(document,"mouseup",this._onDocumentMouseUp)},_onMouseMove:function(e){var t=this._nOptionRegionX;t&&(d.getPageX(e)>t?this.addStateCSSClasses("hoveroption"):this.removeStateCSSClasses("hoveroption"))},_onMouseOut:function(e){var t=this.get("type");this.removeStateCSSClasses("hover"),"menu"!=t&&this.removeStateCSSClasses("active"),(this._activationButtonPressed||this._bOptionPressed)&&d.on(document,"mouseup",this._onDocumentMouseUp,null,this),"split"===t&&d.getPageX(e)>this._nOptionRegionX&&this.removeStateCSSClasses("hoveroption")},_onDocumentMouseUp:function(e){this._activationButtonPressed=!1,this._bOptionPressed=!1;var t,i,s=this.get("type");"menu"!=s&&"split"!=s||(t=d.getTarget(e))==(i=this._menu.element)||c.isAncestor(i,t)||(this.removeStateCSSClasses("menu"==s?"active":"activeoption"),this._hideMenu()),d.removeListener(document,"mouseup",this._onDocumentMouseUp)},_onMouseDown:function(e){var t,i=!0;return 1==(e.which||e.button)&&(this.hasFocus()||this.focus(),"split"==(t=this.get("type"))?d.getPageX(e)>this._nOptionRegionX?(this.fireEvent("option",e),i=!1):(this.addStateCSSClasses("active"),this._activationButtonPressed=!0):"menu"==t?this.isActive()?(this._hideMenu(),this._activationButtonPressed=!1):(this._showMenu(e),this._activationButtonPressed=!0):(this.addStateCSSClasses("active"),this._activationButtonPressed=!0),"split"!=t&&"menu"!=t||(this._hideMenuTimer=m.later(250,this,this.on,["mouseup",function e(){this._hideMenu(),this.removeListener("mouseup",e)}]))),i},_onMouseUp:function(e){var t=this.get("type"),i=this._hideMenuTimer,s=!0;return i&&i.cancel(),"checkbox"!=t&&"radio"!=t||this.set("checked",!this.get("checked")),this._activationButtonPressed=!1,"menu"!=t&&this.removeStateCSSClasses("active"),"split"==t&&d.getPageX(e)>this._nOptionRegionX&&(s=!1),s},_onFocus:function(e){var t;this.addStateCSSClasses("focus"),this._activationKeyPressed&&this.addStateCSSClasses("active"),(i=this)._hasKeyEventHandlers||(t=this._button,d.on(t,"blur",this._onBlur,null,this),d.on(t,"keydown",this._onKeyDown,null,this),d.on(t,"keyup",this._onKeyUp,null,this),this._hasKeyEventHandlers=!0),this.fireEvent("focus",e)},_onBlur:function(e){this.removeStateCSSClasses("focus"),"menu"!=this.get("type")&&this.removeStateCSSClasses("active"),this._activationKeyPressed&&d.on(document,"keyup",this._onDocumentKeyUp,null,this),i=null,this.fireEvent("blur",e)},_onDocumentKeyUp:function(e){this._isActivationKey(d.getCharCode(e))&&(this._activationKeyPressed=!1,d.removeListener(document,"keyup",this._onDocumentKeyUp))},_onKeyDown:function(e){var t=this._menu;"split"==this.get("type")&&this._isSplitButtonOptionKey(e)?this.fireEvent("option",e):this._isActivationKey(d.getCharCode(e))&&("menu"==this.get("type")?this._showMenu(e):(this._activationKeyPressed=!0,this.addStateCSSClasses("active"))),t&&t.cfg.getProperty("visible")&&27==d.getCharCode(e)&&(t.hide(),this.focus())},_onKeyUp:function(e){this._isActivationKey(d.getCharCode(e))&&("checkbox"!=(e=this.get("type"))&&"radio"!=e||this.set("checked",!this.get("checked")),this._activationKeyPressed=!1,"menu"!=this.get("type")&&this.removeStateCSSClasses("active"))},_onClick:function(e){var t,i;switch(this.get("type")){case"submit":!1!==e.returnValue&&this.submitForm();break;case"reset":(t=this.getForm())&&t.reset();break;case"split":0<this._nOptionRegionX&&d.getPageX(e)>this._nOptionRegionX?i=!1:(this._hideMenu(),(t=this.get("srcelement"))&&"submit"==t.type&&!1!==e.returnValue&&this.submitForm(
1))}return i},_onDblClick:function(e){var t=!0;return"split"==this.get("type")&&d.getPageX(e)>this._nOptionRegionX&&(t=!1),t},_onAppendTo:function(e){m.later(0,this,this._addListenersToForm)},_onFormReset:function(e){var t=this.get("type"),i=this._menu;"checkbox"!=t&&"radio"!=t||this.resetValue("checked"),v&&i&&i instanceof v&&this.resetValue("selectedMenuItem")},_onFormSubmit:function(e){this.createHiddenFields()},_onDocumentMouseDown:function(e){var t=d.getTarget(e),i=this.get("element"),e=this._menu.element;t==i||c.isAncestor(i,t)||t==e||c.isAncestor(e,t)||(this._hideMenu(),p.ie&&t.focus&&t.setActive(),d.removeListener(document,"mousedown",this._onDocumentMouseDown))},_onOption:function(e){this.hasClass(this.CLASS_NAME_PREFIX+"split-button-activeoption")?(this._hideMenu(),this._bOptionPressed=!1):(this._showMenu(e),this._bOptionPressed=!0)},_onMenuShow:function(e){d.on(document,"mousedown",this._onDocumentMouseDown,null,this);var t="split"==this.get("type")?"activeoption":"active";this.addStateCSSClasses(t)},_onMenuHide:function(e){var t="split"==this.get("type")?"activeoption":"active";this.removeStateCSSClasses(t),"split"==this.get("type")&&(this._bOptionPressed=!1)},_onMenuKeyDown:function(e,t){t=t[0];27==d.getCharCode(t)&&(this.focus(),"split"==this.get("type")&&(this._bOptionPressed=!1))},_onMenuRender:function(e){var t=this.get("element").parentNode,i=this._menu,s=i.element,o=i.srcElement;t!=s.parentNode&&t.appendChild(s),this._renderedMenu=!0,o&&"select"===o.nodeName.toLowerCase()&&o.value&&(o=i.getItem(o.selectedIndex),this.set("selectedMenuItem",o,!0),this._onSelectedMenuItemChange({newValue:o}))},_onMenuClick:function(e,t){t=t[1];t&&(this.set("selectedMenuItem",t),(t=this.get("srcelement"))&&"submit"==t.type&&this.submitForm(),this._hideMenu())},_onSelectedMenuItemChange:function(e){var t=e.prevValue,i=e.newValue,e=this.CLASS_NAME_PREFIX;t&&c.removeClass(t.element,e+"button-selectedmenuitem"),i&&c.addClass(i.element,e+"button-selectedmenuitem")},_onLabelClick:function(e){this.focus();var t=this.get("type");"radio"!=t&&"checkbox"!=t||this.set("checked",!this.get("checked"))},createButtonElement:function(e){var t=this.NODE_NAME,i=document.createElement(t);return i.innerHTML="<"+t+' class="first-child">'+("link"==e?"<a></a>":'<button type="button"></button>')+"</"+t+">",i},addStateCSSClasses:function(e){var t=this.get("type"),i=this.CLASS_NAME_PREFIX;m.isString(e)&&("activeoption"!=e&&"hoveroption"!=e&&this.addClass(i+this.CSS_CLASS_NAME+"-"+e),this.addClass(i+t+"-button-"+e))},removeStateCSSClasses:function(e){var t=this.get("type"),i=this.CLASS_NAME_PREFIX;m.isString(e)&&(this.removeClass(i+this.CSS_CLASS_NAME+"-"+e),this.removeClass(i+t+"-button-"+e))},createHiddenFields:function(){this.removeHiddenFields();var e,t,i,s,o,n,r,a=this.getForm();return a&&!this.get("disabled")&&(((n="checkbox"==(e=this.get("type"))||"radio"==e)&&this.get("checked")||l==this)&&(s=h(n?e:"hidden",this.get("name"),this.get("value"),this.get("checked")))&&(n&&(s.style.display="none"),a.appendChild(s)),t=this._menu,v&&t&&t instanceof v&&(e=this.get("selectedMenuItem"),r=(n=t.srcElement)&&"SELECT"==n.nodeName.toUpperCase(),e?(t=null===e.value||""===e.value?e.cfg.getProperty("text"):e.value,e=this.get("name"),r?o=n.name:e&&(o=e+"_options"),t&&o&&(i=h("hidden",o,t),a.appendChild(i))):r&&(i=a.appendChild(n))),s&&i?this._hiddenFields=[s,i]:!s&&i?this._hiddenFields=i:s&&!i&&(this._hiddenFields=s),s=this._hiddenFields),s},removeHiddenFields:function(){var e,t,i=this._hiddenFields;function s(e){c.inDocument(e)&&e.parentNode.removeChild(e)}if(i){if(m.isArray(i)){if(0<(e=i.length))for(t=e-1;s(i[t]),t--;);}else s(i);this._hiddenFields=null}},submitForm:function(){var e=this.getForm(),t=this.get("srcelement"),i=!1;return e&&(("submit"==this.get("type")||t&&"submit"==t.type)&&(l=this),i=p.ie?e.fireEvent("onsubmit"):((t=document.createEvent("HTMLEvents")).initEvent("submit",!0,!0),e.dispatchEvent(t)),(p.ie||p.webkit)&&i&&e.submit()),i},init:function(e,t){var i="link"==t.type?"a":"button",s=t.srcelement,o=e.getElementsByTagName(i)[0];o||(i=e.getElementsByTagName("input")[0])&&((o=document.createElement("button")).setAttribute("type","button"),i.parentNode.replaceChild(o,i)),this._button=o,YAHOO.widget.Button.superclass.init.call(this,e,t);var n,r=this.get("id"),a=r+"-button";o.id=a;s&&"link"!=this.get("type")&&(h=c.getElementsBy(function(e){return e.htmlFor===r},"label"),m.isArray(h)&&0<h.length&&(n=h[0]));o=(f[r]=this).CLASS_NAME_PREFIX;this.addClass(o+this.CSS_CLASS_NAME),this.addClass(o+this.get("type")+"-button"),d.on(this._button,"focus",this._onFocus,null,this),this.on("mouseover",this._onMouseOver),this.on("mousedown",this._onMouseDown),this.on("mouseup",this._onMouseUp),this.on("click",this._onClick);var l,h=this.get("onclick");this.set("onclick",null),this.set("onclick",h),this.on("dblclick",this._onDblClick),n&&(this.get("replaceLabel")?(this.set("label",n.innerHTML),(l=n.parentNode).removeChild(n)):(this.on("appendTo",function(){n.setAttribute(p.ie?"htmlFor":"for",a)}),d.on(n,"click",this._onLabelClick,null,this),this._label=n)),this.on("appendTo",this._onAppendTo);var u=this.get("container"),o=this.get("element"),h=c.inDocument(o);u?(s&&s!=o&&(l=s.parentNode)&&l.removeChild(s),m.isString(u)?d.onContentReady(u,this.appendTo,u,this):this.on("init",function(){m.later(0,this,this.appendTo,u)})):!h&&s&&s!=o?(l=s.parentNode)&&(this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:l}),l.replaceChild(o,s),this.fireEvent("appendTo",{type:"appendTo",target:l})):"link"!=this.get("type")&&h&&s&&s==o&&this._addListenersToForm(),this.fireEvent("init",{type:"init",target:this})},initAttributes:function(e){e=e||{};YAHOO.widget.Button.superclass.initAttributes.call(this,e),this.setAttributeConfig("type",{value:e.type||"push",validator:m.isString,writeOnce:!0,method:this._setType}),this.setAttributeConfig("label",{value:e.label,validator:m.isString,method:this._setLabel}),this.setAttributeConfig("value",{value:e.value}),this.setAttributeConfig("name",{value:e.name,validator:m.isString}),this.setAttributeConfig("tabindex",{value:e.tabindex,validator:m.isNumber,method:this._setTabIndex}),this.configureAttribute("title",{value:e.title,validator:m.isString,method:this._setTitle}),this.setAttributeConfig("disabled",{value:e.disabled||!1,validator:m.isBoolean,method:this._setDisabled}),this.setAttributeConfig("href",{value:e.href,validator:m.isString,method:this._setHref}),this.setAttributeConfig("target",{value:e.target,validator:m.isString,method:this._setTarget}),this.setAttributeConfig("checked",{value:e.checked||!1,validator:m.isBoolean,method:this._setChecked}),this.setAttributeConfig("container",{value:e.container,writeOnce:!0}),this.setAttributeConfig("srcelement",{value:e.srcelement,writeOnce:!0}),this.setAttributeConfig("menu",{value:null,method:this._setMenu,writeOnce:!0}),this.setAttributeConfig("lazyloadmenu",{value:!1!==e.lazyloadmenu,validator:m.isBoolean,writeOnce:!0}),this.setAttributeConfig("menuclassname",{value:e.menuclassname||this.CLASS_NAME_PREFIX+"button-menu",validator:m.isString,method:this._setMenuClassName,writeOnce:!0}),this.setAttributeConfig("menuminscrollheight",{value:e.menuminscrollheight||90,validator:m.isNumber}),this.setAttributeConfig("menumaxheight",{value:e.menumaxheight||0,validator:m.isNumber}),this.setAttributeConfig("menualignment",{value:e.menualignment||["tl","bl"],validator:m.isArray}),this.setAttributeConfig("selectedMenuItem",{value:null}),this.setAttributeConfig("onclick",{value:e.onclick,method:this._setOnClick}),this.setAttributeConfig("focusmenu",{value:!1!==e.focusmenu,validator:m.isBoolean}),this.setAttributeConfig("replaceLabel",{value:!1,validator:m.isBoolean,writeOnce:!0})},focus:function(){this.get("disabled")||this._button.focus()},blur:function(){this.get("disabled")||this._button.blur()},hasFocus:function(){return i==this},isActive:function(){return this.hasClass(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME+"-active")},getMenu:function(){return this._menu},getForm:function(){var e,t=this._button;return t&&(e=t.form),e},getHiddenFields:function(){return this._hiddenFields},destroy:function(){var e,t=this.get("element"),i=this._menu,s=this._label;i&&(b&&b.find(i)&&b.remove(i),i.destroy()),d.purgeElement(t),d.purgeElement(this._button),d.removeListener(document,"mouseup",this._onDocumentMouseUp),d.removeListener(document,"keyup",this._onDocumentKeyUp),d.removeListener(document,"mousedown",this._onDocumentMouseDown),s&&(d.removeListener(s,"click",this._onLabelClick),(e=s.parentNode).removeChild(s));s=this.getForm();s&&(d.removeListener(s,"reset",this._onFormReset),d.removeListener(s,"submit",this._onFormSubmit)),this.unsubscribeAll(),(e=t.parentNode)&&e.removeChild(t),delete f[this.get("id")];var t=this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME,t=c.getElementsByClassName(t,this.NODE_NAME,s);m.isArray(t)&&0===t.length&&d.removeListener(s,"keypress",YAHOO.widget.Button.onFormKeyPress)},fireEvent:function(e,t){return(!this.DOM_EVENTS[e]||!this.get("disabled"))&&YAHOO.widget.Button.superclass.fireEvent.apply(this,arguments)},toString:function(){return"Button "+this.get("id")}}),YAHOO.widget.Button.onFormKeyPress=function(e){var i,s,o,t=d.getTarget(e),n=d.getCharCode(e),r=t.nodeName&&t.nodeName.toUpperCase(),t=t.type,a=!1;13!=n||("INPUT"!=r||"text"!=t&&"password"!=t&&"checkbox"!=t&&"radio"!=t&&"file"!=t)&&"SELECT"!=r||(c.getElementsBy(function(e){var t;switch(e.nodeName.toUpperCase()){case"INPUT":case"BUTTON":"submit"!=e.type||e.disabled||a||o||(o=e);break;default:(t=e.id)&&(i=f[t])&&(a=!0,i.get("disabled")||(t=i.get("srcelement"),!s&&("submit"==i.get("type")||t&&"submit"==t.type)&&(s=i)))}},"*",this),o?o.focus():!o&&s&&(d.preventDefault(e),p.ie?s.get("element").fireEvent("onclick"):((e=document.createEvent("HTMLEvents")).initEvent("click",!0,!0),p.gecko<1.9?s.fireEvent("click",e):s.get("element").dispatchEvent(e))))},YAHOO.widget.Button.addHiddenFieldsToForm=function(e){var t,i,s,o=YAHOO.widget.Button.prototype,n=c.getElementsByClassName(o.CLASS_NAME_PREFIX+o.CSS_CLASS_NAME,"*",e),r=n.length;if(0<r)for(s=0;s<r;s++)(i=n[s].id)&&(t=f[i])&&t.createHiddenFields()},YAHOO.widget.Button.getButton=function(e){return f[e]}}(),function(){var n=YAHOO.util.Dom,o=YAHOO.util.Event,r=YAHOO.lang,a=YAHOO.widget.Button,l={};YAHOO.widget.ButtonGroup=function(e,t){var i,s,o=YAHOO.widget.ButtonGroup.superclass.constructor;1!=arguments.length||r.isString(e)||e.nodeName?r.isString(e)?(i=n.get(e))&&i.nodeName.toUpperCase()==this.NODE_NAME&&o.call(this,i,t):(s=e.nodeName.toUpperCase())&&s==this.NODE_NAME&&(e.id||(e.id=n.generateId()),o.call(this,e,t)):(e.id||(s=n.generateId(),e.id=s),o.call(this,this._createGroupElement(),e))},YAHOO.extend(YAHOO.widget.ButtonGroup,YAHOO.util.Element,{_buttons:null,NODE_NAME:"DIV",CLASS_NAME_PREFIX:"yui-",CSS_CLASS_NAME:"buttongroup",_createGroupElement:function(){return document.createElement(this.NODE_NAME)},_setDisabled:function(e){var t,i=this.getCount();if(0<i)for(t=i-1;this._buttons[t].set("disabled",e),t--;);},_onKeyDown:function(e){var t=o.getTarget(e),i=o.getCharCode(e),e=t.parentNode.parentNode.id,t=l[e],e=-1;37==i||38==i?e=0===t.index?this._buttons.length-1:t.index-1:39!=i&&40!=i||(e=t.index===this._buttons.length-1?0:t.index+1),-1<e&&(this.check(e),this.getButton(e).focus())},_onAppendTo:function(e){for(var t=this._buttons,i=t.length,s=0;s<i;s++)t[s].appendTo(this.get("element"))},_onButtonCheckedChange:function(e,t){var i=e.newValue,e=this.get("checkedButton");i&&e!=t?(e&&e.set("checked",!1,!0),this.set("checkedButton",t),this.set("value",t.get("value"))):e&&!e.set("checked")&&e.set("checked",!0,!0)},init:function(e,t){this._buttons=[],YAHOO.widget.ButtonGroup.superclass.init.call(this,e,t),this.addClass(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);t=YAHOO.widget.Button.prototype.CLASS_NAME_PREFIX+"radio-button",t=this.getElementsByClassName(t);0<t.length&&this.addButtons(t),0<(t=n.getElementsBy(function(e){return"radio"==e.type},"input",this.get("element"))).length&&this.addButtons(t),this.on("keydown",this._onKeyDown),this.on("appendTo",this._onAppendTo);var i=this.get("container");i&&(r.isString(i)?o.onContentReady(i,function(){this.appendTo(i)},null,this):this.appendTo(i))},initAttributes:function(e){e=e||{};YAHOO.widget.ButtonGroup.superclass.initAttributes.call(this,e),this.setAttributeConfig("name",{value:e.name,validator:r.isString}),this.setAttributeConfig("disabled",{value:e.disabled||!1,validator:r.isBoolean,method:this._setDisabled}),this.setAttributeConfig("value",{value:e.value}),this.setAttributeConfig("container",{value:e.container,writeOnce:!0}),this.setAttributeConfig("checkedButton",{value:null})},addButton:function(e){var t,i,s=e instanceof a&&"radio"==e.get("type")?e:r.isString(e)||e.nodeName?new a(e,{type:"radio"}):(e.type="radio",new a(e));return s&&(t=this._buttons.length,i=s.get("name"),e=this.get("name"),s.index=t,this._buttons[t]=s,l[s.get("id")]=s,i!=e&&s.set("name",e),this.get("disabled")&&s.set("disabled",!0),s.get("checked")&&this.set("checkedButton",s),i=s.get("element"),e=this.get("element"),i.parentNode!=e&&e.appendChild(i),s.on("checkedChange",this._onButtonCheckedChange,s,this)),s},addButtons:function(e){var t,i,s,o;if(r.isArray(e)&&(s=[],0<(t=e.length)))for(o=0;o<t;o++)(i=this.addButton(e[o]))&&(s[s.length]=i);return s},removeButton:function(e){var t,i=this.getButton(e);if(i&&(this._buttons.splice(e,1),delete l[i.get("id")],i.removeListener("checkedChange",this._onButtonCheckedChange),i.destroy(),0<this._buttons.length))for(t=this._buttons.length-1;this._buttons[t].index=t,t--;);},getButton:function(e){return this._buttons[e]},getButtons:function(){return this._buttons},getCount:function(){return this._buttons.length},focus:function(e){var t,i,s;
1if(r.isNumber(e))(t=this._buttons[e])&&t.focus();else for(i=this.getCount(),s=0;s<i;s++)if(!(t=this._buttons[s]).get("disabled")){t.focus();break}},check:function(e){e=this.getButton(e);e&&e.set("checked",!0)},destroy:function(){var e,t=this._buttons.length,i=this.get("element"),s=i.parentNode;if(0<t)for(e=this._buttons.length-1;this._buttons[e].destroy(),e--;);o.purgeElement(i),s.removeChild(i)},toString:function(){return"ButtonGroup "+this.get("id")}})}(),YAHOO.register("button",YAHOO.widget.Button,{version:"2.8.1",build:"19"}),function(){var u=YAHOO.util.Dom,r=YAHOO.util.Event,a=YAHOO.lang,i=function(e,t){t={element:e,attributes:t||{}};i.superclass.constructor.call(this,t.element,t.attributes)};i._instances={},i.getResizeById=function(e){return i._instances[e]||!1},YAHOO.extend(i,YAHOO.util.Element,{CSS_RESIZE:"yui-resize",CSS_DRAG:"yui-draggable",CSS_HOVER:"yui-resize-hover",CSS_PROXY:"yui-resize-proxy",CSS_WRAP:"yui-resize-wrap",CSS_KNOB:"yui-resize-knob",CSS_HIDDEN:"yui-resize-hidden",CSS_HANDLE:"yui-resize-handle",CSS_STATUS:"yui-resize-status",CSS_GHOST:"yui-resize-ghost",CSS_RESIZING:"yui-resize-resizing",_resizeEvent:null,dd:null,browser:YAHOO.env.ua,_locked:null,_positioned:null,_dds:null,_wrap:null,_proxy:null,_handles:null,_currentHandle:null,_currentDD:null,_cache:null,_active:null,_createProxy:function(){this.get("proxy")?(this._proxy=document.createElement("div"),this._proxy.className=this.CSS_PROXY,this._proxy.style.height=this.get("element").clientHeight+"px",this._proxy.style.width=this.get("element").clientWidth+"px",this._wrap.parentNode.appendChild(this._proxy)):this.set("animate",!1)},_createWrap:function(){if((this._positioned=!1)===this.get("wrap"))switch(this.get("element").tagName.toLowerCase()){case"img":case"textarea":case"input":case"iframe":case"select":this.set("wrap",!0)}var e;!0===this.get("wrap")?(this._wrap=document.createElement("div"),this._wrap.id=this.get("element").id+"_wrap",this._wrap.className=this.CSS_WRAP,"textarea"==this.get("element").tagName.toLowerCase()&&u.addClass(this._wrap,"yui-resize-textarea"),u.setStyle(this._wrap,"width",this.get("width")+"px"),u.setStyle(this._wrap,"height",this.get("height")+"px"),u.setStyle(this._wrap,"z-index",this.getStyle("z-index")),this.setStyle("z-index",0),e=u.getStyle(this.get("element"),"position"),u.setStyle(this._wrap,"position","static"==e?"relative":e),u.setStyle(this._wrap,"top",u.getStyle(this.get("element"),"top")),u.setStyle(this._wrap,"left",u.getStyle(this.get("element"),"left")),"absolute"==u.getStyle(this.get("element"),"position")&&(this._positioned=!0,u.setStyle(this.get("element"),"position","relative"),u.setStyle(this.get("element"),"top","0"),u.setStyle(this.get("element"),"left","0")),this.get("element").parentNode.replaceChild(this._wrap,this.get("element")),this._wrap.appendChild(this.get("element"))):(this._wrap=this.get("element"),"absolute"==u.getStyle(this._wrap,"position")&&(this._positioned=!0)),this.get("draggable")&&this._setupDragDrop(),this.get("hover")&&u.addClass(this._wrap,this.CSS_HOVER),this.get("knobHandles")&&u.addClass(this._wrap,this.CSS_KNOB),this.get("hiddenHandles")&&u.addClass(this._wrap,this.CSS_HIDDEN),u.addClass(this._wrap,this.CSS_RESIZE)},_setupDragDrop:function(){u.addClass(this._wrap,this.CSS_DRAG),this.dd=new YAHOO.util.DD(this._wrap,this.get("id")+"-resize",{dragOnly:!0,useShim:this.get("useShim")}),this.dd.on("dragEvent",function(){this.fireEvent("dragEvent",arguments)},this,!0)},_createHandles:function(){this._handles={},this._dds={};for(var e=this.get("handles"),t=0;t<e.length;t++){this._handles[e[t]]=document.createElement("div"),this._handles[e[t]].id=u.generateId(this._handles[e[t]]),this._handles[e[t]].className=this.CSS_HANDLE+" "+this.CSS_HANDLE+"-"+e[t];var i=document.createElement("div");i.className=this.CSS_HANDLE+"-inner-"+e[t],this._handles[e[t]].appendChild(i),this._wrap.appendChild(this._handles[e[t]]),r.on(this._handles[e[t]],"mouseover",this._handleMouseOver,this,!0),r.on(this._handles[e[t]],"mouseout",this._handleMouseOut,this,!0),this._dds[e[t]]=new YAHOO.util.DragDrop(this._handles[e[t]],this.get("id")+"-handle-"+e,{useShim:this.get("useShim")}),this._dds[e[t]].setPadding(15,15,15,15),this._dds[e[t]].on("startDragEvent",this._handleStartDrag,this._dds[e[t]],this),this._dds[e[t]].on("mouseDownEvent",this._handleMouseDown,this._dds[e[t]],this)}this._status=document.createElement("span"),this._status.className=this.CSS_STATUS,document.body.insertBefore(this._status,document.body.firstChild)},_ieSelectFix:function(){return!1}
1,_ieSelectBack:null,_setAutoRatio:function(e){this.get("autoRatio")&&(e&&e.shiftKey?this.set("ratio",!0):this.set("ratio",this._configs.ratio._initialConfig.value))},_handleMouseDown:function(e){if(this._locked)return!1;"absolute"==u.getStyle(this._wrap,"position")&&(this._positioned=!0),e&&this._setAutoRatio(e),this.browser.ie&&(this._ieSelectBack=document.body.onselectstart,document.body.onselectstart=this._ieSelectFix)},_handleMouseOver:function(e){if(this._locked)return!1;u.removeClass(this._wrap,this.CSS_RESIZE),this.get("hover")&&u.removeClass(this._wrap,this.CSS_HOVER);var t=r.getTarget(e);if(u.hasClass(t,this.CSS_HANDLE)||(t=t.parentNode),u.hasClass(t,this.CSS_HANDLE)&&!this._active)for(var i in u.addClass(t,this.CSS_HANDLE+"-active"),this._handles)if(a.hasOwnProperty(this._handles,i)&&this._handles[i]==t){u.addClass(t,this.CSS_HANDLE+"-"+i+"-active");break}u.addClass(this._wrap,this.CSS_RESIZE)},_handleMouseOut:function(e){u.removeClass(this._wrap,this.CSS_RESIZE),this.get("hover")&&!this._active&&u.addClass(this._wrap,this.CSS_HOVER);var t=r.getTarget(e);if(u.hasClass(t,this.CSS_HANDLE)||(t=t.parentNode),u.hasClass(t,this.CSS_HANDLE)&&!this._active)for(var i in u.removeClass(t,this.CSS_HANDLE+"-active"),this._handles)if(a.hasOwnProperty(this._handles,i)&&this._handles[i]==t){u.removeClass(t,this.CSS_HANDLE+"-"+i+"-active");break}u.addClass(this._wrap,this.CSS_RESIZE)},_handleStartDrag:function(e,t){var i,s=t.getDragEl();if(u.hasClass(s,this.CSS_HANDLE)){for(var o in"absolute"==u.getStyle(this._wrap,"position")&&(this._positioned=!0),this._active=!0,this._currentDD=t,this._proxy&&(this._proxy.style.visibility="visible",this._proxy.style.zIndex="1000",this._proxy.style.height=this.get("element").clientHeight+"px",this._proxy.style.width=this.get("element").clientWidth+"px"),this._handles)if(a.hasOwnProperty(this._handles,o)&&this._handles[o]==s){var n="_handle_for_"+(this._currentHandle=o);u.addClass(s,this.CSS_HANDLE+"-"+o+"-active"),t.on("dragEvent",this[n],this,!0),t.on("mouseUpEvent",this._handleMouseUp,this,!0);break}u.addClass(s,this.CSS_HANDLE+"-active"),this.get("proxy")&&(i=u.getXY(this.get("element")),u.setXY(this._proxy,i),this.get("ghost")&&this.addClass(this.CSS_GHOST)),u.addClass(this._wrap,this.CSS_RESIZING),this._setCache(),this._updateStatus(this._cache.height,this._cache.width,this._cache.top,this._cache.left),this.fireEvent("startResize",{type:"startresize",target:this})}},_setCache:function(){this._cache.xy=u.getXY(this._wrap),u.setXY(this._wrap,this._cache.xy),this._cache.height=this.get("clientHeight"),this._cache.width=this.get("clientWidth"),this._cache.start.height=this._cache.height,this._cache.start.width=this._cache.width,this._cache.start.top=this._cache.xy[1],this._cache.start.left=this._cache.xy[0],this._cache.top=this._cache.xy[1],this._cache.left=this._cache.xy[0],this.set("height",this._cache.height,!0),this.set("width",this._cache.width,!0)},_handleMouseUp:function(e){this._active=!1;var t,i="_handle_for_"+this._currentHandle;for(t in this._currentDD.unsubscribe("dragEvent",this[i],this,!0),this._currentDD.unsubscribe("mouseUpEvent",this._handleMouseUp,this,!0),this._proxy&&(this._proxy.style.visibility="hidden",this._proxy.style.zIndex="-1",this.get("setSize")?this.resize(e,this._cache.height,this._cache.width,this._cache.top,this._cache.left,!0):this.fireEvent("resize",{ev:"resize",target:this,height:this._cache.height,width:this._cache.width,top:this._cache.top,left:this._cache.left}),this.get("ghost")&&this.removeClass(this.CSS_GHOST)),this.get("hover")&&u.addClass(this._wrap,this.CSS_HOVER),this._status&&u.setStyle(this._status,"display","none"),this.browser.ie&&(document.body.onselectstart=this._ieSelectBack),this.browser.ie&&u.removeClass(this._wrap,this.CSS_RESIZE),this._handles)a.hasOwnProperty(this._handles,t)&&u.removeClass(this._handles[t],this.CSS_HANDLE+"-active");this.get("hover")&&!this._active&&u.addClass(this._wrap,this.CSS_HOVER),u.removeClass(this._wrap,this.CSS_RESIZING),u.removeClass(this._handles[this._currentHandle],this.CSS_HANDLE+"-"+this._currentHandle+"-active"),u.removeClass(this._handles[this._currentHandle],this.CSS_HANDLE+"-active"),this.browser.ie&&u.addClass(this._wrap,this.CSS_RESIZE),this._resizeEvent=null,this._currentHandle=null,this.get("animate")||(this.set("height",this._cache.height,!0),this.set("width",this._cache.width,!0)),this.fireEvent("endResize",{ev:"endResize",target:this,height:this._cache.height,width:this._cache.width,top:this._cache.top,left
1:this._cache.left})},_setRatio:function(e,t,i,s){var o=e,n=t;if(this.get("ratio")){this._cache.height,this._cache.width;var r=parseInt(this.get("height"),10),a=parseInt(this.get("width"),10),l=this.get("maxHeight"),h=this.get("minHeight");this.get("maxWidth"),this.get("minWidth");switch(this._currentHandle){case"l":e=r*(t/a),t=a*((e=Math.min(Math.max(h,e),l))/r),i=this._cache.start.top- -(r-e)/2,s=this._cache.start.left- -(a-t);break;case"r":e=r*(t/a),t=a*((e=Math.min(Math.max(h,e),l))/r),i=this._cache.start.top- -(r-e)/2;break;case"t":e=r*((t=a*(e/r))/a),s=this._cache.start.left- -(a-t)/2,i=this._cache.start.top- -(r-e);break;case"b":e=r*((t=a*(e/r))/a),s=this._cache.start.left- -(a-t)/2;break;case"bl":t=a*((e=r*(t/a))/r),s=this._cache.start.left- -(a-t);break;case"br":t=a*((e=r*(t/a))/r);break;case"tl":t=a*((e=r*(t/a))/r),s=this._cache.start.left- -(a-t),i=this._cache.start.top- -(r-e);break;case"tr":t=a*((e=r*(t/a))/r),s=this._cache.start.left,i=this._cache.start.top- -(r-e)}o=this._checkHeight(e),n=this._checkWidth(t),o==e&&n==t||(s=i=0,o!=e&&(n=this._cache.width),n!=t&&(o=this._cache.height))}return[o,n,i,s]},_updateStatus:function(e,t,i,s){var o,n;this._resizeEvent&&!a.isString(this._resizeEvent)&&(e=0===e?this._cache.start.height:e,t=0===t?this._cache.start.width:t,o=parseInt(this.get("height"),10),n=parseInt(this.get("width"),10),isNaN(o)&&(o=parseInt(e,10)),isNaN(n)&&(n=parseInt(t,10)),o=parseInt(e,10)-o,n=parseInt(t,10)-n,this._cache.offsetHeight=o,this._cache.offsetWidth=n,this.get("status")&&(u.setStyle(this._status,"display","inline"),this._status.innerHTML="<strong>"+parseInt(e,10)+" x "+parseInt(t,10)+"</strong><em>"+(0<o?"+":"")+o+" x "+(0<n?"+":"")+n+"</em>",u.setXY(this._status,[r.getPageX(this._resizeEvent)+12,r.getPageY(this._resizeEvent)+12])))},lock:function(e){return this._locked=!0,e&&this.dd&&(u.removeClass(this._wrap,"yui-draggable"),this.dd.lock()),this},unlock:function(e){return this._locked=!1,e&&this.dd&&(u.addClass(this._wrap,"yui-draggable"),this.dd.unlock()),this},isLocked:function(){return this._locked},reset:function(){return this.resize(null,this._cache.start.height,this._cache.start.width,this._cache.start.top,this._cache.start.left,!0),this},resize:function(e,t,i,s,o,n,r){if(this._locked)return!1;this._resizeEvent=e;var a=this._wrap,l=this.get("animate"),h=!0;this._proxy&&!n&&(a=this._proxy,l=!1),this._setAutoRatio(e),this._positioned&&this._proxy&&(s=this._cache.top-s,o=this._cache.left-o);e=this._setRatio(t,i,s,o);if((t=parseInt(e[0],10),i=parseInt(e[1],10),s=parseInt(e[2],10),o=parseInt(e[3],10),0==s&&(s=u.getY(a)),0==o&&(o=u.getX(a)),this._positioned&&(this._proxy&&n?l?(s=this._proxy.style.top,o=this._proxy.style.left):(a.style.top=this._proxy.style.top,a.style.left=this._proxy.style.left):(this.get("ratio")||this._proxy||(s=this._cache.top+-s,o=this._cache.left+-o),s&&(this.get("minY")&&s<this.get("minY")&&(s=this.get("minY")),this.get("maxY")&&s>this.get("maxY")&&(s=this.get("maxY"))),o&&(this.get("minX")&&o<this.get("minX")&&(o=this.get("minX")),this.get("maxX")&&o+i>this.get("maxX")&&(o=this.get("maxX")-i)))),!r)&&!1===this.fireEvent("beforeResize",{ev:"beforeResize",target:this,height:t,width:i,top:s,left:o}))return!1;return this._updateStatus(t,i,s,o),this._positioned&&(this._proxy&&n||(s&&(u.setY(a,s),this._cache.top=s),o&&(u.setX(a,o),this._cache.left=o))),t&&(l||(h=!0,this._proxy&&n&&(this.get("setSize")||(h=!1)),h&&(a.style.height=t+"px"),(this._proxy&&n||!this._proxy)&&this._wrap!=this.get("element")&&(this.get("element").style.height=t+"px")),this._cache.height=t),i&&(this._cache.width=i,l||(h=!0,this._proxy&&n&&(this.get("setSize")||(h=!1)),h&&(a.style.width=i+"px"),(this._proxy&&n||!this._proxy)&&this._wrap!=this.get("element")&&(this.get("element").style.width=i+"px"))),l?YAHOO.util.Anim&&(l=new YAHOO.util.Anim(a,{height:{to:this._cache.height},width:{to:this._cache.width}},this.get("animateDuration"),this.get("animateEasing")),this._positioned&&(s&&(l.attributes.top={to:parseInt(s,10)}),o&&(l.attributes.left={to:parseInt(o,10)})),this._wrap!=this.get("element")&&l.onTween.subscribe(function(){this.get("element").style.height=a.style.height,this.get("element").style.width=a.style.width},this,!0),l.onComplete.subscribe(function(){this.set("height",t),this.set("width",i),this.fireEvent("resize",{ev:"resize",target:this,height:t,width:i,top:s,left:o})},this,!0),l.animate()):this._proxy&&!n?this.fireEvent("proxyResize",{ev:"proxyresize",target:this,height:t,width:i,top:s,left:o}):this.fireEvent("resize",{ev:"resize",target:this,height:t,width:i,top:s,left:o}),this}
1,_handle_for_br:function(e){var t=this._setWidth(e.e),i=this._setHeight(e.e);this.resize(e.e,i,t,0,0)},_handle_for_bl:function(e){var t=this._setWidth(e.e,!0),i=this._setHeight(e.e),s=t-this._cache.width;this.resize(e.e,i,t,0,s)},_handle_for_tl:function(e){var t=this._setWidth(e.e,!0),i=this._setHeight(e.e,!0),s=i-this._cache.height,o=t-this._cache.width;this.resize(e.e,i,t,s,o)},_handle_for_tr:function(e){var t=this._setWidth(e.e),i=this._setHeight(e.e,!0),s=i-this._cache.height;this.resize(e.e,i,t,s,0)},_handle_for_r:function(e){this._dds.r.setYConstraint(0,0);var t=this._setWidth(e.e);this.resize(e.e,0,t,0,0)},_handle_for_l:function(e){this._dds.l.setYConstraint(0,0);var t=this._setWidth(e.e,!0),i=t-this._cache.width;this.resize(e.e,0,t,0,i)},_handle_for_b:function(e){this._dds.b.setXConstraint(0,0);var t=this._setHeight(e.e);this.resize(e.e,t,0,0,0)},_handle_for_t:function(e){this._dds.t.setXConstraint(0,0);var t=this._setHeight(e.e,!0),i=t-this._cache.height;this.resize(e.e,t,0,i,0)},_setWidth:function(e,t){var i=this._cache.xy[0],s=(this._cache.width,r.getPageX(e)),e=s-i;return t&&(e=i-s+parseInt(this.get("width"),10)),e=this._snapTick(e,this.get("xTicks")),e=this._checkWidth(e)},_checkWidth:function(e){return this.get("minWidth")&&e<=this.get("minWidth")&&(e=this.get("minWidth")),this.get("maxWidth")&&e>=this.get("maxWidth")&&(e=this.get("maxWidth")),e},_checkHeight:function(e){return this.get("minHeight")&&e<=this.get("minHeight")&&(e=this.get("minHeight")),this.get("maxHeight")&&e>=this.get("maxHeight")&&(e=this.get("maxHeight")),e},_setHeight:function(e,t){var i=this._cache.xy[1],s=(this._cache.height,r.getPageY(e)),e=s-i;return t&&(e=i-s+parseInt(this.get("height"),10)),e=this._snapTick(e,this.get("yTicks")),e=this._checkHeight(e)},_snapTick:function(e,t){if(!e||!t)return e;var i=e,s=e%t;return 0<s&&(i=t/2<s?e+(t-s):e-s),i},init:function(e,t){this._locked=!1,this._cache={xy:[],height:0,width:0,top:0,left:0,offsetHeight:0,offsetWidth:0,start:{height:0,width:0,top:0,left:0}},i.superclass.init.call(this,e,t),this.set("setSize",this.get("setSize")),t.height?this.set("height",parseInt(t.height,10)):"auto"==this.getStyle("height")&&this.set("height",parseInt(this.get("element").offsetHeight,10)),t.width?this.set("width",parseInt(t.width,10)):"auto"==this.getStyle("width")&&this.set("width",parseInt(this.get("element").offsetWidth,10));a.isString(e)||(e=u.generateId(e)),(i._instances[e]=this)._active=!1,this._createWrap(),this._createProxy(),this._createHandles()},getProxyEl:function(){return this._proxy},getWrapEl:function(){return this._wrap},getStatusEl:function(){return this._status},getActiveHandleEl:function(){return this._handles[this._currentHandle]},isActive:function(){return!!this._active},initAttributes:function(e){var t;i.superclass.initAttributes.call(this,e),this.setAttributeConfig("useShim",{value:!0===e.useShim,validator:YAHOO.lang.isBoolean,method:function(e){for(var t in this._dds)a.hasOwnProperty(this._dds,t)&&(this._dds[t].useShim=e);this.dd&&(this.dd.useShim=e)}}),this.setAttributeConfig("setSize",{value:!1!==e.setSize,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("wrap",{writeOnce:!0,validator:YAHOO.lang.isBoolean,value:e.wrap||!1}),this.setAttributeConfig("handles",{writeOnce:!0,value:e.handles||["r","b","br"],validator:function(e){a.isString(e)&&"all"==e.toLowerCase()&&(e=["t","b","r","l","bl","br","tl","tr"]),a.isArray(e)||(e=(e=e.replace(/, /g,",")).split(",")),this._configs.handles.value=e}}),this.setAttributeConfig("width",{value:e.width||parseInt(this.getStyle("width"),10),validator:YAHOO.lang.isNumber,method:function(e){0<(e=parseInt(e,10))&&(this.get("setSize")&&this.setStyle("width",e+"px"),this._cache.width=e,this._configs.width.value=e)}}),this.setAttributeConfig("height",{value:e.height||parseInt(this.getStyle("height"),10),validator:YAHOO.lang.isNumber,method:function(e){0<(e=parseInt(e,10))&&(this.get("setSize")&&this.setStyle("height",e+"px"),this._cache.height=e,this._configs.height.value=e)}}),this.setAttributeConfig("minWidth",{value:e.minWidth||15,validator:YAHOO.lang.isNumber}),this.setAttributeConfig("minHeight",{value:e.minHeight||15,validator:YAHOO.lang.isNumber}),this.setAttributeConfig("maxWidth",{value:e.maxWidth||1e4,validator:YAHOO.lang.isNumber}),this.setAttributeConfig("maxHeight",{value:e.maxHeight||1e4,validator:YAHOO.lang.isNumber}),this.setAttributeConfig("minY",{value:e.minY||!1}),this.setAttributeConfig("minX",{value:e.minX||!1}),this.setAttributeConfig("maxY",{value:e.maxY||!1}),this.setAttributeConfig("maxX",{value:e.maxX||!1}),this.setAttributeConfig("animate",{value:e.animate||!1,validator:function(e){var t=!0;return YAHOO.util.Anim||(t=!1),t}}),this.setAttributeConfig("animateEasing",{value:e.animateEasing||(t=!1,YAHOO.util.Easing&&YAHOO.util.Easing.easeOut&&(t=YAHOO.util.Easing.easeOut),t)}),this.setAttributeConfig("animateDuration",{value:e.animateDuration||.5}),this.setAttributeConfig("proxy",{value:e.proxy||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("ratio",{value:e.ratio||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("ghost",{value:e.ghost||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("draggable",{value:e.draggable||!1,validator:YAHOO.lang.isBoolean,method:function(e){e&&this._wrap?this._setupDragDrop():this.dd&&(u.removeClass(this._wrap,this.CSS_DRAG),this.dd.unreg())}}),this.setAttributeConfig("hover",{value:e.hover||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("hiddenHandles",{value:e.hiddenHandles||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("knobHandles",{value:e.knobHandles||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("xTicks",{value:e.xTicks||!1}),this.setAttributeConfig("yTicks",{value:e.yTicks||!1}),this.setAttributeConfig("status",{value:e.status||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("autoRatio",{value:e.autoRatio||!1,validator:YAHOO.lang.isBoolean})},destroy:function(){for(var e in this._handles)a.hasOwnProperty(this._handles,e)&&(r.purgeElement(this._handles[e]),this._handles[e].parentNode.removeChild(this._handles[e]));for(var t in this._proxy&&this._proxy.parentNode.removeChild(this._proxy),this._status&&this._status.parentNode.removeChild(this._status),this.dd&&(this.dd.unreg(),u.removeClass(this._wrap,this.CSS_DRAG)),this._wrap!=this.get("element")&&(this.setStyle("position",""),this.setStyle("top",""),this.setStyle("left",""),this._wrap.parentNode.replaceChild(this.get("element"),this._wrap)),this.removeClass(this.CSS_RESIZE),delete YAHOO.util.Resize._instances[this.get("id")],this)a.hasOwnProperty(this,t)&&(this[t]=null,delete this[t])},toString:function(){return this.get?"Resize (#"+this.get("id")+")":"Resize Utility"}}),YAHOO.util.Resize=i}(),YAHOO.register("resize",YAHOO.util.Resize,{version:"2.8.1",build:"19"}),function(){var e,r=YAHOO.util.Dom,s=YAHOO.util.Event,o=YAHOO.lang,i=function(e,t){o.isObject(e)&&!e.tagName&&(t=e,e=null),o.isString(e)&&r.get(e)&&(e=r.get(e));t={element:e=e||document.body,attributes:t||{}};i.superclass.constructor.call(this,t.element,t.attributes)};i._instances={},i.getLayoutById=function(e){return i._instances[e]||!1},YAHOO.extend(i,YAHOO.util.Element,{browser:((e=YAHOO.env.ua).standardsMode=!1,e.secure=!1,e),_units:null,_rendered:null,_zIndex:null,_sizes:null,_setBodySize:function(e){var t=0,i=0;e=!1!==e,this._isBody?(t=r.getClientHeight(),i=r.getClientWidth()):(t=parseInt(this.getStyle("height"),10),i=parseInt(this.getStyle("width"),10),isNaN(i)&&(i=this.get("element").clientWidth),isNaN(t)&&(t=this.get("element").clientHeight)),this.get("minWidth")&&i<this.get("minWidth")&&(i=this.get("minWidth")),this.get("minHeight")&&t<this.get("minHeight")&&(t=this.get("minHeight")),e&&(t<0&&(t=0),i<0&&(i=0),r.setStyle(this._doc,"height",t+"px"),r.setStyle(this._doc,"width",i+"px")),this._sizes.doc={h:t,w:i},this._setSides(e)},_setSides:function(e){var t=this._units.top?this._units.top.get("height"):0,i=this._units.bottom?this._units.bottom.get("height"):0,s=this._sizes.doc.h,o=this._sizes.doc.w;e=!1!==e,this._sizes.top={h:t,w:this._units.top?o:0,t:0},this._sizes.bottom={h:i,w:this._units.bottom?o:0};i=s-(t+i);this._sizes.left={h:i,w:this._units.left?this._units.left.get("width"):0},this._sizes.right={h:i,w:this._units.right?this._units.right.get("width"):0,l:this._units.right?o-this._units.right.get("width"):0,t:this._units.top?this._sizes.top.h:0},this._units.right&&e&&(this._units.right.set("top",this._sizes.right.t),this._units.right._collapsing||this._units.right.set("left",this._sizes.right.l),this._units.right.set("height",this._sizes.right.h,!0)),this._units.left&&(this._sizes.left.l=0,this._units.top?this._sizes.left.t=this._sizes.top.h:this._sizes.left.t=0,e&&(this._units.left.set("top",this._sizes.left.t),this._units.left.set("height",this._sizes.left.h,!0),this._units.left.set("left",0))),this._units.bottom&&(this._sizes.bottom.t=this._sizes.top.h+this._sizes.left.h,e&&(this._units.bottom.set("top",this._sizes.bottom.t),this._units.bottom.set("width",this._sizes.bottom.w,!0))),this._units.top&&e&&this._units.top.set("width",this._sizes.top.w,!0),this._setCenter(e)},_setCenter:function(e){e=!1!==e;var t=this._sizes.left.h,i=this._sizes.doc.w-(this._sizes.left.w+this._sizes.right.w);e&&(this._units.center.set("height",t,!0),this._units.center.set("width",i,!0),this._units.center.set("top",this._sizes.top.h),this._units.center.set("left",this._sizes.left.w)),this._sizes.center={h:t,w:i,t:this._sizes.top.h,l:this._sizes.left.w}},getSizes:function(){return this._sizes},getUnitById:function(e){return YAHOO.widget.LayoutUnit.getLayoutUnitById(e)},getUnitByPosition:function(e){return!!e&&(e=e.toLowerCase(),this._units[e]||!1)},removeUnit:function(e){delete this._units[e.get("position")],this.resize()},addUnit:function(e){if(!e.position)return!1;if(this._units[e.position])return!1;var t=null,i=null;e.id&&r.get(e.id)&&(t=r.get(e.id),delete e.id),e.element&&(t=e.element),i||(i=document.createElement("div"),n=r.generateId(),i.id=n),t=t||document.createElement("div"),r.addClass(t,"yui-layout-wrap"),this.browser.ie&&!this.browser.standardsMode&&(i.style.zoom=1,t.style.zoom=1),i.firstChild?i.insertBefore(t,i.firstChild):i.appendChild(t),this._doc.appendChild(i);var s=!1,o=!1;e.height&&(s=parseInt(e.height,10)),e.width&&(o=parseInt(e.width,10));var n={};YAHOO.lang.augmentObject(n,e),n.parent=this,n.wrap=t,n.height=s,n.width=o;n=new YAHOO.widget.LayoutUnit(i,n);return n.on("heightChange",this.resize,{unit:n},this),n.on("widthChange",this.resize,{unit:n},this),n.on("gutterChange",this.resize,{unit:n},this),this._units[e.position]=n,this._rendered&&this.resize(),n},_createUnits:function(){var e,t=this.get("units");for(e in t)o.hasOwnProperty(t,e)&&this.addUnit(t[e])},resize:function(e,t){var i=e;return i&&i.prevValue&&i.newValue&&i.prevValue==i.newValue&&t&&t.unit&&(t.unit.get("animate")||(e=!1)),(e=!1!==e)&&(!1===this.fireEvent("beforeResize")&&(e=!1),this.browser.ie&&(this._isBody?(r.removeClass(document.documentElement,"yui-layout"),r.addClass(document.documentElement,"yui-layout")):(this.removeClass("yui-layout"),this.addClass("yui-layout")))),this._setBodySize(e),e&&this.fireEvent("resize",{target:this,sizes:this._sizes,event:i}),this},_setupBodyElements:function(){this._doc=r.get("layout-doc"),this._doc||(this._doc=document.createElement("div"),this._doc.id="layout-doc",document.body.firstChild?document.body.insertBefore(this._doc,document.body.firstChild):document.body.appendChild(this._doc)),this._createUnits(),this._setBodySize(),s.on(window,"resize",this.resize,this,
1!0),r.addClass(this._doc,"yui-layout-doc")},_setupElements:function(){this._doc=this.getElementsByClassName("yui-layout-doc")[0],this._doc||(this._doc=document.createElement("div"),this.get("element").appendChild(this._doc)),this._createUnits(),this._setBodySize(),r.addClass(this._doc,"yui-layout-doc")},_isBody:null,_doc:null,init:function(e,t){this._zIndex=0,i.superclass.init.call(this,e,t),this.get("parent")&&(this._zIndex=this.get("parent")._zIndex+10),this._sizes={},this._units={};o.isString(e)||(e=r.generateId(e)),i._instances[e]=this},render:function(){this._stamp();var e=this.get("element");return e&&e.tagName&&"body"==e.tagName.toLowerCase()?(this._isBody=!0,r.addClass(document.body,"yui-layout"),r.hasClass(document.body,"yui-skin-sam")&&(r.addClass(document.documentElement,"yui-skin-sam"),r.removeClass(document.body,"yui-skin-sam")),this._setupBodyElements()):(this._isBody=!1,this.addClass("yui-layout"),this._setupElements()),this.resize(),this._rendered=!0,this.fireEvent("render"),this},_stamp:function(){"CSS1Compat"==document.compatMode&&(this.browser.standardsMode=!0),0===window.location.href.toLowerCase().indexOf("https")&&(r.addClass(document.documentElement,"secure"),this.browser.secure=!0)},initAttributes:function(e){i.superclass.initAttributes.call(this,e),this.setAttributeConfig("units",{writeOnce:!0,validator:YAHOO.lang.isArray,value:e.units||[]}),this.setAttributeConfig("minHeight",{value:e.minHeight||!1,validator:YAHOO.lang.isNumber}),this.setAttributeConfig("minWidth",{value:e.minWidth||!1,validator:YAHOO.lang.isNumber}),this.setAttributeConfig("height",{value:e.height||!1,validator:YAHOO.lang.isNumber,method:function(e){e<0&&(e=0),this.setStyle("height",e+"px")}}),this.setAttributeConfig("width",{value:e.width||!1,validator:YAHOO.lang.isNumber,method:function(e){e<0&&(e=0),this.setStyle("width",e+"px")}}),this.setAttributeConfig("parent",{writeOnce:!0,value:e.parent||!1,method:function(e){e&&e.on("resize",this.resize,this,!0)}})},destroy:function(){var e,t,i=this.get("parent");for(e in i&&i.removeListener("resize",this.resize,this,!0),s.removeListener(window,"resize",this.resize,this,!0),this.unsubscribeAll(),this._units)o.hasOwnProperty(this._units,e)&&this._units[e]&&this._units[e].destroy(!0);for(t in s.purgeElement(this.get("element")),this.get("parentNode").removeChild(this.get("element")),delete YAHOO.widget.Layout._instances[this.get("id")],this)o.hasOwnProperty(this,t)&&(this[t]=null,delete this[t]);i&&i.resize()},toString:function(){return this.get?"Layout #"+this.get("id"):"Layout"}}),YAHOO.widget.Layout=i}(),function(){var r=YAHOO.util.Dom,t=YAHOO.util.Selector,s=YAHOO.util.Event,o=YAHOO.lang,n=function(e,t){t={element:e,attributes:t||{}};n.superclass.constructor.call(this,t.element,t.attributes)};n._instances={},n.getLayoutUnitById=function(e){return n._instances[e]||!1},YAHOO.extend(n,YAHOO.util.Element,{STR_CLOSE:"Click to close this pane.",STR_COLLAPSE:"Click to collapse this pane.",STR_EXPAND:"Click to expand this pane.",LOADING_CLASSNAME:"loading",browser:null,_sizes:null,_anim:null,_resize:null,_clip:null,_gutter:null,header:null,body:null,footer:null,_collapsed:null,_collapsing:null,_lastWidth:null,_lastHeight:null,_lastTop:null,_lastLeft:null,_lastScroll:null,_lastCenterScroll:null,_lastScrollTop:null,resize:function(e){var t,i,s,o;return!1===this.fireEvent("beforeResize")||this._collapsing&&!0!==e||(t=this.get("scroll"),this.set("scroll",!1),i=this._getBoxSize(this.header),s=this._getBoxSize(this.footer),e=(o=[this.get("height"),this.get("width")])[0]-i[0]-s[0]-(this._gutter.top+this._gutter.bottom),o=o[1]-(this._gutter.left+this._gutter.right),e=e+(i[0]+s[0]),o=o,this._collapsed&&!this._collapsing?(this._setHeight(this._clip,e),this._setWidth(this._clip,o),r.setStyle(this._clip,"top",this.get("top")+this._gutter.top+"px"),r.setStyle(this._clip,"left",this.get("left")+this._gutter.left+"px")):(!this._collapsed||this._collapsed&&this._collapsing)&&(e=this._setHeight(this.get("wrap"),e),o=this._setWidth(this.get("wrap"),o),this._sizes.wrap.h=e,this._sizes.wrap.w=o,r.setStyle(this.get("wrap"),"top",this._gutter.top+"px"),r.setStyle(this.get("wrap"),"left",this._gutter.left+"px"),this._sizes.header.w=this._setWi
1dth(this.header,o),this._sizes.header.h=i[0],this._sizes.footer.w=this._setWidth(this.footer,o),this._sizes.footer.h=s[0],r.setStyle(this.footer,"bottom","0px"),this._sizes.body.h=this._setHeight(this.body,e-(i[0]+s[0])),this._sizes.body.w=this._setWidth(this.body,o),r.setStyle(this.body,"top",i[0]+"px"),this.set("scroll",t),this.fireEvent("resize"))),this},_setWidth:function(e,t){var i;return e&&(t-=(i=this._getBorderSizes(e))[1]+i[3],(t=this._fixQuirks(e,t,"w"))<0&&(t=0),r.setStyle(e,"width",t+"px")),t},_setHeight:function(e,t){var i;return e&&(t-=(i=this._getBorderSizes(e))[0]+i[2],(t=this._fixQuirks(e,t,"h"))<0&&(t=0),r.setStyle(e,"height",t+"px")),t},_fixQuirks:function(e,t,i){var s=0,o=2;return"w"==i&&(s=1,o=3),this.browser.ie<8&&!this.browser.standardsMode&&(i=this._getBorderSizes(e),e=this._getBorderSizes(e.parentNode),0===i[s]&&0===i[o]?0!==e[s]&&0!==e[o]&&(t-=e[s]+e[o]):0===e[s]&&0===e[o]&&(t+=i[s]+i[o])),t},_getBoxSize:function(e){var t,i=[0,0];return e&&(this.browser.ie&&!this.browser.standardsMode&&(e.style.zoom=1),t=this._getBorderSizes(e),i[0]=e.clientHeight+(t[0]+t[2]),i[1]=e.clientWidth+(t[1]+t[3])),i},_getBorderSizes:function(e){var t=[];e=e||this.get("element"),this.browser.ie&&!this.browser.standardsMode&&(e.style.zoom=1),t[0]=parseInt(r.getStyle(e,"borderTopWidth"),10),t[1]=parseInt(r.getStyle(e,"borderRightWidth"),10),t[2]=parseInt(r.getStyle(e,"borderBottomWidth"),10),t[3]=parseInt(r.getStyle(e,"borderLeftWidth"),10);for(var i=0;i<t.length;i++)isNaN(t[i])&&(t[i]=0);return t},_createClip:function(){var e;this._clip||(this._clip=document.createElement("div"),this._clip.className="yui-layout-clip yui-layout-clip-"+this.get("position"),this._clip.innerHTML='<div class="collapse"></div>',(e=this._clip.firstChild).title=this.STR_EXPAND,s.on(e,"click",this.expand,this,!0),this.get("element").parentNode.appendChild(this._clip))},_toggleClip:function(){if(this._collapsed)r.setStyle(this._clip,"display","none");else{var e=this._getBoxSize(this.header),t=this._getBoxSize(this.footer),i=[this.get("height"),this.get("width")],s=i[0]-e[0]-t[0]-(this._gutter.top+this._gutter.bottom),o=i[1]-(this._gutter.left+this._gutter.right),n=s+(e[0]+t[0]);switch(this.get("position")){case"top":case"bottom":this._setWidth(this._clip,o),this._setHeight(this._clip,this.get("collapseSize")),r.setStyle(this._clip,"left",this._lastLeft+this._gutter.left+"px"),"bottom"==this.get("position")?r.setStyle(this._clip,"top",this._lastTop+this._lastHeight-(this.get("collapseSize")-this._gutter.top)+"px"):r.setStyle(this._clip,"top",this.get("top")+this._gutter.top+"px");break;case"left":case"right":this._setWidth(this._clip,this.get("collapseSize")),this._setHeight(this._clip,n),r.setStyle(this._clip,"top",this.get("top")+this._gutter.top+"px"),"right"==this.get("position")?r.setStyle(this._clip,"left",this._lastLeft+this._lastWidth-this.get("collapseSize")-this._gutter.left+"px"):r.setStyle(this._clip,"left",this.get("left")+this._gutter.left+"px")}r.setStyle(this._clip,"display","block"),this.setStyle("display","none")}},getSizes:function(){return this._sizes},toggle:function(){return this._collapsed?this.expand ():this.collapse(),this},expand:function(){if(!this._collapsed)return this;if(!1===this.fireEvent("beforeExpand"))return this;if(this._collapsing=!0,this.setStyle("zIndex",this.get("parent")._zIndex+1),this._anim){this.setStyle("display","none");var e,t={};switch(this.get("position")){case"left":case"right":this.set("width",this._lastWidth,!0),this.setStyle("width",this._lastWidth+"px"),this.get("parent").resize(!1),e=this.get("parent").getSizes()[this.get("position")],this.set("height",e.h,!0);var i=e.l,t={left:{to:i}};"left"==this.get("position")&&(t.left.from=i-e.w,this.setStyle("left",i-e.w+"px"));break;case"top":case"bottom":this.set("height",this._lastHeight,!0),this.setStyle("height",this._lastHeight+"px"),this.get("parent").resize(!1),e=this.get("parent").getSizes()[this.get("position")],this.set("width",e.w,!0);i=e.t;t={top:{to:i}},"top"==this.get("position")&&(this.setStyle("top",i-e.h+"px"),t.top.from=i-e.h)}this._anim.attributes=t;var s=function(){this.setStyle("display","block"),this.resize(!0),this._anim.onStart.unsubscribe(s,this,!0)},o=function(){this._collapsing=!1,this.setStyle("zIndex",this.get("parent")._zIndex),this.set("width",this._lastWidth),this.set("height",this._lastHeight),this._collapsed=!1,this.resize(),this.set("scroll",this._lastScroll),0<this._lastScrollTop&&(this.body.scrollTop=this._lastScrollTop),this._anim.onComplete.unsubscribe(o,this,!0),this.fireEvent("expand")};this._anim.onStart.subscribe(s,this,!0),this._anim.onComplete.subscribe(o,this,!0),this._anim.animate(),this._toggleClip()}else this._collapsing=!1,this._toggleClip(),this._collapsed=!1,this.setStyle("zIndex",this.get("parent")._zIndex),this.setStyle("display","block"),this.set("width",this._lastWidth),this.set("height",this._lastHeight),this.resize(),this.set("scroll",this._lastScroll),0<this._lastScrollTop&&(this.body.scrollTop=this._lastScrollTop),this.fireEvent("expand");return this},collapse:function(){if(this._collapsed)return this;if(!1===this.fireEvent("beforeCollapse"))return this;this._clip||this._createClip(),this._collapsing=!0;var e=this.get("width"),t=this.get("height"),i={};this._lastWidth=e,this._lastHeight=t,this._lastScroll=this.get("scroll"),this._lastScrollTop=this.body.scrollTop,this.set("scroll",!1,!0),this._lastLeft=parseInt(this.get("element").style.left,10),this._lastTop=parseInt(this.get("element").style.top,10),isNaN(this._lastTop)&&(this._lastTop=0,this.set("top",0)),isNaN(this._lastLeft)&&(this._lastLeft=0,this.set("left",0)),this.setStyle("zIndex",this.get("parent")._zIndex+1);var s,o=this.get("position");switch(o){case"top":case"bottom":this.set("height",this.get("collapseSize")+(this._gutter.top+this._gutter.bottom)),i={top:{to:this.get("top")-t}},"bottom"==o&&(i.top.to=this.get("top")+t);break;case"left":case"right":this.set("width",this.get("collapseSize")+(this._gutter.left+this._gutter.right)),i={left:{to:-this._lastWidth}}
1,"right"==o&&(i.left={to:this.get("left")+e})}return this._anim?(this._anim.attributes=i,s=function(){this._collapsing=!1,this._toggleClip(),this.setStyle("zIndex",this.get("parent")._zIndex),this._collapsed=!0,this.get("parent").resize(),this._anim.onComplete.unsubscribe(s,this,!0),this.fireEvent("collapse")},this._anim.onComplete.subscribe(s,this,!0),this._anim.animate()):(this._collapsing=!1,this.setStyle("display","none"),this._toggleClip(),this.setStyle("zIndex",this.get("parent")._zIndex),this.get("parent").resize(),this._collapsed=!0,this.fireEvent("collapse")),this},close:function(){return this.setStyle("display","none"),this.get("parent").removeUnit(this),this.fireEvent("close"),this._clip&&(this._clip.parentNode.removeChild(this._clip),this._clip=null),this.get("parent")},loadHandler:{success:function(e){this.body.innerHTML=e.responseText,this.resize(!0)},failure:function(e){}},dataConnection:null,_loading:!1,loadContent:function(){return!(!YAHOO.util.Connect||!this.get("dataSrc")||this._loading||this.get("dataLoaded"))&&(this._loading=!0,r.addClass(this.body,this.LOADING_CLASSNAME),this.dataConnection=YAHOO.util.Connect.asyncRequest(this.get("loadMethod"),this.get("dataSrc"),{success:function(e){this.loadHandler.success.call(this,e),this.set("dataLoaded",!0),this.dataConnection=null,r.removeClass(this.body,this.LOADING_CLASSNAME),this._loading=!1,this.fireEvent("load")},failure:function(e){this.loadHandler.failure.call(this,e),this.dataConnection=null,r.removeClass(this.body,this.LOADING_CLASSNAME),this._loading=!1,this.fireEvent("loadError",{error:e})},scope:this,timeout:this.get("dataTimeout")}),this.dataConnection)},init:function(e,t){this._gutter={left:0,right:0,top:0,bottom:0},this._sizes={wrap:{h:0,w:0},header:{h:0,w:0},body:{h:0,w:0},footer:{h:0,w:0}},n.superclass.init.call(this,e,t),this.browser=this.get("parent").browser;o.isString(e)||(e=r.generateId(e)),(n._instances[e]=this).setStyle("position","absolute"),this.addClass("yui-layout-unit"),this.addClass("yui-layout-unit-"+this.get("position"));e=this.getElementsByClassName("yui-layout-hd","div")[0];e&&(this.header=e);e=this.getElementsByClassName("yui-layout-bd","div")[0];e&&(this.body=e);e=this.getElementsByClassName("yui-layout-ft","div")[0];e&&(this.footer=e),this.on("contentChange",this.resize,this,!0),this._lastScrollTop=0,this.set("animate",this.get("animate"))},initAttributes:function(e){n.superclass.initAttributes.call(this,e),this.setAttributeConfig("wrap",{value:e.wrap||null,method:function(e){e&&(e=r.generateId(e),n._instances[e]=this)}}),this.setAttributeConfig("grids",{value:e.grids||!1}),this.setAttributeConfig("top",{value:e.top||0,validator:o.isNumber,method:function(e){this._collapsing||this.setStyle("top",e+"px")}}),this.setAttributeConfig("left",{value:e.left||0,validator:o.isNumber,method:function(e){this._collapsing||this.setStyle("left",e+"px")}}),this.setAttributeConfig("minWidth",{value:e.minWidth||!1,method:function(e){this._resize&&this._resize.set("minWidth",e)},validator:YAHOO.lang.isNumber}),this.setAttributeConfig("maxWidth",{value:e.maxWidth||!1,method:function(e){this._resize&&this._resize.set("maxWidth",e)},validator:YAHOO.lang.isNumber}),this.setAttributeConfig("minHeight",{value:e.minHeight||!1,method:function(e){this._resize&&this._resize.set("minHeight",e)},validator:YAHOO.lang.isNumber}),this.setAttributeConfig("maxHeight",{value:e.maxHeight||!1,method:function(e){this._resize&&this._resize.set("maxHeight",e)},validator:YAHOO.lang.isNumber}),this.setAttributeConfig("height",{value:e.height,validator:o.isNumber,method:function(e){this._collapsing||(e<0&&(e=0),this.setStyle("height",e+"px"))}}),this.setAttributeConfig("width",{value:e.width,validator:o.isNumber,method:function(e){this._collapsing||(e<0&&(e=0),this.setStyle("width",e+"px"))}}),this.setAttributeConfig("zIndex",{value:e.zIndex||!1,method:function(e){this.setStyle("zIndex",e)}}),this.setAttributeConfig("position",{value:e.position}),this.setAttributeConfig("gutter",{value:e.gutter||0,validator:YAHOO.lang.isString,method:function(e){e=e.split(" ");e.length&&(this._gutter.top=parseInt(e[0],10),e[1]?this._gutter.right=parseInt(e[1],10):this._gutter.right=this._gutter.top,e[2]?this._gutter.bottom=parseInt(e[2],10):this._gutter.bottom=this._gutter.top,e[3]?this._gutter.left=parseInt(e[3],10):e[1]?this._gutter.left=this._gutter.right:this._gutter.left=this._gutter.top)}}),this.setAttributeConfig("parent",{writeOnce:!0,value:e.parent||!1,method:function(e){e&&e.on("resize",this.resize,this,
1!0)}}),this.setAttributeConfig("collapseSize",{value:e.collapseSize||25,validator:YAHOO.lang.isNumber}),this.setAttributeConfig("duration",{value:e.duration||.5}),this.setAttributeConfig("easing",{value:e.easing||(YAHOO.util&&YAHOO.util.Easing?YAHOO.util.Easing.BounceIn:"false")}),this.setAttributeConfig("animate",{value:!1!==e.animate,validator:function(){var e=!1;return YAHOO.util.Anim&&(e=!0),e},method:function(e){this._anim=!!e&&new YAHOO.util.Anim(this.get("element"),{},this.get("duration"),this.get("easing"))}}),this.setAttributeConfig("header",{value:e.header||!1,method:function(e){var t;!1===e?this.header&&(r.addClass(this.body,"yui-layout-bd-nohd"),this.header.parentNode.removeChild(this.header),this.header=null):(this.header||(t=(t=this.getElementsByClassName("yui-layout-hd","div")[0])||this._createHeader(),this.header=t),(t=this.header.getElementsByTagName("h2")[0])||(t=document.createElement("h2"),this.header.appendChild(t)),t.innerHTML=e,this.body&&r.removeClass(this.body,"yui-layout-bd-nohd")),this.fireEvent("contentChange",{target:"header"})}}),this.setAttributeConfig("proxy",{writeOnce:!0,value:!1!==e.proxy}),this.setAttributeConfig("body",{value:e.body||!1,method:function(e){this.body||((t=this.getElementsByClassName("yui-layout-bd","div")[0])?this.body=t:((t=document.createElement("div")).className="yui-layout-bd",this.body=t,this.get("wrap").appendChild(t))),this.header||r.addClass(this.body,"yui-layout-bd-nohd"),r.addClass(this.body,"yui-layout-bd-noft");var t,i=null;o.isString(e)?i=r.get(e):e&&e.tagName&&(i=e),i?(t=r.generateId(i),(n._instances[t]=this).body.appendChild(i)):this.body.innerHTML=e,this._cleanGrids(),this.fireEvent("contentChange",{target:"body"})}}),this.setAttributeConfig("footer",{value:e.footer||!1,method:function(e){var t;!1===e?this.footer&&(r.addClass(this.body,"yui-layout-bd-noft"),this.footer.parentNode.removeChild(this.footer),this.footer=null):(this.footer||((t=this.getElementsByClassName("yui-layout-ft","div")[0])?this.footer=t:((t=document.createElement("div")).className="yui-layout-ft",this.footer=t,this.get("wrap").appendChild(t))),t=null,o.isString(e)?t=r.get(e):e&&e.tagName&&(t=e),t?this.footer.appendChild(t):this.footer.innerHTML=e,r.removeClass(this.body,"yui-layout-bd-noft")),this.fireEvent("contentChange",{target:"footer"})}}),this.setAttributeConfig("close",{value:e.close||!1,method:function(e){if("center"==this.get("position"))return!1;!this.header&&e&&this._createHeader();var t=r.getElementsByClassName("close","div",this.header)[0];e?(this.get("header")||this.set("header","&nbsp;"),t||((t=document.createElement("div")).className="close",this.header.appendChild(t),s.on(t,"click",this.close,this,!0)),t.title=this.STR_CLOSE):t&&t.parentNode&&(s.purgeElement(t),t.parentNode.removeChild(t)),this._configs.close.value=e,this.set("collapse",this.get("collapse"))}}),this.setAttributeConfig("collapse",{value:e.collapse||!1,method:function(e){if("center"==this.get("position"))return!1;!this.header&&e&&this._createHeader();var t=r.getElementsByClassName("collapse","div",this.header)[0];e?(this.get("header")||this.set("header","&nbsp;"),t||(t=document.createElement("div"),this.header.appendChild(t),s.on(t,"click",this.collapse,this,!0)),t.title=this.STR_COLLAPSE,t.className="collapse"+(this.get("close")?" collapse-close":"")):t&&t.parentNode&&(s.purgeElement(t),t.parentNode.removeChild(t))}}),this.setAttributeConfig("scroll",{value:(!0===e.scroll||!1===e.scroll||null===e.scroll)&&e.scroll,method:function(e){!1!==e||this._collapsed||this.body&&0<this.body.scrollTop&&(this._lastScrollTop=this.body.scrollTop),!0===e?(this.addClass("yui-layout-scroll"),this.removeClass("yui-layout-noscroll"),0<this._lastScrollTop&&this.body&&(this.body.scrollTop=this._lastScrollTop)):!1===e?(this.removeClass("yui-layout-scroll"),this.addClass("yui-layout-noscroll")):null===e&&(this.removeClass("yui-layout-scroll"),this.removeClass("yui-layout-noscroll"))}}),this.setAttributeConfig("hover",{writeOnce:!0,value:e.hover||!1,validator:YAHOO.lang.isBoolean}),this.setAttributeConfig("useShim",{value:e.useShim||!1,validator:YAHOO.lang.isBoolean,method:function(e){this._resize&&this._resize.set("useShim",e)}}),this.setAttributeConfig("resize",{value:e.resize||!1,validator:function(e){return!(!YAHOO.util||!YAHOO.util.Resize)},method:function(e){if(e&&!this._resize){if("center"==this.get("position"))return!1;var t=!1;switch(this.get("position")){case"top":t="b";break;case"bottom":t="t";break;case"right":t="l";break;case"left":t="r"}this.setStyle("position","absolute"),t&&(this._resize=new YAHOO.util.Resize(this.get("element"),{proxy:this.get("proxy"),hover:this.get("hover"),status:!1,autoRatio:!1,handles:[t],minWidth:this.get("minWidth"),maxWidth:this.get("maxWidth"),minHeight:this.get("minHeight"),maxHeight:this.get("maxHeight"),height:this.get("height"),width:this.get("width"),setSize:!1,useShim:this.get("useShim"),wrap:!1}),this._resize._handles[t].innerHTML='<div class="yui-layout-resize-knob"></div>',this.get("proxy")&&(this._resize.getProxyEl().innerHTML='<div class="yui-layout-handle-'+t+'"></div>'),this._resize.on("startResize",function(e){var t;this._lastScroll=this.get("scroll"),this.set("scroll",!1),this.get("parent")&&(this.get("parent").fireEvent("startResize"),t=this.get("parent").getUnitByPosition("center"),this._lastCenterScroll=t.get("scroll"),t.addClass(this._resize.CSS_RESIZING),t.set("scroll",!1)),this.fireEvent("startResize")},this,!0),this._resize.on("resize",function(e){this.set("height",e.height),this.set("width",e.width)},this,!0),this._resize.on("endResize",function(e){var t;this.set("scroll",this._lastScroll),this.get("parent")&&((t=this.get("parent").getUnitByPosition("center")).set("scroll",this._lastCenterScroll),t.removeClass(this._resize.CSS_RESIZING)),this.resize(),this.fireEvent("endResize")},this,!0))}else this._resize&&this._resize.destroy()}}),this.setAttributeConfig("dataSrc",{value:e.dataSrc}),this.setAttributeConfig("loadMethod",{value:e.loadMethod||"GET",validator:YAHOO.lang.isString}),this.setAttributeConfig("dataLoaded",{value:!1,validator:YAHOO.lang.isBoolean,writeOnce:!0}),this.setAttributeConfig("dataTimeout",{value:e.dataTimeout||null,validator:YAHOO.lang.isNumber})},_cleanGrids:function(){var e;this.get("grids")&&((e=t.query("div.yui-b",this.body,!0))&&r.removeClass(e,"yui-b"),s.onAvailable("yui-main",function(){r.setStyle(t.query("#yui-main"),"margin-left","0"),r.setStyle(t.query("#yui-main"),"margin-right","0")}))},_createHeader:function(){var e=document.createElement("div");return e.className="yui-layout-hd",this.get("firstChild")?this.get("wrap").insertBefore(e,this.get("wrap").firstChild):this.get("wrap").appendChild(e),this.header=e},destroy:function(e){this._resize&&this._resize.destroy();var t,i=this.get("parent");for(t in this.setStyle("display","none"),this._clip&&(this._clip.parentNode.removeChild(this._clip),this._clip=null),e||i.removeUnit(this),i&&i.removeListener("resize",this.resize,this,
1!0),this.unsubscribeAll(),s.purgeElement(this.get("element")),this.get("parentNode").removeChild(this.get("element")),delete YAHOO.widget.LayoutUnit._instances[this.get("id")],this)o.hasOwnProperty(this,t)&&(this[t]=null,delete this[t]);return i},toString:function(){return this.get?"LayoutUnit #"+this.get("id")+" ("+this.get("position")+")":"LayoutUnit"}}),YAHOO.widget.LayoutUnit=n}(),YAHOO.register("layout",YAHOO.widget.Layout,{version:"2.8.1",build:"19"}),YAHOO.util.DragDropMgr||(YAHOO.util.DragDropMgr=function(){var t=YAHOO.util.Event,i=YAHOO.util.Dom;return{useShim:!1,_shimActive:!1,_shimState:!1,_debugShim:!1,_createShim:function(){var e=document.createElement("div");e.id="yui-ddm-shim",document.body.firstChild?document.body.insertBefore(e,document.body.firstChild):document.body.appendChild(e),e.style.display="none",e.style.backgroundColor="red",e.style.position="absolute",e.style.zIndex="99999",i.setStyle(e,"opacity","0"),this._shim=e,t.on(e,"mouseup",this.handleMouseUp,this,!0),t.on(e,"mousemove",this.handleMouseMove,this,!0),t.on(window,"scroll",this._sizeShim,this,!0)},_sizeShim:function(){var e;this._shimActive&&((e=this._shim).style.height=i.getDocumentHeight()+"px",e.style.width=i.getDocumentWidth()+"px",e.style.top="0",e.style.left="0")},_activateShim:function(){var e,t;this.useShim&&(this._shim||this._createShim(),this._shimActive=!0,e=this._shim,t="0",this._debugShim&&(t=".5"),i.setStyle(e,"opacity",t),this._sizeShim(),e.style.display="block")},_deactivateShim:function(){this._shim.style.display="none",this._shimActive=!1},_shim:null,ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:!0,stopPropagation:!0,initialized:!1,locked:!1,interactionInfo:null,init:function(){this.initialized=!0},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(e,t){for(var i in this.ids)for(var s in this.ids[i]){var o=this.ids[i][s];this.isTypeOfDD(o)&&o[e].apply(o,t)}},_onLoad:function(){this.init(),t.on(document,"mouseup",this.handleMouseUp,this,!0),t.on(document,"mousemove",this.handleMouseMove,this,!0),t.on(window,"unload",this._onUnload,this,!0),t.on(window,"resize",this._onResize,this,!0)},_onResize:function(e){this._execOnAll("resetConstraints",[])},lock:function(){this.locked=!0},unlock:function(){this.locked=!1},isLocked:function(){return this.locked},locationCache:{},useCache:!0,clickPixelThresh:3,clickTimeThresh:1e3,dragThreshMet:!1,clickTimeout:null,startX:0,startY:0,fromTimeout:!1,regDragDrop:function(e,t){this.initialized||this.init(),this.ids[t]||(this.ids[t]={}),this.ids[t][e.id]=e},removeDDFromGroup:function(e,t){this.ids[t]||(this.ids[t]={});t=this.ids[t];t&&t[e.id]&&delete t[e.id]},_remove:function(e){for(var t in e.groups){var i;!t||(i=this.ids[t])&&i[e.id]&&delete i[e.id]}delete this.handleIds[e.id]},regHandle:function(e,t){this.handleIds[e]||(this.handleIds[e]={}),this.handleIds[e][t]=t},isDragDrop:function(e){return!!this.getDDById(e)},getRelated:function(e,t){var i,s=[];for(i in e.groups)for(var o in this.ids[i]){var n=this.ids[i][o];this.isTypeOfDD(n)&&(t&&!n.isTarget||(s[s.length]=n))}return s},isLegalTarget:function(e,t){for(var i=this.getRelated(e,!0),s=0,o=i.length;s<o;++s)if(i[s].id==t.id)return!0;return!1},isTypeOfDD:function(e){return e&&e.__ygDragDrop},isHandle:function(e,t){return this.handleIds[e]&&this.handleIds[e][t]},getDDById:function(e){for(var t in this.ids)if(this.ids[t][e])return this.ids[t][e];return null},handleMouseDown:function(e,t){this.currentTarget=YAHOO.util.Event.getTarget(e);t=(this.dragCurrent=t).getEl();this.startX=YAHOO.util.Event.getPageX(e),this.startY=YAHOO.util.Event.getPageY(e),this.deltaX=this.startX-t.offsetLeft,this.deltaY=this.startY-t.offsetTop,this.dragThreshMet=!1,this.clickTimeout=setTimeout(function(){var e=YAHOO.util.DDM;e.startDrag(e.startX,e.startY),e.fromTimeout=!0},this.clickTimeThresh)},startDrag:function(e,t){this.dragCurrent&&this.dragCurrent.useShim&&(this._shimState=this.useShim,this.useShim=!0),this._activateShim(),clearTimeout(this.clickTimeout);var i=this.dragCurrent;i&&i.events.b4StartDrag&&(i.b4StartDrag(e,t),i.fireEvent("b4StartDragEvent",{x:e,y:t})),i&&i.events.startDrag&&(i.startDrag(e,t),i.fireEvent("startDragEvent",{x:e,y:t})),this.dragThreshMet=!0},handleMouseUp:function(e){this.dragCurrent&&(clearTimeout(this.clickTimeout),this.dragThreshMet&&(this.fromTimeout&&(this.fromTimeout=!1,this.handleMouseMove(e)),this.fromTimeout=!1,this.fireEvents(e,!0)),this.stopDrag(e),this.stopEvent(e))},stopEvent:function(e){this.stopPropagation&&YAHOO.util.Event.stopPropagation(e),this.preventDefault&&YAHOO.util.Event.preventDefault(e)},stopDrag:function(e,t){var i=this.dragCurrent;i&&!t&&(this.dragThreshMet&&(i.events.b4EndDrag&&(i.b4EndDrag(e),i.fireEvent("b4EndDragEvent",{e:e})),i.events.endDrag&&(i.endDrag(e),i.fireEvent("endDragEvent",{e:e}))),i.events.mouseUp&&(i.onMouseUp(e),i.fireEvent("mouseUpEvent",{e:e}))),this._shimActive&&(this._deactivateShim(),this.dragCurrent&&this.dragCurrent.useShim&&(this.useShim=this._shimState,this._shimState=!1)),this.dragCurrent=null,this.dragOvers={}},handleMouseMove:function(e){var t,i,s=this.dragCurrent;if(s){if(YAHOO.util.Event.isIE&&!e.button)return this.stopEvent(e),this.handleMouseUp(e);e.clientX<0||e.clientY,this.dragThreshMet||(t=Math.abs(this.startX-YAHOO.util.Event.getPageX(e)),i=Math.abs(this.startY-YAHOO.util.Event.getPageY(e)),(t>this.clickPixelThresh||i>this.clickPixelThresh)&&this.startDrag(this.startX,this.startY)),this.dragThreshMet&&(s&&s.events.b4Drag&&(s.b4Drag(e),s.fireEvent("b4DragEvent",{e:e})),s&&s.events.drag&&(s.onDrag(e),s.fireEvent("dragEvent",{e:e})),s&&this.fireEvents(e,!1)),this.stopEvent(e)}},fireEvents:function(e,t){var i=this.dragCurrent;if(i&&!i.isLocked()&&!i.dragOnly){var s,o,n,r=YAHOO.util.Event.getPageX(e),a=YAHOO.util.Event.getPageY(e),l=new YAHOO.util.Point(r,a),r=i.getTargetCoord(l.x,l.y),a=i.getDragEl(),h=["out","over","drop","enter"],u=new YAHOO.util.Region(r.y,r.x+a.offsetWidth,r.y+a.offsetHeight,r.x),c=[],d={},m=[],p={outEvts:[],overEvts:[],dropEvts:[],enterEvts:[]};for(s in this.dragOvers){var g=this.dragOvers[s];this.isTypeOfDD(g)&&(this.isOverTarget(l,g,this.mode,u)||p.outEvts.push(g),c[s]=!0,delete this.dragOvers[s])}for(o in i.groups)if("string"==typeof o)for(s in this.ids[o]){var v=this.ids[o][s];this.isTypeOfDD(v)&&v.isTarget&&!v.isLocked()&&v!=i&&this.isOverTarget(l,v,this.mode,u)&&(d[o]=!0,t?p.dropEvts.push(v):((c[v.id]?p.overEvts:p.enterEvts).push(v),this.dragOvers[v.id]=v))}for(n in this.interactionInfo={out:p.outEvts,enter:p.enterEvts,over:p.overEvts,drop:p.dropEvts,point:l,draggedRegion:u,sourceRegion:this.locationCache[i.id],validDrop:t},d)m.push(n);for(t&&!p.dropEvts.length&&(this.interactionInfo.validDrop=!1,i.events.invalidDrop&&(i.onInvalidDrop(e),i.fireEvent("invalidDropEvent",{e:e}))),s=0;s<h.length;s++){var f=null;if(p[h[s]+"Evts"]&&(f=p[h[s]+"Evts"]),f&&f.length){var b=h[s].charAt(0).toUpperCase()+h[s].substr(1),y="onDrag"+b,O="b4Drag"+b,_="drag"+b+"Event",C="drag"+b;if(this.mode)i.events[O]&&(i[O](e,f,m),i.fireEvent(O+"Event",{event:e,info:f,group:m})),i.events[C]&&(i[y](e,f,m),i.fireEvent(_,{event:e,info:f,group:m}));else for(var A=0,S=f.length;A<S;++A)i.events[O]&&(i[O](e,f[A].id,m[0]),i.fireEvent(O+"Event",{event:e,info:f[A].id,group:m[0]})),i.events[C]&&(i[y](e,f[A].id,m[0]),i.fireEvent(_,{event:e,info:f[A].id,group:m[0]}))}}}},getBestMatch:function(e){var t=null,i=e.length;if(1==i)t=e[0];else for(var s=0;s<i;++s){var o=e[s];if(this.mode==this.INTERSECT&&o.cursorIsOver){t=o;break}t&&t.overlap&&!(o.overlap&&t.overlap.getArea()<o.overlap.getArea())||
1(t=o)}return t},refreshCache:function(e){for(var t in e||this.ids)if("string"==typeof t)for(var i in this.ids[t]){var s,o=this.ids[t][i];this.isTypeOfDD(o)&&((s=this.getLocation(o))?this.locationCache[o.id]=s:delete this.locationCache[o.id])}},verifyEl:function(e){try{if(e)if(e.offsetParent)return!0}catch(e){}return!1},getLocation:function(e){if(!this.isTypeOfDD(e))return null;var t,i,s,o,n,r=e.getEl();try{t=YAHOO.util.Dom.getXY(r)}catch(e){}return t?(o=(i=t[0])+r.offsetWidth,n=(s=t[1])+r.offsetHeight,s=s-e.padding[0],o=o+e.padding[1],n=n+e.padding[2],e=i-e.padding[3],new YAHOO.util.Region(s,o,n,e)):null},isOverTarget:function(e,t,i,s){var o=this.locationCache[t.id];if(o&&this.useCache||(o=this.getLocation(t),this.locationCache[t.id]=o),!o)return!1;t.cursorIsOver=o.contains(e);var n=this.dragCurrent;if(!n||!i&&!n.constrainX&&!n.constrainY)return t.cursorIsOver;t.overlap=null,s||(e=n.getTargetCoord(e.x,e.y),n=n.getDragEl(),s=new YAHOO.util.Region(e.y,e.x+n.offsetWidth,e.y+n.offsetHeight,e.x));o=s.intersect(o);return!!o&&(t.overlap=o,!!i||t.cursorIsOver)},_onUnload:function(e,t){this.unregAll()}
1,unregAll:function(){this.dragCurrent&&(this.stopDrag(),this.dragCurrent=null),this._execOnAll("unreg",[]),this.ids={}},elementCache:{},getElWrapper:function(e){var t=this.elementCache[e];return t&&t.el||(t=this.elementCache[e]=new this.ElementWrapper(YAHOO.util.Dom.get(e))),t},getElement:function(e){return YAHOO.util.Dom.get(e)},getCss:function(e){e=YAHOO.util.Dom.get(e);return e?e.style:null},ElementWrapper:function(e){this.el=e||null,this.id=this.el&&e.id,this.css=this.el&&e.style},getPosX:function(e){return YAHOO.util.Dom.getX(e)},getPosY:function(e){return YAHOO.util.Dom.getY(e)},swapNode:function(e,t){var i,s;e.swapNode?e.swapNode(t):(i=t.parentNode,(s=t.nextSibling)==e?i.insertBefore(e,t):t==e.nextSibling?i.insertBefore(t,e):(e.parentNode.replaceChild(t,e),i.insertBefore(e,s)))},getScroll:function(){var e,t,i=document.documentElement,s=document.body;return i&&(i.scrollTop||i.scrollLeft)?(e=i.scrollTop,t=i.scrollLeft):s&&(e=s.scrollTop,t=s.scrollLeft),{top:e,left:t}},getStyle:function(e,t){return YAHOO.util.Dom.getStyle(e,t)},getScrollTop:function(){return this.getScroll().top},getScrollLeft:function(){return this.getScroll().left},moveToEl:function(e,t){t=YAHOO.util.Dom.getXY(t);YAHOO.util.Dom.setXY(e,t)},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight()},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth()},numericSort:function(e,t){return e-t},_timeoutCount:0,_addListeners:function(){var e=YAHOO.util.DDM;YAHOO.util.Event&&document?e._onLoad():2e3<e._timeoutCount||(setTimeout(e._addListeners,10),document&&document.body&&(e._timeoutCount+=1))},handleWasClicked:function(e,t){if(this.isHandle(t,e.id))return!0;for(var i=e.parentNode;i;){if(this.isHandle(t,i.id))return!0;i=i.parentNode}return!1}}}(),YAHOO.util.DDM=YAHOO.util.DragDropMgr,YAHOO.util.DDM._addListeners()),function(){var r=YAHOO.util.Event,n=YAHOO.util.Dom;YAHOO.util.DragDrop=function(e,t,i){e&&this.init(e,t,i)},YAHOO.util.DragDrop.prototype={events:null,on:function(){this.subscribe.apply(this,arguments)},id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:!1,lock:function(){this.locked=!0},unlock:function(){this.locked=!1},isTarget:!0,padding:null,dragOnly:!1,useShim:!1,_domRef:null,__ygDragDrop:!0,constrainX:!1,constrainY:!1,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:!1,xTicks:null,yTicks:null,primaryButtonOnly:!0,available:!1,hasOuterHandles:!1,cursorIsOver:!1,overlap:null,b4StartDrag:function(e,t){},startDrag:function(e,t){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,t){},b4DragOver:function(e){},onDragOver:function(e,t){},b4DragOut:function(e){},onDragOut:function(e,t){},b4DragDrop:function(e){},onDragDrop:function(e,t){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){return this._domRef||(this._domRef=n.get(this.id)),this._domRef},getDragEl:function(){return n.get(this.dragElId)},init:function(e,t,i){for(var s in this.initTarget(e,t,i),r.on(this._domRef||this.id,"mousedown",this.handleMouseDown,this,!0),this.events)this.createEvent(s+"Event")},initTarget:function(e,t,i){this.config=i||{},this.events={},this.DDM=YAHOO.util.DDM,this.groups={},"string"!=typeof e&&(this._domRef=e,e=n.generateId(e)),this.id=e,this.addToGroup(t||"default"),this.handleElId=e,r.onAvailable(e,this.handleOnAvailable,this,!0),this.setDragElId(e),this.invalidHandleTypes={A:"A"},this.invalidHandleIds={},this.invalidHandleClasses=[],this.applyConfig()},applyConfig:function(){if(this.events={mouseDown:!0,b4MouseDown:!0,mouseUp:!0,b4StartDrag:!0,startDrag:!0,b4EndDrag:!0,endDrag:!0,drag:!0,b4Drag:!0,invalidDrop:!0,b4DragOut:!0,dragOut:!0,dragEnter:!0,b4DragOver:!0,dragOver:!0,b4DragDrop:!0,dragDrop:!0},this.config.events)for(var e in this.config.events)!1===this.config.events[e]&&(this.events[e]=!1);this.padding=this.config.padding||[0,0,0,0],this.isTarget=!1!==this.config.isTarget,this.maintainOffset=this.config.maintainOffset,this.primaryButtonOnly=!1!==this.config.primaryButtonOnly,this.dragOnly=!0===this.config.dragOnly,this.useShim=!0===this.config.useShim},handleOnAvailable:function(){this.available=!0,this.resetConstraints(),this.onAvailable()},setPadding:function(e,t,i,s){this.padding=t||0===t?i||0===i?[e,t,i,s]:[e,t,e,t]:[e,e,e,e]},setInitPosition:function(e,t){var i,s=this.getEl();this.DDM.verifyEl(s)?(i=e||0,e=t||0,t=n.getXY(s),this.initPageX=t[0]-i,this.initPageY=t[1]-e,this.lastPageX=t[0],this.lastPageY=t[1],this.setStartPosition(t)):s&&s.style&&s.style.display},setStartPosition:function(e){e=e||n.getXY(this.getEl());this.deltaSetXY=null,this.startPageX=e[0],this.startPageY=e[1]},addToGroup:function(e){this.groups[e]=!0,this.DDM.regDragDrop(this,e)},removeFromGroup:function(e){this.groups[e]&&delete this.groups[e],this.DDM.removeDDFromGroup(this,e)},setDragElId:function(e){this.dragElId=e},setHandleElId:function(e){"string"!=typeof e&&(e=n.generateId(e)),this.handleElId=e,this.DDM.regHandle(this.id,e)},setOuterHandleElId:function(e){"string"!=typeof e&&(e=n.generateId(e)),r.on(e,"mousedown",this.handleMouseDown,this,!0),this.setHandleElId(e),this.hasOuterHandles=!0},unreg:function(){r.removeListener(this.id,"mousedown",this.handleMouseDown),this._domRef=null,this.DDM._remove(this)},isLocked:function(){return this.DDM.isLocked()||this.locked},handleMouseDown:function(e,t){var i,s,o,n=e.which||e.button;this.primaryButtonOnly&&1<n||this.isLocked()||(i=this.b4MouseDown(e),s=!0,this.events.b4MouseDown&&(s=this.fireEvent("b4MouseDownEvent",e)),o=this.onMouseDown(e),n=!0,this.events.mouseDown&&(n=this.fireEvent("mouseDownEvent",e)),!1!==i&&!1!==o&&!1!==s&&!1!==n&&(this.DDM.refreshCache(this.groups),n=new YAHOO.util.Point(r.getPageX(e),r.getPageY(e)),(this.hasOuterHandles||this.DDM.isOverTarget(n,this))&&this.clickValidator(e)&&(this.setStartPosition(),this.DDM.handleMouseDown(e,this),this.DDM.stopEvent(e))))},clickValidator:function(e){e=YAHOO.util.Event.getTarget(e);return this.isValidHandleChild(e)&&(this.id==this.handleElId||this.DDM.handleWasClicked(e,this.id))},getTargetCoord:function(e,t){e-=this.deltaX,t-=this.deltaY;return this.constrainX&&(e<this.minX&&(e=this.minX),e>this.maxX&&(e=this.maxX)),this.constrainY&&(t<this.minY&&(t=this.minY),t>this.maxY&&(t=this.maxY)),{x:e=this.getTick(e,this.xTicks),y:t=this.getTick(t,this.yTicks)}},addInvalidHandleType:function(e){e=e.toUpperCase();this.invalidHandleTypes[e]=e},addInvalidHandleId:function(e){"string"!=typeof e&&(e=n.generateId(e)),this.invalidHandleIds[e]=e},addInvalidHandleClass:function(e){this.invalidHandleClasses.push(e)},removeInvalidHandleType:function(e){e=e.toUpperCase();delete this.invalidHandleTypes[e]},removeInvalidHandleId:function(e){"string"!=typeof e&&(e=n.generateId(e)),delete this.invalidHandleIds[e]},removeInvalidHandleClass:function(e){for(var t=0,i=this.invalidHandleClasses.length;t<i;++t)this.invalidHandleClasses[t]==e&&delete this.invalidHandleClasses[t]},isValidHandleChild:function(t){var i,e=!0;try{i=t.nodeName.toUpperCase()}catch(e){i=t.nodeName}e=(e=e&&!this.invalidHandleTypes[i])&&!this.invalidHandleIds[t.id];for(var s=0,o=this.invalidHandleClasses.length;e&&s<o;++s)e=!n.hasClass(t,this.invalidHandleClasses[s]);return e},setXTicks:function(e,t){this.xTicks=[],this.xTickSize=t;for(var i={},s=this.initPageX;s>=this.minX;s-=t)i[s]||(i[this.xTicks[this.xTicks.length]=s]=!0);for(s=this.initPageX;s<=this.maxX;s+=t)i[s]||(i[this.xTicks[this.xTicks.length]=s]=!0);this.xTicks.sort(this.DDM.numericSort)},setYTicks:function(e,t){this.yTicks=[],this.yTickSize=t;for(var i={},s=this.initPageY;s>=this.minY;s-=t)i[s]||(i[this.yTicks[this.yTicks.length]=s]=!0);for(s=this.initPageY;s<=this.maxY;s+=t)i[s]||(i[this.yTicks[this.yTicks.length]=s]=!0);this.yTicks.sort(this.DDM.numericSort)},setXConstraint:function(e,t,i){this.leftConstraint=parseInt(e,10),this.rightConstraint=parseInt(t,10),this.minX=this.initPageX-this.leftConstraint,this.maxX=this.initPageX+this.rightConstraint,i&&this.setXTicks(this.initPageX,i),this.constrainX=!0},clearConstraints:function(){this.constrainX=!1,this.constrainY=!1,this.clearTicks()},clearTicks:function(){this.xTicks=null,this.yTicks=null,this.xTickSize=0,this.yTickSize=0},setYConstraint:function(e,t,i){this.topConstraint=parseInt(e,10),this.bottomConstraint=parseInt(t,10),this.minY=this.initPageY-this.topConstraint,this.maxY=this.initPageY+this.bottomConstraint,i&&this.setYTicks(this.initPageY,i),this.constrainY=!0},resetConstraints:function(){var e,t;this.initPageX||0===this.initPageX?(e=this.maintainOffset?this.lastPageX-this.initPageX:0,t=this.maintainOffset?this.lastPageY-this.initPageY:0,this.setInitPosition(e,t)):this.setInitPosition(),this.constrainX&&this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize),this.constrainY&&this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize)},getTick:function(e,t){if(t){if(t[0]>=e)return t[0];for(var i=0,s=t.length;i<s;++i){var o=i+1;if(t[o]&&t[o]>=e)return e-t[i]<t[o]-e?t[i]:t[o]}return t[t.length-1]}return e},toString:function(){return"DragDrop "+this.id}},YAHOO.augment(YAHOO.util.DragDrop,YAHOO.util.EventProvider)}(),YAHOO.util.DD=function(e,t,i){e&&this.init(e,t,i)},YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:!0,autoOffset:function(e,t){e-=this.startPageX,t
1-=this.startPageY;this.setDelta(e,t)},setDelta:function(e,t){this.deltaX=e,this.deltaY=t},setDragElPos:function(e,t){var i=this.getDragEl();this.alignElWithMouse(i,e,t)},alignElWithMouse:function(e,t,i){var s=this.getTargetCoord(t,i);this.deltaSetXY?(YAHOO.util.Dom.setStyle(e,"left",s.x+this.deltaSetXY[0]+"px"),YAHOO.util.Dom.setStyle(e,"top",s.y+this.deltaSetXY[1]+"px")):(t=[s.x,s.y],YAHOO.util.Dom.setXY(e,t),i=parseInt(YAHOO.util.Dom.getStyle(e,"left"),10),t=parseInt(YAHOO.util.Dom.getStyle(e,"top"),10),this.deltaSetXY=[i-s.x,t-s.y]),this.cachePosition(s.x,s.y);var o=this;setTimeout(function(){o.autoScroll.call(o,s.x,s.y,e.offsetHeight,e.offsetWidth)},0)},cachePosition:function(e,t){e?(this.lastPageX=e,this.lastPageY=t):(t=YAHOO.util.Dom.getXY(this.getEl()),this.lastPageX=t[0],this.lastPageY=t[1])},autoScroll:function(e,t,i,s){var o,n,r,a,l,h,u;this.scroll&&(o=this.DDM.getClientHeight(),n=this.DDM.getClientWidth(),r=this.DDM.getScrollTop(),a=this.DDM.getScrollLeft(),l=i+t,h=s+e,u=o+r-t-this.deltaY,i=n+a-e-this.deltaX,s=document.all?80:30,o<l&&u<40&&window.scrollTo(a,r+s),t<r&&0<r&&t-r<40&&window.scrollTo(a,r-s),n<h&&i<40&&window.scrollTo(a+s,r),e<a&&0<a&&e-a<40&&window.scrollTo(a-s,r))},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this),this.scroll=!1!==this.config.scroll},b4MouseDown:function(e){this.setStartPosition(),this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e))},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e))},toString:function(){return"DD "+this.id}}),YAHOO.util.DDProxy=function(e,t,i){e&&(this.init(e,t,i),this.initFrame())},YAHOO.util.DDProxy.dragElId="ygddfdiv",YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:!0,centerFrame:!1,createFrame:function(){var e,t,i,s=this,o=document.body;o&&o.firstChild?(e=this.getDragEl(),t=YAHOO.util.Dom,e||((e=document.createElement("div")).id=this.dragElId,(i=e.style).position="absolute",i.visibility="hidden",i.cursor="move",i.border="2px solid #aaa",i.zIndex=999,i.height="25px",i.width="25px",i=document.createElement("div"),t.setStyle(i,"height","100%"),t.setStyle(i,"width","100%"),t.setStyle(i,"background-color","#ccc"),t.setStyle(i,"opacity","0"),e.appendChild(i),o.insertBefore(e,o.firstChild))):setTimeout(function(){s.createFrame()},50)},initFrame:function(){this.createFrame()},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this),this.resizeFrame=!1!==this.config.resizeFrame,this.centerFrame=this.config.centerFrame,this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId)},showFrame:function(e,t){this.getEl();var i=this.getDragEl(),s=i.style;this._resizeProxy(),this.centerFrame&&this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2)),this.setDragElPos(e,t),YAHOO.util.Dom.setStyle(i,"visibility","visible")},_resizeProxy:function(){var e,t,i,s,o,n,r;this.resizeFrame&&(e=YAHOO.util.Dom,t=this.getEl(),i=this.getDragEl(),s=parseInt(e.getStyle(i,"borderTopWidth"),10),o=parseInt(e.getStyle(i,"borderRightWidth"),10),r=parseInt(e.getStyle(i,"borderBottomWidth"),10),n=parseInt(e.getStyle(i,"borderLeftWidth"),10),isNaN(s)&&(s=0),isNaN(o)&&(o=0),isNaN(r)&&(r=0),isNaN(n)&&(n=0),n=Math.max(0,t.offsetWidth-o-n),r=Math.max(0,t.offsetHeight-s-r),e.setStyle(i,"width",n+"px"),e.setStyle(i,"height",r+"px"))},b4MouseDown:function(e){this.setStartPosition();var t=YAHOO.util.Event.getPageX(e),e=YAHOO.util.Event.getPageY(e);this.autoOffset(t,e)},b4StartDrag:function(e,t){this.showFrame(e,t)},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden")},endDrag:function(e){var t=YAHOO.util.Dom,i=this.getEl(),s=this.getDragEl();t.setStyle(s,"visibility",""),t.setStyle(i,"visibility","hidden"),YAHOO.util.DDM.moveToEl(i,s),t.setStyle(s,"visibility","hidden"),t.setStyle(i,"visibility","")},toString:function(){return"DDProxy "+this.id}}),YAHOO.util.DDTarget=function(e,t,i){e&&this.initTarget(e,t,i)},YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return"DDTarget "+this.id}}),YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.8.1",build:"19"}),function(){function e(e,t,i,s){this.init(e,t,i,s)}var a=YAHOO.util;e.NAME="Anim",e.prototype={toString:function(){var e=this.getEl()||{},e=e.id||e.tagName;return this.constructor.NAME+": "+e},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(e,t,i){return this.method(this.currentFrame,t,i-t,this.totalFrames)},setAttribute:function(e,t,i){var s=this.getEl();this.patterns.noNegatives.test(e)&&(t=0<t?t:0),e in s&&!("style"in s&&e in s.style)?s[e]=t:a.Dom.setStyle(s,e,t+i)},getAttribute:function(e){var t=this.getEl(),i=a.Dom.getStyle(t,e);if("auto"!==i&&!this.patterns.offsetUnit.test(i))return parseFloat(i);var s=this.patterns.offsetAttribute.exec(e)||[],o=!!s[3],n=!!s[2];return"style"in t?i=n||"absolute"==a.Dom.getStyle(t,"position")&&o?t["offset"+s[0].charAt(0).toUpperCase()+s[0].substr(1)]:0:e in t&&(i=t[e]),i},getDefaultUnit:function(e){return this.patterns.defaultUnit.test(e)?"px":""},setRuntimeAttribute:function(e){var t,i,s=this.attributes;this.runtimeAttributes[e]={};function o(e){return void 0!==e}if(!o(s[e].to)&&!o(s[e].by))return!1;if(t=o(s[e].from)?s[e].from:this.getAttribute(e),o(s[e].to))i=s[e].to;else if(o(s[e].by))if(t.constructor==Array){i=[];for(var n=0,r=t.length;n<r;++n)i[n]=t[n]+ +s[e].by[n]}else i=t+ +s[e].by;return this.runtimeAttributes[e].start=t,this.runtimeAttributes[e].end=i,this.runtimeAttributes[e].unit=o(s[e].unit)?s[e].unit:this.getDefaultUnit(e),!0}
1,init:function(t,e,i,s){var o=!1,n=null,r=0;t=a.Dom.get(t),this.attributes=e||{},this.duration=YAHOO.lang.isUndefined(i)?1:i,this.method=s||a.Easing.easeNone,this.useSeconds=!0,this.currentFrame=0,this.totalFrames=a.AnimMgr.fps,this.setEl=function(e){t=a.Dom.get(e)},this.getEl=function(){return t},this.isAnimated=function(){return o},this.getStartTime=function(){return n},this.runtimeAttributes={},this.animate=function(){return!this.isAnimated()&&(this.currentFrame=0,this.totalFrames=this.useSeconds?Math.ceil(a.AnimMgr.fps*this.duration):this.duration,0===this.duration&&this.useSeconds&&(this.totalFrames=1),a.AnimMgr.registerElement(this),!0)},this.stop=function(e){if(!this.isAnimated())return!1;e&&(this.currentFrame=this.totalFrames,this._onTween.fire()),a.AnimMgr.stop(this)};this._onStart=new a.CustomEvent("_start",this,!0),this.onStart=new a.CustomEvent("start",this),this.onTween=new a.CustomEvent("tween",this),this._onTween=new a.CustomEvent("_tween",this,!0),this.onComplete=new a.CustomEvent("complete",this),this._onComplete=new a.CustomEvent("_complete",this,!0),this._onStart.subscribe(function(){for(var e in this.onStart.fire(),this.runtimeAttributes={},this.attributes)this.setRuntimeAttribute(e);o=!0,r=0,n=new Date}),this._onTween.subscribe(function(){var e={duration:new Date-this.getStartTime(),currentFrame:this.currentFrame,toString:function(){return"duration: "+e.duration+", currentFrame: "+e.currentFrame}};this.onTween.fire(e);var t,i=this.runtimeAttributes;for(t in i)this.setAttribute(t,this.doMethod(t,i[t].start,i[t].end),i[t].unit);r+=1}),this._onComplete.subscribe(function(){var e=(new Date-n)/1e3,t={duration:e,frames:r,fps:r/e,toString:function(){return"duration: "+t.duration+", frames: "+t.frames+", fps: "+t.fps}};o=!1,r=0,this.onComplete.fire(t)})}},a.Anim=e}(),YAHOO.util.AnimMgr=new function(){var s=null,o=[],n=0;this.fps=1e3,this.delay=1,this.registerElement=function(e){o[o.length]=e,n+=1,e._onStart.fire(),this.start()},this.unRegister=function(e,t){return t=t||i(e),!(!e.isAnimated()||-1===t)&&(e._onComplete.fire(),o.splice(t,1),--n<=0&&this.stop(),!0)},this.start=function(){null===s&&(s=setInterval(this.run,this.delay))},this.stop=function(e){if(e)this.unRegister(e);else{clearInterval(s);for(var t=0,i=o.length;t<i;++t)this.unRegister(o[0],0);o=[],s=null,n=0}},this.run=function(){for(var e=0,t=o.length;e<t;++e){var i=o[e];i&&i.isAnimated()&&(i.currentFrame<i.totalFrames||null===i.totalFrames?(i.currentFrame+=1,i.useSeconds&&r(i),i._onTween.fire()):YAHOO.util.AnimMgr.stop(i,e))}};var i=function(e){for(var t=0,i=o.length;t<i;++t)if(o[t]===e)return t;return-1},r=function(e){var t=e.totalFrames,i=e.currentFrame,s=e.currentFrame*e.duration*1e3/e.totalFrames,o=new Date-e.getStartTime(),n=0;0<(n=o<1e3*e.duration?Math.round((o/s-1)*e.currentFrame):t-(i+1))&&isFinite(n)&&(e.currentFrame+n>=t&&(n=t-(i+1)),e.currentFrame+=n)};this._queue=o,this._getIndex=i},YAHOO.util.Bezier=new function(){this.getPosition=function(e,t){for(var i=e.length,s=[],o=0;o<i;++o)s[o]=[e[o][0],e[o][1]];for(var n=1;n<i;++n)for(o=0;o<i-n;++o)s[o][0]=(1-t)*s[o][0]+t*s[parseInt(o+1,10)][0],s[o][1]=(1-t)*s[o][1]+t*s[parseInt(o+1,10)][1];return[s[0][0],s[0][1]]}},function(){var o=function(e,t,i,s){o.superclass.constructor.call(this,e,t,i,s)};o.NAME="ColorAnim",o.DEFAULT_BGCOLOR="#fff";var n=YAHOO.util;YAHOO.extend(o,n.Anim);var r=o.superclass,e=o.prototype;e.patterns.color=/color$/i,e.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,e.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,e.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i,e.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/,e.parseColor=function(e){if(3==e.length)return e;var t=this.patterns.hex.exec(e);return t&&4==t.length?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:(t=this.patterns.rgb.exec(e))&&4==t.length?[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]:(t=this.patterns.hex3.exec(e))&&4==t.length?[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]:null},e.getAttribute=function(e){var t,i,s=this.getEl();return this.patterns.color.test(e)?(i=YAHOO.util.Dom.getStyle(s,e),(t=this).patterns.transparent.test(i)&&(s=YAHOO.util.Dom.getAncestorBy(s,function(e){return!t.patterns.transparent.test(i)}),i=s?n.Dom.getStyle(s,e):o.DEFAULT_BGCOLOR)):i=r.getAttribute.call(this,e),i},e.doMethod=function(e,t,i){var s;if(this.patterns.color.test(e)){s=[];for(var o=0,n=t.length;o<n;++o)s[o]=r.doMethod.call(this,e,t[o],i[o]);s="rgb("+Math.floor(s[0])+","+Math.floor(s[1])+","+Math.floor(s[2])+")"}else s=r.doMethod.call(this,e,t,i);return s},e.setRuntimeAttribute=function(e){if(r.setRuntimeAttribute.call(this,e),this.patterns.color.test(e)){var t=this.attributes,i=this.parseColor(this.runtimeAttributes[e].start),s=this.parseColor(this.runtimeAttributes[e].end);if(void 0===t[e].to&&void 0!==t[e].by){s=this.parseColor(t[e].by);for(var o=0,n=i.length;o<n;++o)s[o]=i[o]+s[o]}this.runtimeAttributes[e].start=i,this.runtimeAttributes[e].end=s}},n.ColorAnim=o}(),YAHOO.util.Easing={easeNone:function(e,t,i,s){return i*e/s+t},easeIn:function(e,t,i,s){return i*(e/=s)*e+t},easeOut:function(e,t,i,s){return-i*(e/=s)*(e-2)+t},easeBoth:function(e,t,i,s){return(e/=s/2)<1?i/2*e*e+t:-i/2*(--e*(e-2)-1)+t},easeInStrong:function(e,t,i,s){return i*(e/=s)*e*e*e+t},easeOutStrong:function(e,t,i,s){return-i*((e=e/s-1)*e*e*e-1)+t},easeBothStrong:function(e,t,i,s){return(e/=s/2)<1?i/2*e*e*e*e+t:-i/2*((e-=2)*e*e*e-2)+t},elasticIn:function(e,t,i,s,o,n){return 0==e?t:1==(e/=s)?t+i:(n=n||.3*s,i=!o||o<Math.abs(i)?(o=i,n/4):n/(2*Math.PI)*Math.asin(i/o),-(o*Math.pow(2,10*--e)*Math.sin((e*s-i)*(2*Math.PI)/n))+t)},elasticOut:function(e,t,i,s,o,n){return 0==e?t:1==(e/=s)?t+i:(n=n||.3*s,r=!o||o<Math.abs(i)?(o=i,n/4):n/(2*Math.PI)*Math.asin(i/o),o*Math.pow(2,-10*e)*Math.sin((e*s-r)*(2*Math.PI)/n)+i+t);var r},elasticBoth:function(e,t,i,s,o,n){return 0==e?t:2==(e/=s/2)?t+i:(n=n||s*(.3*1.5),r=!o||o<Math.abs(i)?(o=i,n/4):n/(2*Math.PI)*Math.asin(i/o),e<1?o*Math.pow(2,10*--e)*Math.sin((e*s-r)*(2*Math.PI)/n)*-.5+t:o*Math.pow(2,-10*--e)*Math.sin((e*s-r)*(2*Math.PI)/n)*.5+i+t);var r},backIn:function(e,t,i,s,o){return void 0===o&&(o=1.70158),i*(e/=s)*e*((o+1)*e-o)+t},backOut:function(e,t,i,s,o){return void 0===o&&(o=1.70158),i*((e=e/s-1)*e*((o+1)*e+o)+1)+t},backBoth:function(e,t,i,s,o){return void 0===o&&(o=1.70158),(e/=s/2)<1?i/2*(e*e*((1+(o*=1.525))*e-o))+t:i/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t},bounceIn:function(e,t,i,s){return i-YAHOO.util.Easing.bounceOut(s-e,0,i,s)+t},bounceOut:function(e,t,i,s){return(e/=s)<1/2.75?i*(7.5625*e*e)+t:e<2/2.75?i*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?i*(7.5625*(e-=2.25/2.75)*e+.9375)+t:i*(7.5625*(e-=2.625/2.75)*e+.984375)+t},bounceBoth:function(e,t,i,s){return e<s/2?.5*YAHOO.util.Easing.bounceIn(2*e,0,i,s)+t:.5*YAHOO.util.Easing.bounceOut(2*e-s,0,i,s)+.5*i+t}},function(){var o=function(e,t,i,s){e&&o.superclass.constructor.call(this,e,t,i,s)};o.NAME="Motion";var h=YAHOO.util;YAHOO.extend(o,h.ColorAnim);var u=o.superclass,e=o.prototype;e.patterns.points=/^points$/i,e.setAttribute=function(e,t,i){this.patterns.points.test(e)?(i=i||"px",u.setAttribute.call(this,"left",t[0],i),u.setAttribute.call(this,"top",t[1],i)):u.setAttribute.call(this,e,t,i)},e.getAttribute=function(e){e=this.patterns.points.test(e)?[u.getAttribute.call(this,"left"),u.getAttribute.call(this,"top")]:u.getAttribute.call(this,e);return e},e.doMethod=function(e,t,i){var s;return this.patterns.points.test(e)?(s=this.method(this.currentFrame,0,100,this.totalFrames)/100,h.Bezier.getPosition(this.runtimeAttributes[e],s)):u.doMethod.call(this,e,t,i)},e.setRuntimeAttribute=function(e){if(this.patterns.points.test(e)){var t,i,s=this.getEl(),o=this.attributes,n=o.points.control||[];if(0<n.length&&!(n[0]instanceof Array))n=[n];else{for(var r=[],a=0,l=n.length;a<l;++a)r[a]=n[a];n=r}if("static"==h.Dom.getStyle(s,"position")&&h.Dom.setStyle(s,"position","relative"),d(o.points.from)?h.Dom.setXY(s,o.points.from):h.Dom.setXY(s,h.Dom.getXY(s)),t=this.getAttribute("points"),d(o.points.to)){i=c.call(this,o.points.to,t);h.Dom.getXY(this.getEl());for(a=0,l=n.length;a<l;++a)n[a]=c.call(this,n[a],t)}else if(d(o.points.by))for(i=[t[0]+o.points.by[0],t[1]+o.points.by[1]],a=0,l=n.length;a<l;++a)n[a]=[t[0]+n[a][0],t[1]+n[a][1]];this.runtimeAttributes[e]=[t],0<n.length&&(this.runtimeAttributes[e]=this.runtimeAttributes[e].concat(n)),this.runtimeAttributes[e][this.runtimeAttributes[e].length]=i}else u.setRuntimeAttribute.call(this,e)};var c=function(e,t){var i=h.Dom.getXY(this.getEl());return e=[e[0]-i[0]+t[0],e[1]-i[1]+t[1]]},d=function(e){return void 0!==e};h.Motion=o}(),function(){var o=function(e,t,i,s){e&&o.superclass.constructor.call(this,e,t,i,s)};o.NAME="Scroll";var e=YAHOO.util;YAHOO.extend(o,e.ColorAnim);var n=o.superclass,t=o.prototype;t.doMethod=function(e,t,i){return"scroll"==e?[this.method(this.currentFrame,t[0],i[0]-t[0],this.totalFrames),this.method(this.currentFrame,t[1],i[1]-t[1],this.totalFrames)]:n.doMethod.call(this,e,t,i)},t.getAttribute=function(e){var t=this.getEl();return"scroll"==e?[t.scrollLeft,t.scrollTop]:n.getAttribute.call(this,e)},t.setAttribute=function(e,t,i){var s=this.getEl();"scroll"==e?(s.scrollLeft=t[0],s.scrollTop=t[1]):n.setAttribute.call(this,e,t,i)},e.Scroll=o}(),YAHOO.register("animation",YAHOO.util.Anim,{version:"2.8.1",build:"19"});var SITE_VERSION=1,clog=!1;ProblemUI=function(e,t){this.board=e,this.board.addUpdatePieceListener(this),this.board.addBackMovePreCurrentListener(this),this.board.addForwardMovePostUpdateListener(this),this.tactics=t,this.userId=0,this.problemId=-1,t&&(t.problem=this),this.comments=new CommentUI("problemComments",e,CommentUI.PROBLEM_COMMENT)},ProblemUI.prototype.handleTacticPieceUpdate=function(e,t,i,s,o,n,r,a,l,h,u,c){if(!u||u.atEnd)return this.board_xy=null,t.setPosition(t.column,t.row,!1,null,this.board.moveAnimationLength),!1;var d=u,m=!1,u=Board.getVarMove(d,s,i,t,e);d.fromColumn!=t.column||d.fromRow!=t.row||d.toRow!=s||d.toColumn!=i||""!=e&&e!=d.promotion?u&&1==u.mateInMoves?(d=u,m=!0):d=u||c:m=!0;c=new Object;return c.allowMove=m,c.move=d,c},ProblemUI.prototype.handleEndgamePieceUpdate=function(e,t,i,s,o,n,r,a,l,h,u,c){if(!this.board.canMove(t.makeLightWeight(),i,s,h,!0))return this.board.board_xy=null,t.setPosition(t.column,t.row,!1,null,this.board.moveAnimationLength),clog&&console.log("move not legal , move back to orig"),!1;clog&&console.log("move is legal");h=Move.columnToChar(t.column)+""+(t.row+1)+Move.columnToChar(i)+(s+1)+e,e=this.board.createMoveFromString(h);return clog&&console.log("creating pending move:"+e.output()),this.endgamePendingPiece=t,this.endgameOldPosition=[t.column,t.row],this.endgamePendingMove=e,this.board.currentMove&&null!=this.board.currentMove.next&&this.board.currentMove.bestMoves&&l?(h=this.board.currentMove,this.board.makeMove(h,t,n,this.board.moveAnimationLength,!0,!0),this.board.setCurrentMove(this.board.currentMove.next),this.board.currentMove):(this.board.currentMove&&clog&&console.log("in endgame updatepiece calling processEndgame currentMove:"+this.board.currentMove.output()+" fens:"+this.board.currentMove.fen),l||(clog&&console.log("col:"+i+" row:"+s),t.setPosition(i,s,!1,null,this.board.moveAnimationLength,null,!1)),this.tactics&&0==this.tactics.problemFirstMoveDate&&(this.tactics.problemFirstMoveDate=(new Date).getTime()),this.processEndgame(h,l)),!1},ProblemUI.prototype.forwardMovePostUpdateCallback=function(e){var t,i,s=this.board.currentMove;s&&(t=!1,s.bestMoves&&(0<s.bestMoves.length?"draw"!=(i=s.bestMoves[0]).score&&0==i.score&&(clog&&console.log("move is mate"),t=!0):t=!0),t&&s.endNode?this.clearBestMoves():this.showBestMoves(s,s.bestMoves,s.correctMove,s.wrongMove))},ProblemUI.prototype.backMovePreCurrentCallback=function(e){var t;this.isEndgame&&(this.board.currentMove?this.board.currentMove.bestMoves&&(t=this.board.currentMove,this.showBestMoves(t,t.bestMoves,t.correctMove,t.wrongMove)):this.initialBestMoves&&this.showBestMoves(this.board.currentMove,this.initialBestMoves,null,null))},ProblemUI.prototype.updatePieceCallback=function(e,t,i,s,o,n,r,a,l,h,u,c){return this.isEndgame?this.handleEndgamePieceUpdate(e,t,i,s,o,n,r,a,l,h,u,c):this.handleTacticPieceUpdate(e,t,i,s,o,n,r,a,l,h,u,c)},ProblemUI.prototype.initLoadingOverlay=function(){},ProblemUI.prototype.abandonProblem=function(isEndgame){var randString=(new Date).getTime()+"-"+parseInt(99999*Math.random());YAHOO.util.Dom.setStyle("busyDiv","visibility","visible"),YAHOO.util.Connect.asyncRequest("POST","/requests/mark_problem.php?rs="+randString,{success:function(o){YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden");var root=eval("("+o.responseText+")")},failure:function(e){YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden"),YAHOO.log("Failed:"+e.statusText)},scope:this},"abandon=1&isEndgame="+(isEndgame?"1":"0"))},ProblemUI.prototype.resumeProblem=function(){this.getProblem(-1,null,!0)},ProblemUI.prototype.dec_cry=function(e){for(var t,i=e.length,s=23,o=0,n=new Array,r=0;r<i;r++)"P"==e.charAt(r)&&(t=e.substring(o,r),t=parseInt(t)-s,n.push(""+String.fromCharCode(t)),s+=15,o=r+1);return n.join("")},ProblemUI.prototype.processTacticData=function(e){var t=e.moves,i=e.prev_move,s=this.board.createMoveFromString(i);this.prev_move_str=i;var o=e.fullmoves;"P"!=t.charAt(1)&&"P"!=t.charAt(2)&&"P"!=t.charAt(3)||(t=this.alk(t)),"NA"!=o&&(o=this.alk(o));i=e.position;this.startPosition=e.startPos,this.board.originalFen=i,this.board.setupFromFen(i,!0,!1,!1),this.board.halfMoveNumber=0,this.board.moveNumber=0,this.board.toMove==ChessPiece.BLACK&&(this.board.moveNumber=1),this.board.startFen=this.board.boardToFen(!0),this.board.prev_move=s,this.board.setMoveSequence(t,o,1,"*"),this.board.setCurrentMove(this.board.moveArray[0])},ProblemUI.prototype.getProblemProcessResponse=function(e){this.root=e,this.board.blockForwardBack=!1,this.board.deferredBlockForwardBack=!1,this.board.pendingMovesOutput=null,this.board.tlf=0,this.board.currentMove=null,this.board.moveIndex=0;var t=e.errorResult;
1if(e.isEndgame&&"0"!=e.isEndgame?e.isEndgame=!0:e.isEndgame=!1,t){var i=parseInt(t),s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Error"),n=_js("Error creating problem set:")+"<br/>",r=[{text:_js("Ok"),handler:function(){d.hide()},isDefault:!0}];switch(i){case 1:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Empty Problem Set"),n=_js("Problem set is empty.<br/>Choose a different problem set."),(a=YAHOO.util.Dom.get("num_problems"))&&(a.innerHTML="("+_js("0 in current set")+")");break;case 2:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Unknown Selection Type"),n=_js("Problem set has an unsupported selection method.")+"<br/>";break;case 3:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Daily Limit Reached"),0==e.member_type?(n=__js("After 10 initial endgame problems, basic members can only do {MAX_ALLOWED} endgame problems per day.",[["MAX_ALLOWED",e.max_allowed]])+"<br/>",n+=_js('Please <a href="/memberships.html">upgrade your membership</a> to access more problems.')+"<br/>"):1==e.member_type&&(n=__js("Silver members have a limit of {MAX_ALLOWED} endgame problems per day.",[["MAX_ALLOWED",e.max_allowed]])+"<br/>");break;case 4:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Session Expired"),n=_js("Your session has expired. Please reload page.")+"<br/>";break;case 5:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Can't Access Endgames."),n=_js("You must be logged in to view endgame problems.")+"<br/>";break;case 7:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Error processing endgame"),n=_js("A server error occurred processing this endgame.")+"<br/>";var a=YAHOO.util.Dom.get("num_problems");break;case 8:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Multiple Problem Viewing/Solving Attempted"),n=_js("When an unsolved problem is still live, you are not<br/> able to solve or view other problems. Please complete your live problem first or click 'Abandon Problem' to throw away the old problem")+"<br/>";var l=this,h=parseInt(e.problemType),u=e.allowResume,c=e.isEndgame,r=0!=h&&u?[{text:_js("Resume Problem"),handler:function(){d.hide(),l.resumeProblem()},isDefault:!1},{text:_js("Abandon Problem"),handler:function(){d.hide(),l.abandonProblem(c)},isDefault:!1},{text:_js("Ok"),handler:function(){d.hide()},isDefault:!0}]:[{text:_js("Abandon Problem"),handler:function(){d.hide(),l.abandonProblem(c)},isDefault:!1},{text:_js("Cancel"),handler:function(){d.hide()},isDefault:!0}];break;case 9:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("End of Sorted Set"),n=_js("You have reached the end of a sorted problem set.<br/>If there are problems still left in the set, clicking next problem will return you to the start of the sorted set."),(a=YAHOO.util.Dom.get("num_problems"))&&(a.innerHTML="("+_js("0 in current set")+")");break;case 11:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("No problems scheduled for solving"),n=__js("You are using a spaced repetition set that has no more problems currently scheduled for solving.<br/> Next available problem scheduled at {SCHEDULED_DATE}.",[["SCHEDULED_DATE",e.scheduled_date]]);break;case 12:s=YAHOO.widget.SimpleDialog.ICON_ERROR,o=_js("Mixed mode with Old Solving UI"),n=_js('The old solving UI does not support solving problems in mixed winning/non-winning rating mode. Please use the <a href="/chess-tactics.html">new solving UI</a>.')}var d=new YAHOO.widget.SimpleDialog("problemResponseDialog",{fixedcenter:!0,visible:!0,draggable:!1,icon:s,constraintoviewport:!0,buttons:r});return d.setHeader(o),d.setBody("<span>"+n+"</span>"),d.render(document.body),this.tactics&&YAHOO.util.Event.addListener("nextProblem","click",this.tactics.nextProblem,this.tactics,!0),void YAHOO.util.Dom.setStyle("nextProblem","cursor","pointer")}t=e.position;this.startPosition=e.startPos;i=YAHOO.util.Dom.get("goProblemError");if(null!=t){if(null!=i&&(i.innerHTML=""),e.isEndgame){YAHOO.util.Dom.setStyle("playStopSpan","display","none");var m=this.board.movesDisplay.getMovesDisplay();m&&(m.innerHTML=""),this.board.moveIndex=-1,this.board.moveArray=new Array,this.board.currentMove=null,this.board.movesDisplay.firstNonMove=!1,this.isEndgame=!0,this.board.movesDisplay.displayType=MovesDisplay.DEFAULT_DISPLAY_TYPE,this.board.movesDisplay.variationOnOwnLine=!1,this.board.originalFen=t,this.board.setupFromFen(t,!0,!1,!1),this.board.halfMoveNumber=0,this.board.moveNumber=0,this.board.toMove==ChessPiece.BLACK&&(this.board.moveNumber=1),this.board.startFen=this.board.boardToFen(!0),this.board.toMove==ChessPiece.WHITE?this.playerColour=ChessPiece.BLACK:this.playerColour=ChessPiece.WHITE,this.board.startPositionAfterOpponentMove=e.startPosition,this.initialBestMoves=e.best_moves,e.best_moves&&(this.fastestMate=e.best_moves[0].score);var p=e.prev_move,m=this.board.createMoveFromString(p);if(this.prev_move_str=p,this.board.prev_move=m,e.played_moves){for(var g=e.played_moves.replace(/\s+$/g,"").split(" "),v=null,f=0;f<g.length;f++){var b=this.board.createMoveFromString(g[f]);this.board.insertMoveAfter(v,b);var y=this.boardPieces[move.fromColumn][move.fromRow];this.board.makeMove(b,y,!1,0,!1,!1,null,null),v=b}this.board.gotoMoveIndex(1)}else e.best_moves&&(S=e.best_moves[0].move,(C=this.board.createMoveFromString(S)).eg_move=e.best_moves[0],C.eg_move.optimal_score=e.best_moves[0].score,C.SAN=e.best_moves[0].sanmove,D=this.tactics,this.board.insertMoveAfter(null,C,!1,D,D),C.fen=e.startPosition,C.nextFen=e.best_moves[0].fen,C.eg_move.optimal_score=e.best_moves[0].score,this.board.setCurrentMove(C),A="draw"!=e.best_moves[0].score&&0==e.best_moves[0].score,C.atEnd=0,C.next.atEnd=A,C.bestMoves=e.best_moves,C.next.bestMoves=e.next_moves,this.showBestMoves(this.board.currentMove,e.best_moves,null,null))}else YAHOO.util.Dom.setStyle("playStopSpan","display","inline"),this.board.movesDisplay.displayType=MovesDisplay.MAIN_ON_OWN_LINE,this.board.movesDisplay.variationOnOwnLine=!0,this.processTacticData(e),this.tactics||this.board.displayPendingMoveList();var O=e.category_tags,_="";if(0<O.length)for(_=_js(O[0]),f=1;f<O.length;f++)_+=", "+_js(O[f]);var C,A,t=e.problem_id,p=e.problem_rnum,m=(e.ratings,e.active,e.replaced_with,e.replaces),S=e.source_game;rating.reset_stars(),rating.defaultAverage=parseFloat(e.quality),rating.set_average(rating.defaultAverage),rating.clear_notify(),rating.problem_id=t,0==this.userId&&(rating.enabled=!1),this.setCategory(_),(D=YAHOO.util.Dom.get("computer"))&&YAHOO.util.Dom.setStyle(D,"visibility","hidden"),this.comments.initCommentDisplay(),this.tactics?(this.tactics.blitzingProblem=!1,this.tactics.opponentSeconds=0,this.tactics.blitzAllowedSeconds=0,this.tactics.aCount=0,this.tactics.problemSet=parseInt(e.problemSet),this.tactics.currentProblemSet=parseInt(e.problemSet),this.tactics.problemSetName=e.problemSetName,this.tactics.problemActive=!0,this.tactics.tacticMarked=!1,YAHOO.util.Dom.get("showSolution")&&(YAHOO.util.Dom.setStyle("showSolution","display","none"),YAHOO.util.Dom.setStyle("hideSolution","display","none")),this.hideDetails(),this.tactics.problemSet<2?this.tactics.processActiveProblemSetDetails(e.ratings):(YAHOO.util.Dom.setStyle("ratedDetail
1sDisplay","display","none"),YAHOO.util.Dom.setStyle("unratedDetailsDisplay","display","none"),this.setProblemDetails(e.ratings,!1)),A="",e.isEndgame&&(A="Endgame"),(C=YAHOO.util.Dom.get(A+"ProblemSetTreeValue"))&&(C.value=this.tactics.problemSet),(A=YAHOO.util.Dom.get(A+"ProblemSetTreeName"))&&(A.innerHTML=_js(this.tactics.problemSetName))):(this.displayDetails(),YAHOO.util.Dom.setStyle("clock","display","none")),this.tactics&&(this.tactics.setLastProblemId(this.problemId),this.tactics.setProblemRnum(p)),this.setProblemId(t),this.setReplacesProblemId(m),this.setSourceGame(S),this.tactics||(this.showProblemId(),this.showSourceGame()),this.tactics&&(E=YAHOO.util.Dom.get("endSession"))&&(E.checked=!1),this.comments.clearComments();var S=parseInt(e.num_mistakes),E=parseInt(e.num_problems);(a=YAHOO.util.Dom.get("num_problems"))&&(E=__js("( {NUM_PROBLEMS} in set)",[["NUM_PROBLEMS",E]]),H="",4==parseInt(e.selection_type)&&(H="("+__js("Learning: {NUM_LEARNING}, Scheduled: {NUM_SCHEDULED}",[["NUM_LEARNING",parseInt(e.num_learning)],["NUM_SCHEDULED",parseInt(e.num_scheduled)]])+")"),a.innerHTML=E+H),this.comments.updateComments(e.num_comments,e.num_comments_all);var w,M,P,D,H=YAHOO.util.Dom.get("mistakes");H&&(H.innerHTML=""),0==S?(YAHOO.util.Dom.setStyle("mistakes","display","none"),YAHOO.util.Dom.setStyle("showMistakesButton","display","none"),YAHOO.util.Dom.setStyle("hideMistakesButton","display","none"),(w=YAHOO.util.Dom.get("numMistakes"))&&(w.innerHTML="")):(YAHOO.util.Dom.setStyle("mistakes","display","block"),YAHOO.util.Dom.setStyle("showMistakesButton","display","block"),YAHOO.util.Dom.setStyle("hideMistakesButton","display","none"),(w=YAHOO.util.Dom.get("numMistakes"))&&(P=__gt_expand (_jn("{NUMBER_MOVES} wrong move","{NUMBER_MOVES} wrong moves",S),[["NUMBER_MOVES",S]]),w.innerHTML=P+" ")),this.tactics&&(this.tactics.problemCompleteOverlay,YAHOO.util.Dom.setStyle("activeSessionInfo","display","block"),YAHOO.util.Dom.setStyle("endedSessionInfo","display","none"),loginManager.getSessionDetails()),this.board.start_move_lalg=this.board.makeShortAlgabraic(this.board.prev_move.fromColumn,this.board.prev_move.fromRow,this.board.prev_move.toColumn,this.board.prev_move.toRow),YAHOO.util.Dom.removeClass(this.board.lastFromSquare,"ct-from-square"),YAHOO.util.Dom.removeClass(this.board.lastToSquare,"ct-to-square"),this.tactics?(this.tactics.stopClock=!0,this.tactics.problemStartDate=(new Date).getTime(),this.tactics.updateTime(),this.tactics.stopClock=!1,0==this.tactics.problemSet?(M=this,P=YAHOO.util.Dom.get("waitingForOpponent"),this.board.toMove==ChessPiece.WHITE?(P.innerHTML=_js("Waiting for black's move"),YAHOO.util.Dom.setStyle(P,"color","black")):(P.innerHTML=_js("Waiting for white's move"),YAHOO.util.Dom.setStyle(P,"color","white")),YAHOO.util.Dom.setStyle(P,"display","inline"),this.board.dragDisabled=!0,setTimeout(function(){var e;M.board.makeMove(M.board.prev_move,M.board.boardPieces[M.board.prev_move.fromColumn][M.board.prev_move.fromRow],!0,1,!1,!0,function(){M.board.updateToPlay()},M),M.tactics.problemStartDate=(new Date).getTime(),M.tactics.problemFirstMoveDate=0,YAHOO.util.Event.addListener("nextProblem","click",M.tactics.nextProblem,M.tactics,!0),YAHOO.util.Dom.setStyle("nextProblem","cursor","pointer"),YAHOO.util.Dom.setStyle("waitingForOpponent","display","none"),M.board.dragDisabled=!1,M.board.scrollToBoardTop&&(e=YAHOO.util.Dom.getXY(M.board.boardName+"-boardBorder"),window.scrollTo(e[0],e[1])),M.tactics.updateTime()},5e3)):(this.board.makeMove(this.board.prev_move,this.board.boardPieces[this.board.prev_move.fromColumn][this.board.prev_move.fromRow],!0,1,!1,!0,function(){M.board.updateToPlay()},M),this.tactics.problemStartDate=(new Date).getTime(),this.tactics.problemFirstMoveDate=0,YAHOO.util.Dom.setStyle("waitingForOpponent","display","none"),this.board.dragDisabled=!1,M=this,setTimeout(function(){YAHOO.util.Event.addListener("nextProblem","click",M.tactics.nextProblem,M.tactics,!0),YAHOO.util.Dom.setStyle("nextProblem","cursor","pointer"),M.tactics.updateTime()},1e3))):this.board.makeMove(this.board.prev_move,this.board.boardPieces[this.board.prev_move.fromColumn][this.board.prev_move.fromRow],!0,1,!1,!0,function(){this.board.updateToPlay()},this),!this.tactics&&this.board.fullmoveArray&&(D=YAHOO.util.Dom.get("computer"),YAHOO.util.Dom.setStyle(D,"visibility","visible")),this.board.setForwardBack(),this.board.scrollToBoardTop&&(D=YAHOO.util.Dom.getXY(this.board.boardName+"-boardBorder"),window.scrollTo(D[0],D[1]))}else i.innerHTML=_js("Invalid Problem")},ProblemUI.prototype.hideDetails=function(){for(var e=0;e<10&&(YAHOO.util.Dom.setStyle("problemDetailsDisplay","display","none"),YAHOO.util.Dom.setStyle("problemDetailsDisplay","visibility","hidden"),this.isEndgame?YAHOO.util.Dom.setStyle("board-moves","display","block"):YAHOO.util.Dom.setStyle("board-moves","display","none"),YAHOO.util.Dom.setStyle("board-postition-moves","display","none"),YAHOO.util.Dom.setStyle("board-position-moves","visibility","hidden"),YAHOO.util.Dom.setStyle(this.board.boardName+"-nav-buttons-only","display","none"),"none"!=YAHOO.util.Dom.getStyle("problemDetailsDisplay","display"));)e++;this.comments.hideCommentsDisplay(),YAHOO.util.Dom.setStyle("tags","display","none"),YAHOO.util.Dom.setStyle("ratingdiv","display","none"),YAHOO.util.Dom.setStyle("mistakesContainer","display","none"),YAHOO.util.Dom.setStyle("showMistakesButton","display","block"),YAHOO.util.Dom.setStyle("hideMistakesButton","display","none"),YAHOO.util.Dom.get("showFen")&&YAHOO.util.Dom.setStyle("fenContainer","display","none")},ProblemUI.prototype.getG=function(){function e(e){e=b[e];!e||(e=e.enabledPlugin)&&(d[e.name]||(d[e.name]=e))}function e(e){e=b[e];!e||(e=e.enabledPlugin)&&(d[e.name]||(d[e.name]=e))}var t=this.getTimeZoneName()||"??",i="%2B00:00";try{var s=-1*(new Date).getTimezoneOffset(),o=parseInt(s/60),s=Math.abs(s%60)+"";s.length<2&&(s="0"+s),i=o+":"+s,0<=o&&(i="%2B"+i)}catch(e){}function n(e){function m(e,t,i){return e&t|~e&i}function p(e,t,i){return i&e|~i&t}function g(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function s(e){for(var t=[],i=0;i<e.length;i++)if(e.charCodeAt(i)<=127)t.push(e.charCodeAt(i));else for(var s=encodeURIComponent(e.charAt(i)).substr(1).split("%"),o=0;o<s.length;o++)t.push(parseInt(s[o],16));return t}function t(e){for(var t=new Array(e.length),i=0;i<e.length;i++)t[i]=e[i];return t}function v(e,t){return 4294967295&e+t}var f=null,i=null;return"string"==typeof e?f=s(e):e.constructor==Array?0===e.length?f=e:"string"==typeof e[0]?f=function(e){for(var t=[],i=0;i<e.length;i++)t=t.concat(s(e[i]));return t}(e):"number"==typeof e[0]?f=e:i=typeof e[0]:"undefined"!=typeof ArrayBuffer?e instanceof ArrayBuffer?f=t(new Uint8Array(e)):e instanceof Uint8Array||e instanceof Int8Array?f=t(e):e instanceof Uint32Array||e instanceof Int32Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Float32Array||e instanceof Float64Array?f=t(new Uint8Array(e.buffer)):i=typeof e:i=typeof e,i&&alert("MD5 type mismatch, cannot process "+i),function(){function e(e,t,i,s){var o=c;c=u,h=v(u=h,(i=v(l,v(e,v(t,i))))<<(s=s)&4294967295|i>>>32-s),l=o}var t=f.length;f.push(128);var i=f.length%64;if(56<i){for(var s=0;s<64-i;s++)f.push(0);i=f.length%64}for(s=0;s<56-i;s++)f.push(0);f=f.concat(function(e){for(var t=[],i=0;i<8;i++)t.push(255&e),e>>>=8;return t}(8*t));for(var o=1732584193,n=4023233417,r=2562383102,a=271733878,l=0,h=0,u=0,c=0,s=0;s<f.length/64;s++){l=o;var d=64*s;e(m(h=n,u=r,c=a),3614090360,g(f,d),7),e(m(h,u,c),3905402710,g(f,4+d),12),e(m(h,u,c),606105819,g(f,8+d),17),e(m(h,u,c),3250441966,g(f,12+d),22),e(m(h,u,c),4118548399,g(f,16+d),7),e(m(h,u,c),1200080426,g(f,20+d),12),e(m(h,u,c),2821735955,g(f,24+d),17),e(m(h,u,c),4249261313,g(f,28+d),22),e(m(h,u,c),1770035416,g(f,32+d),7),e(m(h,u,c),2336552879,g(f,36+d),12),e(m(h,u,c),4294925233,g(f,40+d),17),e(m(h,u,c),2304563134,g(f,44+d),22),e(m(h,u,c),1804603682,g(f,48+d),7),e(m(h,u,c),4254626195,g(f,52+d),12),e(m(h,u,c),2792965006,g(f,56+d),17),e(m(h,u,c),1236535329,g(f,60+d),22),e(p(h,u,c),4129170786,g(f,4+d),5),e(p(h,u,c),3225465664,g(f,24+d),9),e(p(h,u,c),643717713,g(f,44+d),14),e(p(h,u,c),3921069994,g(f,d),20),e(p(h,u,c),3593408605,g(f,20+d),5),e(p(h,u,c),38016083,g(f,40+d),9),e(p(h,u,c),3634488961,g(f,60+d),14),e(p(h,u,c),3889429448,g(f,16+d),20),e(p(h,u,c),568446438,g(f,36+d),5),e(p(h,u,c),3275163606,g(f,56+d),9),e(p(h,u,c),4107603335,g(f,12+d),14),e(p(h,u,c),1163531501,g(f,32+d),20),e(p(h,u,c),2850285829,g(f,52+d),5),e(p(h,u,c),4243563512,g(f,8+d),9),e(p(h,u,c),1735328473,g(f,28+d),14),e(p(h,u,c),2368359562,g(f,48+d),20),e(h^u^c,4294588738,g(f,20+d),4),e(h^u^c,2272392833,g(f,32+d),11),e(h^u^c,1839030562,g(f,44+d),16),e(h^u^c,4259657740,g(f,56+d),23),e(h^u^c,2763975236,g(f,4+d),4),e(h^u^c,1272893353,g(f,16+d),11),e(h^u^c,4139469664,g(f,28+d),16),e(h^u^c,3200236656,g(f,40+d),23),e(h^u^c,681279174,g(f,52+d),4),e(h^u^c,3936430074,g(f,d),11),e(h^u^c,3572445317,g(f,12+d),16),e(h^u^c,76029189,g(f,24+d),23),e(h^u^c,3654602809,g(f,36+d),4),e(h^u^c,3873151461,g(f,48+d),11),e(h^u^c,530742520,g(f,60+d),16),e(h^u^c,3299628645,g(f,8+d),23),e(u^(h|~c),4096336452,g(f,d),6),e(u^(h|~c),1126891415,g(f,28+d),10),e(u^(h|~c),2878612391,g(f,56+d),15),e(u^(h|~c),4237533241,g(f,20+d),21),e(u^(h|~c),1700485571,g(f,48+d),6),e(u^(h|~c),2399980690,g(f,12+d),10),e(u^(h|~c),4293915773,g(f,40+d),15),e(u^(h|~c),2240044497,g(f,4+d),21),e(u^(h|~c),1873313359,g(f,32+d),6),e(u^(h|~c),4264355552,g(f,60+d),10),e(u^(h|~c),2734768916,g(f,24+d),15),e(u^(h|~c),1309151649,g(f,52+d),21),e(u^(h|~c),4149444226,g(f,16+d),6),e(u^(h|~c),3174756917,g(f,44+d),10),e(u^(h|~c),718787259,g(f,8+d),15),e(u^(h|~c),3951481745,g(f,36+d),21),o=v(o,l),n=v(n,h),r=v(r,u),a=v(a,c)}return function(e,t,i,s){for(var o,n,r="",a=3;0<=a;a--)n=255&(o=arguments[a]),n<<=8,n|=255&(o>>>=8),n<<=8,n|=255&(o>>>=8),n<<=8,r+=(n=((n=n|=o>>>=8)>>>0).toString(16),"00000000".substr(0,8-n.length)+n);return r}(a,r,n,o).toUpperCase()}()}
1var r=(window.outerHeight,window.innerHeight,0),a=(window.outerWidth,window.innerWidth,0),l=(screen.height,screen.availHeight,0),h=(screen.width,screen.availWidth,0),u=(screen.width,screen.height,screen.colorDepth,0),c="x",d=[];if(navigator&&navigator.plugins)for(f=[],c+="x"+(b=navigator.plugins).length,p=0;p<b.length;p++)d[b[p].name]=b[p];if(navigator&&navigator.mimeTypes){for(f=[],c+="x"+(b=navigator.mimeTypes).length,p=0;p<b.length;p++)e(b[p].type);for(var m=["audio/midi","video/msvideo","application/pdf","application/x-shockwave-flash","application/x-silverlight","application/vnd.rn-realmedia","audio/vnd.rn-realaudio","application/x-director","application/itunes-plugin","audio/x-pn-realaudio-plugin","audio/x-pn-realaudio","application/vlc","video/x-msvideo","application/x-tar","video/x-ms-wmx","application/x-java-applet","video/divx","application/x-mplayer2","application/skype-web-plugin"],p=0;p<m.length;p++)e(m[p])}for(g in f=[],d)c+="x",f.push(d[g].name+d[g].filename+d[g].version);f.sort(),n(c+=f.join(" "));var g,v=(new function(){var d=["monospace","sans-serif","serif"],m="mmmmmmmmmmlli",p=document.getElementsByTagName("body")[0],o=document.createElement("span");o.style.fontSize="72px",o.innerHTML=m;var e,g={},v={};for(e in d)o.style.fontFamily=d[e],p.appendChild(o),g[d[e]]=o.offsetWidth,v[d[e]]=o.offsetHeight,p.removeChild(o);this.detect=function(e){var t,i=!1;for(t in d){o.style.fontFamily=e+","+d[t],p.appendChild(o);var s=o.offsetWidth!=g[d[t]]||o.offsetHeight!=v[d[t]];p.removeChild(o),i=i||s}return i},this.detectList=function(e){for(var t=[],i=0,s=[],o=0;o<e.length;o++){var n,r=e[o],a=!1,l=document.createElement("span");for(n in s.push(l),l.style.fontSize="72px",l.innerHTML=m,d){l.style.fontFamily=r+","+d[n],p.appendChild(l);var h=l.offsetWidth,u=l.offsetHeight,c=h!=g[d[n]]||u!=v[d[n]];i+=h+u,a=a||c}a&&t.push(r)}for(o=0;o<s.length;o++)p.removeChild(s[o]);return{fonts:t,size:i}}}).detectList(["Tahoma","Arial Narrow","Century Gothic","MS Sans Serif","Lucida Console","Garamond","Lucida Sans Unicode","Bookman Old Style","Book Antiqua","Microsoft Sans Serif","Palatino Linotype","Monotype Corsiva","Terminal","Haettenschweiler","Modern","Franklin Gothic Medium","Script","Sylfaen","Papyrus","Arial Rounded MT Bold","Copperplate Gothic Light","Curlz MT","MT Extra","Edwardian Script ITC","Lucida Handwriting","Lucida Sans","Bauhaus 93","Modern No. 20","Mangal","Batang","Arial Unicode MS","Tunga","SimSun","Century Schoolbook","Gautami","MV Boli","Perpetua","Raavi","Shruti","Tempus Sans ITC","Calisto MT","Century","Engravers MT","Licusa Sans Regular","Mistra","Rockwell","Franklin Gothic Book","Bradley Hand ITC","French Script MT","Franklin Gothic Demi","Felix Titling","Britannic Bold","Cooper Black","Goudy Old Style","Stencil","Univers 45 Light","Wide Latin","Andale Mono","Lucida Bright","Onyx","Footlight MT Light","Playbill","Baskerville Old Face","Berand MT Condensed","Juice ITC","Warren 1","Zartz!","Bell MT","Colonna MT","Staccato 222 BT","Gloucester MT Extra Condensed","Palatino","Old English Text MT","Optima","Times Roman","Zapf Elliptical 711 BT","Trade Gothic Condensed No.18","Tw Cen MT","Aldine 401 BT","Baskerville","Bookshelf Symbol 7","Gill Sans","Helvetica 95 Black","Orator 15 Pitch BT","Geometric slabserif 703 Bold BT","Hemi Head 426","Sci Fied 2002","Broken 15","Chicago","Universal Math 1 BT","Bullpen 3D","Tengwar Noldor 1","Brush 445 BT","Courier 10 Pitch","Sanskrit 98","Courier-BoldOblique","Elder Futhark ver 1.1","VT 100","Bitstream Vera Sans","News Gothic MT","Bookman","Utopia","Zapf Chancery","Avantgarde","Lucidatypewriter","Nimbus Mono L","URW Bookman L","Blue Highway Condensed","Lucida Typewriter"]),v=n(v.fonts.join(":")+v.size),r=(window.outerHeight||0)-(window.innerHeight||0),a=(window.outerWidth||0)-(window.innerWidth||0),l=(screen.height||0)-(screen.availHeight||0),h=(screen.width||0)-(screen.availWidth||0),u=(screen.width||0)+""+(screen.height||0)+(screen.colorDepth||0),c="x",d=[];if(navigator&&navigator.plugins)for(f=[],c+="x"+(b=navigator.plugins).length,p=0;p<b.length;p++)d[b[p].name]=b[p];if(navigator&&navigator.mimeTypes){var f=[],b=navigator.mimeTypes;for(c+="x"+b.length,p=0;p<b.length;p++)e(b[p].type);for(m=["audio/midi","video/msvideo","application/pdf","application/x-shockwave-flash","application/x-silverlight","application/vnd.rn-realmedia","audio/vnd.rn-realaudio","application/x-director","application/itunes-plugin","audio/x-pn-realaudio-plugin","audio/x-pn-realaudio","application/vlc","video/x-msvideo","application/x-tar","video/x-ms-wmx","application/x-java-applet","video/divx","application/x-mplayer2","application/skype-web-plugin"],p=0;p<m.length;p++)e(m[p])}for(g in f=[],d)c+="x",f.push(d[g].name+d[g].filename+d[g].version);return f.sort(),"fh:"+v+";tz2:"+t+";tz:"+i+";plh:"+n(c+=f.join(" "))+";bthh:"+r+";btwh:"+a+";sthh:"+l+";stwh:"+h+";sch:"+u},ProblemUI.prototype.getTimeZoneName=function(){if("undefined"!=typeof jstz)return jstz.determine().name();if("undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return null;var e=Intl.DateTimeFormat;return void 0===(e=e())||void 0===e.resolvedOptions?null:e.resolvedOptions().timeZone},ProblemUI.prototype.displayDetails=function(){var e=this.root,t=e.active,i=e.replaced_with,s=e.is_defensive;this.isEndgame||(YAHOO.util.Dom.setStyle("tags","display","block"),YAHOO.util.Dom.setStyle("ct-tacticType","display","block")),YAHOO.util.Dom.setStyle("ratingdiv","display","block"),this.comments.showCommentsDisplay(),this.isEndgame||YAHOO.util.Dom.setStyle("mistakesContainer","display","block"),YAHOO.util.Dom.get("showFen")&&YAHOO.util.Dom.setStyle("fenContainer","display","block"),this.setProblemDetails(e.ratings,!0),YAHOO.util.Dom.setStyle("problemDetailsDisplay","display","block"),YAHOO.util.Dom.setStyle("problemDetailsDisplay","visibility","visible"),this.isEndgame?(YAHOO.util.Dom.setStyle("board-moves","display","block"),YAHOO.util.Dom.setStyle("board-position-moves","visibility","visible"),YAHOO.util.Dom.setStyle("board-position-moves","display","block"),YAHOO.util.Dom.setStyle("board-moves","height","auto"),YAHOO.util.Dom.setStyle("board-position-moves","height","auto"),YAHOO.util.Dom.setStyle("board-moves","overflow","visible"),YAHOO.util.Dom.setStyle("board-position-moves","overflow","visible")):(YAHOO.util.Dom.setStyle("board-moves","display","block"),YAHOO.util.Dom.setStyle("board-moves","overflow","auto"),YAHOO.util.Dom.setStyle("board-moves","height","400px"),YAHOO.util.Dom.setStyle("board-position-moves","height","auto"),(e=YAHOO.util.Dom.getElementsByClassName("ct-tactic-type-data"))&&0<e.length&&(e[0].innerHTML=_js(s?"Non-winning":"Winning"))),YAHOO.util.Dom.setStyle(this.board.boardName+"-nav-buttons-only","display","inline"),YAHOO.util.Dom.setStyle("ratedDetail
1sDisplay","display","none"),YAHOO.util.Dom.setStyle("unratedDetailsDisplay","display","block"),t?YAHOO.util.Dom.setStyle("inactive","display","none"):(YAHOO.util.Dom.setStyle("inactive","display","block"),YAHOO.util.Dom.get("replacedWith").innerHTML="NONE"!=i?__js('<a href="/chess-problems/{PROBLEM_ID}"/>Replaced by {PROBLEM_ID}</a>',[["PROBLEM_ID",i]]):"")},ProblemUI.prototype.setProblemDetails=function(e,t){function o(e){return 0==e?"00":e<10?"0"+e:""+e}for(var i=YAHOO.util.Dom.get("unratedDetailsDisplay"),s="",n=0;n<e.length;n++){var r,a,l=_js(e[n].problem_set_name);s+="<hr><div>",s+=__js("Problem {RATING_TYPE} Rating:<span>{PROBLEM_RATING}</span>",[["RATING_TYPE",l],["PROBLEM_RATING",e[n].rating]]),s+="</div>",s+="<div>",s+=__js("{RATING_TYPE} Av Seconds:<span>{AVERAGE_SECONDS}</span>",[["RATING_TYPE",l],["AVERAGE_SECONDS",function(e){var t=!1;(e=parseInt(e))<0&&(e*=-1,t=!0);var i=e%60,s=Math.floor(e/60)%60,e=Math.floor(e/3600);return(t?"-":"")+(0<e?e+":":"")+o(s)+":"+o(i)}(e[n].av_seconds)]]),s+="</div>",this.isEndgame&&(r=e[n].av_score,e[n].av_total_moves,a=e[n].av_total_subopt,0<=r&&(r=1-r),r<0?r="-":0!=r&&(r=Math.round(100*r*10)/10+"%"),a<0?a="-":0!=a&&(a=Math.round(10*a)/10),s+="<div>",s+=__js("{RATING_TYPE} Av Score:<span>{AVERAGE_SCORE}</span>",[["RATING_TYPE",l],["AVERAGE_SCORE",r]]),s+="</div>",s+="<div>",s+=__js("{RATING_TYPE} Av Extra:<span>{AVERAGE_EXTRA}</span>",[["RATING_TYPE",l],["AVERAGE_EXTRA",a]]),s+="</div>"),s+="<div>",s+=__js("{RATING_TYPE} Attempts:<span>{NUMBER_ATTEMPTS}</span>",[["RATING_TYPE",l],["NUMBER_ATTEMPTS",e[n].attempts]]),s+="</div>",s+=__js("{RATING_TYPE} Success Rate:<span>{PERCENT_SUCCESS}%</span>",[["RATING_TYPE",l],["PERCENT_SUCCESS",e[n].percent_success]]),s+="</div>"}i.innerHTML=s},ProblemUI.prototype.makeScoresVisible=function(){if(this.board.moveArray)for(var e=0;e<this.board.moveArray.length;e++){YAHOO.util.Dom.setStyle(this.board.boardName+"-msc"+e,"display","inline");var t,i=YAHOO.util.Dom.get(this.board.boardName+"-m"+e);i&&((t=i.getAttribute("alt"))&&(i.title=t,i.alt=null),(t=i.getAttribute("rel"))&&(t=i.innerHTML.replace(/___/,t),i.innerHTML=t))}},ProblemUI.prototype.processEndgameResponse=function(i,e,s,t,o){var n;this.tactics&&(this.tactics.opponentSeconds+=o/1e3,n=this.tactics,this.tactics.stopClock=!1,setTimeout(function(){n.updateTime()},1e3)),this.board.deferredBlockForwardBack=!0;var r=i.errorResult;if(r){var o=parseInt(r),r=YAHOO.widget.SimpleDialog.ICON_ERROR,a="Error",l="Error creating problem set:<br/>";6===o&&(r=YAHOO.widget.SimpleDialog.ICON_ERROR,a=_js("Error checking endgame"),l=_js("An error occurred checking this endgame.")+"<br/>",YAHOO.util.Dom.get("num_problems")),this.board.deferredBlockForwardBack=!1;var h=this,u=new YAHOO.widget.SimpleDialog("problemResponseDialog",{fixedcenter:!0,visible:!0,draggable:!1,icon:r,constraintoviewport:!0,buttons:[{text:_js("Ok"),handler:function(){var e,t;u.hide(),h.endgamePendingPiece&&(e=h.endgameOldPosition[0],t=h.endgameOldPosition[1],h.endgamePendingPiece.setPosition(e,t,!1,null,.5))},isDefault:!0}]});return u.setHeader(a),u.setBody("<span>"+l+"</span>"),void u.render(document.body)}var c=!1;this.tactics&&this.tactics.problemActive&&(c=!0),this.tactics&&this.tactics.processMarkSession(i);a=i.endgame_resp.correct,l=parseInt(i.endgame_resp.finished);if(a)if(clog&&console.log("correct"),l){if(this.showProblemId(),this.showSourceGame(),clog&&console.log("finished"),this.tactics&&i.ratings&&(this.tactics.showComplete(a),this.makeScoresVisible()),this.tactics&&i.ratings&&this.tactics.processMarkDisplay(i,a),s||(this.board.toggleToMove(),this.board.updateToPlay()),t)return this.board.deferredBlockForwardBack=!1,void this.getProblem();var d=i.endgame_resp.opponent_move,m=i.endgame_resp.next_position,p=i.endgame_resp.position;this.endgamePendingMove&&(i.endgame_resp.isPruned?(clog&&console.log("pruned"),this.endgamePendingMove.eg_move=i.endgame_resp.our_move,this.board.replaceMove(this.board.currentMove,this.endgamePendingMove,!1,!0,c),this.board.setCurrentMove(this.endgamePendingMove),this.endgamePendingMove.fen=p,this.endgamePendingMove.nextFen=m,this.endgamePendingMove.bestMoves=i.endgame_resp.best_moves,this.endgamePendingMove.eg_move=i.endgame_resp.our_move,clog&&console.log("finished with pending move:"+this.endgamePendingMove.output()),b=s,this.board.makeMove(this.endgamePendingMove,this.endgamePendingPiece,s,.5,!1,!0,function(){this.board.deferredBlockForwardBack=!1},this,!0),this.board.setCurrentMove(this.endgamePendingMove.next),this.board.currentMove.bestMoves=i.endgame_resp.next_moves,this.endgamePendingMove.next.atEnd=0,this.showBestMoves(this.board.currentMove,i.endgame_resp.next_moves,null,null),b||(this.board.deferredBlockForwardBack=!1)):(clog&&console.log("not pruned"),f=!0,this.tactics&&this.tactics.problemActive&&(f=!1),this.board.replaceMove(this.board.currentMove,this.endgamePendingMove,f,!0,c),this.board.setCurrentMove(this.endgamePendingMove),this.board.currentMove.bestMoves=i.endgame_resp.best_moves,this.endgamePendingMove.fen=p,clog&&console.log("finished with pending move:"+this.endgamePendingMove.output()),b=s,this.board.makeMove(this.endgamePendingMove,this.endgamePendingPiece,b,.5,!1,!0,function(){this.board.deferredBlockForwardBack=!1},this,!0),b||(this.board.deferredBlockForwardBack=!1),this.endgamePendingMove.atEnd=0,this.endgamePendingMove.next.atEnd=1,clog&&console.log("about to move to null node in win/daw/loss unpruned"),this.board.setCurrentMove(this.endgamePendingMove.next),this.board.currentMove.bestMoves=i.endgame_resp.next_moves,this.clearBestMoves()))}else{clog&&console.log("correct NOT finished");var d=i.endgame_resp.opponent_move,m=i.endgame_resp.next_position,p=i.endgame_resp.position,g=null;d&&(clog&&console.log("oppMove:"+d),g=this.board.createMoveFromString(d.move)),clog&&console.log("curfen:"+p+" oppfen:"+m),c&&
1(0<(_=i.endgame_resp.our_move.score-i.endgame_resp.our_move.optimal_score)?(C=__jn("{MOVE} takes {NUMBER_MOVES} move longer to mate.","{MOVE} takes {NUMBER_MOVES} moves longer to mate.",_,[["MOVE",Board.moveToLocale(i.endgame_resp.our_move.sanmove)],["NUMBER_MOVES",_]]),this.tactics.showProblemStatus(_js("Longer Mate"),C)):this.tactics.hideProblemStatus()),clog&&console.log("about to make our move");var v=.5;s||(v=0);var f,b=this.board.currentMove;this.endgamePendingMove&&(clog&&console.log("pending:"+this.endgamePendingMove.output()),clog&&console.log("replacing current move"),f=!c,this.endgamePendingMove.eg_move=i.endgame_resp.our_move,clog&&(console.log("before replaceMove endgamePendingMove:"+this.endgamePendingMove.output()),b&&b.next&&console.log("prepending next:"+b.next.output())),this.board.replaceMove(b,this.endgamePendingMove,f,!0,c),clog&&(console.log("after replaceMove endgamePendingMove:"+this.endgamePendingMove.output()),this.endgamePendingMove.next&&console.log("after replaceMove endgamePendingMove next:"+this.endgamePendingMove.next.output())),clog&&console.log("finished replacing current move"),this.board.setCurrentMove(this.endgamePendingMove),this.board.currentMove.fen=p,this.board.currentMove.nextFen=m,this.board.currentMove.eg_move=i.endgame_resp.our_move,i.endgame_resp.best_moves&&(this.endgamePendingMove.bestMoves=i.endgame_resp.best_moves)),this.board.makeMove(this.endgamePendingMove,this.endgamePendingPiece,!0,v,!1,!0,function(){var e,t;(s?this.board.toMove==this.playerColour:this.board.toMove!=this.playerColour)&&this.autoPlayOpponent||c?(g&&(clog&&console.log("insertMoveAfter opponent move with curr move:"+this.board.currentMove.output()),g.eg_move=d,g.eg_move.optimal_score=d.score,this.board.insertMoveAfter(this.board.currentMove,g,!1,!1,c),clog&&this.board.currentMove&&this.board.currentMove.next&&(console.log("after inserting opponent move currentMoveNext:"+this.board.currentMove.next.output()),this.endgamePendingMove.next&&console.log("after inserting opponent move pending next:"+this.endgamePendingMove.next.output())),this.board.setCurrentMove(g),g.fen=m,g.nextFen=i.endgame_resp.our_next_position,g.eg_move=d,g.eg_move.optimal_score=d.score,g.atEnd=0,g.bestMoves=i.endgame_resp.next_moves),clog&&console.log("about to make opponent move"),this.board.makeMove(g,this.board.boardPieces[g.fromColumn][g.fromRow],!0,.5,!1,!0,function(){clog&&console.log("about to move to null node in opponent make move callback");var e=0;g.bestMoves&&0<g.bestMoves.length&&"draw"!=g.bestMoves[0].score&&0==g.bestMoves[0].score&&(clog&&console.log("opp move is mate"),e=1),g.next.atEnd=e,this.board.setCurrentMove(g.next),this.board.currentMove.bestMoves=i.endgame_resp.our_next_best,this.board.currentMove.atEnd=e,this.board.deferredBlockForwardBack=!1},this),clog&&console.log("finished making opponent move"),s&&(this.board.toggleToMove(),this.board.updateToPlay()),i.endgame_resp.our_next_best&&(clog&&console.log("show best moves opp_move:"+g.output()),g&&this.showBestMoves(g,i.endgame_resp.our_next_best,null,null,!0))):(this.board.currentMove?clog&&console.log("not playing opponent move with currentMove:"+this.board.currentMove.output()):clog&&console.log("not playng opponent move with NULL currentMove"),s||(this.board.toggleToMove(),this.board.updateToPlay()),this.board.currentMove&&this.board.currentMove.next&&(clog&&console.log("about to set currentMove to end move:"+this.board.currentMove.next.output()),this.board.setCurrentMove(this.board.currentMove.next),this.board.currentMove.bestMoves=i.endgame_resp.next_moves,e=0,(t=i.endgame_resp.our_move)&&"draw"!=t.score&&0==t.score&&(clog&&console.log("move is mate"),e=1),this.board.currentMove.atEnd=e),this.showBestMoves(this.board.currentMove,i.endgame_resp.next_moves,null,null,!1),this.board.deferredBlockForwardBack=!1)},this),clog&&console.log("finished making our move")}else{clog&&console.log("incorrect"),this.endgamePendingPiece&&(y=this.endgameOldPosition[0],O=this.endgameOldPosition[1],this.endgamePendingPiece.setPosition(y,O,!1,null,.5));var p=i.endgame_resp.best_moves[0],v=this.board.createMoveFromString(p.move),y=i.endgame_resp.position;v.fen=y,v.nextFen=p.fen,v||alert("2null bestmove from:"+p.move),this.board.currentMove?clog&&console.log("replacing "+v.output()+" after current:"+this.board.currentMove.output()):clog&&console.log("inserting bestmove with no currentmove:"+v.output());var O=!1;c&&i.endgame_resp.try_again&&(O=!0),this.board.replaceMove(this.board.currentMove,v,!1,!0,c,O),v.fen=y,v.nextFen=p.fen,this.board.setCurrentMove(v);v=0;p&&"draw"!=p.score&&0==p.score&&(clog&&console.log("move is mate"),v=1);p=0;if(i.endgame_resp.next_moves&&0==i.endgame_resp.next_moves.length&&(p=1),this.board.currentMove.atEnd=v,this.board.currentMove.next.atEnd=v,this.board.currentMove.bestMoves=i.endgame_resp.best_moves,this.board.currentMove.correctMove=i.endgame_resp.correct_move,this.board.currentMove.wrongMove=i.endgame_resp.wrong_move,this.endgamePendingMove.eg_move=i.endgame_resp.our_move,this.board.replaceMove(this.board.currentMove,this.endgamePendingMove,!0,!0,c),this.endgamePendingMove.atEnd=p,this.endgamePendingMove.nextFen=i.endgame_resp.wrong_position,this.endgamePendingMove.bestMoves=i.endgame_resp.best_moves,this.endgamePendingMove.next.bestMoves=i.endgame_resp.next_moves,this.endgamePendingMove.next.atEnd=p,this.endgamePendingMove.eg_move=i.endgame_resp.our_move,this.tactics)if(i.endgame_resp.try_again){var _=i.endgame_resp.our_move.score-i.endgame_resp.best_moves[0].score,C=__jn("{MOVE}
1 takes {NUMBER_MOVES} move longer to mate.","{MOVE} takes {NUMBER_MOVES} moves longer to mate.",_,[["MOVE",Board.moveToLocale(i.endgame_resp.our_move.sanmove)],["NUMBER_MOVES",_]]);this.tactics.showProblemStatus(_js("Longer Mate"),C)}else if(this.tactics.showComplete(a),this.showProblemId(),this.showSourceGame(),this.makeScoresVisible(),t||this.showBestMoves(this.board.currentMove,i.endgame_resp.best_moves,i.endgame_resp.correct_move,i.endgame_resp.wrong_move),this.tactics&&i.ratings&&this.tactics.processMarkDisplay(i,a),t)return this.board.deferredBlockForwardBack=!1,void this.getProblem();this.board.deferredBlockForwardBack=!1}YAHOO.util.Dom.setStyle(this.board.boardName+"-ms0","visibility","visible"),this.tactics&&this.tactics.problemActive||this.board.setForwardBack()},ProblemUI.prototype.tryEndgameMarkProblem=function(tries,move,calledFromForward,getNewProblem,playBestParam,position,used,problemRnum,currentProblemSet,doingTactic,rating,getNext,beginOpponentTime,problemId,userId,tlf){if(5<tries)return YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden"),this.board.deferredBlockForwardBack=!1,void alert("Unable to contact server. Please try again later.");var playBlitzParam="0",btl=0;this.tactics&&this.tactics.blitzingProblem&&(playBlitzParam="1",btl=this.tactics.getEgBlitzTimeLeft());var randString=(new Date).getTime()+"-"+parseInt(99999*Math.random());YAHOO.util.Dom.setStyle("busyDiv","visibility","visible"),YAHOO.util.Connect.asyncRequest("POST","/requests/mark_problem.php?rs="+randString,{success:function(o){var root=eval("("+o.responseText+")");if(root.errorResult){var errorResult=parseInt(root.errorResult);if(10==errorResult)return void this.tryEndgameMarkProblem(tries,move,calledFromForward,getNewProblem,playBestParam,position,used,problemRnum,currentProblemSet,doingTactic,rating,getNext,beginOpponentTime,problemId,userId,tlf)}YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden"),""==move&&root.endgame_resp.best_moves&&0<root.endgame_resp.best_moves.length&&(move=root.endgame_resp.best_moves[0].move,clog&&console.log("best moves after empty move:"+move),this.endgamePendingMove=this.board.createMoveFromString(move),clog&&console.log("created move:"+this.endgamePendingMove),this.endgamePendingPiece=this.board.boardPieces[this.endgamePendingMove.fromColumn][this.endgamePendingMove.fromRow],this.endgameOldPosition=[this.endgamePendingPiece.column,this.endgamePendingPiece.row]),this.processEndgameResponse(root,move,calledFromForward,getNewProblem,(new Date).getTime()-beginOpponentTime)},failure:function(e){var t=this;setTimeout(function(){t.tryEndgameMarkProblem(tries+1,move,calledFromForward,getNewProblem,playBestParam,position,used,problemRnum,currentProblemSet,doingTactic,rating,getNext,beginOpponentTime,problemId,userId,tlf)},3e3*(tries+1))},scope:this},"isEndgame=1&move="+move+"&playBest="+playBestParam+"&playBlitz="+playBlitzParam+"&btl="+btl+"&problemId="+problemId+position+"&secondsUsed="+used.secondsUsed+"&secondsUsedAfterFirstMove="+used.secondsUsedAfterFirstMove+"&userId="+userId+"&problemRnum="+problemRnum+"&currentRatingType="+currentProblemSet+"&lf="+tlf+"&doingTactic="+doingTactic+"&newRatingType="+rating+getNext)},ProblemUI.prototype.processEndgame=function(e,t,i,s){this.board.deferredBlockForwardBack=!0,this.problemMarked=!1;var o=-1,n=0;this.tactics&&(n=this.tactics.calcUsed(),o=this.tactics.getProblemType());var r="0";s&&(r="1");var a="",l=this.board.currentMove;l?l.endNode?(a="&position="+l.prev.nextFen,clog&&console.log("position from prev node:"+a+" currMove:"+l.output()+" currMove.prev:"+l.prev.output())):l.fen?(a="&position="+l.fen,clog&&console.log("position:"+l.fen+" currMove:"+l.output())):clog&&console.log(" no position currMove:"+l.output()):clog&&console.log("currMove null");var h=0,u=-1,s=-1;this.tactics&&(h=1,u=this.tactics.currentProblemSet,s=this.tactics.problemRnum);l="&get_next=0";(this.autoPlayOpponent||this.tactics&&this.tactics.problemActive)&&(l="&get_next=1"),this.tactics&&(this.tactics.stopClock=!0),this.tryEndgameMarkProblem(0,e,t,i,r,a,n,s,u,h,o,l,(new Date).getTime(),this.problemId,this.userId,this.board.tlf)},ProblemUI.prototype.clearBestMoves=function(){this.movesDisplay=YAHOO.util.Dom.get(this.board.boardName+"-position-moves"),this.movesDisplay&&(this.movesDisplay.innerHTML="")},ProblemUI.prototype.showBestMoves=function(e,t,i,s,o){if(clog&&console.log("incrementMove:"+o),!t)return e?clog&&console.log("best_moves not defined in showbestmoves with move:"+e.output()):clog&&console.log("best_moves not defined in showbestmoves null move"),void this.clearBestMoves();var n='<table class="top-users-table"><tr><th class="top-users-header">'+_js("Move")+'</th><th class="top-users-header">'+_js("Outcome")+"</th></tr>";clog&&console.log("show best moves for move:"+e.output()+" with moveNum:"+e.moveNum+" to move:"+this.board.toMove);var r="999",a="null";for(e&&(clog&&console.log("show best moves for move:"+e.output()+" with moveNum:"+e.moveNum+" to move:"+this.board.toMove),r=e.moveNum,o&&r++,r=Math.round(r/2),a=e.moveNum),this.board.toMove==ChessPiece.WHITE?r+=".":r+="...",a="",u=0;u<t.length;u++){var l="draw"==(l=(c=t[u]).score)?_js("Draw"):l<0?__js("Lose in {NUMBER_MOVES}",[["NUMBER_MOVES",-1*l]]):0<l?__js("Mate in {NUMBER_MOVES}",[["NUMBER_MOVES",l]]):_js("Mate"),h=t[u].move==i?'class="eg-move-correct"':t[u].move==s?'class="eg-move-wrong"':'class="eg-move-row'+u%2+'"';n+='<tr id="showbest_'+c.move+'"'+h+"><td>
1"+a+r+Board.moveToLocale(c.sanmove)+"</td><td>"+l+"</td></tr>"}n+="</table>",this.movesDisplay=YAHOO.util.Dom.get(this.board.boardName+"-position-moves"),YAHOO.util.Event.purgeElement(this.movesDisplay,!0),this.movesDisplay.innerHTML=n;for(var u=0;u<t.length;u++){var c=t[u];YAHOO.util.Dom.get("showbest_"+c.move).move=c.move,YAHOO.util.Event.addListener("showbest_"+c.move,"click",this.playFromBestMoveList,this,!0)}},ProblemUI.prototype.playFromBestMoveList=function(e){if(this.board.blockFowardBack||this.board.deferredBlockForwardBack)return!1;this.board.blockFowardBack=!0;var t=YAHOO.util.Event.getTarget(e),e=t.id.substr("showbest_".length),e=t.parentNode.move;this.endgamePendingMove=this.board.createMoveFromString(e),this.endgamePendingPiece=this.board.boardPieces[this.endgamePendingMove.fromColumn][this.endgamePendingMove.fromRow],this.endgamePendingPiece&&(this.endgameOldPosition=[this.endgamePendingPiece.column,this.endgamePendingPiece.row],this.processEndgame(e,!1)),this.board.blockFowardBack=!1},ProblemUI.prototype.getProblem=function(prob_id,attempt_id,resumeProblem){ct_clear_cached_tooltips(),this.tactics&&(YAHOO.util.Event.removeListener("nextProblem","click",this.tactics.nextProblem),YAHOO.util.Dom.setStyle("nextProblem","cursor","default")),void 0===prob_id&&(prob_id=-1);var treePrefix="";this.isEndgame&&(treePrefix="Endgame");var problemSetInput=YAHOO.util.Dom.get(treePrefix+"ProblemSetTreeValue"),rating=0;problemSetInput&&(rating=parseInt(problemSetInput.value));var isEndgame=0;this.isEndgame&&(isEndgame=1);var resumeString="";resumeProblem&&(resumeString="&resume=1");var attString="";attempt_id&&(attString="&attempt_id="+attempt_id);var firstProb=!1;this.tactics&&(firstProb=this.tactics.firstProblem,this.tactics.firstProblem=!1),YAHOO.util.Dom.setStyle("busyDiv","visibility","visible");var val=this.getG();YAHOO.util.Connect.initHeader("X-hd",val),YAHOO.util.Connect.asyncRequest("POST","/requests/get_problem.php",{success:function(o){YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden");var p=this.alk(o.responseText),root=eval("("+p+")");if(root.errorResult){var errorResult=parseInt(root.errorResult);if(10==errorResult)return void alert(_js("Chess Tempo is down for maintenance. Please try again in a few minutes."))}this.getProblemProcessResponse(root)},failure:function(e){YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden"),YAHOO.log("Failed:"+e.statusText),this.tactics&&(YAHOO.util.Event.addListener("nextProblem","click",this.tactics.nextProblem,this.tactics,!0),YAHOO.util.Dom.setStyle("nextProblem","cursor","pointer"))},scope:this},"rating_type="+rating+"&prob_id="+prob_id+"&isEndgame="+isEndgame+attString+resumeString+"&firstProblem="+(firstProb?"1":"0"));var problemState=YAHOO.util.Dom.get("problemState");YAHOO.util.Dom.setStyle("problemState","display","none"),problemState=problemState||YAHOO.util.Dom.get(this.board.boardName+"-problemState"),problemState&&(problemState.alt="",problemState.title=""),YAHOO.util.Dom.setStyle("voteSelector","display","none"),this.comments.cancelComment(),YAHOO.util.Dom.setStyle("commentEntry","display","none")},ProblemUI.prototype.voteCategoryUp=function(e){var t=(t=YAHOO.util.Event.getTarget(e).id).split("-"),i=parseInt(t[0]),e=null;1<t.length&&(e=t[1]),this.recordVote(i,e,1)},ProblemUI.prototype.voteCategoryDown=function(e){var t=(t=YAHOO.util.Event.getTarget(e).id).split("-"),i=parseInt(t[0]),e=null;1<t.length&&(e=t[1]),this.recordVote(i,e,-1)},ProblemUI.prototype.setCategory=function(e){var t=YAHOO.util.Dom.get("category");YAHOO.util.Event.purgeElement(t,!0),t.innerHTML=e;for(var i=YAHOO.util.Dom.getElementsByClassName("categoryVoteUp","span",t),s=0;s<i.length;s++)YAHOO.util.Event.addListener(i[s],"click",this.voteCategoryUp,this,!0);for(i=YAHOO.util.Dom.getElementsByClassName("categoryVoteDown","span",t),s=0;s<i.length;s++)YAHOO.util.Event.addListener(i[s],"click",this.voteCategoryDown,this,!0)},ProblemUI.prototype.showProblemId=function(){var e,t;this.problemId&&(e=YAHOO.util.Dom.get("problemNum"),t='<a href="/chess-problems/'+this.problemId+'">'+this.problemId+"</a>",this.replacesProblemId&&"NONE"!=this.replacesProblemId&&(t+=' (<a href="/chess-problems/'+this.replacesProblemId+'">'+this.replacesProblemId+"</a>)"),e.innerHTML=t)},ProblemUI.prototype.formatOpeningName=function(e){for(var t=e.split(/:/),i=t[0],s=1;s<t.length;s++)""!=t[s]&&(i+=", "+t[s]);return i},ProblemUI.prototype.formatGameDate=function(e){var t=_js("?");return!e||3==(e=e.split(/\./)).length&&"????"!=e[0]&&(t=e[0],"??"!=e[1]&&(t+="-"+e[1],"??"!=e[2]&&(t+="-"+e[2]))),t},ProblemUI.prototype.formatPlayerName=function(e,t){return t?e+" ("+t+")":e},ProblemUI.prototype.formatResult=function(e,t){var i="?";switch(e){case"w":i="1-0";break;case"b":i="0-1";break;case"d":i=t?"1/2-1/2":"&frac12;-&frac12;"}return i},ProblemUI.prototype.showSourceGame=function(){var e,t,i,s=YAHOO.util.Dom.get("gameSource");s&&(this.sourceGame?(e="",this.board.isFlipped&&(e="&flip=true"),i=__js("{WHITE_P
1LAYER} vs {BLACK_PLAYER}",[["WHITE_PLAYER",this.formatPlayerName(this.sourceGame.white,this.sourceGame.elowhite)],["BLACK_PLAYER",this.formatPlayerName(this.sourceGame.black,this.sourceGame.eloblack)]]),t=__js("Date:{DATE}, Site:{SITE}, Event:{EVENT}, Opening:{OPENING_NAME} ({ECO})",[["DATE",this.formatGameDate(this.sourceGame.date)],["SITE",this.sourceGame.site],["EVENT",this.sourceGame.event],["OPENING_NAME",this.formatOpeningName(this.sourceGame.opening_name)],["ECO",this.sourceGame.eco]]),i='<a title="'+(t+=" "+this.formatResult(this.sourceGame.result))+'" target="_blank" href="/gamedb/game/'+this.sourceGame.game_id+"/"+this.startPosition+e+'">'+i+"</a>",s.innerHTML=i):s.innerHTML=_js("?"))},ProblemUI.prototype.setReplacesProblemId=function(e){this.replacesProblemId=e},ProblemUI.prototype.setSourceGame=function(e){this.sourceGame=e},ProblemUI.prototype.setProblemId=function(e){this.problemId=e,this.comments.setCommentTargetId(e),this.tactics&&this.tactics.setProblemId(e)},ProblemUI.prototype.createProblemUI=function(){var e,t=YAHOO.util.Dom.get(this.board.boardName+"-navButtons");this.tactics&&(e='<span id="nextProblem" title="'+_js("Go to next problem")+'" class="inline-button">'+_js("Next Problem")+'</span><span id="giveUpProblem" title="'+_js("Give up problem")+'" class="inline-button">'+_js("Give Up")+"</span>",this.isEndgame&&(e+='<span id="playBest" title="'+_js("Play the best move (penalty applies)")+'" class="inline-button">'+_js("Play Best")+"</span>",e+='<span id="playBlitz" title="'+_js("Play this endgame under the clock")+'" class="inline-button">'+_js("Blitz")+"</span>"),t.innerHTML=e+t.innerHTML)},ProblemUI.prototype.computerMoves=function(e){if(!(this.tactics&&this.tactics.problemActive||null==this.board.fullmoveArray)){for(var t=this.board.tacticMoveArray[0],i=0;null!=t;)i++,t=t.next;if(--i<this.board.fullmoveArray.length){for(var s=this.board.tacticMoveArray[0],o=this.board.fullmoveArray[0];!s.atEnd;)s=s.next,o=o.next;this.board.currentMove.atEnd&&this.board.currentMove==this.board.tacticMoveArray[this.board.lastMoveIndex].next&&this.board.setCurrentMove(o),this.board.tacticMoveArray[this.board.lastMoveIndex].atEnd=!1,(this.board.tacticMoveArray[this.board.lastMoveIndex].next=o).prev=this.board.tacticMoveArray[this.board.lastMoveIndex],this.board.lastMoveIndex=this.board.fullmoveArrayLastMoveIndex,this.board.moveArray=this.board.fullmoveArray}}},ProblemUI.prototype.createTag=function(e){var t;YAHOO.util.Event.stopEvent(e),(t=new YAHOO.widget.Dialog("createTagDialog",{width:"350px",fixedcenter:!0,visible:!1,constraintoviewport:!0,buttons:[{text:_js("Create"),handler:function(){try{var e=YAHOO.util.Connect.setForm("createTagDialogForm")}catch(e){alert("error creating search query:"+e)}YAHOO.util.Connect.asyncRequest("POST","/requests/createTag.php?"+e,{success:function(e){t.hide()},failure:function(e){}})},isDefault:!0},{text:_js("Cancel"),handler:function(){this.cancel()}}]})).validate=function(){return!1},t.setHeader(_js("Enter Name of New Tag")),t.setBody('<form id="createTagDialogForm" method="POST" action="/requests/empty/"><label for="setName">'+_js("Tag Name:")+'</label><input type="textbox" name="tagName" /></form>'),t.setFooter(""),t.render(document.body),t.show()},ProblemUI.prototype.setupTagVote=function(){YAHOO.util.Connect.asyncRequest("POST","/requests/get_tags.php",{success:function(e){var t=e.responseText,e=YAHOO.util.Dom.get("voteSelector");YAHOO.util.Event.removeListener("tagVote","change"),e.innerHTML=t,"block"==YAHOO.util.Dom.getStyle("voteSelector","display")?YAHOO.util.Dom.setStyle("voteSelector","display","none"):(YAHOO.util.Dom.setStyle("voteSelector","display","block"),YAHOO.util.Event.addListener("tagVote","change",this.vote,this,!0),YAHOO.util.Dom.get("tagVote").selectedIndex=-1)},failure:function(e){},scope:this},"&votingAgainst="+(this.votingAgainst?1:0)+"&pid="+this.problemId)},ProblemUI.prototype.voteSetupFor=function(e){this.votingAgainst=!1,this.setupTagVote()},ProblemUI.prototype.voteSetupAgainst=function(e){this.votingAgainst=!0,this.setupTagVote()},ProblemUI.prototype.showFen=function(e){var t=new YAHOO.widget.SimpleDialog("fenDialog",{fixedcenter:!1,visible:!0,draggable:!0,constraintoviewport:!1,buttons:[{id:"linkbutton4",text:"Test"},{text:_js("Ok"),handler:function(){t.hide()},isDefault:!0}]});t.setHeader(_js("Start Position (before opponent move) in PGN format"));var i=this.board.originalFen.split(" ")[5]+".";this.board.opponentColour==ChessPiece.BLACK&&(i+="..");i='[Event "?"]\n[Site "?"]\n[Date "????.??.??"]\n[Round "?"]\n[White "?"]\n[Black "?"]\n[Result "*"]\n[SetUp "1"]\n[FEN "'+this.board.originalFen+'"]\n\n'+i+this.board.start_move_lalg+" * ";t.setBody('<textarea class="showPgn" id="pgnText" rows="11" readonly="true" cols="'+(this.board.startFen.length+9)+'">'+i+"</textarea>"),t.render(document.body),t.setFooter('<span id="pgndl"></span><span id="pgnok"></span>'),t.center(),new YAHOO.widget.Button({type:"link",label:_js("Download"),href:"/requests/dl_pgn.php?pid="+this.problemId+"&move="+this.board.start_move_lalg,container:"pgndl"}),new YAHOO.widget.Button({type:"button",label:_js("Ok"),container:"pgnok",onclick:{fn:function(){t.hide()}}})},ProblemUI.prototype.hideMistakes=function(e){YAHOO.util.Dom.setStyle("mistakes","display","none"),YAHOO.util.Dom.setStyle("showMistakesButton","display","block"),YAHOO.util.Dom.setStyle("hideMistakesButton","display","none")},ProblemUI.prototype.showMistakes=function(e){var t=YAHOO.util.Dom.get("mistakes");t&&(""==t.innerHTML?YAHOO.util.Connect.asyncRequest("POST","/requests/get_mistakes.php",{success:function(e){YAHOO.log("mistakes response:"+e.responseText),YAHOO.util.Dom.get("mistakes").innerHTML=e.responseText,YAHOO.util.Dom.setStyle("mistakes","display","block"),YAHOO.util.Dom.setStyle("showMistakesButton","display","none"),YAHOO.util.Dom.setStyle("hideMistakesButton","display","block")},failure:function(e){YAHOO.log("get mistakes failed:"+e.statusText)},scope:this},"problemId="+this.problemId):(YAHOO.util.Dom.setStyle("mistakes","display","block"),YAHOO.util.Dom.setStyle("showMistakesButton","display","none"),YAHOO.util.Dom.setStyle("hideMistakesButton","display","block")))},ProblemUI.prototype.sessionCallback=function(e,t){e.autoExpandCommentBoards&&(t.board.autoExpandCommentBoards=!0),t.tactics&&(t.tactics.session=e),t.setUserId(e.userid),t.board.showSolutionButton=e.showSolutionButton;var i=e.pieceSize,s=e.pieceStyle,o=e.boardStyle,n=e.showCoordinates,r=e.boardSounds;t.board.gamedb&&(i=e.gamedbPieceSize,s=e.gamedbPieceStyle,o=e.gamedbBoardStyle,n=e.gamedbShowCoordinates,r=e.gamedbBoardSounds),t.board.soundEnabled=r,t.board.clickAndClick=e.clickAndClick,t.board.clickAndClickDisabled=e.clickAndClickDisabled;var a=YAHOO.util.Dom.get("startProblemSetStr");a&&(r="",r=t.isEndgame?_js(e.defaultEndgameProblemSetName):_js(e.defaultProblemSetName),a.innerHTML=r),t.board.showBoards=e.showBoards,t.board.analysisPieceSet=e.analysisPieceSet,t.board.analysisPieceStyle=e.anal
1ysisPieceStyle,t.board.analysisPieceSize=e.analysisPieceSize,t.board.pieceSet==s&&t.board.pieceSize==i||t.board.changePieceSet(s,i);o=Board.boardStyleToClassName(o);t.board.squareColorClass!=o&&(t.board.squareColorClass=o,t.board.changePieceSet(s,i)),t.board.analysisSquareColorClass=Board.boardStyleToClassName(e.analysisBoardStyle),t.board.gamedb||(t.board.reverseFlip=e.boardFlipping),t.board.highlightFromTo!=e.highlightFromTo&&(t.board.highlightFromTo=e.highlightFromTo),t.board.highlightValidSquares!=e.highlightValidSquares&&(t.board.highlightValidSquares=e.highlightValidSquares),t.board.analysisShowCoordinates=e.analysisShowCoordinates,t.board.showCoordinates!=n&&(t.board.showCoordinates=n),(t.board.showCoordinates&&!t.board.coordinatesShown||!t.board.showCoordinates&&t.board.coordinatesShown)&&t.board.createBoardCoords(),0!=e.userid?(YAHOO.util.Dom.setStyle("categoryVoteForButton","display","block"),YAHOO.util.Dom.setStyle("categoryVoteAgainstButton","display","block"),YAHOO.util.Dom.setStyle("createTagButton","display","block"),t.comments.showAddButton()):(YAHOO.util.Dom.setStyle("categoryVoteForButton","display","none"),YAHOO.util.Dom.setStyle("categoryVoteAgainstButton","display","none"),YAHOO.util.Dom.setStyle("createTagButton","display","none"),t.comments.hideAddButton())},ProblemUI.prototype.setUserId=function(e){this.userId=e,this.tactics&&this.tactics.setUserId(e),this.comments&&(this.comments.userId=e)},ProblemUI.prototype.goProblem=function(e){var t=YAHOO.util.Dom.get("goProblemField"),t=parseInt(t.value);!isNaN(t)&&0<t?window.location="/chess-problems/"+t:YAHOO.util.Dom.get("goProblemError").innerHTML=_js("Invalid problem number"),YAHOO.util.Event.preventDefault(e)},ProblemUI.prototype.recordVote=function(e,t,i){var s=YAHOO.util.Dom.get("tagVote"),t=t?"&suggestedMove="+t:"";YAHOO.util.Connect.asyncRequest("POST","/requests/vote_category.php",{success:function(e){YAHOO.util.Dom.setStyle("voteSelector","display","none"),"10"==e.responseText?alert(_js("System maintenance is currently occurring and voting is temporarily disabled. Please try again soon.")):"1"==e.responseText?alert(_js("You must be logged in to vote on tags.")):"2"==e.responseText||(e.responseText?this.setCategory(e.responseText):this.setCategory("")),s&&(s.selectedIndex=0)},failure:function(e){},scope:this},"vote="+e+"&problemId="+this.problemId+"&userId="+this.userId+"&forAgainst="+i+t)},ProblemUI.prototype.vote=function(e){var t,i,s,o,n,r=YAHOO.util.Dom.get("tagVote");0!=r.options[r.selectedIndex].value.length?(t=1,this.votingAgainst&&(t=-1),n=r.options[r.selectedIndex].value.split("-"),i=parseInt(n[0]),s=null,1<n.length&&(s=n[1]),(o=this).votingAgainst||31!=i&&32!=i?this.recordVote(i,s,t):((r=new YAHOO.widget.Dialog("improvementDialog",{width:"350px",fixedcenter:!0,visible:!1,constraintoviewport:!0,buttons:[{text:_js("Create"),handler:function(){try{YAHOO.util.Connect.setForm("improvementDialogForm")}catch(e){alert("error creating search query:"+e)}o.recordVote(i,s,t),this.hide()},isDefault:!0},{text:_js("Cancel"),handler:function(){this.cancel()}}]})).validate=function(){return!1},n="",31==i?(r.setHeader(_js("Enter Extra Move Suggestion")),n='<div style="text-align:left">'+_js("Please enter the first move in the longer move sequence you are suggesting. Please don't enter the full move sequence, only the first extra move that is required. For example if the problem finished at 2...Nxf3 and you think the sequence should have continued 3.Bxf3 Qxd2 then you should only enter 3.Bxf3. If the extra move is a black move then use the format 3...Bxf3 (i.e. move number followed by 3 dots and then the move). No spaces should be used.  Please use the English letters for the pieces, Q=Queen , R=Rook, B=Bishop, N=Knight, K=King. Please do not use RxQ type notation, use the full Rxf3 format. Move numbers should always be used.")+"</div><br/>"):32==i&&(r.setHeader(_js("Enter Different Opponent Move Suggestion")),n='<div style="text-align:left;">'+_js("Please enter the replacement move suggestion, for example if you think 2.Nxf3 should replace 2.Qxf2 then enter 2.Nxf3.  If the move is a black move then use the format 2...Qxf2 (i.e. move number followed by 3 dots and then the move). No spaces should be used.  Please use the English letters for the pieces, Q=Queen , R=Rook, B=Bishop, N=Knight, K=King. Please do not use RxQ type notation, use the full Rxf3 format. Always use a move number that matches the move you are replacing, move numbers are not optional.")+"</div><br/>"),r.setBody('<form id="improvementDialogForm" method="POST" action="/requests/empty/">'+n+'<label for="suggestedMove">'+_js("Suggested Move:")+'</label><input type="textbox" name="suggestedMove" /></form>'),r.setFooter(""),r.render(document.body),r.show())):YAHOO.util.Dom.setStyle("voteSelector","display","none")},ProblemUI.prototype.alk=function(e){for(var t,i=e.length,s=21,o=0,n=new Array,r=0;r<i;r++)"P"==e.charAt(r)&&(t=e.substring(o,r),t=parseInt(t)-s,n.push(""+String.fromCharCode(t)),s+=13,o=r+1);return n.join("")},ProblemUI.prototype.showSolution=function(){this.tactics&&this.tactics.problemActive||(this.board.displayPendingMoveList(),this.showProblemId(),this.showSourceGame(),this.displayDetails(),YAHOO.util.Dom.setStyle("showSolution","display","none"),YAHOO.util.Dom.setStyle("hideSolution","display","inline"))},ProblemUI.prototype.hideSolution=function(){this.hideDetails(),YAHOO.util.Dom.setStyle(this.board.boardName+"-nav-buttons-only","display","inline"),YAHOO.util.Dom.setStyle("showSolution","display","inline"),YAHOO.util.Dom.setStyle("hideSolution","display","none")},ProblemUI.prototype.setupEventHandlers=function(){YAHOO.util.Dom.get("showSolution")&&(YAHOO.util.Event.addListener("showSolution","click",this.showSolution,this,!0),YAHOO.util.Event.addListener("hideSolution","click",this.hideSolution,this,!0)),this.tactics&&(YAHOO.util.Event.addListener("giveUpProblem","click",this.tactics.giveUpProblem,this.tactics,!0),YAHOO.util.Event.addListener("playBest","click",this.tactics.playBest,this.tactics,!0),YAHOO.util.Event.addListener("playBlitz","click",this.tactics.playBlitz,this.tactics,!0)),YAHOO.util.Dom.get("categoryVoteFor")&&YAHOO.util.Event.addListener("categoryVoteFor","click",this.voteSetupFor,this,
1!0),YAHOO.util.Dom.get("categoryVoteAgainst")&&YAHOO.util.Event.addListener("categoryVoteAgainst","click",this.voteSetupAgainst,this,!0),YAHOO.util.Dom.get("createTag")&&YAHOO.util.Event.addListener("createTag","click",this.createTag,this,!0),YAHOO.util.Dom.get("showMistakes")&&(YAHOO.util.Event.addListener("showMistakes","click",this.showMistakes,this,!0),YAHOO.util.Event.addListener("hideMistakes","click",this.hideMistakes,this,!0)),YAHOO.util.Dom.get("showFen")&&YAHOO.util.Event.addListener("showFen","click",this.showFen,this,!0),this.tactics||(YAHOO.util.Event.addListener("goProblem","click",this.goProblem,this,!0),YAHOO.util.Event.addListener("nonsubmitForm","submit",function(e){this.goProblem(e)},this,!0)),this.comments.commentEventSetup()},CommentUI=function(e,t,i){this.commentsId=e,this.board=t,this.commentTargetId=-1,this.commentTargetType=i,this.extraNumberFields=[]},CommentUI.PROBLEM_COMMENT=0,CommentUI.GAME_COMMENT=1,CommentUI.OPENING_COMMENT=2,CommentUI.PLAYER_COMMENT=3,CommentUI.USER_COMMENT=4,CommentUI.PLAYGM_COMMENT=5,CommentUI.ONLINE_GAME_COMMENT=6,CommentUI.USER_GAME_COMMENT=7,CommentUI.OPENING_COMMENT=8,CommentUI.getTargetId=function(e){for(var t=(t=e.currentTarget||!!e.targetElement&&e.targetElement)||YAHOO.util.Event.getTarget(e);t&&!t.id;)t=t.parentNode;return t?t.id:null},CommentUI.prototype.initNumComments=function(){YAHOO.util.Connect.asyncRequest("POST","/requests/get_numcomments.php",{success:function(o){var root=eval("("+o.responseText+")"),num_comments=parseInt(root.num_comments),num_comments_all=parseInt(root.num_comments_all);this.updateComments(num_comments,num_comments_all)},failure:function(e){},scope:this},"&targetId="+this.commentTargetId+"&commentTargetType="+this.commentTargetType)},CommentUI.prototype.addExtraNumberField=function(e){this.extraNumberFields.push(e)},CommentUI.prototype.updateComments=function(e,t){this.showAddButton(),this.numInitialComments=e,this.numInitialCommentsAll=t;var i=YAHOO.util.Dom.get(this.commentsId+"-numComments");0<e?(i.numComments=e,i.innerHTML=__jn("{NUMBER_COMMENTS} comment","{NUMBER_COMMENTS} comments",e,[["NUMBER_COMMENTS",e]]),YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","block")):(i.numComments=0,i.innerHTML=_js("0 comments"),YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","none"),YAHOO.util.Dom.setStyle(this.commentsId+"-commentsAndAddButton","display","block"));for(var s=0;s<this.extraNumberFields.length;s++){var o=YAHOO.util.Dom.get(this.extraNumberFields[s]);o&&(o.innerHTML="- "+i.innerHTML)}t!=e?(i.innerHTML+="("+__jn("{NUMBER_HIDDEN_COMMENTS} hidden","{NUMBER_HIDDEN_COMMENTS} hidden",t-e,[["NUMBER_HIDDEN_COMMENTS",t-e]])+")",YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","block")):YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","none")},CommentUI.prototype.hideComments=function(e){YAHOO.util.Dom.setStyle(this.commentsId+"-commentsAndAddButton","display","none"),0<this.numInitialComments&&YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","block"),this.numInitialCommentsAll!=this.numInitialComments&&YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","block"),YAHOO.util.Dom.setStyle(this.commentsId+"-hideCommentsButton","display","none")},CommentUI.getCommentId=function(e){return CommentUI.getTargetId(e).split("-")[1]},CommentUI.prototype.editCommentCallback=function(e,t){YAHOO.util.Dom.get(this.commentsId+"-commentField").value=unescapeHtml(t),this.editCommentId=e,YAHOO.util.Dom.setStyle(this.commentsId+"-commentEntry","display","block")},CommentUI.prototype.editComment=function(e){var t=CommentUI.getCommentId(e);YAHOO.util.Connect.asyncRequest("POST","/requests/get_comment_from_id.php",{success:function(e){this.editCommentCallback(t,e.responseText)},failure:function(e){},scope:this},"commentId="+t)},CommentUI.prototype.deleteCommentConfirmed=function(e){YAHOO.util.Connect.asyncRequest("POST","/requests/delete_comment.php",{success:function(e){YAHOO.util.Dom.get(this.commentsId+"-comments").innerHTML="",this.showComments(),this.updateComments(this.numInitialComments-1,this.numInitialCommentsAll-1)},failure:function(e){},scope:this},"commentId="+e)},CommentUI.prototype.deleteComment=function(e){var t=CommentUI.getCommentId(e),i=this,e=new YAHOO.widget.SimpleDialog("confirmDelete",{fixedcenter:!0,visible:!0,draggable:!1,
1close:!1,modal:!0,text:_js("Are you sure you want to delete your comment?"),icon:YAHOO.widget.SimpleDialog.ICON_WARN,constraintoviewport:!0,buttons:[{text:_js("Yes"),handler:function(){this.hide(),i.deleteCommentConfirmed(t)},isDefault:!0},{text:_js("No"),handler:function(){this.hide()}}]});e.setHeader(_js("Confirm comment deletion")),e.render(document.body),e.show()},CommentUI.prototype.voteCommentUp=function(e){var id=CommentUI.getCommentId(e);YAHOO.util.Connect.asyncRequest("POST","/requests/vote_comment.php",{success:function(o){var root=eval("("+o.responseText+")"),voteTd=YAHOO.util.Dom.get("voteSum-"+id),vs;voteTd&&(parseInt(voteTd.innerHTML)==root.vote_sum?alert(_js("Already voted that comment up.")):(vs=parseInt(root.vote_sum),0<vs&&(vs="+"+vs),voteTd.innerHTML=vs))},failure:function(e){},scope:this},"voteUp=1&commentId="+id)},CommentUI.prototype.voteCommentDown=function(e){var id=CommentUI.getCommentId(e);YAHOO.util.Connect.asyncRequest("POST","/requests/vote_comment.php",{success:function(o){var root=eval("("+o.responseText+")"),voteTd=YAHOO.util.Dom.get("voteSum-"+id),vs;voteTd&&(voteTd.innerHTML==root.vote_sum?alert(_js("Already voted that comment down.")):(vs=parseInt(root.vote_sum),0<vs&&(vs="+"+vs),voteTd.innerHTML=vs))},failure:function(e){},scope:this},"voteUp=0&commentId="+id)},CommentUI.prototype.processGetComments=function(e,t){ctime&&console.time("processGetComments");var i=YAHOO.util.Dom.get(this.commentsId+"-comments");YAHOO.util.Event.purgeElement(i,!0),i.innerHTML=e,YAHOO.util.Dom.setStyle(this.commentsId+"-commentsAndAddButton","display","block"),t?0<this.numInitialComments&&YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","block"):YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","none"),t?YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","none"):this.numInitialCommentsAll!=this.numInitialComments&&YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","block"),YAHOO.util.Dom.setStyle(this.commentsId+"-hideCommentsButton","display","block"),this.processCommentsBuildBoards(i),ctime&&console.timeEnd("processGetComments"),new YAHOO.util.Scroll(i,{scroll:{to:[0,0]}},0).animate()},CommentUI.prototype.showCommentsCall=function(t){var e;-1!=this.commentTargetId?""==YAHOO.util.Dom.get(this.commentsId+"-comments").innerHTML||this.allComments!=t?(this.allComments=t,ct_clear_cached_tooltips(),YAHOO.util.Connect.asyncRequest("POST","/requests/get_comments.php",{success:function(e){this.processGetComments(e.responseText,t)},failure:function(e){YAHOO.log("comment failed:"+e.statusText)},scope:this},"targetId="+this.commentTargetId+"&allComments="+t+"&commentTargetType="+this.commentTargetType)):(YAHOO.util.Dom.setStyle(this.commentsId+"-commentsAndAddButton","display","block"),e=!(this.numInitialCommentsAll==this.numInitialComments),this.allComments||!e?(YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","none"),0<this.numInitialComments&&e?YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","block"):YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","none")):(YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","block"),YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","none")),YAHOO.util.Dom.setStyle(this.commentsId+"-hideCommentsButton","display","block")):this.hideButtons()},CommentUI.prototype.showComments=function(e){this.showCommentsCall(0)},CommentUI.prototype.showAllComments=function(e){this.showCommentsCall(1)},CommentUI.prototype.commentSetup=function(e){YAHOO.util.Dom.setStyle(this.commentsId+"-commentEntry","display","block")},CommentUI.prototype.comment=function(e){var t=YAHOO.util.Dom.get(this.commentsId+"-commentTypeSelector"),i=YAHOO.util.Dom.get(this.commentsId+"-commentField"),s="/requests/problem_comment.php";0<=this.editCommentId&&(s="/requests/update_comment.php");var o=t?encodeURIComponent(t.options[t.selectedIndex].value):"0";YAHOO.util.Connect.asyncRequest("POST",s,{success:function(e){var t=e.responseXML.documentElement,e=parseInt(getTagValue(t,"num_comments")),t=parseInt(getTagValue(t,"num_comments_all"));0<=e&&(YAHOO.util.Dom.setStyle(this.commentsId+"-commentEntry","display","none"),YAHOO.util.Dom.get(this.commentsId+"-commentField").value="",YAHOO.util.Dom.get(this.commentsId+"-comments").innerHTML="",this.showComments(),YAHOO.util.Dom.get(this.commentsId+"-numComments"),this.numInitialComments=e,this.numInitialCommentsAll=t,this.updateComments(e,t))},failure:function(e){YAHOO.log("comment failed:"+e.statusText)},scope:this},"comment="+encodeURIComponent(i.value)+"&targetId="+this.commentTargetId+"&userId="+this.userId+"&editCommentId="+this.editCommentId+"&commentTargetType="+this.commentTargetType+"&commentType="+o),this.editCommentId=-1},CommentUI.prototype.cancelComment=function(e){var t=YAHOO.util.Dom.get(this.commentsId+"-commentField");t&&(t.value=""),YAHOO.util.Dom.setStyle(this.commentsId+"-commentEntry","display","none"),this.editCommentId=-1},CommentUI.prototype.showFenBoard=function(e){e=CommentUI.getTargetId(e);e&&(e=e.substring(2),this.setupFenBoard(e))},CommentUI.prototype.setupFenBoard=function(e){if(this.pendingFenBoards){var t,i=null;for(t in this.pendingFenBoards){if(clog&&console.log("looking up fenSp
1anId:"+e+" x:"+t),i=this.pendingFenBoards[t][e])break;clog&&console.log("not found")}if(clog&&console.log("found fenObj:"+i),i){var s=YAHOO.util.Dom.get(e),o=new String(s.id).split("-")[0];s.innerHTML="";s=new BoardConfig;s.boardName=o,s.pieceSet=this.board.pieceSet,s.showCoordinates=this.board.showCoordinates,s.squareColorClass=this.board.squareColorClass,s.pieceSize=24,s.boardImagePath="",s.r=!0,s.g=this.board.g,"true"==i.flip&&(s.reverseFlip=!0);s=new FenBoard(i.fen,s);s.board.problem=this,s.board.analysisPieceSet=this.analysisPieceSet,s.board.analysisPieceSize=this.analysisPieceSize,s.board.analysisBoardStyle=this.analysisBoardStyle,s.board.analysisShowCoordinates=this.analysisShowCoordinates,s.board.analysisSquareColorClass=this.analysisSquareColorClass}else if(clog)for(t in this.pendingFenBoards)for(y in this.pendingFenBoards[t]){console.log("looking up y:"+y+" x:"+t);var n=this.pendingFenBoards[t][y];console.log("t:"+n)}}},CommentUI.prototype.showAnalysisBoard=function(e){e=CommentUI.getTargetId(e);e&&(e=e.substring(2),this.setupAnalysisBoard(e))},CommentUI.prototype.setupAnalysisBoard=function(e){if(this.pendingAnalysisBoards){var t,i,s,o=null;for(t in this.pendingAnalysisBoards){if(clog&&console.log("looking up analysisId:"+e),o=this.pendingAnalysisBoards[t+""][e])break;clog&&console.log("not found")}o&&(s=YAHOO.util.Dom.get(e),i=new String(s.id).split("-")[0],s.innerHTML="",(s=new BoardConfig).boardName=i,s.pieceSet=this.board.pieceSet,s.showCoordinates=this.board.showCoordinates,s.squareColorClass=this.board.squareColorClass,s.initialFen=o.fen,clog&&console.log("analysisObj.fen:"+o.fen),s.pgnMoves=o.movesList,s.pieceSize=29,s.boardImagePath="",s.r=!0,s.g=this.board.g,"true"==o.movesFlip&&(s.reverseFlip=!0),s.avoidDomReadySetup=!0,(s=new AnalysisBoard(s,null,this.board)).setup(),clog&&(s.board.prev_move?console.log("analysisBoard.prev_move:"+s.board.prev_move.output()):console.log("no prev_mov")),s.board.analysisPieceSet=this.analysisPieceSet,s.board.analysisPieceSize=this.analysisPieceSize,s.board.analysisBoardStyle=this.analysisBoardStyle,s.board.analysisShowCoordinates=this.analysisShowCoordinates,s.board.analysisSquareColorClass=this.analysisSquareColorClass)}},CommentUI.prototype.processCommentsBuildBoards=function(o,e){for(var n=YAHOO.util.Dom.getElementsByClassName("commentFen","div",o),r=YAHOO.util.Dom.getElementsByClassName("commentMoves","div",o),t=YAHOO.util.Dom.getElementsByClassName("edit-comment","span",o),i=YAHOO.util.Dom.getElementsByClassName("delete-comment","span",o),s=YAHOO.util.Dom.getElementsByClassName("voteup-comment","span",o),a=YAHOO.util.Dom.getElementsByClassName("votedown-comment","span",o),l=0;l<t.length;l++){var h=t[l];YAHOO.util.Event.addListener(h,"click",this.editComment,this,!0)}for(l=0;l<i.length;l++){var u=i[l];YAHOO.util.Event.addListener(u,"click",this.deleteComment,this,!0)}for(l=0;l<s.length;l++)c=s[l],YAHOO.util.Event.addListener(c,"click",this.voteCommentUp,this,!0);for(l=0;l<a.length;l++){var c=a[l];YAHOO.util.Event.addListener(c,"click",this.voteCommentDown,this,!0)}var d=0,m=0,p=this;this.pendingFenBoards||(this.pendingFenBoards=[]),this.pendingAnalysisBoards||(this.pendingAnalysisBoards=[]),this.pendingAnalysisBoards[o.id]=[],this.pendingFenBoards[o.id]=[];var g=function(){if(d<n.length){var e=n[d],t=e.id,i=YAHOO.util.Dom.getElementsByClassName("fenString","div",t),s=YAHOO.util.Dom.getElementsByClassName("fenFlip","div",t),i=trimStr(i[0].innerHTML),s=trimStr(s[0].innerHTML);return new String(t).split("-")[0],e.innerHTML="",p.pendingFenBoards[o.id][t]={id:t,fen:i,flip:s},clog&&console.log("adding pending fen for commentField.id:"+o.id+" and fenId:"+t+" len:"+p.pendingFenBoards[o.id].length),p.board.showBoards?p.setupFenBoard(t):(e.innerHTML='<span id="SB'+t+'" class="yui-button"><span class="first-child"><button type="button">'+_js("Show Board")+"</button></span></span></span>",clog&&console.log("inserting fen id:"+t+" commentsField.id:"+o.id),YAHOO.util.Event.addListener("SB"+t,"click",p.showFenBoard,p,!0)),d++,void setTimeout(g,5)}if(m<r.length){i=r[m],s=YAHOO.util.Dom.getElementsByClassName("movesStart","div",i.id),e=YAHOO.util.Dom.getElementsByClassName("movesFlip","div",i.id),t=YAHOO.util.Dom.getElementsByClassName("moves","div",i.id),s=trimStr(s[0].innerHTML),t=trimStr(t[0].innerHTML),e=tr
1imStr(e[0].innerHTML);return p.pendingAnalysisBoards[o.id][i.id]={id:i.id,fen:s,movesList:t,movesFlip:e},p.board.showBoards?p.setupAnalysisBoard(i.id):(t=(t=t.replace(/{/g,'<span class="ct-board-move-comment">')).replace(/}/g,"</span>"),i.innerHTML='<span id="SB'+i.id+'" class="yui-button"><span class="first-child"><button type="button">'+_js("Show Board")+"</button></span></span></span><span>"+t+"</span>",clog&&console.log("inserting analysis id:"+i.id),YAHOO.util.Event.addListener("SB"+i.id,"click",p.showAnalysisBoard,p,!0)),m++,void setTimeout(g,5)}};g()},CommentUI.prototype.showCommentsDisplay=function(){YAHOO.util.Dom.setStyle(this.commentsId+"-commentsContainer","display","block")},CommentUI.prototype.clearComments=function(){YAHOO.util.Dom.get(this.commentsId+"-commentField").value="",this.editCommentId=-1;var e=YAHOO.util.Dom.get(this.commentsId+"-comments");YAHOO.util.Dom.setStyle(this.commentsId+"-commentsAndAddButton","display","none"),e.innerHTML=""},CommentUI.prototype.hideCommentsDisplay=function(){YAHOO.util.Dom.setStyle(this.commentsId+"-commentsContainer","display","none")},CommentUI.prototype.initCommentDisplay=function(){YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","block"),YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","block"),YAHOO.util.Dom.setStyle(this.commentsId+"-hideCommentsButton","display","none")},CommentUI.prototype.commentEventSetup=function(){YAHOO.util.Dom.get(this.commentsId+"-commentSelector")&&YAHOO.util.Event.addListener(this.commentsId+"-commentSelector","click",this.commentSetup,this,!0),YAHOO.util.Event.addListener(this.commentsId+"-showComments","click",this.showComments,this,!0),YAHOO.util.Event.addListener(this.commentsId+"-showAllComments","click",this.showAllComments,this,!0),YAHOO.util.Event.addListener(this.commentsId+"-hideComments","click",this.hideComments,this,!0),YAHOO.util.Event.addListener(this.commentsId+"-commentSubmit","click",this.comment,this,!0),YAHOO.util.Event.addListener(this.commentsId+"-commentCancel","click",this.cancelComment,this,!0)},CommentUI.prototype.showAddButton=function(){YAHOO.util.Dom.setStyle(this.commentsId+"-commentSelectorButton","display","block")},CommentUI.prototype.hideAddButton=function(){YAHOO.util.Dom.setStyle(this.commentsId+"-commentSelectorButton","display","none")},CommentUI.prototype.copyFenToComment=function(e,t){var i=YAHOO.util.Dom.get(this.commentsId+"-commentField");i&&(t=t?" flip=true":"",i.value=i.value+"[fen"+t+"]"+e+"[/fen]",this.commentSetup())},CommentUI.prototype.copyAnalysisToComment=function(e,t,i){var s=YAHOO.util.Dom.get(this.commentsId+"-commentField");s&&(i="true"==i?"flip=true ":"",s.value=s.value+"[moves "+i+"start="+t+"]"+e+"[/moves]",this.commentSetup(),s.scrollIntoView&&s.scrollIntoView())},CommentUI.prototype.hideButtons=function(){this.hideAddButton(),YAHOO.util.Dom.setStyle(this.commentsId+"-showCommentsButton","display","none"),YAHOO.util.Dom.setStyle(this.commentsId+"-showAllCommentsButton","display","none")},CommentUI.prototype.setNoCommentTargetText=function(e){YAHOO.util.Dom.get(this.commentsId+"-noCommentTarget").innerHTML=e},CommentUI.prototype.clearUI=function(){YAHOO.util.Dom.get(this.commentsId+"-comments").innerHTML="",YAHOO.util.Dom.get(this.commentsId+"-numComments").innerHTML="",this.hideButtons()},CommentUI.prototype.setCommentTargetType=function(e){this.commentTargetType=e},CommentUI.prototype.setCommentTargetId=function(e){this.commentTargetId=e,YAHOO.util.Dom.get(this.commentsId+"-comments").innerHTML="",-1!=e&&this.setNoCommentTargetText("")},CommentUI.prototype.show=function(){this.showCommentsCall(0)};var SITE_VERSION=1;function isMouseOver(e,t){e=YAHOO.util.Dom.get(e);if(!e)return!1;e=YAHOO.util.Dom.getRegion(e);if(!e)return!1;e.top,e.left,e.bottom,e.right;t=YAHOO.util.Event.getXY(t);t[0],t[1]}function trimStr(e){if(!e)return"";for(var t=/\s/,i=(e=e.replace(/^\s\s*/,"")).length;t.test(e.charAt(--i)););return e.slice(0,i+1)}function clearClone(e){if(null!=e)for(prop in e)"object"==typeof e[prop]&&null!=e[prop]&&e[prop].alreadyCloned&&(e[prop].alreadyCloned=!1,clearClone(e[prop]))}function cloneWork(e){if(null==e)return null;var t=new Object;for(prop in e)e[prop],t[prop]=e[prop];return t}function clone(e){return cloneWork(e)}function getTagValue(e,t){e=e.getElementsByTagName(t);return null==e?(YAHOO.log("got null node for tag:"+t),null):0==e.length?(YAHOO.log("got empty array no
1de for tag:"+t),null):null==e[0].firstChild?(YAHOO.log("firstChild is null for tag:"+t),null):null==e[0].firstChild.nodeValue?(YAHOO.log("firstChild.nodeValue is null for tag:"+t),null):void 0!==e[0].textContent?e[0].textContent:e[0].firstChild.nodeValue}function unescapeHtml(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText||t.textContent}function insertBefore(e,t){t&&t.parentNode.insertBefore(e,t)}function insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)}function touchHandler(e){if(!(e.changedTouches&&1<e.changedTouches.length)){e.preventDefault();var t=e.changedTouches[0],i="";switch(e.type){case"touchstart":i="mousedown";break;case"touchmove":i="mousemove";break;case"touchend":i="mouseup";break;default:return}e=document.createEvent("MouseEvents");e.initMouseEvent(i,!0,!0,window,1,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(e)}}function initIphone(e){e.addEventListener("touchstart",touchHandler,!0),e.addEventListener("touchmove",touchHandler,!0),e.addEventListener("touchend",touchHandler,!0),e.addEventListener("touchcancel",touchHandler,!0)}TacticsUI=function(e){this.board=e,this.board.addUpdatePieceEndOfMovesListener(this),this.board.addUpdatePieceHaveAltListener(this),this.board.addUpdatePieceWrongMoveListener(this),this.board.addUpdatePieceAllowMoveListener(this),this.board.addUpdatePieceListener(this),this.userId=0,this.problemId=-1,this.firstProblem=!0,this.autoForward=!0},TacticsUI.prototype.updateAllowMoveCallback=function(e,t,i,s,o,n,r,a,l,h){0==this.problemFirstMoveDate&&(this.problemFirstMoveDate=(new Date).getTime())},TacticsUI.prototype.handleAlt=function(e){var t=_js("That");e&&e.SAN&&(t=Board.moveToLocale(e.SAN)),this.showProblemStatus(_js("Keep Looking"),__js("{ALTERNATIVE_MOVE} was a good move, but not the computer's first choice.<br/> Please keep looking for another move.",[["ALTERNATIVE_MOVE",t]])),this.aCount++},TacticsUI.prototype.updateHaveAltCallback=function(e,t,i,s,o,n,r,a,l,h){},TacticsUI.prototype.updateWrongMoveCallback=function(e,t,i,s,o,n,r,a,l,h){var u,c;h.isAlt?this.handleAlt(h):(this.autoForward=!1,this.problemActive&&(u=!1,this.session&&(u=1==this.session.continueFailed),c=Math.round(h.moveNum/2),h=Move.columnToChar(t.column)+""+(t.row+1)+Move.columnToChar(i)+(s+1),h+="|"+this.board.makeShortAlgabraic(t.column,t.row,i,s),this.markProblem(!1,u,c,h)))},TacticsUI.prototype.updatePieceCallback=function(e,t,i,s,o,n,r,a,l,h){this.problemActive&&this.hideProblemStatus();var u=new Object;return u.ignoreRetVal=!0,u},TacticsUI.prototype.updateEndOfMovesCallback=function(e,t,i,s,o,n,r,a,l){var h;this.problemActive&&(h=0,this.session&&1==this.session.continueCorrect&&(h=1),this.markProblem(!0,h,"NULL","NULL"))},TacticsUI.prototype.setLastProblemId=function(e){!this.displayMode&&0<=e&&(YAHOO.util.Dom.get("lastProbField").innerHTML="&nbsp;"+__js('Last Problem: <a href="/chess-problems/{LAST_PROBLEM_ID}">{LAST_PROBLEM_ID}</a>',[["LAST_PROBLEM_ID",e]]))},TacticsUI.prototype.updateSessionDisplay=function(e,t){var i=YAHOO.util.Dom.get("numCorrect"),s=YAHOO.util.Dom.get("numIncorrect");i&&(i.innerHTML=e+"&nbsp;",s.innerHTML=t+"&nbsp;")},TacticsUI.prototype.initProblemCompleteOverlay=function(){this.problemCompleteOverlay=new YAHOO.widget.Module("problemCompleteOverlay",{visible:!0,draggable:!1,iframe:!0}),this.problemCompleteOverlay.render()},TacticsUI.prototype.hideProblemComplete=function(){this.problemCompleteOverlay.hide()},TacticsUI.prototype.updateProblemCompleteRating=function(e,t,i,s,o,n,r,a,l,h,u){var c,d;!isNaN(0)&&loginManager.isLoggedIn()?(0<r?d="+"+r:(d=r)<0&&e&&(c=YAHOO.util.Dom.get("correctHeaderInner"))&&YAHOO.util.Dom.addClass(c,"problems-correct-lost-points"),n=o+" ("+(n=0<n?"+"+n:n)+")",s="<div>"+__js("User: {USER_RATING_CHANGE}",[["USER_RATING_CHANGE",d=s+" ("+d+")"]])+"</div>",s+="<div>"+__js("Problem: {PROBLEM_RATING_CHANGE}",[["PROBLEM_RATING_CHANGE",n]])+"</div>",u&&(n=d="",a&&(n=" ("+__js("{EXTRA_MOVES} extra",[["EXTRA_MOVES",a]])+")"),h&&(d="<div>"+(h=Math.round(1e4*parseFloat(h))/100)+"%"+n+"</div>"),l?(s+="<div>",s+=__js("Moves: {TOTAL_MOVES} (+{EXTRA_MOVES})",[["TOTAL_MOVES",u],["EXTRA_MOVES",l]])):(s+="<div>",s+=__js("Moves:{TOTAL_MOVES}
1 (Perfect!)",[["TOTAL_MOVES",u]])),s+="</div>",s+=d),this.problemCompleteOverlay.setBody(s)):this.problemCompleteOverlay.setBody('<div style="text-align:left;">'+_js('<a href="/registration.html">Register</a> for free, then login to: <br/><ul><li>Get a tactics rating</li><li>Receive problems targeted at your current ability level</li><li>Choose between blitz and standard modes</li><li>Change board and piece styles</li><li>Track your progress via stats and graphs</li></ul>')+"</div>"),this.problemCompleteOverlay.render(),this.problemCompleteOverlay.show(),this.stopClock=!0,this.problemCompleteOverlay},TacticsUI.prototype.showProblemComplete=function(e,t){this.board.puzzle||(e?this.problemCompleteOverlay.setHeader('<div id="correctHeader"><div id="correctHeaderInner">'+_js("Last Problem: Correct")+"</div></div>"):this.problemCompleteOverlay.setHeader('<div id="wrongHeader">'+_js("Last Problem: Failed")+"</div>"),this.problemCompleteOverlay.setBody(""),this.problemCompleteOverlay.show())},TacticsUI.prototype.showProblemStatus=function(e,t){this.problemCompleteOverlay?(this.problemCompleteOverlay.setHeader('<div id="neutralHeader">'+e+"</div>"),this.problemCompleteOverlay.setBody(t),this.problemCompleteOverlay.show()):alert(t)},TacticsUI.prototype.hideProblemStatus=function(){this.problemCompleteOverlay&&this.problemCompleteOverlay.hide()},TacticsUI.prototype.setProblemInactive=function(e){this.problemActive=!1,e||(this.board.fullmoveArray&&(e=YAHOO.util.Dom.get("computer"),YAHOO.util.Dom.setStyle(e,"visibility","visible")),YAHOO.util.Dom.setStyle("board-moves","display","block"),YAHOO.util.Dom.setStyle("board-position-moves","display","block"),YAHOO.util.Dom.setStyle("board-position-moves","visibility","visible"),YAHOO.util.Dom.setStyle(this.board.boardName+"-nav-buttons-only","display","inline"),this.problem.isEndgame?(YAHOO.util.Dom.setStyle("board-moves","height","auto"),YAHOO.util.Dom.setStyle("board-position-moves","height","auto"),YAHOO.util.Dom.setStyle("board-moves","overflow","visible"),YAHOO.util.Dom.setStyle("board-position-moves","overflow","visible")):(YAHOO.util.Dom.setStyle("board-moves","height","400px"),YAHOO.util.Dom.setStyle("board-position-moves","height","auto")),1<this.problemSet?(YAHOO.util.Dom.setStyle("problemDetailsDisplay","display","block"),YAHOO.util.Dom.setStyle("problemDetailsDisplay","visibility","visible"),YAHOO.util.Dom.setStyle("ratedDetailsDisplay","display","none")):(YAHOO.util.Dom.setStyle("ratedDetailsDisplay","display","none"),YAHOO.util.Dom.setStyle("problemDetailsDisplay","display","block"),YAHOO.util.Dom.setStyle("problemDetailsDisplay","visibility","visible")),YAHOO.util.Dom.setStyle("unratedDetailsDisplay","display","block"),this.problem.isEndgame||YAHOO.util.Dom.setStyle("tags","display","block"),this.problem.comments.showCommentsDisplay(),YAHOO.util.Dom.setStyle("mistakesContainer","display","block"),YAHOO.util.Dom.get("showFen")&&YAHOO.util.Dom.setStyle("fenContainer","display","block"),YAHOO.util.Dom.setStyle("ratingdiv","display","block"))},TacticsUI.prototype.processMarkSession=function(e){this.board.tlf=0,this.sessionEnd&&(this.firstProblem=!0,this.sessionEnd=!1,this.notifySessionEnd()),"true"==e.session_expired&&(loginManager.session&&(loginManager.session.userid=""),loginManager.getSessionDetails())},TacticsUI.prototype.processActiveProblemSetDetails=function(e){for(var t=0;t<e.length&&e[t].problem_set_id!=this.problemSet;t++);},TacticsUI.prototype.processMarkDisplay=function(e,t){var i,s,o,n,r=e.prob_rating_change,a=e.rating_change,l=e.new_user_rating,h=e.new_prob_rating;this.setProblemRating(h),0!=l&&(n=o=s=i=0,e.endgame_resp&&(n=e.weight,i=e.endgame_resp.suboptimal_total,o=e.endgame_resp.suboptimal_moves_total,s=e.endgame_resp.total_moves,e.prob_ratings&&this.problem.setProblemDetails(e.prob_ratings,!0)),this.updateProblemCompleteRating(t,e.ratings,e.prob_ratings,l,h,r,a,i,o,n,s),this.setUserRating(e.ratings)),YAHOO.util.Dom.get("numCorrect"),YAHOO.util.Dom.get("numIncorrect"),this.updateSessionDisplay(e.num_correct,e.numIncorrect)},TacticsUI.prototype.processMarkProblemResponse=function(e,t,i,s){!this.problem.isEndgame&&this.tacticMarked||(this.tacticMarked=!0,this.board.showSolutionButton?(YAHOO.util.Dom.setStyle("showSolution","display","inline"),YAHOO.util.Dom.setStyle("hideSolution","display","none"),YAHOO.util.Dom.setStyle(this.board.boardName+"-nav-buttons-only","display","inline")):(YAHOO.util.Dom.setStyle("showSolution","display","none"),YAHOO.util.Dom.setStyle("hideSolution","display","none"),this.board.displayPendingMoveList(),this.problem.showProblemId(),this.problem.showSourceGame()),this.processMarkSession(e),this.processMarkDisplay(e,i),this.sessionToEnd?(this.notifySessionEnd(),this.sessionToEnd=!1):s&&this.problem.getProblem(),this.doLogout&&(loginManager.doLogout(),this.doLogout=!1),this.problemSet=t)},TacticsUI.prototype.showComplete=function(e,t){var i=(i=YAHOO.util.Dom.get("problemState"))||YAHOO.util.Dom.get(this.board.boardName+"-problemState");this.setProblemInactive(t),this.showProblemComplete(e),e=e?(i.src=this.board.boardImagePath+"/images/tick.vers"+SITE_VERSION+".gif",i.alt=_js("Problem Correct"),i.title=_js("Problem Correct"),1):(i.src=this.board.boardImagePath+"/images/cross.vers"+SITE_VERSION+".gif",i.alt=_js("Problem Failed"),i.title=_js("Problem Failed"),0),i&&YAHOO.util.Dom.setStyle(i,"display","inline")},TacticsUI.prototype.calcUsed=function(e,t,i,s){var o=new Date,n=parseInt((o.getTime()-this.problemStartDate)/1e3),r=0;this.problemFirstMoveDate&&(r=parseInt((o.getTime()-this.problemFirstMoveDate)/1e3));o=new Object;return o.secondsUsedAfterFirstMove=r,o.secondsUsed=n,o},TacticsUI.prototype.getProblemType=function(){var e,t=0;return(e=this.problem.isEndgame?YAHOO.util.Dom.get("EndgameProblemSetTreeValue"):YAHOO.util.Dom.get("ProblemSetTreeValue"))&&(t=parseInt(e.value)),t},TacticsUI.prototype.tryMarkProblem=function(tries,eg,pc,used,wrongMoveNum,wrongMove,rating,correct,getNextProblem,problemId,userId,problemRnum,aCount,currentProblemSet,tlf){if(5<tries)return YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden"),void alert(_js("Unable to contact server. Please try again later."));YAHOO.util.Dom.setStyle("busyDiv","visibility","visible"),YAHOO.util.Connect.asyncRequest("POST","/requests/mark_problem.php",{success:function(o){YAHOO.util.Dom.setStyle("busyDiv","visibility","hidden");var root=eval("("+o.responseText+")");if(root.errorResult){var errorResult=parseInt(root.errorResult);if(10==errorResult)return void this.tryMarkProblem(tries,eg,pc,used,wrongMoveNum,wrongMove,rating,correct,getNextProblem,problemId,userId,problemRnum,aCount,currentProblemSet,tlf)}this.processMarkProblemResponse(root,rating,correct,getNextProblem)},failure:function(e){this.tryMarkProblem(tries+1,eg,pc,used,wrongMoveNum,wrongMove,rating,correct,getNextProblem,problemId,userId,problemRnum,aCount,currentProblemSet,tlf),YAHOO.log("Failed:"+e.statusText)},scope:this,timeout:1e4},"isEndgame="+eg+"&problemCorrect="+pc+"&problemId="+problemId+"&secondsUsed="+used.secondsUsed+"&secondsUsedAfterFirstMove="+used.secondsUsedAfterFirstMove+"&userId="+userId+"&problemRnum="+problemRnum+"&ac="+aCount+"&currentRatingType="+currentProblemSet+"&wrongMoveNum="+wrongMoveNum+"&wrongMove="+wrongMove+"&lf="+tlf+"&newRatingType="+rating)},TacticsUI.prototype.markProblem=function(e,t,i,s){var o,n,r,a;this.stopClock=!0,this.showComplete(e,this.board.showSolutionButton),this.board.puzzle||(o=this.calcUsed(),n=this.getProblemType(),this.problemMarked=!1,r=e?
11:0,a=0,this.problem.isEndgame&&(a=1),this.tryMarkProblem(0,a,r,o,i,s,n,e,t,this.problemId,this.userId,this.problemRnum,this.aCount,this.currentProblemSet,this.board.tlf))},TacticsUI.prototype.getEgBlitzTimeLeft=function(){var e=new Date,e=parseInt((e.getTime()-this.problemStartDate)/1e3);return e-=this.opponentSeconds,this.blitzAllowedSeconds-e},TacticsUI.prototype.updateTime=function(){var e=YAHOO.util.Dom.get("clock"),t=new Date,i=parseInt((t.getTime()-this.problemStartDate)/1e3);this.problemActive||(this.stopClock=!0),this.blitzingProblem&&(i-=this.opponentSeconds,(i=this.blitzAllowedSeconds-i)<0&&(i=0,this.stopClock=!0,this.problemActive&&this.failProblem()));var s=parseInt(i/60),t=parseInt(i%60);minutes=s<10?"0"+s:s,seconds=t<10?"0"+t:t;var o,t="black";this.blitzingProblem&&0==i&&(t="red"),YAHOO.util.Dom.setStyle("clock","border-color",t),e.innerHTML='<span id="minutes">'+minutes+'</span>:<span id="seconds">'+seconds+"</span>",this.stopClock?this.stopClock=!1:(o=this,setTimeout(function(){o.updateTime()},1e3))},TacticsUI.prototype.setUserRating=function(e){for(var t=0;t<e.length;t++){var i=YAHOO.util.Dom.get(e[t].problem_set_name);i&&(i.innerHTML=e[t].rating)}},TacticsUI.prototype.setProblemRating=function(e){var t=YAHOO.util.Dom.get("problemRating");this.problemActive?YAHOO.util.Dom.setStyle("problemRatingDisplay","display","none"):YAHOO.util.Dom.setStyle("problemRatingDisplay","display","block"),t.innerHTML=e,this.problemRating=e},TacticsUI.prototype.setProblemAvSeconds=function(e){var t=YAHOO.util.Dom.get("problemAvSeconds");this.problemActive?YAHOO.util.Dom.setStyle("problemAvSecondsDisplay","display","none"):YAHOO.util.Dom.setStyle("problemAvSecondsDisplay","display","block"),t.innerHTML=e,this.avSeconds=e},TacticsUI.prototype.setProblemAvScore=function(e){var t=YAHOO.util.Dom.get("problemAvScore");this.problemActive?YAHOO.util.Dom.setStyle("problemAvScoreDisplay","display","none"):YAHOO.util.Dom.setStyle("problemAvScoreDisplay","display","block"),t.innerHTML=e,this.avScore=e},TacticsUI.prototype.setProblemAvTotalMoves=function(e){var t=YAHOO.util.Dom.get("problemAvTotalMoves");this.problemActive?YAHOO.util.Dom.setStyle("problemAvTotalMovesDisplay","display","none"):YAHOO.util.Dom.setStyle("problemAvTotalMovesDisplay","display","block"),t.innerHTML=e,this.avTotalMoves=e},TacticsUI.prototype.setProblemAttempts=function(e){var t=YAHOO.util.Dom.get("problemAttempts");this.problemActive?YAHOO.util.Dom.setStyle("problemAttemptsDisplay","display","none"):YAHOO.util.Dom.setStyle("problemAttemptsDisplay","display","block"),t.innerHTML=e,this.problemAttempts=e},TacticsUI.prototype.setProblemPercentSuccess=function(e){var t=YAHOO.util.Dom.get("problemPercentSuccess");this.problemActive?YAHOO.util.Dom.setStyle("problemPercentSuccessDisplay","display","none"):YAHOO.util.Dom.setStyle("problemPercentSuccessDisplay","display","block"),t.innerHTML=e+"%",this.problemPercentSuccess=e},TacticsUI.prototype.setProblemId=function(e){this.problemId=e},TacticsUI.prototype.setProblemRnum=function(e){this.problemRnum=e},TacticsUI.prototype.notifySessionEnd=function(){YAHOO.util.Connect.asyncRequest("POST","/requests/end_session.php",{success:function(e){YAHOO.util.Dom.setStyle("endedSessionInfo","display","block")},failure:function(e){YAHOO.log("end session failed:"+e.statusText)},scope:this},"userid="+this.userId)},TacticsUI.prototype.endSession=function(e){YAHOO.util.Dom.get("endSession").checked?(this.sessionToEnd=!0,this.preEndSessionAutoForward=this.autoForward,this.autoForward=!1):(this.sessionToEnd=!1,this.autoForward=this.preEndSessionAutoForward)},TacticsUI.prototype.failProblem=function(){this.problemActive&&!this.board.puzzle&&(YAHOO.util.Dom.setStyle(this.board.boardName+"-ms0","visibility","visible"),this.problem.makeScoresVisible(),this.markProblem(!1,!1,"NULL","NULL"))},TacticsUI.prototype.giveUpProblem=function(e){this.failProblem()},TacticsUI.prototype.playBlitz=function(e){var t;this.problemActive&&(this.problemFirstMoveDate?alert(_js("You can only choose to blitz a problem before the first move")):parseInt(((new Date).getTime()-this.problemStartDate)/1e3)<(t=Math.max(60,3*(this.problem.fastestMate+1)+10))-5?(this.blitzingProblem=!0,0==this.blitzAllowedSeconds&&(this.blitzAllowedSeconds=t)):alert(_js("You would have less than 5 seconds left to solve the problem. Blitz mode not allowed.")))},TacticsUI.prototype.playBest=function(e){this.board.blockFowardBack||this.board.deferredBlockForwardBack||this.problemActive&&(0==this.problemFirstMoveDate&&(this.problemFirstMoveDate=(new Date).getTime()),this.blitzingProblem?alert(_js("Play best cannot be used when blitzing a problem")):(this.board.deferredBlockForwardBack=!0,this.board.toggleToMove(),this.board.updateToPlay(),this.problem.processEndgame("",!0,!1,!0)))},TacticsUI.prototype.nextProblem=function(e){this.problemActive||(this.problemCompleteOverlay.hide(),YAHOO.util.Event.removeListener("nextProblem","click",this.nextProblem),this.problemActive?(this.autoForward=!1,this.markProblem(!1,!0,"NULL","NULL")):(this.autoForward=!0,this.problem.getProblem()))},TacticsUI.prototype.loginCallback=function(e,t){var i=e.problemSet;t.problem.isEndgame&&(i=e.endgameProblemSet);e=YAHOO.util.Dom.get("ProblemSetTreeValue");e&&(e.value=i),t.problemActive=!1},TacticsUI.prototype.logoutCallback=function(e,t){t.problemActive?(t.autoForward=!1,t.firstProblem=!0,t.doLogout=!0,t.markProblem(!1,!1,"NULL","NULL")):loginManager.doLogout()},TacticsUI.prototype.setUserId=function(e){this.userId=e},TacticsUI.prototype.leavingPage=function(e){this.problemActive&&(self.firstProblem=!0,this.autoForward=!1,this.markProblem(!1,!1,"NULL","NULL"))},TacticsUI.prototype.checkLeavingPage=function(e){if(this.problemActive){var t=_js("If you leave the page you will fail the current problem.");return(e=e||window.event)&&(e.returnValue=t),t}},TacticsUI.prototype.setupEventHandlers=function(){YAHOO.util.Event.addListener("endSession","click",this.endSession,this,!0)},PgnViewer=function(e,t){var i=new BoardConfig;
1e&&i.applyConfig(e),window._pvObject||(window._pvObject=new Array),window._pvObject[i.boardName]=this,(e=i).pgnMode=!0,e.scrollVariations=!0,this.chessapp=new ChessApp(e),this.finishedCallback=t,e.loadImmediately?(this.chessapp.init(null,null,null,this,!0),this.board=this.chessapp.board):YAHOO.util.Event.onDOMReady(this.setup,this,!0)},PgnViewer.prototype.setup=function(){this.chessapp.init(null,null,null,this,!0),this.board=this.chessapp.board},PgnViewer.prototype.updatePieceCallback=function(e,t,i,s,o,n,r,a,l,h,u,c){var d=new Object,m=u,p=!1,u=Board.getVarMove(m,s,i,t,e);return m.fromColumn!=t.column||m.fromRow!=t.row||m.toRow!=s||m.toColumn!=i||""!=e&&e!=m.promotion?u&&(m=u,p=!0):p=!0,d.move=m,d.allowMove=p,d.dontMakeOpponentMove=!1,d},PgnViewer.prototype.setupFromPgn=function(e,t){this.chessapp.pgn.setupFromPGN(e,t)},PgnViewer.prototype.setupFromFen=function(e,t,i,s){this.chessapp.pgn.board.setupFromFen(e,t,i,s)},PGNGame=function(e,t,i,s,o,n,r,a,l,h,u,c,d){this.movesseq=e,this.startFen=t,this.blackPlayer=i,this.whitePlayer=s,this.pgn_result=o,this.event=n,this.site=r,this.date=a,this.round=l,this.start_movenum=h,this.whitePlayerElo=u,this.blackPlayerElo=c,this.eco=d},PGN=function(e){this.board=e,this.pgnGames=new Array,this.lastShownGame=0},PGN.prototype.pollPGNFromURL=function(e,t,i){var s=this;this.getPGNFromURL(e,t),this.foundResult&&(i=this.board.pollPGNMillisecondsPostResult,this.foundResultPolls++),this.foundResultPolls>=this.board.numberPollsAfterResult?this.finishedPolling=!0:(this.pollTime=i,this.lastPoll=(new Date).getTime(),setTimeout(function(){s.pollPGNFromURL(e,t,i)},i))},PGN.prototype.getPGNFromURL=function(url,gotoEnd){var randString=(new Date).getTime()+"-"+parseInt(99999*Math.random());YAHOO.util.Connect.asyncRequest("GET",url+"?rs="+randString,{success:function(o){var resTag="",site="",moveText="",re=eval("/\\n[^[]/");0<=o.responseText.indexOf("\r")&&eval("/\\r[^[]/");var ind=o.responseText.search(re),ind2;0<=ind&&(moveText=o.responseText.substring(ind)),re=eval("/\\[Result /"),0<=(ind=o.responseText.search(re))&&(ind2=o.responseText.indexOf("\n",ind),ind2<0&&(ind2=o.responseText.indexOf("\r",ind)),0<=ind2&&(resTag=o.responseText.substring(ind,ind2)));var ind2,re=eval("/\\[Site /"),whiteClock,blackClock,ss,whiteTime,blackTime,siteDiv;0<=(ind=o.responseText.search(re))&&(ind2=o.responseText.indexOf("]",ind),0<=ind2&&(site=o.responseText.substring(ind+6,ind2-1))),site&&(this.board.fideClock?(whiteClock=YAHOO.util.Dom.get(this.board.boardName+"-whitePlayerClock"),blackClock=YAHOO.util.Dom.get(this.board.boardName+"-blackPlayerClock"),ss=site.split("-"),whiteTime=ss[0],blackTime="0",'"'==whiteTime.charAt(0)&&(whiteTime=whiteTime.substr(1)),1<ss.length&&(blackTime=ss[1]),whiteClock&&(whiteClock.innerHTML=whiteTime),blackClock&&(blackClock.innerHTML=blackTime)):(siteDiv=YAHOO.util.Dom.get(this.board.boardName+"-site"),siteDiv&&(siteDiv.innerHTML=site))),this.currentMoveText==moveText&&this.currentResultTag==resTag||(this.currentMoveText=moveText,this.currentResultTag=resTag,this.setupFromPGN(o.responseText,gotoEnd))},failure:function(e){this.board.hidePGNErrors||alert("pgn load failed:"+e.statusText+" for file:"+url)},scope:this},"rs2="+randString)},PGN.prototype.getMoveFromPGNMove=function(e,t,i){var s=null,o=!1,n=null;if("#"==e.charAt(e.length-1)?e=e.substr(0,e.length-1):"+"==e.charAt(e.length-1)&&(e=1<e.length&&"+"==e.charAt(e.length-2)?e.substr(0,e.length-2):e.substr(0,e.length-1)),"O-O-O"==e)return"w"==t?this.board.createMoveFromString("e1c1"):this.board.createMoveFromString("e8c8");if("O-O"==e)return"w"==t?this.board.createMoveFromString("e1g1"):this.board.createMoveFromString("e8g8");var r,a=e.indexOf("=");0<=a&&(r=(s=e.substr(a+1,1)).charAt(0),this.board.pieceCharToPieceNum(r),e=e.substr(0,a));a=e.charAt(e.length-1);"Q"!=a&&"R"!=a&&"N"!=a&&"B"!=a||(s=a+"",this.board.pieceCharToPieceNum(s),e=e.substr(0,e.length-1));var a=e.substr(e.length-2,2),l=a.charCodeAt(0)-"a".charCodeAt(0),h=a.charCodeAt(1)-"1".charCodeAt(0);if(7<l||l<0||7<h||h<0)return this.lastMoveFromError=__js("Error processing to Square:{TO_SQUARE} on move:{MOVE}",[["TO_SQUARE",a],["MOVE",e]]),null;2<e.length&&(n="x"==e.charAt(e.length-3)?(o=!0,e.substr(0,e.length-3)):e.substr(0,e.length-2));var u=new Array,c=0,d=null,m="w"==t?ChessPiece.WHITE:ChessPiece.BLACK;switch(e.charAt(0)){case"K":case"k":d=ChessPiece.KING;break;case"Q":case"q":d=ChessPiece.QUEEN;break;case"R":case"r":d=ChessPiece.ROOK;break;case"B":d=ChessPiece.BISHOP;break;case"N":case"n":d=ChessPiece.KNIGHT;break;case"P":case"p":d=ChessPiece.PAWN;break;default:d=ChessPiece.PAWN}var p=null,g=null;if(n){t=n.toLowerCase().charAt(0);if(t==n.charAt(0)&&"a"<=t&&t<="h")g=t,2==n.length&&(p=n.charAt(1));else if(1<n.length)if(2==n.length){var v=n.charAt(1);"1"<=v&&v<="8"?p=v:g=v}else{if(3!=n.length)return this.lastMoveFromError=__js("Error: unhandled fromChars:{FROM_CHARS}",[["FROM_CHARS",n]]),null;g=n.charAt(1),p=n.charAt(2),"1"<=g&&g<="9"&&(v=g,g=p,p=v)}}for(var f=0;f<8;f++)for(var b=0;b<8;b++){var y,O,_=this.board.boardPieces[f][b];null!=_&&_.colour==m&&_.piece==d&&this.board.canMove(_,l,h,i,!0)&&(y=String.fromCharCode("a".charCodeAt(0)+f).charAt(0),O=String.fromCharCode("1".charCodeAt(0)+b).charAt(0),null!=g&&g!=y||null!=p&&p!=O||(u[c++]=_))}if(0==c)return this.lastMoveFromError=__js("no candidate pieces for:{MOVE}",[["MOVE",e]]),null;if(1<c)return this.lastMoveFromError=__js("Ambiguous:{MOVE} with fromChars:{FROM_CHARS} disambigRow:{DISAMBIG_ROW} disambigCol:{DISAMBIG_COL}",[["MOVE",e],["FROM_CHARS",n],["DISAMBIG_ROW",p],["DISAMBIG_COL",g]]),null;e=u[0],n="";return n+=String.fromCharCode("a".charCodeAt(0)+e.column),n+=String.fromCharCode("1".charCodeAt(0)+e.row),o&&(n+="x"),n+=a,s&&(n+=s),this.board.createMoveFromString(n)},PGN.prototype.parseTag=function(e,t,i){if(t.substr(i,e.length+3)=="["+e+' "'){var s=t.indexOf('"',i+e.length+3);if(0<=s)return t.substring(i+e.length+3,s)}return null},PGN.prototype.parsePGN=function(e,t,i){ctime&&console.time("parsePGN"),e=(e=e.replace(/&nbsp;/g," ")).replace(/^\s+|\s+$/g,""),this.pgn=e;e=new Array;this.pgnGames=new Array,this.finishedParseCallback=t,this.startParseTime=(new Date).getTime();e=this.parsePGN_cont(e,1,0,0,i),i=new Object;return e?(i.parsedOk=!1,i.errorString=e,i.pgnGames=null):(i.parsedOk=!0,i.pgnGames=this.pgnGames),ctime&&console.timeEnd("parsePGN"),i},PGN.prototype.parsePGN_cont=function(e,t,i,s,o){for(var n=this.pgn,r=this.board.boardName+"-progress",a=YAHOO.util.Dom.get(r);s<n.length;){var l="",h="",u="",c="",d="",m="?",p="",g="?",v="?",f="",b="w",y=0,O=(new Array,""),_=null,C=null,A=new Array,S=new Array,E=new Array,w=new Array,M=new Array;this.board.pieceMoveDisabled=!0,this.board.initialFen?this.board.startFen=this.board.initialFen:this.board.startFen="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";var P=0;for(P=s;P<n.length;P++){var D=this.parseTag("FEN",n,P);
1if(D&&"?"!=D?this.board.startFen=D:(D=this.parseTag("White",n,P))&&"?"!=D?p=D:(D=this.parseTag("Black",n,P))&&"?"!=D?h=D:(D=this.parseTag("Result",n,P))&&"?"!=D?l=D:(D=this.parseTag("Event",n,P))&&"?"!=D?u=D:(D=this.parseTag("Site",n,P))&&"?"!=D?c=D:(D=this.parseTag("Date",n,P))&&"?"!=D?d=D:(D=this.parseTag("Round",n,P))&&"?"!=D?m=D:(D=this.parseTag("WhiteElo",n,P))&&"?"!=D?g=D:(D=this.parseTag("BlackElo",n,P))&&"?"!=D?v=D:(D=this.parseTag("ECO",n,P))&&"?"!=D&&(f=D),"["!=n.charAt(P))if("{"!=n.charAt(P)){if("."==n.substr(P,1)){for(k=P-1;0<=k&&"0"<=n.charAt(k)&&n.charAt(k)<="9";)k--;k++,"0"<=n.charAt(k)&&n.charAt(k)<="9"&&(t=parseInt(n.substring(k,P)));break}}else{if(!(0<=(Y=n.indexOf("}",P+1))))return U=_js("PgnViewer: Error parsing PGN. Found unclosed {"),this.finishedParseCallback&&this.finishedParseCallback(o,U),U;N=n.substring(P+1,Y),P=Y,O+="{ "+N+" } "}else{for(k=P+1;k<n.length&&"]"!=n.charAt(k);k++);if(k==n.length)return U=_js("PgnViewer: Error parsing PGN. Found unclosed ["),this.finishedParseCallback&&this.finishedParseCallback(o,U),U;P=k-1}}n.substr(P,1),this.board.prev_move=null,this.board.setupFromFen(this.board.startFen,!1,!1,!0,!0),_=this.board.prev_move;for(var H=P,T=null;P<n.length;P++){var I=-1;if("1-0"==n.substr(P,3)||"0-1"==n.substr(P,3)?I=3:"1/2-1/2"==n.substr(P,7)?I=7:"*"==n.substr(P,1)&&(I=1),0<I){T=n.substr(P,I),s=P+I;break}if("["==n.charAt(P)){s=P;break}if(" "!=n.charAt(P)&&"\t"!=n.charAt(P)&&"\n"!=n.charAt(P)&&"\r"!=n.charAt(P)){if(!("0"<=n.charAt(P)&&n.charAt(P)<="9"))if("."==n.charAt(P)){for(n.substring(H,P).replace(/^\s+|\s+$/g,""),H=P;P+1<n.length&&"."==n.charAt(P+1);)P++;b=H!=P?"b":"w",H=P+1}else if("{"==n.charAt(P)){var N,Y=n.indexOf("}",P+1);0<=Y&&(N=n.substring(P+1,Y),P=Y,O+="{ "+N+" } "),H=P+1}else if("("==n.charAt(P))A[y]=this.board.boardPieces,S[y]=b,w[y]=_,M[y]=C,this.board.boardPieces=E[y],this.board.boardPieces=this.board.copyBoardPieces(!1),_=C,y++,H=P+1,O+="(";else if(")"==n.charAt(P))boardPool.putObject(A[y]),y--,this.board.boardPieces=A[y],b=S[y],_=w[y],C=M[y],H=P+1,O+=") ";else if("$"!=n.charAt(P)){for(var x=-1,k=P+1;k<n.length;k++)if(")"==n.charAt(k)||"("==n.charAt(k)||"{"==n.charAt(k)||"}
1"==n.charAt(k)||" "==n.charAt(k)||"\t"==n.charAt(k)||"\n"==n.charAt(k)||"\r"==n.charAt(k)){x=k;break}-1==x&&(x=n.length);var I=H,L=n.substring(H,x).replace(/^\s+|\s+$/g,"");if(P=(H=x)-1,!(4<=L.length&&"e.p."==L.substring(0,4))){if(0==L.length)return U=__js("PgnViewer: Error: got empty move endMoveInd:{ENDMOVE_INDEX} upto:{UPTO} from:{FROM}",[["ENDMOVE_INDEX",x],["UPTO",I],["FROM",n.substr(I)]]),this.finishedParseCallback&&this.finishedParseCallback(o,U),U;for(var B=L.length-1;0<=B;)if("?"==L.charAt(B))B--;else{if("!"!=L.charAt(B))break;B--}var I=L.substring(0,B+1),R=this.getMoveFromPGNMove(I,b,_);if(null==R)return O+="unknown ",U=__js("PgnViewer: Error parsing:{MOVE}, {ERROR_REASON}",[["MOVE",L],["ERROR_REASON",this.lastMoveFromError]]),this.finishedParseCallback&&this.finishedParseCallback(o,U),U;C=_,_=R;I=this.board.boardPieces[R.fromColumn][R.fromRow];boardPool.putObject(E[y]),E[y]=this.board.copyBoardPieces(!1),I&&this.board.makeMove(R,I,!1,.5,!1,!1),b=this.board.flipToMove(b),O+=R.moveString+"|"+L+" "}}else{for(k=P+1;k<n.length&&"0"<=n.charAt(k)&&n.charAt(k)<="9";k++);if(--k>P){R=parseInt(n.substr(P+1,k+1));if(R<=9)switch(R){case 1:O=O.substr(0,O.length-1)+"! ";break;case 2:O=O.substr(0,O.length-1)+"? ";break;case 3:O=O.substr(0,O.length-1)+"!! ";break;case 4:O=O.substr(0,O.length-1)+"?? ";break;case 5:O=O.substr(0,O.length-1)+"!? ";break;case 6:O=O.substr(0,O.length-1)+"?! "}else O+=n.substring(P,k+1)+" ";P=k}}}else H=P+1}s<P&&(s=P);var F=n.indexOf("{",s),z=n.indexOf("[",s);if(0<=F&&(-1==z||F<z)){z=n.indexOf("}",F+1);if(!(0<=z)){var U=_js("PgnViewer: Error: Unclosed {");return this.finishedParseCallback&&this.finishedParseCallback(o,U),U}s=z+1,O+="{ "+(N=n.substring(F+1,z))+" } "}if(O=O.replace(/^\s+|\s+$/g,""),this.board.pieceMoveDisabled=!1,null!=T&&(0!=l.length&&"?"!=l||(l=T)),this.board.ignoreMultipleGames&&T&&l&&"*"==l&&"*"!=T&&"?"!=T&&""!=T&&(l=T),this.pgnGames[i++]=new PGNGame(O,this.board.startFen,h,p,l,u,c,d,m,t,g,v,f),a&&(a.innerHTML="Loaded "+i+" games"),this.board.ignoreMultipleGames)break;if(this.finishedParseCallback&&500<(new Date).getTime()-this.startParseTime)return this.startParseTime=(new Date).getTime(),void setTimeout('window._pvObject["'+this.board.boardName+'"].chessapp.pgn.parsePGN_cont("'+e+'","'+t+'","'+i+'","'+s+'",'+o+");",0)}return this.finishedParseCallback&&this.finishedParseCallback(o),!1},PGN.prototype.setupFromPGN=function(e,t){this.parsePGN(e,this.setupFromPGNCallback,t)},PGN.prototype.setupFromPGNCallback=function(e,t){var s=this.board.boardName+"-progress",o=YAHOO.util.Dom.get(s);if(t)return this.board.hidePGNErrors||((a=YAHOO.util.Dom.get(this.board.boardName+"-pgnError"))?a.innerHTML=t:alert(t)),!1;if(0==this.pgnGames.length)return this.board.hidePGNErrors||alert("PgnViewer: Error: Unable to find any pgn games in:"+pgn),!1;if(1==this.pgnGames.length||this.board.ignoreMultipleGames)d=e?-1:0,this.showGame(0,d);else{var n=this.board.boardName+"-container",r=YAHOO.util.Dom.get(n),s=YAHOO.util.Dom.get(this.board.boardName+"-problemSelector"),a=document.createElement("div"),t='<form id="'+this.board.boardName+'-problemSelectorForm" action="" method="">',n='<select id="'+this.board.boardName+'-problemSelector" name="'+this.board.boardName+'-problemSelector" style="width: '+8*this.board.pieceSize+'px;">',l="";for(i=0;i<this.pgnGames.length;i++){var h=this.pgnGames[i],u=this.board.boardName+"-game-"+i,c=i+1+". "+h.whitePlayer+" vs "+h.blackPlayer;0<h.pgn_result.length&&"?"!=h.pgn_result&&1==this.board.showResult&&(c+=" "+h.pgn_result),0<h.event.length&&"?"!=h.event&&1==this.board.showEvent&&(c+=" "+h.event),0<h.round.length&&"?"!=h.round&&1==this.board.showRound&&(c+=" Rnd:"+h.round),0<h.site.length&&"?"!=h.site&&1==this.board.showSite&&(c+=" "+h.site),0<h.date.length&&"?"!=h.date&&1==this.board.showDate&&(c+=" "+h.date);h="";i==this.lastShownGame&&(h='selected=""'),l+="<option "+h+' id="'+u+'" value="'+i+'">'+c+"</option>"}s?this.board.selectorBody!=l&&(s.innerHTML=l,this.board.selectorBody=l):(t+=n+l+"</select></form>",a.innerHTML=t,r.insertBefore(a,r.firstChild),this.board.selectorBody=l),s=YAHOO.util.Dom.get(this.board.boardName+"-problemSelector"),YAHOO.util.Event.addListener(s,"change",this.selectGame,this,!0);var d=0,s=0;e&&(d=-1,s=this.lastShownGame),this.showGame(s,d)}o&&YAHOO.util.Dom.setStyle(o,"visibility","hidden"),window._pvObject[this.board.boardName].finishedCallback&&window._pvObject[this.board.boardName].finishedCallback()},PGN.prototype.selectGame=function(e){var t=YAHOO.util.Event.getTarget(e).selectedIndex,e=0;this.board.gotoEndOnRefresh&&(e=-1),this.showGame(t,e);e=this.board.boardName+"-piecestaken",e=YAHOO.util.Dom.get(e);e&&(e.innerHTML=""),this.board.resetMoveListScrollPosition()},PGN.prototype.showGame=function(e,t){t=void 0===t?0:t;var i=this.lastShownGame;this.lastShownGame=e;var s=this.board.moveArray,o=this.board.currentMove,n=!1;o&&o.atEnd&&(n=!0);var r=this.pgnGames[e],a=r.pgn_result;!a||"1/2-1/2"!=a&&"0-1"!=a&&"1-0"!=a?(this.foundResult=!1,this.foundResultPolls=0):this.foundResult=!0,this.board.startFen=r.startFen,this.board.setupFromFen(r.startFen,!1,!1,
1!1),this.board.setMoveSequence(r.movesseq,"NA",r.start_movenum,r.pgn_result);var l=!0,a=-1;e==i&&n&&(a=this.board.moveArray.length-1),Move.moveArraysEqual(s,this.board.moveArray)?(o=Move.findMoveInNewArray(s,this.board.moveArray,o))&&o.prev&&(a=o.prev.index):l=!1,this.board.displayPendingMoveList(),0<this.board.moveArray.length&&this.board.setCurrentMove(this.board.moveArray[0]),l?0<a&&a<this.board.moveArray.length&&(clog&&console.log("going to currMoveIndex:"+a),this.board.gotoMoveIndex(a,!1,!0)):(-1==t?0<=(h=this.board.moveArray.length-1)&&this.board.gotoMoveIndex(h,!1,!0):0!=t&&this.board.gotoMoveIndex(t),-1!=t&&this.board.autoplayFirst&&this.board.forwardMove()),this.board.displayMode=!0;var h=this.board.boardName,t=YAHOO.util.Dom.get(h+"-whitePlayer");t&&(t.innerHTML=r.whitePlayer);t=YAHOO.util.Dom.get(h+"-blackPlayer");t&&(t.innerHTML=r.blackPlayer);t=YAHOO.util.Dom.get(h+"-event");t&&(t.innerHTML=r.event);t=YAHOO.util.Dom.get(h+"-site");t&&(t.innerHTML=r.site);t=YAHOO.util.Dom.get(h+"-date");t&&(t.innerHTML=r.date);t=YAHOO.util.Dom.get(h+"-round");t&&(t.innerHTML=r.round);t=YAHOO.util.Dom.get(h+"-whiteElo");t&&(t.innerHTML=r.whitePlayerElo);t=YAHOO.util.Dom.get(h+"-blackElo");t&&(t.innerHTML=r.blackPlayerElo);h=YAHOO.util.Dom.get(h+"-result");h&&(h.innerHTML=r.pgn_result),clog&&(this.board.currentMove?console.log("after show game currentMove:"+this.board.currentMove.output()):console.log("after show game currentMove is null"))};var SITE_VERSION=1,clog=!1,ctime=!1,cprof=!1,move_obj_id_counter=0,activeBoard=null,boardSounds=new CTSound({soundPath:"/sounds"});window.console||(window.console={}),window.console.log||(window.console.log=function(){}),YAHOO.util.Event.onDOMReady(function(){
2}), BoardConfig=function(){
3this.boardName="board", this.puzzle = !1, this.showToMoveIndicators = !1, this.scrollVariations = !1, this.pgnString=null, this.pgnDiv=null, this.pgnFile=null, this.scrollOffsetCorrection=0, this.handleCommentClicks = !1, this.pollPGNMilliseconds=0, this.pollPGNMillisecondsPostResult=3e4, this.numberPollsAfterResult=5, this.gotoEndOnRefresh = !1, this.allowPreMoveSelection = !1, this.pieceSet="merida", this.newAnalysis = !1, this.pieceSize=46, this.isEndgame = !1, this.tr = !1, this.ie6FixCoordsOffsetSize=4, this.allIeFixCoordsOffsetSize=0, this.addVersion = !0, this.ignoreMultipleGames = !1, this.ml=9999, this.r = !1, this.g = !1, this.g2 = !1, this.canPasteFen = !1, this.makeActive = !1, this.showSolutionButton = !1, this.avoidMouseoverActive = !1, this.autoScrollMoves = !1, this.moveAnimationLength=.5, this.showBracketsOnVariation = !0, this.hideBracketsOnTopLevelVariation = !1, this.variationStartString="(", this.variationEndString=") ", this.ignoreCommentRegex=null, this.newlineForEachMainMove = !0, this.useDivClearForNewline = !1, this.showNPS = !1, this.squareColorClass="", this.analysisWindowName="analysis_window", this.pieceTakenSize=this.pieceSize, this.pauseBetweenMoves=800, this.pgnMode = !1, this.hidePGNErrors = !1, this.previewMode = !1, this.movesFormat="default", this.boardImagePath="https://chesstempo.com", this.showCoordinates = !1, this.highlightFromTo = !1, this.highlightValidSquares = !1, this.fideClock = !1, this.disableFlipper = !1, this.showResult=1, this.showEvent=1, this.showRound=1, this.showSite=1, this.showDate=1, this.ignoreFlipping = !1, this.reverseFlip = !1, this.autoplayFirst = !1, this.dontOutputNavButtons = !1, this.dontCheckLeavingPage = !1, this.clickAndClick = !1, this.clickAndClickDisabled = !1, this.whiteMoveSoundName="movePiece3", this.blackMoveSoundName="movePiece7", this.whiteTakeSoundName="takePiece1", this.blackTakeSoundName="takePiece1", this.finishedSoundName="finished", this.soundEnabled = !1, this.gamedb = !1
4}, BoardConfig.prototype.applyConfig=function(e){
5for (var t in e) this[t]=e[t]
6},ChessApp=function(e){this.displayMode=!1,this.config=e,this.board=null},ChessApp.prototype.setDisplayMode=function(e){this.displayMode=e},ChessApp.prototype.setProblemNumber=function(e,t){this.problemNumber=e,this.attId=t},ChessApp.prototype.init=function(e,t,i,s,o){ChessPiece.init(),this.board=new Board(this.config.boardName),o&&this.board.addUpdatePieceListener(s),this.board.moveArray=new Array,this.hideOnInit||(YAHOO.util.Dom.setStyle(this.config.boardName+"-container","display","block"),YAHOO.util.Dom.setStyle("toPlaySpan","display","inline")),this.tactics=this.displayMode||this.config.pgnMode||this.config.previewMode||this.config.fenBoard?null:new TacticsUI(this.board),this.problem=this.config.pgnMode||this.config.previewMode||this.config.fenBoard?null:new ProblemUI(this.board,this.tactics),this.board.tactics=this.tactics,this.board.problem=this.problem,this.board.puzzle=this.config.puzzle,this.problem&&(this.problem.autoPlayOpponent=1),this.pgn=this.config.pgnMode?new PGN(this.board):null;var r,n,s=MovesDisplay.DEFAULT_DISPLAY_TYPE;"main_on_own_line"==this.config.movesFormat&&(s=MovesDisplay.MAIN_ON_OWN_LINE),this.movesDisplay=new MovesDisplay(this.board,s),this.movesDisplay.variationOnOwnLine=this.config.variationOnOwnLine,this.board.movesDisplay=this.movesDisplay,this.board.boardImagePath=this.config.boardImagePath,this.board.showNPS=this.config.showNPS,this.board.showSolutionButton=this.config.showSolutionButton,this.board.analysisWindowName=this.config.analysisWindowName,this.board.squareColorClass=this.config.squareColorClass,this.board.tr=this.config.tr,this.board.scrollToBoardTop=this.config.scrollToBoardTop,this.board.ml=this.config.ml,this.board.r=this.config.r,this.board.g=this.config.g,this.board.g2=this.config.g2,this.board.canPasteFen=this.config.canPasteFen,this.board.addVersion=this.config.addVersion,this.board.ignoreMultipleGames=this.config.ignoreMultipleGames,this.board.ie6FixCoordsOffsetSize=this.config.ie6FixCoordsOffsetSize,this.board.allIeFixCoordsOffsetSize=this.config.allIeFixCoordsOffsetSize,this.board.allowingFreeMovement=this.config.allowingFreeMovement,this.board.autoScrollMoves=this.config.autoScrollMoves,this.board.moveAnimationLength=this.config.moveAnimationLength,this.board.showBracketsOnVariation=this.config.showBracketsOnVariation,this.board.hideBracketsOnTopLevelVariation=this.config.hideBracketsOnTopLevelVariation,this.board.variationStartString=this.config.variationStartString,this.board.variationEndString=this.config.variationEndString,this.board.ignoreCommentRegex=this.config.ignoreCommentRegex,this.board.newlineForEachMainMove=this.config.newlineForEachMainMove,this.board.useDivClearForNewline=this.config.useDivClearForNewline,this.board.pieceSize=this.config.pieceSize,this.board.showToMoveIndicators=this.config.showToMoveIndicators,this.board.handleCommentClicks=this.config.handleCommentClicks,this.board.scrollOffsetCorrection=this.config.scrollOffsetCorrection,this.board.pollPGNMilliseconds=this.config.pollPGNMilliseconds,this.board.pollPGNMillisecondsPostResult=this.config.pollPGNMillisecondsPostResult,this.board.numberPollsAfterResult=this.config.numberPollsAfterResult,this.board.gotoEndOnRefresh=this.config.gotoEndOnRefresh,this.board.allowPreMoveSelection=this.config.allowPreMoveSelection,this.board.newAnalysis=this.config.newAnalysis,this.board.pieceTakenSize=this.config.pieceTakenSize,this.board.pieceSet=this.config.pieceSet,this.board.pauseBetweenMoves=this.config.pauseBetweenMoves,this.board.showCoordinates=this.config.showCoordinates,this.board.highlightFromTo=this.config.highlightFromTo,this.board.highlightValidSquares=this.config.highlightValidSquares,this.board.fideClock=this.config.fideClock,this.board.disableFlipper=this.config.disableFlipper,this.board.showDate=this.config.showDate,this.board.showEvent=this.config.showEvent,this.board.showGame=this.config.showGame,this.board.showResult=this.config.showResult,this.board.showRound=this.config.showRound,this.board.showSite=this.config.showSite,this.board.ignoreFlipping=this.config.ignoreFlipping,this.board.reverseFlip=this.config.reverseFlip,this.board.autoplayFirst=this.config.auto
6playFirst,this.board.scrollVariations=this.config.scrollVariations,this.board.dontOutputNavButtons=this.config.dontOutputNavButtons,this.board.clickAndClick=this.config.clickAndClick,this.board.clickAndClickDisabled=this.config.clickAndClickDisabled,this.board.avoidMouseoverActive=this.config.avoidMouseoverActive,this.board.dontCheckLeavingPage=this.config.dontCheckLeavingPage,this.board.whiteMoveSoundName=this.config.whiteMoveSoundName,this.board.whiteTakeSoundName=this.config.whiteTakeSoundName,this.board.blackMoveSoundName=this.config.blackMoveSoundName,this.board.blackTakeSoundName=this.config.blackTakeSoundName,this.board.soundEnabled=this.config.soundEnabled,this.board.hidePGNErrors=this.config.hidePGNErrors,this.board.gamedb=this.config.gamedb,this.config.makeActive&&(activeBoard=this.board),this.problem&&(this.problem.isEndgame=this.config.isEndgame),this.board.puzzle||"undefined"==typeof loginManager||(this.tactics&&(loginManager.setLoginCallback(this.tactics.loginCallback,this.tactics),loginManager.setLogoutCallback(this.tactics.logoutCallback,this.tactics)),this.problem&&loginManager.setSessionCallback(this.problem.sessionCallback,this.problem)),YAHOO.util.DragDropMgr.clickTimeThresh=50,YAHOO.util.DragDropMgr.clickPixelThresh=1,this.board.createBoardUI(),this.board.puzzle||(this.problem&&this.problem.createProblemUI(),this.tactics&&this.tactics.initProblemCompleteOverlay(),this.problem&&this.problem.initLoadingOverlay(),this.config.pgnMode?this.config.pgnFile?this.config.pollPGNMilliseconds?(this.pgn.foundResult=!1,this.pgn.foundResultPolls=0,(r=this).pgn.pollTime=this.config.pollPGNMilliseconds,this.pgn.pollPGNFromURL(this.config.pgnFile,this.config.gotoEndOnRefresh,this.config.pollPGNMilliseconds),setTimeout(function e(){var t,i,s,o,n=YAHOO.util.Dom.get(r.config.boardName+"-nextUpdate");n&&(r.pgn.finishedPolling||r.pgn.foundResult?(o=s="00",n.innerHTML='<span id="minutes">'+s+'</span>:<span id="seconds">'+o+"</span>"):(i=(new Date).getTime(),(t=(r.pgn.lastPoll+r.pgn.pollTime-i)/1e3)<0&&(t=0),i=t,s=(t=parseInt(i/60))<10?"0"+t:t,o=(i=parseInt(i%60))<10?"0"+i:i,n.innerHTML='<span id="minutes">'+s+'</span>:<span id="seconds">'+o+"</span>",setTimeout(e,1e3)))},1e3)):this.pgn.getPGNFromURL(this.config.pgnFile,this.config.gotoEndOnRefresh):this.config.pgnString?this.pgn.setupFromPGN(this.config.pgnString):!this.config.pgnDiv||(s=YAHOO.util.Dom.get(this.config.pgnDiv))&&this.pgn.setupFromPGN(s.innerHTML):!this.board.dontCheckLeavingPage&&this.tactics?(YAHOO.util.Event.addListener(window,"beforeunload",this.tactics.checkLeavingPage,this.tactics,!0),YAHOO.util.Event.addListener(window,"unload",this.tactics.leavingPage,this.tactics,!0),this.tactics.updateSessionDisplay(0,0),"undefined"!=typeof showingStart&&showingStart?(r=this,n="",loggedIn&&(n=this.config.isEndgame?_js("Endgame Problem Set")+': <span id="startProblemSetStr">'+_js(startEndgameSetName)+"</span>":_js("Tactics Problem Set")+': <span id="startProblemSetStr">'+_js(startTacticsSetName)+"</span>"),this.board.preloadPieces(),n=new YAHOO.widget.SimpleDialog("starttacticdialog1",{width:"300px",fixedcenter:!0,modal:!1,visible:!0,draggable:!0,close:!1,text:'<div style="color:black">'+n+'</div><br/><div style="color:black">'+_js("Click start to begin solving problems")+"</div>",icon:YAHOO.widget.SimpleDialog.ICON_INFO,constraintoviewport:!0,buttons:[{text:_js("Start"),handler:function(){var e;r.board.imagesLoaded?(this.hide(),r.problem.getProblem()):(e=_js("Still trying to load piece images.\n If you keep receiving this message you may need to reload the page.\n If you continue to get this message, you can disable it by going into your preferences and turning 'show problem start dialog' (available under the other tab) off."),alert(e))},isDefault:!0}]}),YAHOO.util.Dom.get("ctb-"+this.board.boardName),n.render(document.body)):this.problem.getProblem()):this.problem&&""!=this.problemNumber&&(YAHOO.util.Dom.setStyle("boardandmoves","display","block"),this.problem.getProblem(this.problemNumber,this.attId))),this.board.setupEventHandlers(),this.problem&&this.problem.setupEventHandlers(),this.tactics&&this.tactics.setupEventHandlers(),this.board.scrollToBoardTop&&(n=YAHOO.util.Dom.getXY(this.board.boardName+"-boardBorder"),window.scrollTo(n[0],n[1])),this.config.flipListener&&this.board.addFlipListener(this.config.flipListener)},get_image_str=function(e,t,i,s,o){o=o?".vers"+SITE_VERSION:"";return check_bad_msie(),"https://schaaksite.nl/wp-content/themes/schaaksite/images/"+i+"/"+e+s+o+".png"},check_bad_msie=function(){return window.ActiveXObject&&void 0===document.body.style.maxHeight},fix_ie_png=function(e){var t,i,s,o;check_bad_msie()&&(t=e.id?"id='"+e.id+"' ":"",i=e.className?"class='"+e.className+"' ":"",s=e.title?"title='"+e.title+"' ":"title='"+e.alt+"' ",o="display:inline-block;"+e.style.cssText,"left"==e.align&&(o="float:left;"+o),"right"==e.align&&(o="float:right;"+o),e.parentElement.href&&(o="cursor:hand;"+o),o="<span "+t+i+s+' style="width:'+e.width+"px; height:"+e.height+"px;"+o+";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.src+"', sizingMethod='image');\"></span>",e.outerHTML=o)},Move=function(e,t,i,s,o,n,r){this.fromColumn=e,this.fromRow=t,this.toColumn=i,this.toRow=s,this.take=o,this.promotion=n,this.moveString=r,this.prev=null,this.next=null,this.numVars=0,this.prevMoveEnpassant=!1,this.ravLevel=0,this.atEnd=!1,this.obj_id=move_obj_id_counter++,this.beforeComment="",this.afterComment=""},Move.prototype.freeMove=function(){if(this.taken&&(this.taken=null),this.vars&&0<this.vars.length)for(var e=0,e=0;e<this.vars.length;e++)this.vars[e].freeMove()},Move.prototype.clone=function(e){var t=this.take;e&&t&&(t=t.makeLightWeight());var i=new Move(this.fromColumn,this.fromRow,this.toColumn,this.toRow,t,this.promotion,this.moveString);if(i.moveNum=this.moveNum,i.atEnd=this.atEnd,i.beforeComment=this.beforeComment,
6i.afterComment=this.afterComment,i.prevMoveEnpassant=this.prevMoveEnpassant,i.index=this.index,this.vars){i.vars=[];for(var s=0,o=0;o<this.vars.length;o++)i.vars[o]=this.vars[o].clone(e),s++;i.numVars=s}return i},Move.columnToChar=function(e){return String.fromCharCode("a".charCodeAt(0)+e)},Move.prototype.output=function(){return Move.columnToChar(this.fromColumn)+""+(this.fromRow+1)+":"+Move.columnToChar(this.toColumn)+(this.toRow+1)+" prom:"+this.promotion+" objid:"+this.obj_id+" dummy:"+this.dummy+" endNode:"+this.endNode+" index:"+this.index+" moveNum:"+this.moveNum+" atEnd:"+this.atEnd+" beforeCom:"+this.beforeComment+" afterCom:"+this.afterComment},Move.prototype.equals=function(e){return e&&this.fromColumn==e.fromColumn&&this.fromRow==e.fromRow&&this.promotion==e.promotion&&this.toColumn==e.toColumn&&this.toRow==e.toRow},Move.moveArraysEqual=function(e,t){if(e==t)return!0;if(null==e||null==t)return!1;if(e.length!=t.length)return!1;for(var i=0;i<e.length;i++){if(!e[i].equals(t[i]))return!1;if(!Move.moveArraysEqual(e[i].vars,t[i].vars))return!1}return!0},Move.findMoveInNewArray=function(e,t,i){if(e==t)return i;if(null==e||null==t)return null;if(e.length!=t.length)return null;for(var s=0;s<e.length;s++){if(!e[s].equals(t[s]))return null;if(!Move.moveArraysEqual(e[s].vars,t[s].vars))return null;if(e[s]==i)return t[s]}return null},Move.prototype.toLALG=function(){return this.toMoveString()},Move.prototype.toMoveString=function(){var e="";return this.promotion&&(e=this.promotion),Move.columnToChar(this.fromColumn)+""+(this.fromRow+1)+Move.columnToChar(this.toColumn)+(this.toRow+1)+e};var ua=navigator.userAgent.toLowerCase(),isOpera=-1<ua.indexOf("opera"),isIphone=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i),isIpad=navigator.userAgent.match(/iPad/i),isSafari=-1<ua.indexOf("safari"),isGecko=!isOpera&&!isSafari&&-1<ua.indexOf("gecko"),isIE=!isOpera&&-1<ua.indexOf("msie");ChessPiece=function(e,t,i,s){var o=e.id;this.board=s,this.icon=get_image_str(ChessPiece.pieceIconNames[t][i],this.board.boardImagePath,this.board.pieceSet,this.board.pieceSize,this.board.addVersion),this.colour=t,this.piece=i,this.id=o,this.div=e;var n,r,a,e=s.getPieceDragDiv(),s=!1;null==e&&((e=document.createElement("div")).id="pieceDragDiv",s=!0,YAHOO.util.Dom.setStyle(e,"visibility","hidden"),YAHOO.util.Dom.setStyle(e,"border","0px"),YAHOO.util.Dom.setStyle(e,"position","absolute")),this.pieceDragEl=e,this.pieceDragElId="pieceDragDiv",s&&(n=this.board.getDocBody())&&n.appendChild(e),YAHOO.util.Event.isIE||isOpera?((e=this.div).innerHTML='<img src="'+this.icon+'"/>',e=e.firstChild,fix_ie_png(e)):YAHOO.util.Dom.setStyle([this.div],"backgroundImage","url("+this.icon+")"),YAHOO.util.Dom.setStyle([this.div],"height",this.board.pieceSize+"px"),YAHOO.util.Dom.setStyle([this.div],"width",this.board.pieceSize+"px"),YAHOO.util.Dom.setStyle([this.div],"position","relative"),this.board.clickAndClick||(this.init(o,"ct-"+this.board.boardName+"-boardandpieces",{dragElId:this.pieceDragElId,resizeFrame:!0,centerFrame:!1,isTarget:!1}),this.initFrame()),(isIphone||isIpad)&&this.board.clickAndClickDisabled&&(r=this.div,(a=this).div.addEventListener("DOMNodeInserted",function(e){a.touchAttached||initIphone(r),a.touchAttached=!0},!1))},ChessPiece.prototype=new YAHOO.util.DDProxy,ChessPiece.PAWN=0,ChessPiece.BISHOP=1,ChessPiece.KNIGHT=2,ChessPiece.ROOK=3,ChessPiece.KING=4,ChessPiece.QUEEN=5,ChessPiece.WHITE=0,ChessPiece.BLACK=1,ChessPiece.init=function(){ChessPiece.pieceIconNames=new Array(2),ChessPiece.pieceIconNames[0]=new Array(6),ChessPiece.pieceIconNames[1]=new Array(6),ChessPiece.pieceIconNames[ChessPiece.WHITE][ChessPiece.PAWN]="whitepawn",ChessPiece.pieceIconNames[ChessPiece.WHITE][ChessPiece.BISHOP]="whitebishop",ChessPiece.pieceIconNames[ChessPiece.WHITE][ChessPiece.KNIGHT]="whiteknight",ChessPiece.pieceIconNames[ChessPiece.WHITE][ChessPiece.ROOK]="whiterook",ChessPiece.pieceIconNames[ChessPiece.WHITE][ChessPiece.KING]="whiteking",ChessPiece.pieceIconNames[ChessPiece.WHITE][ChessPiece.QUEEN]="whitequeen",ChessPiece.pieceIconNames[ChessPiece.BLACK][ChessPiece.PAWN]="blackpawn",ChessPiece.pieceIconNames[ChessPiece.BLACK][ChessPiece.BISHOP]="blackbishop",ChessPiece.pieceIconNames[ChessPiece.BLACK][ChessPiece.KNIGHT]="blackknight",ChessPiece.pieceIconNames[ChessPiece.BLACK][ChessPiece.ROOK]="blackrook",ChessPiece.pieceIconNames[ChessPiece.BLACK][ChessPiece.KING]="blackking",ChessPiece.pieceIconNames[ChessPiece.BLACK][ChessPiece.QUEEN]="blackqueen"},ChessPiece.materialValue=function(e){switch(e){case ChessPiece.PAWN:return 1;case ChessPiece.BISHOP:case ChessPiece.KNIGHT:return 3;case ChessPiece.ROOK:return 5;case ChessPiece.KING:return 0;case ChessPiece.QUEEN:return 9}return 0},ChessPiece.prototype.free=function(){this.board.clickAndClick||this.unreg()},ChessPiece.prototype.clickValidator=function(e){if(this.board.dragDisabled)return!1;if(!this.board.allowPreMoveSelection&&this.board.toMove!=this.colour)return!1;if(-1==this.board.restrictedColourMovement||this.colour==this.board.restrictedColourMovement){var t=YAHOO.util.Event.getTarget(e),t=this.isValidHandleChild(t)&&(this.id==this.handleElId||this.DDM.handleWasClicked(t,this.id));return this.board.selectDestSquare(e),YAHOO.util.Event.preventDefault(e),t}},ChessPiece.prototype.onDragOut=function(e,t){this.insideBoard=!1},ChessPiece.prototype.onDragEnter=function(e,t){this.insideBoard=!0},ChessPiece.prototype.endDrag=function(e){this.board.lastOverSquare&&(YAHOO.util.Dom.removeClass(this.board.lastOverSquare,"ct-over-valid-square"),YAHOO.util.Dom.removeClass(this.board.lastOverSquare,"ct-over-invalid-square")),this.board.lastOverSquare=null,this.insideBoard||(this.board.board_xy=null,this.setPosition(this.column,this.row,!1,null,this.board.moveAnimationLength)),this.hideAfterDragEnd?this.hideAfterDragEnd=!1:YAHOO.util.Dom.setStyle(this.getEl(),"visibility","visible")},ChessPiece.prototype.startDrag=function(e,t){this.insideBoard=!0;var i=this.board.currentMove&&this.board.currentMove.prev?this.board.currentMove.prev:this.board.prev_move;if(this.board.highlightValidSquares)for(this.candidates=null,this.candidates=new Array(8),o=0;o<8;o++)for(this.candidates[o]=new Array(8),n=0;n<8;n++)this.candidates[o][n]=!1;this.pieceDragEl.innerHTML='<img src="'+this.icon+'"/>';var s=this.pieceDragEl.firstChild;if(fix_ie_png(s),YAHOO.util.Dom.setStyle(this.pieceDragEl,"zIndex",1e3),YAHOO.util.Dom.setStyle(this.pieceDragEl,"height",this.board.pieceSize+"px"),YAHOO.util.Dom.setStyle(this.pieceDragEl,"width",this.board.pieceSize+"px"),YAHOO.util.Dom.setStyle(this.getEl(),"visibility","hidden"),this.board.highlightValidSquares)for(var o=0;o<8;o++)for(var n=0;n<8;n++){var r=7-o,a=n;this.board.isFlipped&&(r=7-r,a=7-a),(r==this.row&&a==this.column||this.board.canMove(this.makeLightWeight(),a,r,i,!0))&&(this.candidates[n][o]=!0)}},ChessPiece.prototype.onDragOver=function(e,t){var i=YAHOO.util.Event.getPageX(e),s=YAHOO.util.Event.getPageY(e),o=YAHOO.util.Dom.getX("ctb-"+this.board.boardName),e=YAHOO.util.Dom.getY("ctb-"+this.board.boardName),o=parseInt((i-o)/this.board.pieceSize),s=parseInt((s-e)/this.board.pieceSize),e=this.board.boardName+"-s"+o+(7-s),e=YAHOO.util.Dom.get(e);this.board.highlightValidSquares&&(this.board.lastOverSquare&&this.board.lastOverSquare!=e&&(YAHOO.util.Dom.removeClass(this.board.lastOverSquare,"ct-over-valid-square"),YAHOO.util.Dom.removeClass(this.board.lastOverSquare,"ct-over-invalid-square"),this.board.lastOverSquare=null,this.candidates&&o<8&&0<=o&&s<8&&0<=s&&this.candidates[o][s]?YAHOO.util.Dom.addClass(e,"ct-over-valid-square"):YAHOO.util.Dom.addClass(e,"ct-over-invalid-square")),this.board.lastOverSquare=e)},ChessPiece.prototype.onDragDrop=function(e,t){if(this.board.blockFowardBack||this.board.deferredBlockForwardBack)return!1;if(this.board.allowPreMoveSelection&&this.board.toMove!=this.colour)return!1;this.board.lastOverSquare&&(YAHOO.util.Dom.removeClass(this.board.lastOverSquare,"ct-over-valid-square"),YAHOO.util.Dom.removeClass(this.board.lastOverSquare,"ct-over-invalid-square"));var i=YAHOO.util.Event.getPageX(e),s=YAHOO.util.Event.getPageY(e),o=YAHOO.util.Dom.getX("ctb-"+this.board.boardName),e=YAHOO.util.Dom.getY("ctb-"+this.board.boardName),o=parseInt((i-o)/this.board.pieceSize),s=parseInt((s-e)/this.board.pieceSize);if(this.board.isFlipped&&(s=7-s,o=7-o),this.board.allowPreMoveSelection&&this.board.boardPieces[this.column][this.row]!=this)return this.setVisible(!1),!(this.hideAfterDragEnd=!0);e=!1;this.board.currentMove&&!this.board.currentMove.atEnd||(e=!0),this.board.updatePiece(this,o,7-s,!1,!1,!0),!e&&this.board.currentMove&&!this.board.allowingFreeMovement&&this.board.currentMove.atEnd&&(this.board.toggleToMove(),this.board.updateToPlay())},ChessPiece.prototype.makeLightWeight=function(){var e=this.board.createPiece(this.colour,this.piece,!0);return e.column=this.column,e.row=this.row,e.enPassant=this.enPassant,e.castled=this.castled,e},ChessPiece.prototype.removeFromParent=function(){var e=this.div;e.parentNode&&e.parentNode.removeChild(e)},ChessPiece.prototype.setVisible=function(e){e=e?"visible":"hidden";YAHOO.util.Dom.setStyle(this.id,"visibility",e)},ChessPiece.prototype.moveResponse=function(e){},ChessPiece.prototype.getIcon=function(){return this.icon},ChessPiece.prototype.makeHeavyWeight=function(){return this.copyPiece()},ChessPiece.prototype.copyPiece=function(){var e=new ChessPiece(this.div,this.colour,this.piece,this.board);return e.column=this.column,e.row=this.row,e.enPassant=this.enPassant,e.castled=this.castled,e},ChessPiece.prototype.changePieceKeepImage=function(e){switch((e+"").toLowerCase().charAt(0)){case"k":this.piece=ChessPiece.KING;break;case"q":this.piece=ChessPiece.QUEEN;break;case"r":this.piece=ChessPiece.ROOK;break;case"b":this.piece=ChessPiece.BISHOP;break;case"n":this.piece=ChessPiece.KNIGHT;break;case"p":this.piece=ChessPiece.PAWN}},ChessPiece.prototype.changePiece=function(e){this.changePieceKeepImage(e),this.icon=get_image_str(ChessPiece.pieceIconNames[this.colour][this.piece],this.board.boardImagePath,this.board.pieceSet,this.board.pieceSize,this.board.addVersion),YAHOO.util.Event.isIE||isOpera?((e=this.div).innerHTML='<img src="'+this.icon+'"/>',e=e.firstChild,isOpera||fix_ie_png(e)):(YAHOO.util.Dom.setStyle(this.div,"backgroundImage","url("+this.icon+")"),YAHOO.util.Dom.setStyle(this.div,"background-repeat","no-repeat"))},ChessPiece.prototype.getNewXYPosition=function(e,t){this.board.getBoardDiv();var i=this.board.getXY(),s=i[0],o=i[1],i=[0,0];return this.board.isFlipped?(i[0]=s+(7-e)*this.board.pieceSize,i[1]=o+t*this.board.pieceSize):(i[0]=s+e*this.board.pieceSize,i[1]=o+(7-t)*this.board.pieceSize),i},ChessPiece.prototype.setPosition=function(e,t,i,s,o,n,r){var a,l,h,u,c;this.column=e,this.row=t,this.board.pieceMoveDisabled||(a=this.div,l=null,l=this.board.isFlipped?this.board.boardName+"-s"+(7-this.column)+(7-this.row):this.board.boardName+"-s"+this.column+this.row,l=this.board.getBoardDivFromId(l),c=null,c=n?this.colour==ChessPiece.WHITE?this.board.whiteTakeSoundName:this.board.blackTakeSoundName:this.colour==ChessPiece.WHITE?this.board.whiteMoveSoundName:this.board.blackMoveSoundName,i?(u=this.getNewXYPosition(e,t),this.board.oldAnim&&this.board.oldAnim.isAnimated()&&(this.board.oldAnim.stop(),YAHOO.util.Dom.setXY(this.board.oldAnimPieceDiv,this.board.old_new_xy,!1)),i=new YAHOO.util.Motion(a,{points:{to:u}}
6),this.board.oldAnim=i,this.board.oldAnimPieceDiv=a,this.board.old_new_xy=u,i.duration=o,h=this,i.onComplete.subscribe(function(){h.board.soundEnabled&&boardSounds.playSound(c)}),s&&i.onComplete.subscribe(s),i.animate()):(this.board.settingUpPosition?(a.parentNode&&a.parentNode.removeChild(a),l.appendChild(a)):(u=this.getNewXYPosition(e,t),YAHOO.util.Dom.setXY(a,u,!1)),this.setVisible(!0),r&&this.board.soundEnabled&&boardSounds.playSound(c),s&&s()))},ChessPiece.prototype.getFenLetter=function(){var e=ChessPiece.pieceTypeToChar(this.piece)+"";return this.colour!=ChessPiece.WHITE&&(e=e.toLowerCase()),e},ChessPiece.pieceTypeToChar=function(e){switch(e){case ChessPiece.KING:return"K";case ChessPiece.QUEEN:return"Q";case ChessPiece.ROOK:return"R";case ChessPiece.BISHOP:return"B";case ChessPiece.KNIGHT:return"N";case ChessPiece.PAWN:return"P"}return"?"},LightweightChessPiece=function(e,t,i,s){this.board=s,this.colour=t,this.piece=i,this.div=e},LightweightChessPiece.prototype.getFenLetter=ChessPiece.prototype.getFenLetter,LightweightChessPiece.prototype.makeLightWeight=function(){return this.copyPiece()},LightweightChessPiece.prototype.makeHeavyWeight=function(){var e=this.board.createPiece(this.colour,this.piece,!1);return e.column=this.column,e.row=this.row,e.enPassant=this.enPassant,e.castled=this.castled,e},LightweightChessPiece.prototype.setVisible=function(e){},LightweightChessPiece.prototype.free=function(){},LightweightChessPiece.prototype.setPosition=function(e,t,i,s,o){this.column=e,this.row=t},LightweightChessPiece.prototype.copyPiece=function(){var e=new LightweightChessPiece(this.id,this.colour,this.piece,this.board);return e.column=this.column,e.row=this.row,e},LightweightChessPiece.prototype.changePiece=function(e){this.changePieceKeepImage(e)},LightweightChessPiece.prototype.changePieceKeepImage=function(e){switch((e+"").toLowerCase().charAt(0)){case"k":this.piece=ChessPiece.KING;break;case"q":this.piece=ChessPiece.QUEEN;break;case"r":this.piece=ChessPiece.ROOK;break;case"b":this.piece=ChessPiece.BISHOP;break;case"n":this.piece=ChessPiece.KNIGHT;break;case"p":this.piece=ChessPiece.PAWN}},MovesDisplay=function(e,t){this.board=e,this.displayType=t},MovesDisplay.DEFAULT_DISPLAY_TYPE=0,MovesDisplay.MAIN_ON_OWN_LINE=1,Board=function(e){(this.boardName=e)&&(this.initTarget("ctb-"+e,"ct-"+this.boardName+"-boardandpieces"),this.boardPieces=Board.createBoardArray()),this.imagesLoaded=!1,this.newAnalysis=!1,this.disableNavigation=!1,this.currentMove=null,this.outputWithoutDisplay=!1,this.moveIndex=-1,this.dontUpdatePositionReachedTable=!1,this.restrictedColourMovement=-1,this.settingUpPosition=!1,this.pendingLevelZeroCommentaryClose=!1,this.isUserFlipped=!1,this.registeredFlipListeners=[],this.registeredSpaceListeners=[],this.registeredForwardAtEndListeners=[],this.registeredPasteFenClickedListeners=[],this.registeredGotoMoveIndexListeners=[],this.registeredBackMovePreCurrentListeners=[],this.registeredForwardMovePostUpdateListeners=[],this.registeredUpdateListeners=[],this.registeredUpdatePieceFinishedListeners=[],this.registeredUpdateEndOfMovesListeners=[],this.registeredUpdateHaveAltListeners=[],this.registeredUpdateWrongMoveListeners=[],this.registeredUpdateAllowMoveListeners=[],this.registeredMakeMoveListeners=[],this.moveNumber=1,this.halfMoveNumber=0},Board.prototype=new YAHOO.util.DDTarget,Board.invertToMove=function(e){return e==ChessPiece.WHITE?ChessPiece.BLACK:ChessPiece.WHITE},Board.boardStyleToClassName=function(e){var t="";switch(e){case 0:t="-lightgrey";break;case 1:t="-grey";break;case 2:t="-brown";break;case 3:t="-green";break;case 4:t="-woodlight";break;case 5:t="-wooddark";break;case 6:t="-metal";break;case 7:t="-marblebrown";break;case 8:t="-stucco";break;case 9:t="-goldsilver";break;case 10:t="-sandsnow";break;case 11:t="-crackedstone";break;case 12:t="-granite";break;case 13:t="-marblegreen";break;case 14:t="-greenwhite"}return t},Board.createBoardArray=function(){var e=boardPool.getObject();if(null==e){e=new Array(8);for(var t=0;t<8;t++)e[t]=new Array(8)}return e},Board.prototype.preloadPieces=function(){for(var o=[],e=0;e<ChessPiece.QUEEN;e++)for(var t=0;t<2;t++){var i=get_image_str(ChessPiece.pieceIconNames[t][e],this.boardImagePath,this.pieceSet,this.pieceSize,!0);o.push(i)}var n=this;!function e(){for(var t=!0,i=0;i<o.length;i++){var s=document.createElement("img");
6s.src=o[i],s.complete&&(void 0===s.naturalWidth||0!=s.naturalWidth)||(t=!1)}t?n.imagesLoaded=!0:setTimeout(e,1e3)}()},Board.prototype.selectDestSquare=function(e){if(this.clickAndClickDisabled)return!0;var t=(new Date).getTime(),i=!1;t-this.lastDestClick<100&&(i=!0),this.lastDestClick=t;var s=YAHOO.util.Event.getPageX(e),o=YAHOO.util.Event.getPageY(e),t=YAHOO.util.Dom.getX("ctb-"+this.boardName),e=YAHOO.util.Dom.getY("ctb-"+this.boardName),s=parseInt((s-t)/this.pieceSize),t=parseInt((o-e)/this.pieceSize),o=this.boardName+"-s"+s+(7-t),e=YAHOO.util.Dom.get(o);if(e==this.oldSelectedSquare)return i||(YAHOO.util.Dom.removeClass(e,"ct-source-square"),this.oldSelectedSquare=null,this.oldSelectedPiece=null,this.oldDestSquare&&(YAHOO.util.Dom.removeClass(this.oldDestSquare,"ct-dest-square"),this.oldDestSquare=null)),!0;this.isFlipped&&(s=7-s,t=7-t),t=7-t;o=this.boardPieces[s][t];if(!o||o.colour!=this.toMove&&!this.allowPreMoveSelection||-1!=this.restrictedColourMovement&&o.colour!=this.restrictedColourMovement){if(!this.oldSelectedSquare)return!0;if(this.oldSelectedPiece&&this.oldSelectedPiece.colour!=this.toMove)return!1;i=null,i=this.currentMove&&this.currentMove.prev?this.currentMove.prev:this.prev_move;this.canMove(this.oldSelectedPiece.makeLightWeight(),s,t,i,!0)&&(this.lastDestSquare=e,this.lastDestRow=t,this.lastDestColumn=s,YAHOO.util.Dom.removeClass(this.oldSelectedSquare,"ct-source-square"),i=!1,this.currentMove&&!this.currentMove.atEnd||(i=!0),this.updatePiece(this.oldSelectedPiece,s,t,!1,!1,!0),this.oldSelectedPiece=null,this.oldSelectedSquare=null,!i&&this.currentMove&&!this.allowingFreeMovement&&this.currentMove.atEnd&&(this.toggleToMove(),this.updateToPlay()))}else this.oldSelectedSquare&&YAHOO.util.Dom.removeClass(this.oldSelectedSquare,"ct-source-square"),this.oldDestSquare&&(YAHOO.util.Dom.removeClass(this.oldDestSquare,"ct-dest-square"),this.oldDestSquare=null),YAHOO.util.Dom.addClass(e,"ct-source-square"),this.oldSelectedSquare=e,this.oldSelectedPiece=o},Board.prototype.selectSourcePiece=function(e){this.lastSourceSquare&&YAHOO.util.Dom.removeClass(s,"ct-source-square");var t=e.row,i=e.column;this.isFlipped&&(t=7-t,i=7-i);var t=this.boardName+"-s"+i+t,s=YAHOO.util.Dom.get(t);YAHOO.util.Dom.addClass(s,"ct-source-square"),this.lastSourceSquare=s,this.lastSourcePiece=e,this.lastSourceRow=e.row,this.lastSourceColumn=e.column},Board.prototype.toggleToMove=function(){this.toMove==ChessPiece.WHITE?this.toMove=ChessPiece.BLACK:this.toMove=ChessPiece.WHITE},Board.prototype.setupPieceDivs=function(){if(this.getBoardDiv(),this.pieces)for(e=0;e<32;e++)this.pieces[e]&&(this.pieces[e].setVisible(!1),this.pieces[e].free(),this.pieces[e]=null);if(this.availPieceDivs)for(var e=0;e<32;e++)this.availPieceDivs[e]&&this.availPieceDivs[e].parentNode&&this.availPieceDivs[e].parentNode.removeChild(this.availPieceDivs[e]);this.availids=null,this.availIds=new Array(32),this.availPieceDivs=null,this.availPieceDivs=new Array(32),this.pieces=null,this.pieces=new Array(32),this.uptoId=0,this.uptoPiece=0},Board.prototype.getXY=function(){return this.board_xy=YAHOO.util.Dom.getXY("ctb-"+this.boardName),this.board_xy},Board.prototype.updateFromTo=function(e,t,i,s,o,n){YAHOO.util.Dom.removeClass(this.lastFromSquare,"ct-from-square"),YAHOO.util.Dom.removeClass(this.lastToSquare,"ct-to-square"),null!=i&&(this.lastFromSquare=e,this.lastToSquare=t,this.lastFromRow=i,this.lastFromColumn=s,this.lastToRow=o,this.lastToColumn=n,this.highlightFromTo&&(YAHOO.util.Dom.addClass(e,"ct-from-square"),YAHOO.util.Dom.addClass(t,"ct-to-square")))},Board.prototype.makeMove=function(e,t,i,s,o,n,r,a,l){var h,u=this.isFlipped?(h=YAHOO.util.Dom.get(this.boardName+"-s"+(7-e.fromColumn)+(7-e.fromRow)),YAHOO.util.Dom.get(this.boardName+"-s"+(7-e.toColumn)+(7-e.toRow))):(h=YAHOO.util.Dom.get(this.boardName+"-s"+e.fromColumn+e.fromRow),YAHOO.util.Dom.get(this.boardName+"-s"+e.toColumn+e.toRow));this.oldSelectedSquare&&(!this.allowPreMoveSelection||this.oldSelectedPiece&&t&&this.oldSelectedPiece.colour==t.colour)&&(YAHOO.util.Dom.removeClass(this.oldSelectedSquare,"ct-source-square"),this.oldSelectedSquare=null,this.oldSelectedPiece=null),n&&this.updateFromTo(h,u,e.fromRow,e.fromColumn,e.toRow,e.toColumn);var c=this.boardPieces[e.toColumn][e.toRow];
6null!=c&&(c.enPassant=!1,c.castled=!1),t.piece==ChessPiece.PAWN&&e.toColumn!=e.fromColumn&&null==this.boardPieces[e.toColumn][e.toRow]&&(c=this.boardPieces[e.toColumn][e.fromRow],(this.boardPieces[e.toColumn][e.fromRow]=null)!=c&&(c.enPassant=!0));var d,m,u=null;t.piece==ChessPiece.KING&&1<Math.abs(e.toColumn-e.fromColumn)&&(e.toColumn>e.fromColumn?(u=this.boardPieces[7][e.fromRow],d=e.fromRow,m=5,this.boardPieces[7][e.toRow]=null):(u=this.boardPieces[0][e.fromRow],d=e.fromRow,m=3,this.boardPieces[0][e.toRow]=null),u?(u.setPosition(m,d,i,null,s,null,l),(this.boardPieces[u.column][u.row]=u).castled=!0):alert("No castle piece")),(e.taken=c)&&o&&this.processTaken(c,!0),this.moveNumber++,e.preHalfMoveNumber=this.halfMoveNumber,this.halfMoveNumber++,!c&&t.piece!=ChessPiece.PAWN||(this.halfMoveNumber=0),(this.board_xy=null)!=e.promotion&&t.changePieceKeepImage(e.promotion),t.setPosition(e.toColumn,e.toRow,i,function(){c&&c.setVisible(!1),null!=e.promotion&&t.changePiece(e.promotion),r&&r.call(a)},s,c,l),i||null!=e.promotion&&t.changePiece(e.promotion),this.boardPieces[e.fromColumn][e.fromRow]=null,this.boardPieces[e.toColumn][e.toRow]=t,null!=u&&(e.taken=u),e.preCastleQueenSide=new Array(2),e.preCastleKingSide=new Array(2),e.preCastleQueenSide[0]=this.canCastleQueenSide[0],e.preCastleQueenSide[1]=this.canCastleQueenSide[1],e.preCastleKingSide[0]=this.canCastleKingSide[0],e.preCastleKingSide[1]=this.canCastleKingSide[1],t.piece==ChessPiece.ROOK?(t.colour==ChessPiece.WHITE&&0==e.fromRow||t.colour==ChessPiece.BLACK&&7==e.fromRow)&&(0==e.fromColumn?this.canCastleQueenSide[t.colour]=!1:7==e.fromColumn&&(this.canCastleKingSide[t.colour]=!1)):t.piece==ChessPiece.KING&&(this.canCastleQueenSide[t.colour]=!1,this.canCastleKingSide[t.colour]=!1),c&&c.piece==ChessPiece.ROOK&&(0==e.toColumn?(c.colour==ChessPiece.WHITE&&0==e.toRow||c.colour==ChessPiece.BLACK&&7==e.toRow)&&(this.canCastleQueenSide[c.colour]=!1):7==e.toColumn&&(c.colour==ChessPiece.WHITE&&0==e.toRow||c.colour==ChessPiece.BLACK&&7==e.toRow)&&(this.canCastleKingSide[c.colour]=!1)),this.updatePositionReached(t.colour);for(var p=0;p<this.registeredMakeMoveListeners.length;p++)this.registeredMakeMoveListeners[p].makeMoveCallback(e)},Board.prototype.isThreeFoldRep=function(e){var t=this.toMove;e&&(t=t==ChessPiece.WHITE?ChessPiece.BLACK:ChessPiece.WHITE);t=this.boardToUniqueFen(t);return 3<=this.positionsSeen[t]},Board.prototype.updatePositionReached=function(e){this.dontUpdatePositionReachedTable||(e=this.boardToUniqueFen(e),this.positionsSeen||(this.positionsSeen=[]),this.positionsSeen[e]?this.positionsSeen[e]++:this.positionsSeen[e]=1)},Board.prototype.promptPromotion=function(e,t,i,s,o){e.prePromotionColumn=e.column,e.prePromotionRow=e.row,e.setPosition(t,i,!1,null,this.moveAnimationLength);var n=this,r=new YAHOO.widget.Dialog("promotionDialogId",{width:"300px",fixedcenter:!0,visible:!0,modal:!0,close:!1,constraintoviewport:!0,buttons:[{text:_js("Queen"),handler:function(){r.hide(),n.updatePiece(e,t,i,s,o,!1,"q")},isDefault:!0},{text:_js("Rook"),handler:function(){r.hide(),n.updatePiece(e,t,i,s,o,!1,"r")},isDefault:!1},{text:_js("Bishop"),handler:function(){r.hide(),n.updatePiece(e,t,i,s,o,!1,"b")},isDefault:!1},{text:_js("Knight"),handler:function(){r.hide(),n.updatePiece(e,t,i,s,o,!1,"n")},isDefault:!1}]});r.setHeader(_js("Select Promotion Piece")),r.setBody("<div></div>"),r.render(document.body)},Board.moveToLocale=function(e){if(!e||""==e)return e;for(var t="",i=0;i<e.length;i++){var s=e.charAt(i);switch(s){case"K":s=_js("K");break;case"Q":s=_js("Q");break;case"R":s=_js("R");break;case"N":s=_js("N");break;case"B":s=_js("B");break;case"P":s=_js("P");break;case"a":s=_js("a");break;case"b":s=_js("b");break;case"c":s=_js("c");break;case"d":s=_js("d");break;case"e":s=_js("e");break;case"f":s=_js("f");break;case"g":s=_js("g");break;case"h":s=_js("h");break;case"x":s=_js("x");break;case"#":s=_js("#")}t+=s}return t},Board.prototype.updatePiece=function(e,t,i,s,o,n,r,a){if(r&&(this.board_xy=null,e.prePromotionRow&&(e.row=e.prePromotionRow,e.column=e.prePromotionColumn)),null==r&&e.column==t&&e.row==i)return this.board_xy=null,e.setPosition(e.column,e.row,!1,null,this.moveAnimationLength),void(clog&&console.log("moved piece back to its orig position"));var l=null,l=this.currentMove&&this.currentMove.prev?this.currentMove.prev:this.prev_move;if(clog&&(this.currentMove?console.log("updatepiece currentMove:"+this.currentMove.output()):console.log("updatepiece currentmove null")),!s&&!this.canMove(e.makeLightWeight(),t,i,l,!0))return this.board_xy=null,e.setPosition(e.column,e.row,!1,null,.5),void(clog&&(console.log("move not legal , move back to orig:"+this.toMove),l?console.log("prevMove was:"+l.output()):console.log("prevMove was null")));var h="";if(!n||e.piece!=ChessPiece.PAWN||7!=i&&0!=i){null!=r&&(h=r);var u="";u+=Move.columnToChar(e.column),u+=String.fromCharCode("1".charCodeAt(0)+e.row),u+=Move.columnToChar(t),u+=String.fromCharCode("1".charCodeAt(0)+i),h&&(u+=h);var c=this.createMoveFromString(u);(p=this.currentMove)&&(c.moveNum=p.moveNum);for(var d=null,m=0;m<this.registeredUpdateListeners.length;m++){if(!(g=this.registeredUpdateListeners[m].updatePieceCallback(h,e,t,i,s,o,n,r,a,l,this.currentMove,c)))return!1;g.ignoreRetVal||(d=g)}if(!d)return clog&&console.log("Got no update piece callbak"),!1;if(d.allowMove){this.oldSelectedSquare&&YAHOO.util.Dom.removeClass(this.oldSelectedSquare,"ct-source-square");for(var p=d.move,m=0;m<this.registeredUpdateAllowMoveListeners.length;m++)this.registeredUpdateAllowMoveListeners[m].updateAllowMoveCallback(h,e,t,i,s,o,n,r,a,p);this.makeMove(p,e,o,this.moveAnimationLength,!0,!0,null,null,!0);u=!d.dontMakeOpponentMove&&!s&&this.currentMove&&this.currentMove.next&&!this.currentMove.next.atEnd;if(clog&&(p.next?console.log("setting current move in updatepiece to:"+p.next.output()):console.log("in updatepiece, current move being set to null")),this.setCurrentMove(p.next,!1,u),this.currentMove.atEnd)for(m=0;m<this.registeredUpdateEndOfMovesListeners.length;m++)d=this.registeredUpdateEndOfMovesListeners[m].updateEndOfMovesCallback(h,e,t,i,s,o,n,r,a);u&&(opponentMove=this.currentMove,this.currentMove&&this.currentMove.next.atEnd&&this.toggleToMove(),this.updatePiece(this.boardPieces[opponentMove.fromColumn][opponentMove.fromRow],opponentMove.toColumn,opponentMove.toRow,!0,!0,!1))}else for(p=d.move,e.column,e.row,this.board_xy=null,e.setPosition(e.column,e.row,!1,null,this.moveAnimationLength),m=0;m<this.registeredUpdateWrongMoveListeners.length;m++)d=this.registeredUpdateWrongMoveListeners[m].updateWrongMoveCallback(h,e,t,i,s,o,n,r,a,p);for(m=0;
6m<this.registeredUpdatePieceFinishedListeners.length;m++)var g=this.registeredUpdatePieceFinishedListeners[m].updatePieceFinishedCallback(h,e,t,i,s,o,n,r,a,l,this.currentMove,c)}else this.promptPromotion(e,t,i,s,o)},Board.prototype.addGotoMoveIndexListener=function(e){this.registeredGotoMoveIndexListeners.push(e)},Board.prototype.addPasteFenClickedListener=function(e){this.registeredPasteFenClickedListeners.push(e)},Board.prototype.addBackMovePreCurrentListener=function(e){this.registeredBackMovePreCurrentListeners.push(e)},Board.prototype.addForwardMovePostUpdateListener=function(e){this.registeredForwardMovePostUpdateListeners.push(e)},Board.prototype.addForwardAtEndListener=function(e){this.registeredForwardAtEndListeners.push(e)},Board.prototype.addUpdatePieceListener=function(e){this.registeredUpdateListeners.push(e)},Board.prototype.addUpdatePieceFinishedListener=function(e){this.registeredUpdatePieceFinishedListeners.push(e)},Board.prototype.addUpdatePieceEndOfMovesListener=function(e){this.registeredUpdateEndOfMovesListeners.push(e)},Board.prototype.addUpdatePieceHaveAltListener=function(e){this.registeredUpdateHaveAltListeners.push(e)},Board.prototype.addUpdatePieceAllowMoveListener=function(e){this.registeredUpdateAllowMoveListeners.push(e)},Board.prototype.addMakeMoveListener=function(e){this.registeredMakeMoveListeners.push(e)},Board.prototype.addUpdatePieceWrongMoveListener=function(e){this.registeredUpdateWrongMoveListeners.push(e)},Board.prototype.scoreToShortString=function(e){return"draw"==e?"D":0<=e?"M"+e:"L"+-1*e},Board.prototype.scoreToLongString=function(e){return"draw"==e?_js("Draw"):0==e?_js("Mate"):0<e?__js("Mate in {NUMBER_MOVES}",[["NUMBER_MOVES",e]]):__js("Lose in {NUMBER_MOVES}",[["NUMBER_MOVES",-1*e]])},Board.prototype.egMoveToScoreString=function(e){var t=e.score,i=e.optimal_score,s=this.scoreToShortString(t),o=this.scoreToShortString(i),n=this.scoreToLongString(t),e=this.scoreToLongString(i);return t==i?["",n]:['<span class="'+("draw"==t||t<0?"ct-bad-move-score":"ct-subopt-move-score")+'">'+s+"("+o+")</span>",n+"("+e+")"]},Board.prototype.makeShortAlgabraic=function(e,t,i,s,o){clog&&console.log("fromCol:"+e+" fromRow:"+t+" toCol:"+i+" toRow:"+s);var n=this.boardPieces[e][t],r=n.piece,a=ChessPiece.pieceTypeToChar(r),l="";if(r==ChessPiece.PAWN)e==i?l=Move.columnToChar(e)+""+(s+1):(l=Move.columnToChar(e)+"x"+Move.columnToChar(i)+(s+1),this.boardPieces[i][s]||(l+=" e.p."));else if(r==ChessPiece.KING){var h=Math.abs(e-i);1==h||0==h?(l=a,this.boardPieces[i][s]&&(l+="x"),l+=Move.columnToChar(i)+""+(s+1)):l=6==i?"O-O":"O-O-O"}else{for(var u=[],c=0;c<8;c++)for(var d=0;d<8;d++){var m,p=this.boardPieces[d][c];!p||p.colour!=n.colour||p.piece!=r||n.column==p.column&&n.row==p.row||(m=null,this.currentMove&&(m=this.currentMove.prev),this.canMove(p.makeLightWeight(),i,s,m,!0)&&u.push(p))}if(l=a,0<u.length){for(var g=!1,v=!1,f=0;f<u.length;f++)u[f].row==t&&(v=!0),u[f].column==e&&(g=!0);!v&&(v||g)||(l+=Move.columnToChar(e)),g&&(l+=""+(t+1))}this.boardPieces[i][s]&&(l+="x"),l+=Move.columnToChar(i)+""+(s+1)}var b="",y="";return o&&(h=this.cloneBoard(),a=ChessPiece.WHITE,h.boardPieces[o.fromColumn][o.fromRow].colour==ChessPiece.WHITE&&(a=ChessPiece.BLACK),h.makeMove(o,h.boardPieces[o.fromColumn][o.fromRow],!1,h.moveAnimationLength,!1,!1),h.isKingSafe(a,o)||(b="+",h.isKingMated(a,o)&&(b="#")),o.promotion&&(y="="+(o.promotion+"").toUpperCase())),l+(y+b)},Board.getVarMove=function(e,t,i,s,o){if(e.vars&&0<e.vars.length)for(var n=0,n=0;n<e.vars.length;n++){var r=e.vars[n];if(r.fromColumn==s.column&&r.fromRow==s.row&&r.toRow==t&&r.toColumn==i&&(""==o||o==r.promotion))return r}},Board.prototype.createMoveFromString=function(e){var t=0,i=!1,s=null,o=e.charCodeAt(t++),n=e.charCodeAt(t++),r=e.split("|"),a=null;"x"==(e=(1<r.length&&(a=r[1]),r[0])).charAt(t)&&(t++,i=!0);var l=e.charCodeAt(t++),r=e.charCodeAt(t++);t<e.length&&(s=e.charAt(t));e=new Move(o-"a".charCodeAt(0),n-"1".charCodeAt(0),l-"a".charCodeAt(0),r-"1".charCodeAt(0),i,s,e);return e.pgn=a,e},Board.prototype.getBackButton=function(){return this.backButton||(this.backButton=YAHOO.util.Dom.get(this.boardName+"-back")),this.backButton},Board.prototype.getForwardButton=function(){return this.forwardButton||(this.forwardButton=YAHOO.util.Dom.get(this.boardName+"-forward")),this.forwardButton},Board.prototype.getEndButton=function(){return this.endButton||(this.endButton=YAHOO.util.Dom.get(this.boardName+"-end")),this.endButton},Board.prototype.getStartButton=function(){return this.startButton||(this.startButton=YAHOO.util.Dom.get(this.boardName+"-start")),this.startButton},Board.prototype.setForwardBack=function(){var e=this.getBackButton(),t=this.getForwardButton(),i=this.getEndButton(),s=this.getStartButton();if(!this.currentMove)return e&&(e.src=this.boardImagePath+"/images/resultset_previous_disabled"+this.getVersString()+".gif"),s&&(s.src=this.boardImagePath+"/images/disabled_resultset_first"+this.getVersString()+".gif"),t&&(t.src=this.boardImagePath+"/images/resultset_next_disabled"+this.getVersString()+".gif"),void(i&&(i.src=this.boardImagePath+"/images/disabled_resultset_last"+this.getVersString()+".gif"));null==this.currentMove.prev?(e&&(e.src=this.boardImagePath+"/images/resultset_previous_disabled"+this.getVersString()+".gif"),s&&(s.src=this.boardImagePath+"/images/disabled_resultset_first"+this.getVersString()+".gif")):(e&&(e.src=this.boardImagePath+"/images/resultset_previous"+this.getVersString()+".gif"),s&&(s.src=this.boardImagePath+"/images/resultset_first"+this.getVersString()+".gif")),this.currentMove.atEnd?(t&&(t.src=this.boardImagePath+"/images/resultset_next_disabled"+this.getVersString()+".gif"),i&&(i.src=this.boardImagePath+"/images/disabled_resultset_last"+this.getVersString()+".gif")):(t&&(t.src=this.boardImagePath+"/images/resultset_next"+this.getVersString()+".gif"),i&&(i.src=this.boardImagePath+"/images/resultset_last"+this.getVersString()+".gif"))},Board.prototype.convertPiecesFromLightWeight=function(e){var t=this.settingUpPosition;this.settingUpPosition=!0;for(var i,s=0;s<8;s++)for(var o=0;o<8;o++)null!=this.boardPieces[s][o]&&(i=this.boardPieces[s][o].makeHeavyWeight(),(this.boardPieces[s][o]=i).setPosition(i.column,i.row,
6!1,null,this.moveAnimationLength),i.setVisible(!0));for(var n=this.moveArray[e];null!=n;)n.taken&&(n.taken=n.taken.makeHeavyWeight()),n=n.prev;this.settingUpPosition=t},MovesDisplay.prototype.setToMove=function(e){this.toMove=e},MovesDisplay.prototype.clickComment=function(e){var t=e.currentTarget||!!e.targetElement&&e.targetElement;(t=t||YAHOO.util.Event.getTarget(e)).id||(t=t.parentNode);var e=t.id.substr((this.board.boardName+"-mcX").length),i=!0;0<=t.id.indexOf("-mca")&&(i=!1);var s=this.board.moveArray[e],e="",e=i?s.beforeComment:s.afterComment;mySimpleDialog=new YAHOO.widget.SimpleDialog(this.boardName+"-editCommentDialog",{width:"20em",fixedcenter:!0,modal:!0,visible:!1,draggable:!1}),mySimpleDialog.setHeader("Edit Comment"),mySimpleDialog.setBody('<textarea id="'+this.board.boardName+'-editComment">'+e+"</textarea>"),mySimpleDialog.cfg.setProperty("icon",YAHOO.widget.SimpleDialog.ICON_INFO);var o=this,e=[{text:"Delete",handler:function(){i?s.beforeComment=null:s.afterComment=null,t.innerHTML="",this.hide()}},{text:"Save",handler:function(){var e=trimStr(YAHOO.util.Dom.get(o.board.boardName+"-editComment").value);i?s.beforeComment=e:s.afterComment=e,t.innerHTML=i?o.outputComment(e,0)+" ":" "+o.outputComment(e,0),this.hide()}},{text:"Cancel",handler:function(){this.hide()},isDefault:!0}];mySimpleDialog.cfg.queueProperty("buttons",e),mySimpleDialog.render(document.body),mySimpleDialog.show()},MovesDisplay.prototype.gotoMove=function(e){var t;this.board.disableNavigation||this.board.tactics&&this.board.tactics.problemActive||this.board.blockFowardBack||this.board.deferredBlockForwardBack||(activeBoard=this.board,(t=(t=e.currentTarget||!!e.targetElement&&e.targetElement)||YAHOO.util.Event.getTarget(e)).id||(t=t.parentNode),t=t.id.substr((this.board.boardName+"-m").length),clog&&console.log("got goto move index:"+t),this.board.gotoMoveIndex(t,!1,!1,!1,!1),this.board.problem&&(this.board.currentMove.bestMoves?this.board.problem.showBestMoves(this.board.currentMove,this.board.currentMove.bestMoves,this.board.currentMove.correctMove,this.board.currentMove.wrongMove):this.board.problem.clearBestMoves()))},MovesDisplay.prototype.getMovesDisplay=function(){var e;return this.cachedMovesDisplay||this.allreadyCachedMovesDisplay||(e=this.board.boardName+"-moves",this.moveListName&&(e=this.moveListName),this.cachedMovesDisplay=YAHOO.util.Dom.get(e),this.allreadyCachedMovesDisplay=!0),this.cachedMovesDisplay},MovesDisplay.prototype.outputVariationStart=function(e,t,i,s){var o="";return t>this.board.ml||1==this.board.ml&&1<s||((this.getMovesDisplay()||this.board.outputWithoutDisplay)&&(0==e&&this.displayType==MovesDisplay.MAIN_ON_OWN_LINE&&this.firstNonMove&&(this.board.useDivClearForNewline&&(o+='<div style="clear:both;"></div>'),o+='<div class="ct-mainline-commentary"/>',this.pendingLevelZeroCommentaryClose=!0),this.variationOnOwnLine&&(this.board.useDivClearForNewline?o+='<div style="clear:both;"></div>':o+="<br/>"),this.board.showBracketsOnVariation&&(!this.board.hideBracketsOnTopLevelVariation||0<e)&&(o+="<span>"+this.board.variationStartString+"</span>")),this.firstNonMove=!1),o},MovesDisplay.prototype.outputVariationEnd=function(e,t,i,s){var o=this.getMovesDisplay(),n="";return 1==this.board.ml&&0<t&&this.board.outputFirstVar||(this.board.outputFirstVar=!0,(o||this.board.outputWithoutDisplay)&&this.board.showBracketsOnVariation&&(!this.board.hideBracketsOnTopLevelVariation||1<e)&&(n+="<span>"+this.board.variationEndString+"</span>"),1==e&&(this.displayType,MovesDisplay.MAIN_ON_OWN_LINE),this.firstNonMove=!1),n},MovesDisplay.prototype.outputComment=function(e,t,i,s){if(this.board.ignoreCommentRegex&&new RegExp(this.board.ignoreCommentRegex).test(e))return"";var o="";return 1==this.board.ml||((this.getMovesDisplay()||this.board.outputWithoutDisplay)&&(0==t&&this.displayType==MovesDisplay.MAIN_ON_OWN_LINE&&(this.firstNonMove&&(o+="<br/>"),o+='<div class="ct-mainline-commentary">',this.pendingLevelZeroCommentaryClose=!0),i=i?"ct-board-move-alt-comment":"ct-board-move-comment",this.board.handleCommentClicks&&(i+=" ct-board-clickable-comment"),o+='<span class="'+i+'"> '+e+" </span>",0==t&&(this.displayType,MovesDisplay.MAIN_ON_OWN_LINE)),s||(this.firstNonMove=!1)),o}
6,MovesDisplay.prototype.outputNag=function(e){var t="";if(this.getMovesDisplay()||this.board.outputWithoutDisplay){var i=null;switch(e){case 11:i="=";break;case 14:i="+=";break;case 15:i="=+";break;case 16:i="+/-";break;case 17:i="-/+";break;case 18:i="+-";break;case 19:i="-+";break;case 20:i="+--";break;case 21:i="--+"}i&&(t+="<span> "+i+" </span>")}return t},MovesDisplay.prototype.outputResult=function(e){return'<span class="ct-result">'+e+"</span>"},MovesDisplay.prototype.outputMove=function(e,t,i,s,o,n,r,a,l,h,u,c,d,m,p){var g,v="",f=this.getMovesDisplay();return this.board.tr&&0<t&&(1<n||3<r)&&!o||1==this.board.ml&&0<n&&this.board.outputFirstVar||((f||this.board.outputWithoutDisplay)&&(n=Math.round(i/2)+". ",f=!1,i%2!=1&&(o||!this.firstNonMove?(n=Math.round(i/2)+"... ",f=!0):n=""),this.displayType!=MovesDisplay.MAIN_ON_OWN_LINE||0!=t||this.firstNonMove&&i%2!=1||(this.pendingLevelZeroCommentaryClose&&(this.pendingLevelZeroCommentaryClose=!1,v+="</div>"),this.board.newlineForEachMainMove&&(this.board.useDivClearForNewline?v+='<div style="clear:both;"></div>':v+="<br/>")),i=o="",a&&a.eg_move&&(o=(g=this.board.egMoveToScoreString(a.eg_move))[0],i=g[1]),a=l?"initially_hidden":"",""!=o&&(o=" "+o),g="",h&&(g=' rel="'+s+'" ',s="___"),f=f&&0==t?'<span class="ct-board-move-dottedempty">&nbsp;</span>':"",n=n?'<span class="ct-board-move-movenum">'+n+"</span>":"",m=p?" ct-current-move ":0==e?u?" ct-best-move ":d?" ct-bad-move ":c?" ct-good-move ":m?" ct-current-move ":" ct-first-move ":"",v+="<span "+g+(l?"alt":"title")+'="'+i+'" id="'+this.board.boardName+"-m"+e+'" class="'+(0==t?"ct-board-move-mainline":"ct-board-move-variation")+m+'">'+n+f+'<span class="ct-board-move-movetext">'+s+'</span><span id="'+this.board.boardName+"-msc"+e+'" class="'+a+'">'+o+"</span></span>"),this.firstNonMove=!0),v},Board.prototype.setMoveSeqLalg=function(e,t,i,s,o,n,r,a,l,h,u,c){var d=new Array;e&&0<e.length&&(d=e.replace(/\s+$/g,"").split(" ")),this.setupFromLalgArray(d,s,i,t,o,n,r,a,l,h,u,c)},Board.prototype.setupFromLalgArray=function(e,t,i,s,o,n,r,a,l,h,u,c){var d;this.outputFirstVar=!1,this.movesDisplay&&(this.movesDisplay.pendingLevelZeroCommentaryClose=!1,(d=this.movesDisplay.getMovesDisplay())&&(n||YAHOO.util.Event.purgeElement(d,!0),d.innerHTML="")),s=s||new Array;var m=this.cloneBoard();this.movesDisplay.firstNonMove=!1;var p=null,g=null;o||(p=new Array,g=new Array),!h&&this.prev_move&&m.boardPieces[this.prev_move.fromColumn][this.prev_move.fromRow]&&m.makeMove(this.prev_move,m.boardPieces[this.prev_move.fromColumn][this.prev_move.fromRow],!1,m.moveAnimationLength,!1,!1);var v=null;o||(v=m.cloneBoard());var f=null,b=0,y="",O=!1,_=!1,C=0,A=!1,S=new Array,E=new Array;E[0]=0;for(var w,M=new Array,P=new Array,D=2*i-1,H=2*i-1,T=new Array,I=ChessPiece.WHITE,N=0,Y="",x="",k="",L=0,B=0;B<e.length;B++){var R,F,z,U,V,G=0;"ALT"!=e[B]?0!=e[B].indexOf("EVAL")?0!=e[B].indexOf("DEPTH")?0!=e[B].indexOf("NODES")?(0==e[B].indexOf("TIME")&&(w=e[B].split(":")[1],0!=(F=Y).indexOf("mate")?0<(F=(parseFloat(Y)/100).toFixed(2))&&(F="+"+F):(z=(F=F.replace(/_/," ")).split(" "),G=parseInt(z[1]),F=_js("mate")+" "+z[1],1==E[C]&&0),(L=G)<0?_=!1:0<G&&G<8&&0<C&&1<E[C]&&(_=!0),R="",_&&(R=_js("ALT")+" "),parseInt(w),z=" "+__js("nps:{NODES_PER_SECOND}",[["NODES_PER_SECOND",Math.round(parseInt(k)/(parseInt(w)/1e3))]]),this.showNPS||(z=""),0<C&&E[C]>this.ml?e[B]="":e[B]=R+F+" ("+__js("depth:{DEPTH}",[["DEPTH",x]])+z+")"),"}"!=e[B]?O?y+=e[B]+" ":"{"!=e[B]?"("!=e[B]?")"!=e[B]?"$"!=e[B].charAt(0)?(R=this.createMoveFromString(e[B]),D==H&&this.boardPieces[R.fromColumn][R.fromRow].colour==ChessPiece.BLACK&&(D++,I=ChessPiece.BLACK),R.index=b,F=R.pgn||R.moveString,R.pgn?F=R.pgn:(F=m.makeShortAlgabraic(R.fromColumn,R.fromRow,R.toColumn,R.toRow,R),R.SAN=F),F=Board.moveToLocale(F),this.movesDisplay&&(this.movesDisplay.setToMove(I),U=!1,u&&c&&!c.atEnd&&(z=c.toMoveString(),c=c.next,z==e[B]?U=!0:u=!1),T.push(this.movesDisplay.outputMove(b,C,D,F+" ",A,E[C],S[0],null,!1,!1,r,a,l,u,U))),I=I==ChessPiece.BLACK?ChessPiece.WHITE:ChessPiece.BLACK,R.moveNum=D,D++,0<C&&A?(null==(U=f)&&alert("Got no previous move for variation:"+movesArra[B]),0==U.numVars&&(U.vars=new Array),R.isAlt=_,R.mateInMoves=L,(U.vars[U.num
6Vars++]=R).prev=U.prev,A=!1):null!=(R.prev=f)&&(f.next=R),(E[C+1]=0)==C&&(N=b),s[b++]=R,f=m.moveArray[b-1]=R,o||(v=m.cloneBoard()),m.makeMove(R,m.boardPieces[R.fromColumn][R.fromRow],!1,m.moveAnimationLength,!1,!1)):this.movesDisplay&&T.push(this.movesDisplay.outputNag(parseInt(e[B].substring(1)))):(this.movesDisplay&&T.push(this.movesDisplay.outputVariationEnd(C,E[C],D,S[0])),(V=new Move).atEnd=!0,(f.next=V).prev=f,D=S[--C],f=M[C],I=P[C],m=p[C],v=g[C],_=!1):(E[C+1]||(E[C+1]=0),E[C+1]++,this.movesDisplay&&T.push(this.movesDisplay.outputVariationStart(C,E[C+1],D,S[0])),S[C]=D,M[C]=f,P[C]=I,p[C]=m,m=(g[C]=v).cloneBoard(),C++,D--,A=!0):O=!(y=""):(O=!1,this.movesDisplay&&(y=y.replace(/\s+$/g,""),T.push(this.movesDisplay.outputComment(y,C,_))))):k=e[B].split(":")[1]:x=e[B].split(":")[1]:(Y=e[B].split(":")[1],175<=parseInt(Y)&&0<C&&1<E[C]&&(_=!0)):_=!0}this.movesDisplay&&!this.disableMoveOutput&&(this.movesDisplay.getMovesDisplay(),T.push(this.movesDisplay.outputResult(t)),this.pendingMovesOutput=T.join(""),this.pendingMovesOutputCount=b),this.lastMoveIndex=N,null!=f&&((V=new Move).atEnd=!0,(f.next=V).prev=f),this.lastCount=b},Board.prototype.getMaterialCount=function(){for(var e=0,t=0,i=0;i<8;i++)for(var s=0;s<8;s++){var o=this.boardPieces[i][s];o&&(o.colour==ChessPiece.WHITE?e+=ChessPiece.materialValue(o.piece):t+=ChessPiece.materialValue(o.piece))}return[e,t]},Board.prototype.getMaterialBalance=function(){var e=this.getMaterialCount();return e[0]-e[1]},Board.prototype.getMaterialBalances=function(){var e=this.cloneBoard(),t=this.moveArray[0];e.gotoMoveIndex(-1,!0,!0,!0,!0);for(var i=[];t&&!t.atEnd;)e.makeMove(t,e.boardPieces[t.fromColumn][t.fromRow],!1,this.moveAnimationLength,!1,!1),i.push(e.getMaterialBalance()),t=t.next,e.toggleToMove();return i},Board.prototype.lalgToMoveList=function(e,t,i,s,o,n){ctime&&console.time("lalgToMoveList"),clog&&console.log("startMoveNum:"+i),s=s||new Array;var r=this.cloneBoard(),a=null,l=null;n||(a=new Array,l=new Array),!o&&this.prev_move&&r.makeMove(this.prev_move,r.boardPieces[this.prev_move.fromColumn][this.prev_move.fromRow],!1,r.moveAnimationLength,!1,!1);var h=null;n||(h=r.cloneBoard());var u=[],c=null,d=0,m="",p=!1,g=0,v=!1,f=new Array,b=new Array;b[0]=0;for(var y,O,_,C=new Array,A=new Array,S=2*i-1,E=(new Array,ChessPiece.WHITE),w=!0,M=0;M<e.length;M++)"}"!=e[M]?p?m+=e[M]+" ":"{"!=e[M]?"("!=e[M]?")"!=e[M]?"$"!=e[M].charAt(0)?((y=this.createMoveFromString(e[M])).nags=u,y.beforeComment=trimStr(m),m=null,u=[],w&&(this.boardPieces[y.fromColumn][y.fromRow].colour==ChessPiece.BLACK&&(S++,E=ChessPiece.BLACK,clog&&console.log("first move black new movenum:"+S)),w=!1),y.index=d,O=y.pgn||y.moveString,y.pgn?(O=y.pgn,y.SAN=y.pgn):(O=r.makeShortAlgabraic(y.fromColumn,y.fromRow,y.toColumn,y.toRow,y),y.SAN=O),E=E==ChessPiece.BLACK?ChessPiece.WHITE:ChessPiece.BLACK,y.moveNum=S,S++,0<g&&v?(null==(O=c)&&alert("Got no previous move for variation:"+movesArra[M]),0==O.numVars&&(O.vars=new Array),(O.vars[O.numVars++]=y).prev=O.prev,v=!1):null!=(y.prev=c)&&(c.next=y),b[g+1]=0,s[d++]=y,c=r.moveArray[d-1]=y,n||(h=r.cloneBoard()),r.makeMove(y,r.boardPieces[y.fromColumn][y.fromRow],!1,r.moveAnimationLength,!1,!1)):u.push(parseInt(e[M].substring(1))):(c&&(clog&&(console.log("var end comment:"+m),console.log("var end comment:"+c.output())),c.afterComment=trimStr(m),m=""),(_=new Move).atEnd=!0,(c.next=_).prev=c,S=f[--g],c=C[g],E=A[g],r=a[g],h=l[g]):(clog&&console.log("var start comment:"+m),c&&(c.afterComment=trimStr(m),m=""),clog&&(c?console.log("old:"+c.output()):console.log("no old move")),b[g+1]||(b[g+1]=0),b[g+1]++,f[g]=S,C[g]=c,A[g]=E,a[g]=r,r=(l[g]=h).cloneBoard(),g++,S--,v=!0):(m&&c&&(c.afterComment=trimStr(m)),p=!(m
6="")):(p=!1,m=m.replace(/\s+$/g,""));return null!=c&&((_=new Move).atEnd=!0,(c.next=_).prev=c,m&&(c.afterComment=trimStr(m))),ctime&&console.timeEnd("lalgToMoveList"),s},Board.prototype.reset=function(e,t){this.lastFromSquare&&YAHOO.util.Dom.removeClass(this.lastFromSquare,"ct-from-square"),this.lastToSquare&&YAHOO.util.Dom.removeClass(this.lastToSquare,"ct-to-square"),this.clearMoveList(),e?(this.startFen=e,this.setupFromFen(e,!1,this.isFlipped,!1,t,!0)):(this.startFen=Board.INITIAL_FEN,this.setupFromFen(Board.INITIAL_FEN,!1,this.isFlipped,!1,!1,!0)),this.setForwardBack()},Board.prototype.clearMoveList=function(e){this.movesDisplay.firstNonMove=!1;var t=this.movesDisplay.getMovesDisplay();t&&(YAHOO.util.Event.purgeElement(t,!0),t.innerHTML=""),this.currentMove=null,this.moveIndex=-1,this.moveArray=new Array,e?(e.prev=null,this.startMoveNum=e.moveNum):this.startMoveNum=1},Board.prototype.insertMovesFromMoveList=function(e,t,i,s,o){var n=!t;if(clog&&console.log("insertMovesFromMoveList called"),ctime&&n&&console.time("insertMovesFromMoveList"),this.movesDisplay){n&&this.clearMoveList(e);for(var r=0,a=(e.moveNum,e);null!=a&&!a.atEnd;){clog&&console.log("move:"+a.output());var l=a.next;if(clog&&(this.currentMove?console.log("current move:"+this.currentMove.output()):console.log("no current move"),l?console.log("next move:"+l.output()):console.log("no next move")),n||e!=a||null==i?(clog&&console.log("about to call insertmoveafter"),null!=s?(clog&&console.log("inserting after moveToInsertAfter:"+s.output()),this.insertMoveAfter(s,a),s=null):(clog&&console.log("inserting after current move"),this.insertMoveAfter(this.currentMove,a)),clog&&console.log("finished call to insertmoveafter")):(clog&&console.log("about to replace variationParent:"+i.output()+" with move:"+a.output()+" and board:"+this.boardToFen()),this.replaceMove(i,a,!0,!0,!1,!1,!0)),a.beforeComment&&this.insertCommentIntoMoveDisplay(a,a.beforeComment,!1),a.afterComment&&this.insertCommentIntoMoveDisplay(a,a.afterComment,!0),clog&&console.log("about to make move:"+a.output()+" with board pos:"+this.boardToFen()),this.makeMove(a,this.boardPieces[a.fromColumn][a.fromRow],!1,this.moveAnimationLength,!1,!1),clog&&console.log("made move"),this.setCurrentMove(a,!0,!0),0<a.numVars){var h=a.index,u=a.prev,c=-1;u&&(c=u.index);var d=a.numVars,m=a.vars;a.numVars=0,a.vars=[];for(var p=0;p<d;p++)this.gotoMoveIndex(c,!0,!0,!0,!0),clog&&console.log("about to call insertMovesFromMoveList with head of variation"),this.insertMovesFromMoveList(m[p],!0,a,null,0),clog&&console.log("about to reset currentMoveIndex  after variation insert:"+h);this.gotoMoveIndex(h,!0,!0,!0,!0),this.backMove();u=this.currentMove;this.makeMove(u,this.boardPieces[u.fromColumn][u.fromRow],!1,this.moveAnimationLength,!1,!1),clog&&(this.currentMove?console.log("popped up from variation, current set back to:"+this.currentMove.output()):console.log("popped up from variation, current set to null"))}if(a=l,r++,0<o&&o<=r)break}if(n&&this.gotoMoveIndex(-1,!1,!1,!1,!1),clog)for(var g=this.currentMove;g;)console.log("m:"+g.output()),g=g.next;ctime&&n&&console.timeEnd("insertMovesFromMoveList")}},Board.prototype.setupFromLalgArrayIncremental=function(e,t,i,s){if(this.outputFirstVar=!1,this.movesDisplay&&this.lastCount)for(this.movesDisplay.pendingLevelZeroCommentaryClose=!1,m=0;m<this.lastCount;m++){var o=YAHOO.util.Dom.get(this.boardName+"-m"+m);o&&YAHOO.util.Event.purgeElement(o)}var n=0,r=2*i-1,a="",l=ChessPiece.WHITE,h=!1,u=!0;this.currentMove=null;for(var c,d,m=0;m<e.length;m++)"}"!=e[m]?h?a+=e[m]+" ":"{"!=e[m]?"("!=e[m]&&")"!=e[m]&&"$"!=e[m].charAt(0)&&(c=this.createMoveFromString(e[m]),u&&this.boardPieces[c.fromColumn][c.fromRow].colour==ChessPiece.BLACK&&(r++,l=ChessPiece.BLACK),this.startMoveNum=r,u=!1,c.index=n++,d=c.moveString,d=Board.moveToLocale(d),l=l==ChessPiece.BLACK?ChessPiece.WHITE:ChessPiece.BLACK,this.insertMoveAfter(this.currentMove,c),clog&&c.prev&&(c.prev.next?console.log("move.prev.next:"+c.prev.next.output()):console.log("move.prev:"+c.prev.output()+" next null")),this.makeMove(c,this.boardPieces[c.fromColumn][c.fromRow],!1,this.moveAnimationLength,!1,!1),this.setCurrentMove(c)):h=!(a=""):(h=!1,this.movesDisplay&&(a=a.replace(/\s+$/g,"")));this.gotoMoveIndex(-1,!1,!1,!1,!1)},Board.prototype.displayPendingMoveList=function(){if(this.pendingMovesOutput&&this.movesDisplay){var e=this.movesDisplay.getMovesDisplay();if(e&&(e.innerHTML=this.pendingMovesOutput,new YAHOO.util.Scroll(e,{scroll:{to:[0,0]}},0).animate()),this.movesDisplay)for(var t=0;t<this.pendingMovesOutputCount;t++){var i=YAHOO.util.Dom.get(this.boardName+"-m"+t);i&&(YAHOO.util.Event.addListener(i,"click",this.movesDisplay.gotoMove,this.movesDisplay,!0),this.handleCommentClicks)&&((i=YAHOO.util.Dom.get(this.boardName+"-mcb"+t))&&YAHOO.util.Event.addListener(i,"click",this.movesDisplay.clickComment,this.movesDisplay,!0),(i=YAHOO.util.Dom.get(this.boardName+"-mca"+t))&&YAHOO.util.Event.addListener(i,"click",this.movesDisplay.clickComment,this.movesDisplay,!0))}}},Board.prototype.setMoveSequence=function(e,t,i,s){this.tacticMoveArray=new Array,this.moveArray=this.tacticMoveArray,this.setMoveSeqLalg(e,this.tacticMoveArray,i,s),this.tacticsmoveArrayLastMoveIndex=this.lastMoveIndex,this.fullmoveArray=null,this.lastMoveIndex=this.tacticsmoveArrayLastMoveIndex},Board.prototype.resetVariationsPreviousNodes=function(e,t){if(0<e.numVars)for(var i=0;i<e.numVars;i++)e.vars[i].prev=t,this.resetVariationsPreviousNodes(e.vars[i],t)},Board.prototype.reconnectNextNodeVariations=function(e,t){if(t&&0<t.numVars)for(var i=0;i<t.numVars;i++)t.vars[i].prev=e,this.reconnectNextNodeVariations(e,t.vars[i])},Board.prototype.findFirstMoveFromList=function(e){for(var t=e;t&&null!=t.prev;)t=t.prev;return t},Board.prototype.findVariationHeadFromMove=function(e){for(var t=e;t&&t.prev&&t.prev.next==t;)t=t.prev;return t&&t.prev&&t.prev.next!=t||t&&!t.prev&&t!=this.moveArray[0]?t:null},Board.prototype.liftVariation=function(e){if(e){var t=null,i=null;e.prev?t=e.prev.next:(t=this.moveArray[0],i=e);var s=null;if(this.currentMove&&this.currentMove.prev&&(s=this.currentMove.prev),t){var o=t.numVars,n=t.vars;t.numVars=0,t.vars=[],0==e.numVars&&(e.vars=[]);for(var r=0;r<o;r++){var a=n[r];clog&&console.log("processing var:"+a.output()),a==e?(clog&&console.log("inserted parent var"),e.vars.push(t)):e.vars.push(a),e.numVars++}e.prev&&(e.prev.next=e),clog&&console.log("finished moving variations"),i=i||this.findFirstMoveFromList(e),this.moveArray[0]=i,this.gotoMoveIndex(-1,!0,!0,!0,!0),clog&&console.log("fm:"+i.output()),this.insertMovesFromMoveList(i)}s&&this.gotoMoveIndex(s.index)}},Board.prototype.deleteMoveAndLine=function(e){var t=e,i=t,s=!1,o=null,n=this.moveArray[0],r=null;clog&&console.log("delete line:"+e.output()),clog&&console.log("delete line prev:"+e.prev),clog&&e.prev&&console.log("delete line prev.next:"+e.prev.next),e&&e.prev&&e.prev.next!=e?(clog&&console.log("var is head and not front of move list"),s=!0,o=e.prev.next):e&&!e.prev&&e!=this.moveArray[0]&&(clog&&console.log("var is head and front of move list"),s=!0,o=this.moveArray[0]),clog&&console.log("isVariationHead:"+s),clog&&console.log("fm:"+n.output());t=t.prev;if(s){if(r=o){clog&&console.log("delete variation from parent:"+o.output());for(var a=[],l=0;l<o.numVars;l++)o.vars[l]!=i?(clog&&console.log("saving var:"+o.vars[l].output()),a.push(o.vars[l])):clog&&console.log("dropping var:"+o.vars[l].output());o.vars=a,o.numVars=a.length}}else{if(!t){clog&&console.log("deleting entire list"),this.movesDisplay&&(this.movesDisplay.firstNonMove=!1,YAHOO.util.Event.purgeElement(this.movesDisplay.getMovesDisplay(),!0),this.movesDisplay.pendingLevelZeroCommentaryClose=!1);s=this.movesDisplay.getMovesDisplay();return s&&(s.innerHTML=""),this.currentMove=null,this.startMoveNum=n.moveNum,clog&&console.log("startFen:"+this.startFen),this.moveIndex=-1,this.moveArray=[],this.setupFromFen(this.startFen),this.lastFromSquare&&YAHOO.util.Dom.removeClass(this.lastFromSquare,"ct-from-square"),this.lastToSquare&&YAHOO.util.Dom.removeClass(this.lastToSquare,"ct-to-square"),void this.setForwardBack()}t.next=null,r=t}this.moveArray[0]=n,this.gotoMoveIndex(-1,!0,!0,!0,!0),clog&&console.log("fm:"+n.output()),this.insertMovesFromMoveList(n),r&&this.gotoMoveIndex(r.index)},Board.prototype.insertMoveAfter=function(e,t,i,s,o,n){addToMovelist=!i,clog&&console.log("addToMovelist:"+addToMovelist);i="null";
6e&&(i=e.output()),clog&&console.log("insert newMove:"+t.output()+" after:"+i),null==e?((this.currentMove=t).atEnd=0,t.prev=null,t.next=null,this.firstMove=t,0<this.startMoveNum?this.currentMove.moveNum=this.startMoveNum:this.toMove==ChessPiece.WHITE?this.currentMove.moveNum=1:this.currentMove.moveNum=2,clog&&console.log("startMoveNum:"+this.startMoveNum+" currMoveNum:"+this.currentMove.moveNum)):(t.atEnd=e.atEnd,(t.prev=e).atEnd=0,clog&&e.next&&console.log("prevMove.next:"+e.next.output()),t.equals(e.next)||t.equals(e)?(clog&&console.log("inserting move that already exists in variation:"+e.next.output()),i=e.next,this.firstMove==i&&(this.firstMove=t),t.equals(e)&&(i=e),i.prev&&i.prev.next==i&&(i.prev.next=t),i.next&&(i.next.prev=t),addToMovelist=!1,t.moveNum=i.moveNum,t.ravLevel=i.ravLevel,t.index=i.index,t.fen=i.fen,t.nextFen=i.nextFen,t.bestMoves=i.bestMoves,t.correctMove=i.correctMove,t.wrongMove=i.wrongMove,t.next=i.next,t.vars=i.vars,t.numVars=i.numVars,this.reconnectNextNodeVariations(t,i.next),this.moveArray[t.index]=t,this.currentMove==i&&this.setCurrentMove(t)):(t.moveNum=e.moveNum+1,t.ravLevel=e.ravLevel,t.next=e.next,t.next&&(t.next.prev=t)),e.next=t),addToMovelist&&this.insertIntoMoveDisplay(e,t,s,o,n),null==t.next?(n=this.createMoveFromString("i1i2"),(t.next=n).prev=t,n.moveNum=t.moveNum+1,n.ravLevel=t.ravLevel,n.next=null,n.atEnd=1,n.endNode=!0,clog&&console.log("created endmove node in insertAfterMove:"+n.output())):(clog&&console.log("allready had a node at end:"+t.next.output()),t.next.moveNum=t.moveNum+1)},Board.prototype.replaceIntoMoveDisplay=function(e,t,i,s,o){if(d="null",e&&(d=e.output()),clog&&console.log("replace display newMove:"+t.output()+" after:"+d+" hideScore:"+s),e){clog&&console.log("about to get movesdsiplay in replace into move display:"+this.movesDisplay);var n=this.movesDisplay.getMovesDisplay();if(clog&&console.log("got moves display"),n){var r=t.SAN;r||(clog&&console.log("about to make san"),r=this.makeShortAlgabraic(t.fromColumn,t.fromRow,t.toColumn,t.toRow,t),clog&&console.log("about to made san:"+r),t.SAN=r),clog&&console.log("oldMove.index:"+e.index);var a=this.boardName+"-ms"+e.index,l=-1;e.next&&(l=this.boardName+"-m"+e.next.index),clog&&console.log("oldMoveId:"+a);var h=YAHOO.util.Dom.get(a),u=YAHOO.util.Dom.get(l);if(i){this.moveIndex++,t.index=this.moveIndex,this.moveArray[this.moveIndex]=t,clog&&console.log("replace as variation old:"+e.output()+" new:"+t.output());var c=document.createElement("span");void 0!==e.ravlevel&&0!=e.ravlevel||YAHOO.util.Dom.addClass(c,"ct-top-var-start");n=this.movesDisplay.outputVariationStart(0,0,t.moveNum,0);t.ravLevel=e.ravlevel+1,d=Board.moveToLocale(r),null==t.prev&&(this.movesDisplay.firstNonMove=!1),m=this.movesDisplay.outputMove(this.moveIndex,t.ravLevel,t.moveNum,d,i,0,t.moveNum,t,s,o),(p=document.createElement("span")).id=this.boardName+"-ms"+t.index,p.innerHTML=m+"&nbsp;";a=this.movesDisplay.outputVariationEnd(0,0,t.moveNum,0);this.movesDisplay.firstNonMove=!0;l=document.createElement("span");l.innerHTML=n;n=document.createElement("span");n.innerHTML=a,c.appendChild(l);a=YAHOO.util.Dom.getElementsByClassName("ct-mainline-commentary","div",c),l=c;0<a.length&&(l=a[0]),l.appendChild(p),l.appendChild(n),h.appendChild(c),u&&0==(a=YAHOO.util.Dom.getElementsByClassName("ct-board-move-movenum","span",u)).length&&(n=e.next.moveNum,c=Math.round(n/2)+". ",a=!1,n%2!=1&&(clog&&console.log("firstRav:"+firstRav+" firstNonMove:"+this.firstNonMove),c=Math.round(n/2)+"... ",a=!0),(p=document.createElement("span")).className="ct-board-move-movenum",p.innerHTML=c,insertBefore(p,u.firstChild),p=document.createElement("span"),a&&(p.className="ct-board-move-dottedempty",p.innerHTML="&nbsp;",insertAfter(p,u.firstChild)))}else{t.index=e.index,this.moveArray[t.index]=t;var d=Board.moveToLocale(r);null==t.prev&&(this.movesDisplay.firstNonMove=!1);var m=this.movesDisplay.outputMove(t.index,t.ravLevel,t.moveNum,d,i,0,t.moveNum,t,s,o),p=document.createElement("span");p.innerHTML=m+"&nbsp;",p.id=this.boardName+"-ms"+t.index;var g=[];if(h&&h.childNodes)for(v=1;v<h.childNodes.length;v++)g[v-1]=h.childNodes[v];if(clog&&console.log("replace as main line not variation old:"+e.output()+" new:"+t.output()),h.parentNode.replaceChild(p,h),g)for(var v=0;v<g.length;v++)p.appendChild(g[v])}YAHOO.util.Event.removeListener(this.boardName+"-m"+t.index),YAHOO.util.Event.addListener(this.boardName+"-m"+t.index,"click",this.movesDisplay.gotoMove,this.movesDisplay,!0)}else clog&&console.log("no movesd disiplay in replace into move display")}else clog&&console.log("null oldMove"),this.insertIntoMoveDisplay(null,t,!1,s)},Board.prototype.insertCommentIntoMoveDisplay=function(e,t,i){var s,o,n,r;this.movesDisplay.getMovesDisplay()&&(n=i?"a":"b",e&&(r=this.boardName+"-mc"+n+e.index,o=!1,(s=YAHOO.util.Dom.get(r))||((s=document.createElement("span")).id=r,o=!0),r=!(n=e.moveNum%2!=1)&&!i,clog&&console.log("dontResetFirstNoneMove:"+r+" isBlackMoveNum:"+n+" insertCommentAfter:"+i+" move.moveNum:"+e.moveNum+" comment:"+t),s.innerHTML=this.movesDisplay.outputComment(t,0,!1,r),(r=YAHOO.util.Dom.get(this.boardName+"-m"+e.index))&&(i?(e.afterComment=t,o&&insertAfter(s,r)):(e.beforeComment=t,o&&insertBefore(s,r))),s&&o&&this.handleCommentClicks&&YAHOO.util.Event.addListener(s,"click",this.movesDisplay.clickComment,this.movesDisplay,!0)))},Board.prototype.insertIntoMoveDisplay=function(e,t,i,s,o){var n,r,a,l=this.movesDisplay.getMovesDisplay();l&&(clog&&(n="null",e&&(n=e.output()),console.log("insert display newMove:"+t.output()+" after:"+n)),(a=t.SAN)||(a=this.makeShortAlgabraic(t.fromColumn,t.fromRow,t.toColumn,t.toRow,t),t.SAN=a),this.moveIndex++,t.index=this.moveIndex,this.moveArray[this.moveIndex]=t,n=Board.moveToLocale(a),r=!1,a=null,e&&(a=YAHOO.util.Dom.get(this.boardName+"-ms"+e.index)),a&&0<YAHOO.util.Dom.getElementsByClassName("ct-mainline-commentary","div",a).length&&(r=!0),s=this.movesDisplay.outputMove(this.moveIndex,t.ravLevel,t.moveNum,n,r,0,t.moveNum,t,s,o),(o=document.createElement("span")).innerHTML=s+"&nbsp;",o.id=this.boardName+"-ms"+this.moveIndex,i&&YAHOO.util.Dom.setStyle(o,"visibility","hidden"),e?(clog&&console.log("prevMove.index:"+e.index+"prevMove:"+e.output()),a?insertAfter(o,a):l.appendChild(o)):t.next?insertBefore(o,YAHOO.util.Dom.get(this.boardName+"-ms"+t.next.index)):l.appendChild(o),YAHOO.util.Event.removeListener(this.boardName+"-m"+this.moveIndex),YAHOO.util.Event.addListener(this.boardName+"-m"+this.moveIndex,"click",this.movesDisplay.gotoMove,this.movesDisplay,!0))},Board.prototype.replaceMove=function(e,t,i,s,o,n,r){var a="null";
6e&&(a=e.output()),clog&&(console.log("replace newMove:"+t.output()+" after:"+a+" replace as var"+i+" rep move display:"+s+" hideScore:"+o+" replaceAsVariationEvenIfSame:"+r),e&&e.prev&&console.log("replace oldMove.prev:"+e.prev.output()),e&&e.next&&console.log("replace oldMove.next:"+e.next.output()));var l=!1,h=null,u=0;if(e.endNode)return clog&&console.log("asked to replace endNode,inserting before instead"),this.insertMoveAfter(e.prev,t,!1,!1,o,n),t.fen=e.fen,void(t.nextFen=e.nextFen);if(!r&&t.equals(e))clog&&console.log("new move is same as old move so not replacing as variation"),i=!1;else if(!r&&e&&0<e.numVars)for(var c=0;c<e.numVars;c++){var d=e.vars[c];if(t.equals(d)){clog&&(console.log("new move is same as an existing variation varNum:"+c),console.log("variation:"+d.output()),d.next&&console.log("variation next:"+d.next.output())),l=!0,h=e,e=d,u=c;break}}if(null==e)clog&&console.log("replaced new move with null oldmove"),(this.currentMove=t).atEnd=1,t.next=null,t.prev=null,this.startPositionAfterOpponentMove&&(t.fen=this.startPositionAfterOpponentMove,t.nextFen=null),this.toMove==ChessPiece.WHITE?this.currentMove.moveNum=1:this.currentMove.moveNum=2,this.firstMove=t;else{a=!1;if(e&&e.prev&&e.prev.next!=e&&(a=!0),this.currentMove!=e||i?clog&&console.log("not setting current move in replacemove"):this.currentMove=t,t.atEnd=e.atEnd,t.prev=e.prev,t.next=e.next,t.fen=e.fen,t.nextFen=e.nextFen,t.bestMoves=e.bestMoves,t.correctMove=e.correctMove,t.wrongMove=e.wrongMove,t.moveNum=e.moveNum,t.ravLevel=e.ravLevel,t.index=e.index,clog&&console.log("replacingVariation with var not null:"+l),l)return(h.vars[u]=t).vars=e.vars,t.numVars=e.numVars,this.reconnectNextNodeVariations(t,e.next),e.next&&(e.next.prev=t),this.moveArray[t.index]=t,void(clog&&(console.log("replacing existing sub variation of main line"),t.next&&console.log("next of replacement variation:"+t.next.output())));i?(clog&&console.log("replacing as variation"),0==e.numVars&&(e.vars=new Array),e.vars[e.numVars++]=t,e.atEnd=0,t.next=null,r=this.createMoveFromString("i1i2"),(t.next=r).prev=t,r.next=null,r.atEnd=1,r.moveNum=t.moveNum+1,r.ravLevel=t.ravLevel,r.endNode=!0):(clog&&console.log("not replacing as variation"),!a&&e.prev&&(e.prev.next=t),e.next&&(e.next.prev=t),t.vars=e.vars,t.numVars=e.numVars,this.reconnectNextNodeVariations(t,e.next),this.firstMove==e&&(this.firstMove=t),this.moveArray[t.index]=t)}s&&this.replaceIntoMoveDisplay(e,t,i,o,n)},Board.prototype.setCurrentMove=function(e,t,i){var s;this.cloned||null==this.currentMove||null!=this.currentMove.prev&&YAHOO.util.Dom.removeClass(this.boardName+"-m"+this.currentMove.prev.index,"ct-board-move-current"),this.currentMove=e,this.cloned||null==this.currentMove||null==this.currentMove.prev?null==e&&clog&&console.log("attempted to set current move on null node"):(s=this.boardName+"-m"+this.currentMove.prev.index,clog&&console.log("setCurrentMove attempted highlight of id:"+s+" for move:"+e.output()),(e=YAHOO.util.Dom.get(s))&&(s=e.className,YAHOO.util.Dom.addClass(e,"ct-board-move-current"),!this.autoScrollMoves||i||!this.scrollVariations&&-1!=s.indexOf("ct-board-move-variation")||(i=this.movesDisplay.getMovesDisplay())&&(s=0,i&&i.offsetHeight&&(s=i.offsetHeight/2),s=YAHOO.util.Dom.getY(e)-(YAHOO.util.Dom.getY(i)+s),new YAHOO.util.Scroll(i,{scroll:{by:[0,s-this.scrollOffsetCorrection]}},this.moveAnimationLength,YAHOO.util.Easing.easeOut).animate()))),t||this.setForwardBack()},Board.prototype.newBoardFromFen=function(e){var t=new Board;return t.boardPieces=Board.createBoardArray(),t.setupFromFen(e,!1,!1,!0),t},Board.prototype.distanceFromInitial=function(){var e=this.cloneBoard();e.setupFromFen(Board.INITIAL_FEN,!1,!1,!0,!1,!1);for(var t=0,i=0;i<8;i++)for(var s=0;s<8;s++){var o=this.boardPieces[i][s],n=e.boardPieces[i][s];o!=n&&n&&(o&&o.piece==n.piece&&o.colour==n.colour||t++)}return t},Board.INITIAL_FEN="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",Board.isFenLegal=function(e){if(!e)return!1;e=e.split(" ");return!(6!=e.length||8!=e[0].split("/").length||"w"!=e[1]&&"b"!=e[1]||isNaN(parseInt(e[4]))||isNaN(parseInt(e[5]))||!function(e){if(e){e=e.toLowerCase();for(var t=0;t<e.length;t++)if("q"!=e.charAt(t)&&"k"!=e.charAt(t)&&"-"!=e.charAt(t))return;return 1}}(e[2])||!function(e){if(e){if("-"==e)return 1;if(2==e.length&&!(e.charAt(0)<"a"||"h"<e.charAt(0))){e=parseInt(e.charAt(1));return!(isNaN(e)||e<1||8<e)}}}(e[3]))},Board.prototype.boardToUniqueFen=function(e){var t=this.boardToFen().split(" "),i="w";return e==ChessPiece.BLACK&&(i="b"),t[0]+" "+i+" "+t[2]+" "+t[3]},Board.prototype.toFen=function(){return this.boardToFen()},Board.prototype.boardToFen=function(e){for(var t="",i=7;0<=i;i--){var s=0,o="";i<7&&(o="/");for(var n=0;n<8;n++){var r=this.boardPieces[n][i];r?(o+=(0<s?s+"":"")+r.getFenLetter(),s=0):s++}0<s&&(o+=s+""),t+=o}var a=t,l=" w ";e?this.toMove==ChessPiece.WHITE&&(l=" b "):this.toMove==ChessPiece.BLACK&&(l=" b "),a+=l;var h="";h+=Board.getFenCastleChar(this.canCastleKingSide,"K",ChessPiece.WHITE),h+=Board.getFenCastleChar(this.canCastleQueenSide,"Q",ChessPiece.WHITE),h+=Board.getFenCastleChar(this.canCastleKingSide,"K",ChessPiece.BLACK),a+=(h+=Board.getFenCastleChar(this.canCastleQueenSide,"Q",ChessPiece.BLACK))?h+" ":"- ";e=null,l="- ";return!(e=this.currentMove&&this.currentMove.prev?this.currentMove.prev:this.prev_move)||(h=this.boardPieces[e.toColumn][e.toRow])&&h.piece==ChessPiece.PAWN&&(h.colour==ChessPiece.WHITE?1==e.fromRow&&3==e.toRow&&(l=Move.columnToChar(e.fromColumn)+"3 "):6==e.fromRow&&4
6==e.toRow&&(l=Move.columnToChar(e.fromColumn)+"6 ")),a+=l,a+=this.halfMoveNumber+" "+parseInt((this.moveNumber+1)/2),clog&&console.log("moveNumber:"+this.moveNumber+" fen:"+a),a},Board.getFenCastleChar=function(e,t,i){return e[i]?i==ChessPiece.WHITE?t.toUpperCase():t.toLowerCase():""},Board.prototype.getCastlingString=function(e){var t=_js("None");return this.canCastleKingSide[e]&&(t="O-O"),this.canCastleQueenSide[e]&&(t==_js("None")?t="O-O-O":t+=",O-O-O"),t},Board.prototype.updateToPlay=function(){var e,t,i;this.disableUpdateToPlay||(this.showToMoveIndicators&&(this.isFlipped?(YAHOO.util.Dom.setStyle(this.boardName+"-top-to-move-inner","background-color","white"),YAHOO.util.Dom.setStyle(this.boardName+"-top-to-move-inner","border","1px solid black"),YAHOO.util.Dom.setStyle(this.boardName+"-bottom-to-move-inner","background-color","black"),YAHOO.util.Dom.setStyle(this.boardName+"-bottom-to-move-inner","border","1px solid white")):(YAHOO.util.Dom.setStyle(this.boardName+"-bottom-to-move-inner","background-color","white"),YAHOO.util.Dom.setStyle(this.boardName+"-bottom-to-move-inner","border","1px solid black"),YAHOO.util.Dom.setStyle(this.boardName+"-top-to-move-inner","background-color","black"),YAHOO.util.Dom.setStyle(this.boardName+"-top-to-move-inner","border","1px solid white")),this.toMove==ChessPiece.WHITE?this.isFlipped?(YAHOO.util.Dom.addClass(this.boardName+"-top-to-move-outer","ct-to-move-active"),YAHOO.util.Dom.removeClass(this.boardName+"-bottom-to-move-outer","ct-to-move-active")):(YAHOO.util.Dom.addClass(this.boardName+"-bottom-to-move-outer","ct-to-move-active"),YAHOO.util.Dom.removeClass(this.boardName+"-top-to-move-outer","ct-to-move-active")):this.isFlipped?(YAHOO.util.Dom.addClass(this.boardName+"-bottom-to-move-outer","ct-to-move-active"),YAHOO.util.Dom.removeClass(this.boardName+"-top-to-move-outer","ct-to-move-active")):(YAHOO.util.Dom.addClass(this.boardName+"-top-to-move-outer","ct-to-move-active"),YAHOO.util.Dom.removeClass(this.boardName+"-bottom-to-move-outer","ct-to-move-active"))),null!=(t=YAHOO.util.Dom.get("toPlay"))&&(this.toMove==ChessPiece.WHITE?(t.src="/images/whiteknight"+this.getVersString()+".gif",t.alt=_js("White to play")):(t.src="/images/blackknight"+this.getVersString()+".gif",t.alt=_js("Black to play")),(e=YAHOO.util.Dom.get("fenStatus"))&&(i=this.getCastlingString(ChessPiece.BLACK),t=this.getCastlingString(ChessPiece.WHITE),i="<div><span>"+_js("White Castling: ")+"</span><span>"+t+"</span></div><div><span>"+_js("Black Castling: ")+"</span><span>"+i+"</span></div>",e.innerHTML=i)))},Board.prototype.getBoardDivFromId=function(e){return this[e]||(this[e]=YAHOO.util.Dom.get(e)),this[e]},Board.prototype.getBoardDiv=function(){return this.boardDiv||(this.boardDiv=YAHOO.util.Dom.get("ctb-"+this.boardName)),this.boardDiv},Board.prototype.getDocBody=function(){var e;return this.docBody||(null==(e=document.getElementsByTagName("body"))||0==e.length?alert("Could not find body tag"):this.docBody=e[0]),this.docBody},Board.prototype.getPieceDragDiv=function(){return this.pieceDragDiv||(this.pieceDragDiv=YAHOO.util.Dom.get("pieceDragDiv")),this.pieceDragDiv},Board.prototype.createBoardCoords=function(){this.coordinatesShown=!1;var e=YAHOO.util.Dom.get(this.boardName+"-fileLabels"),t=YAHOO.util.Dom.get(this.boardName+"-rankLabels");if(e&&t){YAHOO.util.Event.purgeElement(e,!0),t.innerHTML="",e.innerHTML="";var i=YAHOO.util.Dom.get(this.boardName+"-boardBorder");if(!this.showCoordinates)return YAHOO.util.Dom.setStyle(e,"display","none"),YAHOO.util.Dom.setStyle(t,"display","none"),s=0,YAHOO.util.Dom.setStyle(i,"width",8*this.pieceSize+s+"px"),void YAHOO.util.Dom.setStyle(i,"height",8*this.pieceSize+s+"px");YAHOO.util.Dom.setStyle(e,"display","block"),YAHOO.util.Dom.setStyle(t,"display","block");var s=15,o=0;for(check_bad_msie()&&(o=this.ie6FixCoordsOffsetSize),YAHOO.util.Event.isIE&&(o+=this.allIeFixCoordsOffsetSize,"CSS1Compat"!=document.compatMode&&(o=8)),YAHOO.util.Dom.setStyle(i,"width",8*this.pieceSize+s+o+"px"),YAHOO.util.Dom.setStyle(i,"height",8*this.pieceSize+s+"px"),this.coordinatesShown=!0,r=0;r<8;r++){var n=document.createElement("div");YAHOO.util.Dom.setStyle(n,"height",this.pieceSize+"px"),YAHOO.util.Dom.setStyle(n,"width","15px"),YAHOO.util.Dom.setStyle(n,"text-align","center"),YAHOO.util.Dom.setStyle(n,"line-height",this.pieceSize+"px"),this.isFlipped?n.innerHTML=""+(r+1):n.innerHTML="9"-(r+1),t.appendChild(n)}for(var r=0;r<9;r++){var a,l=document.createElement("span");YAHOO.util.Dom.setStyle(l,"float","left"),YAHOO.util.Dom.setStyle(l,"height","15px"),
60==r?(YAHOO.util.Dom.setStyle(l,"width","15px"),YAHOO.util.Dom.setStyle(l,"clear","both"),YAHOO.util.Dom.setStyle(l,"margin-top","-5px"),o?YAHOO.util.Dom.setStyle(l,"margin-left","-3px"):YAHOO.util.Dom.setStyle(l,"margin-left","-2px"),a="",a=this.isFlipped?"whiteblack-flipper"+this.getVersString()+".png":"blackwhite-flipper"+this.getVersString()+".png",l.innerHTML='<span><img id="'+this.boardName+'-flipper" title="'+_js("Flip Board")+'" src="'+this.boardImagePath+"/images/"+a+'"/></span>',this.disableFlipper||YAHOO.util.Event.addListener(this.boardName+"-flipper","click",this.flipBoard,this,!0)):(YAHOO.util.Dom.setStyle(l,"width",this.pieceSize+"px"),YAHOO.util.Dom.setStyle(l,"text-align","center"),this.isFlipped?l.innerHTML=_js(Move.columnToChar(8-r)):l.innerHTML=_js(Move.columnToChar(r-1))),e.appendChild(l)}s=YAHOO.util.Dom.get(this.boardName+"-flipper");s&&fix_ie_png(s)}},Board.prototype.showNavigation=function(){this.disableNavigation=!1,YAHOO.util.Dom.setStyle(this.boardName+"-ct-nav-container","display","block")},Board.prototype.hideNavigation=function(){this.disableNavigation=!0,YAHOO.util.Dom.setStyle(this.boardName+"-ct-nav-container","display","none")},Board.prototype.createBoardUI=function(){var e=this.boardName+"-container",t=YAHOO.util.Dom.get(e);if(null!=t){YAHOO.util.Dom.addClass(t,"ct-board-container"),this.boardDiv=null;var i=document.createElement("div");i.id=this.boardName+"-boardBorder",YAHOO.util.Dom.addClass(i,"ct-board-border"+this.squareColorClass);var s=0;this.showCoordinates&&(s=15),YAHOO.util.Dom.setStyle(i,"width",8*this.pieceSize+s+"px"),YAHOO.util.Dom.setStyle(i,"height",8*this.pieceSize+s+"px");var o=document.createElement("div");YAHOO.util.Dom.setStyle(o,"float","left"),o.id=this.boardName+"-rankLabels",i.appendChild(o);var n=document.createElement("div");YAHOO.util.Dom.addClass(n,"ct-board"),YAHOO.util.Dom.setStyle(n,"width",8*this.pieceSize+"px"),YAHOO.util.Dom.setStyle(n,"height",8*this.pieceSize+"px"),n.id="ctb-"+this.boardName;for(var r="ct-white-square"+this.squareColorClass,a="",l=[],h=7;0<=h;h--){for(var u="<div>",c=0;c<8;c++){document.createElement("div");var d=this.boardName+"-s"+c+h,m=(c+1)*(h+1)%19/19*100,p=(65-(c+1)*(h+1))%19/19*100;u+='<div id="'+d+'" class="'+r+'" style="width:'+this.pieceSize+"px;height:"+this.pieceSize+"px;background-position:"+m+"% "+p+'%"></div>',l.push(d),r=r=="ct-black-square"+this.squareColorClass?"ct-white-square"+this.squareColorClass:"ct-black-square"+this.squareColorClass}r=r=="ct-black-square"+this.squareColorClass?"ct-white-square"+this.squareColorClass:"ct-black-square"+this.squareColorClass,a+=u+="</div>"}n.innerHTML=a;var g=document.createElement("div");g.id=this.boardName+"-fileLabels",i.appendChild(n),i.appendChild(g),t.appendChild(i),this.showToMoveIndicators&&((v=document.createElement("div")).id=this.boardName+"-moveIndicators",YAHOO.util.Dom.addClass(v,"ct-move-indicators"),v.innerHTML='<div class="ct-top-to-move-outer" id="'+this.boardName+'-top-to-move-outer"><div  class="ct-top-to-move-inner" id="'+this.boardName+'-top-to-move-inner"></div></div><div class="ct-bottom-to-move-outer"  id="'+this.boardName+'-bottom-to-move-outer"><div class="ct-bottom-to-move-inner" id="'+this.boardName+'-bottom-to-move-inner" ></div>',t.appendChild(v),YAHOO.util.Dom.setStyle(i,"float","left"),YAHOO.util.Dom.setStyle(v,"float","left"),YAHOO.util.Dom.setStyle(v,"margin-left","2px"),YAHOO.util.Dom.setStyle(v,"height",8*this.pieceSize+2+"px"),YAHOO.util.Dom.setStyle(v,"position","relative"),f=document.createElement("div"),YAHOO.util.Dom.setStyle(f,"clear","both"),t.appendChild(f)),this.createBoardCoords();var v,f,b,y,o=!1,n=YAHOO.util.Dom.get(this.boardName+"-ct-nav-container");n?(o=!0,n.innerHTML=""):n=document.createElement("div"),n.id=this.boardName+"-ct-nav-container",this.dontOutputNavButtons&&!this.r||(g="",this.dontOutputNavButtons||this.problem&&this.problem.isEndgame||(g='<span id="playStopSpan"><img class="ct-end" id="'+this.boardName+'-end" src="'+this.boardImagePath+"/images/resultset_last"+this.getVersString()+'.gif" alt="'+_js("End position")+'" title="'+_js("Go to final position")+'"/><img class="ct-play" id="'+this.boardName+'-play" src="'+this.boardImagePath+"/images/control_play_blue"+this.getVersString()+'.gif" alt="'+_js("Play moves")+'" title="'+_js("Play sequence of moves")+'"/><img class="ct-stop" id="'+this.boardName+'-stop" src="'+this.boardImagePath+"/images/control_stop_blue"+this.getVersString()+'.gif" alt="'+_js("Stop playing")+'" title="'+_js("Stop playing move sequence")+'"/></span>'),i='<div class="ct-nav-buttons" id="'+this.boardName+'-navButtons"><span id="'+this.boardName+'-nav-buttons-only">',this.dontOutputNavButtons||(b="",(isIphone||isIpad)&&(b=' width="50px" height="34px" ',g=""),isIphone||isIpad||(i+='<img class="ct-start" id="'+this.boardName+'-start" src="'+this.boardImagePath+"/images/resultset_first"+this.getVersString()+'.gif" alt="'+_js("Start position")+'" title="'+_js("Go to starting position")+'"/>'),i+='<img class="ct-back" id="'+this.boardName+'-back" '+b+' src="'+this.boardImagePath+"/images/resultset_previous"+this.getVersString()+'.gif" alt="'+_js("Previous Move")+'" title="'+_js("Go back a move")+'"/><img class="ct-forward" id="'+this.boardName+'-forward" '+b+' src="'+this.boardImagePath+"/images/resultset_next"+this.getVersString()+'.gif" alt="'+_js("Next Move")+'" title="'+_js("Go forward a move")+'"/>'+g),this.r&&(i+='<img class="ct-forward" id="'+this.boardName+'-analyse" src="'+this.boardImagePath+"/images/anboard"+this.getVersString()+'.gif" alt="'+_js("Analyse")+'" title="'+_js("Launch analysis board to explore different lines in this position")+'"/>',this.g||(i+='<img class="ct-forward" id="'+this.boardName+'-showfen" src="'+this.boardImagePath+"/images/copy_fen"+this.getVersString()+'.gif" alt="'+_js("Copy FEN")+'" title="'+_js("Show FEN for current position")+'"/>')),this.canPasteFen&&(i+='<img class="ct-forward" id="'+this.boardName+'-pastefen" src="'+this.boardImagePath+"/images/paste_fen"+this.getVersString()+'.gif" alt="'+_js("Input FEN")+'" title="'+_js("Setup position from user supplied FEN or move list")+'"/>'),this.g2&&(i+='<img class="ct-forward" id="'+this.boardName+'-playcomp" src="'+this.boardImagePath+"/images/computer"+this.getVersString()+'.gif" alt="'+_js("Play Current Position vs Computer")+'" title="'+_js("Play current position against computer")+'"/>'),i+="</span>",i+="</div>",this.puzzle&&(g=b=f=v="",g=29<=this.pieceSize?(v=_js("Easy"),f=_js("Medium"),b=_js("Hard"),_js("Help")):(v=_js("D1"),f=_js("D2"),b=_js("D3"),_js("?")),i+='<div><form action=""><button type="button" id="'+this.boardName+'-puzzleSolution" class="asolution-button">'+_js("Show")+'</button><button id="'+this.boardName+'-easyPuzzle" type="button" class="puzzle-difficulty">'+v+'</button><button id="'+this.boardName+'-mediumPuzzle" type="button" class="puzzle-difficulty">'+f+'</button><button id="'+this.boardName+'-hardPuzzle" type="button" class="puzzle-difficulty">'+b+'</button><button id="'+this.boardName+'-puzzleHelp" type="button" class="puzzle-difficulty">'+g+'</button><img alt="" class="ct-forward" id="'+this.boardName+'-problemState"></img><span id="'+this.boardName+'-puzzleResult"></span></form></div>',i+='<div class="initially_hidden initially_invisible" id="'+this.boardName+'-moves"></div>',i+='<div class="initially_hidden initially_invisible" id="'+this.boardName+'-moves"></div>'),n.innerHTML=i),o||t.appendChild(n),this.problem&&(y=YAHOO.util.Dom.get("body"))&&YAHOO.util.Dom.setStyle(y,"min-width",8*this.pieceSize+s+300+200+120+"px")}else alert("Could not find board container:"+e)},Board.prototype.getPieceDiv=function(){var e=this.getBoardDiv(),t=document.createElement("div");return this.availPieceDivs[this.uptoId]=t,this.availIds[this.uptoId]=YAHOO.util.Dom.generateId(t),YAHOO.util.Dom.setStyle(t,"visibility","hidden"),YAHOO.util.Dom.addClass(t,"board-piece-start-style"),e.appendChild(t),this.uptoId++,t},Board.prototype.flipToMove=function(e){return"w"==e?"b":"w"},Board.prototype.pieceCharToPieceNum=function(e){var t;switch(e){case"K":t=ChessPiece.KING;break;case"Q":t=ChessPiece.QUEEN;break;case"R":t=ChessPiece.ROOK;break;
6case"B":t=ChessPiece.BISHOP;break;case"N":t=ChessPiece.KNIGHT;break;case"P":t=ChessPiece.PAWN}return t},Board.prototype.pieceTypeToChar=function(e){switch(e){case ChessPiece.KING:return"K";case ChessPiece.QUEEN:return"Q";case ChessPiece.ROOK:return"R";case ChessPiece.BISHOP:return"B";case ChessPiece.KNIGHT:return"N";case ChessPiece.PAWN:return"P"}return"?"},Board.prototype.canMoveKnight=function(e,t,i,s){return e+2==i&&t+1==s||e+2==i&&t-1==s||e-2==i&&t+1==s||e-2==i&&t-1==s||e+1==i&&t+2==s||e-1==i&&t+2==s||e+1==i&&t-2==s||e-1==i&&t-2==s},Board.prototype.canMovePawn=function(e,t,i,s,o){var n=this.boardPieces[i][s],r=this.boardPieces[e][t];if(o){var a=this.boardPieces[o.toColumn][o.toRow];if(a&&a.piece==ChessPiece.PAWN)if(a.colour==ChessPiece.WHITE){if(1==o.fromRow&&3==o.toRow&&i==o.fromColumn&&3==t&&2==s&&(e==i+1||e==i-1))return!0}else if(6==o.fromRow&&4==o.toRow&&i==o.fromColumn&&4==t&&5==s&&(e==i+1||e==i-1))return!0}if(n){if(r.colour==ChessPiece.WHITE){if((e==i+1||e==i-1)&&t==s-1)return!0}else if((e==i+1||e==i-1)&&t==s+1)return!0}else if(e==i)if(r.colour==ChessPiece.WHITE){if(1==t){if(2==s)return!0;if(3==s&&null==this.boardPieces[i][2])return!0}else if(t+1==s)return!0}else if(6==t){if(5==s)return!0;if(4==s&&null==this.boardPieces[i][5])return!0}else if(t-1==s)return!0;return!1},Board.prototype.canMoveStraight=function(e,t,i,s,o,n){var r=e,a=t,l=0,h=0;if(e<i?l=1:i<e&&(l=-1),t<s?h=1:s<t&&(h=-1),clog&&console.log("deltaRow:"+h+" deltaCol:"+l+" fromCol:"+e+" fromRow:"+t+" toCol:"+i+" toRow:"+s),o==ChessPiece.ROOK&&0!=l&&0!=h)return!1;if(o==ChessPiece.BISHOP&&(0==l||0==h))return!1;for(var u=0;;){if(u++,e+=l,t+=h,o==ChessPiece.KING&&1<u){if(clog&&console.log("king count:"+u+" toCol:"+i+" toRow:"+s),2!=u)return!1;if(0!=h)return!1;if(6!=i&&2!=i)return!1;if(2==i){if(this.boardPieces[1][t]||this.boardPieces[2][t]||this.boardPieces[3][t])return!1;if(!this.canCastleQueenSide[n.colour])return!1}else{if(6!=i)return clog&&console.log("king not in col 2 or 6"),!1;if(this.boardPieces[5][t]||this.boardPieces[6][t])return clog&&console.log("king can't castle intervening piece"),!1;if(!this.canCastleKingSide[n.colour])return clog&&console.log("king can't castle king side (made previously invalid) colour:"+n.colour),!1}m="",m+=Move.columnToChar(r),m+=String.fromCharCode("1".charCodeAt(0)+a),m+=Move.columnToChar(r+l),m+=String.fromCharCode("1".charCodeAt(0)+(a+h));var c=this.createMoveFromString(m),d=this.cloneBoard();if(d.makeMove(c,d.boardPieces[r][a],!1,this.moveAnimationLength,!1,!1),kingSafe=d.isKingSafe(n.colour,c),clog&&console.log("kingSafe1:"+kingSafe),!kingSafe)return!1;var m="";if(m+=Move.columnToChar(r),m+=String.fromCharCode("1".charCodeAt(0)+a),m+=Move.columnToChar(r),m+=String.fromCharCode("1".charCodeAt(0)+a),c=this.createMoveFromString(m),(d=this.cloneBoard()).makeMove(c,d.boardPieces[r][a],!1,this.moveAnimationLength,!1,!1),kingSafe=d.isKingSafe(n.colour,c),(d=this.cloneBoard()).makeMove(c,d.boardPieces[r][a],!1,this.moveAnimationLength,!1,!1),kingSafe=this.isKingSafe(n.colour,c),clog&&console.log("kingSafe2:"+kingSafe),!kingSafe)return!1}if(e==i&&t==s)return!0;if(e<0||7<e||t<0||7<t)return!1;if(null!=this.boardPieces[e][t])return!1}},Board.prototype.canMove=function(e,t,i,s,o){var n=e.column,r=e.row;if(7<t||t<0||7<i||i<0)return clog&&console.log("can't move coz out of bounds"),!1;var a=this.boardPieces[t][i],l=this.boardPieces[n][r];if(null==l)return!1;if(a&&a.colour==l.colour)return!1;l=e.piece==ChessPiece.PAWN?this.canMovePawn(n,r,t,i,s):e.piece==ChessPiece.KNIGHT?this.canMoveKnight(n,r,t,i):this.canMoveStraight(n,r,t,i,e.piece,e);clog&&console.log("moveOk:"+l);s=!0;return l&&o&&(o="",o+=Move.columnToChar(n),o+=String.fromCharCode("1".charCodeAt(0)+r),o+=Move.columnToChar(t),o+=String.fromCharCode("1".charCodeAt(0)+i),i=this.createMoveFromString(o),(o=this.cloneBoard()).makeMove(i,o.boardPieces[n][r],!1,this.moveAnimationLength,!1,!1),s=o.isKingSafe(e.colour,i)),l&&s},Board.prototype.is50MoveRule=function(){return 100<=this.halfMoveNumber},Board.prototype.isCheckmate=function(e){return!this.isKingSafe(this.toMove,e)&&this.isKingMated(this.toMove,e)},Board.prototype.isStalemate=function(e){return this.isKingSafe(this.toMove,e)&&0==this.getCandidateMoves(this.toMove,e,!0).length},Board.prototype.isKingMated=function(e,t){for(var i=null,s=0;s<8;s++)for(var o=0;o<8;o++)if(null!=(r=this.boardPieces[s][o])&&r.piece==ChessPiece.KING&&r.colour==e){i=r;break}for(var n=[[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1],[0,1],[0,-1],[2,0],[-2,0]],r=i,a=0;a<n.length;a++)if(this.canMove(r,r.column+n[a][0],r.row+n[a][1],t,!0))return!1;return!(0<this.getCandidateMoves(e,t,!0,!0).length)},Board.prototype.getCandidateMoves=function(e,t,i,s){for(var o=new Array,n=0;n<8;n++)for(var r=0;r<8;r++){var a=this.boardPieces[n][r],l=[];
6if(a&&a.colour==e){switch(a.piece){case ChessPiece.KING:if(s)continue;l=[[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1],[0,1],[0,-1],[2,0],[-2,0]];break;case ChessPiece.KNIGHT:l=[[2,1],[2,-1],[-2,1],[-2,-1],[1,2],[1,-2],[-1,2],[-1,-2]];break;case ChessPiece.BISHOP:for(h=0;h<8;h++)l.push([1+h,1+h]),l.push([1+h,-1-h]),l.push([-1-h,1+h]),l.push([-1-h,-1-h]);break;case ChessPiece.QUEEN:for(h=0;h<8;h++)l.push([1+h,0]),l.push([1+h,1+h]),l.push([1+h,-1-h]),l.push([-1-h,0]),l.push([-1-h,1+h]),l.push([-1-h,-1-h]),l.push([0,-1-h]),l.push([0,1+h]);break;case ChessPiece.ROOK:for(h=0;h<8;h++)l.push([1+h,0]),l.push([-1-h,0]),l.push([0,-1-h]),l.push([0,1+h]);break;case ChessPiece.PAWN:e==ChessPiece.BLACK?(l=[[0,-1],[1,-1],[-1,-1]],6==r&&l.push([0,-2])):(l=[[0,1],[1,1],[-1,1]],1==r&&l.push([0,2]))}for(var h=0;h<l.length;h++)if(this.canMove(a,a.column+l[h][0],a.row+l[h][1],t,!0)&&(o.push(new Move(a.column,a.row,a.column+l[h][0],a.row+l[h][1])),i))return o}}return o},Board.prototype.isKingSafe=function(e,t){for(var i=null,s=0;s<8;s++)for(o=0;o<8;o++)if(null!=(n=this.boardPieces[s][o])&&n.piece==ChessPiece.KING&&n.colour==e){i=n;break}for(s=0;s<8;s++)for(var o=0;o<8;o++){var n=this.boardPieces[s][o];if(null!=n&&n.colour!=e&&this.canMove(n,i.column,i.row,t,!1))return!1}return!0},Board.prototype.freeBoardPieces=function(e){if(this.boardPieces)for(var t=0;t<8;t++){for(var i=0;i<8;i++)null!=this.boardPieces[t][i]&&(this.boardPieces[t][i].free(),this.boardPieces[t][i]=null);e&&(this.boardPieces[t]=null)}e&&(this.boardPieces=null)},Board.prototype.freeBoard=function(){this.freeBoardPieces(!0),this.freeMoveArray()},Board.prototype.freeMoveArray=function(){if(this.moveArray)for(var e=0;e<this.moveArray.length;e++){var t=this.moveArray[e];t&&(t.freeMove(),this.moveArray[e]=null)}},Board.prototype.cloneBoard=function(){var e=new Board;return e.boardName=this.boardName,e.cloned=!0,e.boardPieces=this.copyBoardPieces(!0),e.moveArray=this.copyMoveArray(!1),e.canCastleQueenSide=this.copyCastleQueenSide(),e.canCastleKingSide=this.copyCastleKingSide(),e.toMove=this.toMove,e.restrictedColourMovement=-1,e.opponentColour=this.opponentColour,e.outputWithoutDisplay=this.outputWithoutDisplay,e.isFlipped=this.isFlipped,e.isUserFlipped=this.isUserFlipped,e.ignoreFlipping=this.ignoreFlipping,e.reverseFlip=this.reverseFlip,e.moveAnimationLength=this.moveAnimationLength,e.moveNumber=this.moveNumber,e.halfMoveNumber=this.halfMoveNumber,e.startFen=this.startFen,e.boardImagePath=this.boardImagePath,e.dontUpdatePositionReachedTable=this.dontUpdatePositionReachedTable,this.prev_move?e.prev_move=this.prev_move.clone():e.prev_move=null,e},Board.prototype.copyCastleQueenSide=function(){return[this.canCastleQueenSide[0],this.canCastleQueenSide[1]]},Board.prototype.copyCastleKingSide=function(){return[this.canCastleKingSide[0],this.canCastleKingSide[1]]},Board.copyMoves=function(e,t,i){var s=new Array;if(t){if(e)for(r=0;r<e.length;r++){var o=e[r],n=null;o&&(n=o.clone(!0)),s[r]=n}}else e&&0<e.length&&(s=e.slice(0));if(i)for(var r=0;r<e.length;r++)e[r].prev&&void 0!==e[r].prev.index&&(s[r].prev=s[e[r].prev.index]),e[r].next&&void 0!==e[r].next.index&&(s[r].next=s[e[r].next.index]);return s},Board.prototype.copyMoveArray=function(e){return Board.copyMoves(this.moveArray,e)},Board.prototype.copyBoardPieces=function(e){for(var t=Board.createBoardArray(),i=0;i<8;i++)for(var s=0;s<8;s++)null!=this.boardPieces[i][s]?t[i][s]=e?this.boardPieces[i][s].makeLightWeight():this.boardPieces[i][s].copyPiece():t[i][s]=null;return t},Board.prototype.createPiece=function(e,t,i){return i?new LightweightChessPiece(null,e,t,this):new ChessPiece(this.getPieceDiv(),e,t,this)},Board.prototype.restoreCastling=function(e){this.canCastleKingSide=e.kingSide,this.canCastleQueenSide=e.queenSide},Board.prototype.saveCastling=function(){return{queenSide:[this.canCastleQueenSide[0],this.canCastleQueenSide[1]],kingSide:[this.canCastleKingSide[0],this.canCastleKingSide[1]]}};var firstLightProf=!0,firstHeavyProf=!0;Board.prototype.setupFromFenLightweight=function(e,t,i,s,o){this.setupFromFenGeneric(e,t,i,!0,s,o)},Board.prototype.setupFromFenHeavyWeight=function(e,t,i,s,o){this.lastFromSquare&&YAHOO.util.Dom.removeClass(this.lastFromSquare,"ct-from-square"),this.lastToSquare&&YAHOO.util.Dom.removeClass(this.lastToSquare,"ct-to-square"),this.setupFromFenGeneric(e,t,i,!1,s,o)},Board.prototype.setupFromFen=function(e,t,i,s,o,n){this.positionsSeen=[],s?this.setupFromFenLightweight(e,t,i,o,n):this.setupFromFenHeavyWeight(e,t,i,o,n)},Board.prototype.setupFromFenGeneric=function(e,t,i,s,o,n){ctime&&console.time("setupFromFen"+s),this.oldSelectedSquare&&YAHOO.util.Dom.removeClass(this.oldSelectedSquare,"ct-source-square"),this.oldSelectedSquare=null,this.oldSelectedPiece=null,this.settingUpPosition=!0;var r=e.split(" "),a=r[0].split("/");this.halfMoveNumber=parseInt(r[4]),this.moveNumber=2*parseInt(r[5]);var l=0,h=8;this.uptoId=0,this.board_xy=null;var u,c=r[2],d=null;for(this.canCastleQueenSide=[!1,!1],this.canCastleKingSide=[!1,!1],"-"!=c&&(0<=c.indexOf("K")&&(this.canCastleKingSide[ChessPiece.WHITE]=!0),0<=c.indexOf("Q")&&(this.canCastleQueenSide[ChessPiece.WHITE]=!0),0<=c.indexOf("k")&&(this.canCastleKingSide[ChessPiece.BLACK]=!0),0<=c.indexOf("q")&&(this.canCastleQueenSide[ChessPiece.BLACK]=!0)),n&&(this.startMoveNum=this.moveNumber),"w"==r[1]?(n&&this.startMoveNum--,this.toMove=ChessPiece.WHITE,this.opponentColour=ChessPiece.WHITE,this.isFlipped=!1,this.moveNumber--):(this.toMove=ChessPiece.BLACK,this.opponentColour=ChessPiece.BLACK,this.isFlipped=!0),o&&"-"!=(u=r[3])&&2==u.length&&(r=u[0],(d=3==parseInt(u[1])?this.createMoveFromString(r+"2"+r+"4"):this.createMoveFromString(r+"7"+r+"5")).prevMoveEnpassant=!0,this.prev_move=d),t&&(this.toMove=ChessPiece.BLACK==this.toMove?ChessPiece.WHITE:ChessPiece.BLACK,this.isFlipped=!this.isFlipped),i&&(this.isFlipped=!0),this.reverseFlip&&(this.isFlipped=!this.isFlipped),this.ignoreFlipping&&(this.isFlipped=!1),this.isUserFlipped&&(this.isFlipped=!this.isFlipped),this.updateToPlay(),this.setupPieceDivs(),O=0;O<8;O++)for(p=0;p<8;p++)this.boardPieces[O][p]=null;for(O=0;O<8;O++){var m=a[O];h--;for(var p=l=0;p<m.length;p++){var g=m.charAt(p),v=m.charCodeAt(p)-"0".charCodeAt(0);if(0<v&&v<9)for(;v--;)this.boardPieces[l][h],this.boardPieces[l][h]=null,l++;else{var f,b=(g+"").toLowerCase().charAt(0),y=ChessPiece.WHITE;switch(b==g&&(y=ChessPiece.BLACK),b){case"k":f=this.createPiece(y,ChessPiece.KING,s);break;case"q":f=this.createPiece(y,ChessPiece.QUEEN,s);break;case"r":f=this.createPiece(y,ChessPiece.ROOK,s);break;case"b":f=this.createPiece(y,ChessPiece.BISHOP,s);break;case"n":f=this.createPiece(y,ChessPiece.KNIGHT,s);break;case"p":f=this.createPiece(y,ChessPiece.PAWN,s);break;default:alert("unknown piece letter:"+b+" for fen:"+e)}(isGecko||isOpera)&&(f.setPosition(l,h,!1,null,this.moveAnimationLength),f.setVisible(!0)),this.boardPieces[l][h]=f,this.pieces[this.uptoPiece]=f,this.pieces[this.uptoPiece].column=l,this.pieces[this.uptoPiece].row=h,this.uptoPiece++,l++}}}if(!isGecko)for(O=0;O<this.uptoPiece;O++)this.pieces[O].setPosition(this.pieces[O].column,this.pieces[O].row,!1,null,0);if(!s)for(var O=0;O<this.uptoPiece;O++)this.pieces[O].setVisible(!0);s||this.createBoardCoords(),this.settingUpPosition=!1,ctime&&console.timeEnd("setupFromFen"+s)},Board.prototype.resetMoveListScrollPosition=function(){var e=this.movesDisplay.getMovesDisplay();e&&new YAHOO.util.Scroll(e,{scroll:{to:[0,0]}},0).animate()},Board.prototype.changePieceSet=function(e,t){if(this.showedIE6Warning||(i=_js("Depending on your browser you may 
6need to reload the<br/> page for piece size changes to properly take effect.")),this.showedIE6Warning=!0,check_bad_msie()){var i;this.showedIE6Warning||(i=_js("Internet Explorer version 6 does not support dynamic piece size changes.<br/> Please reload page to view new settings."),alert(i.replace("<br/>","\n"))),this.showedIE6Warning=!0}else{this.pieceSize,this.pieceSet=e,this.pieceSize=t;e=YAHOO.util.Dom.get(this.boardName+"-boardBorder"),t=0;this.showCoordinates&&(t=15),e.className="",YAHOO.util.Dom.addClass(e,"ct-board-border"+this.squareColorClass),YAHOO.util.Dom.setStyle(e,"width",8*this.pieceSize+t+"px"),YAHOO.util.Dom.setStyle(e,"height",8*this.pieceSize+t+"px");e=YAHOO.util.Dom.get("ctb-"+this.boardName);YAHOO.util.Dom.setStyle(e,"width",8*this.pieceSize+"px"),YAHOO.util.Dom.setStyle(e,"height",8*this.pieceSize+"px");for(var s,o,n,r,a="ct-white-square"+this.squareColorClass,l=7;0<=l;l--){for(d=0;d<8;d++){var h=this.getBoardDivFromId(this.boardName+"-s"+d+l);h.className="",YAHOO.util.Dom.addClass(h,a),YAHOO.util.Dom.setStyle(h,"width",this.pieceSize+"px"),YAHOO.util.Dom.setStyle(h,"height",this.pieceSize+"px");var u=(d+1)*(l+1)%19/19*100,c=(65-(d+1)*(l+1))%19/19*100;YAHOO.util.Dom.setStyle(h,"background-position",u+"% "+c+"%"),a=a=="ct-black-square"+this.squareColorClass?"ct-white-square"+this.squareColorClass:"ct-black-square"+this.squareColorClass}a=a=="ct-black-square"+this.squareColorClass?"ct-white-square"+this.squareColorClass:"ct-black-square"+this.squareColorClass}for(l=0;l<8;l++)for(var d=0;d<8;d++)(s=this.boardPieces[l][d])&&(s.icon=get_image_str(ChessPiece.pieceIconNames[s.colour][s.piece],s.board.boardImagePath,s.board.pieceSet,s.board.pieceSize,s.board.addVersion),YAHOO.util.Event.isIE||isOpera?((o=s.div).innerHTML='<img src="'+s.icon+'"/>',n=o.firstChild,isOpera||fix_ie_png(n)):(YAHOO.util.Dom.setStyle([s.div],"backgroundImage","url("+s.icon+")"),YAHOO.util.Dom.setStyle([s.div],"background-repeat","no-repeat")),YAHOO.util.Dom.setStyle([s.div],"height",this.pieceSize+"px"),YAHOO.util.Dom.setStyle([s.div],"width",this.pieceSize+"px"),YAHOO.util.Dom.setStyle([s.div],"left",""),YAHOO.util.Dom.setStyle([s.div],"top",""),r=s.getNewXYPosition(s.column,s.row),YAHOO.util.Dom.setXY(s.div,r,!1));if(this.moveArray)for(var m=this.moveArray[0];null!=m;)!m.taken||(s=m.taken).getNewXYPosition&&(s.icon=get_image_str(ChessPiece.pieceIconNames[s.colour][s.piece],s.board.boardImagePath,s.board.pieceSet,s.board.pieceSize,s.board.addVersion),YAHOO.util.Event.isIE||isOpera?((o=s.div).innerHTML='<img src="'+s.icon+'"/>',YAHOO.util.Dom.setStyle([s.div],"position","relative"),n=o.firstChild,isOpera||fix_ie_png(n)):(YAHOO.util.Dom.setStyle([s.div],"backgroundImage","url("+s.icon+")"),YAHOO.util.Dom.setStyle([s.div],"background-repeat","no-repeat")),YAHOO.util.Dom.setStyle([s.div],"height",this.pieceSize+"px"),YAHOO.util.Dom.setStyle([s.div],"width",this.pieceSize+"px"),YAHOO.util.Dom.setStyle([s.div],"left",""),YAHOO.util.Dom.setStyle([s.div],"top",""),r=s.getNewXYPosition(s.column,s.row),YAHOO.util.Dom.setXY(s.div,r,!1)),m=m.next;!this.problem||(e=YAHOO.util.Dom.get("body"))&&YAHOO.util.Dom.setStyle(e,"min-width",8*this.pieceSize+t+300+200+120+"px"),this.createBoardCoords()}},Board.prototype.forwardMove=function(e){if(!this.disableNavigation)if(this.blockFowardBack||this.deferredBlockForwardBack)clog&&console.log("returning early from forward due to block forward on");else if(this.tactics&&this.tactics.problemActive)clog&&console.log("not forwarding, tactic is active");else{if(this.blockForwardBack=!0,this.currentMove&&!this.currentMove.atEnd)if(move=this.currentMove,move?clog&&console.log("forward move:"+move.output()):clog&&console.log("forward move with currentmove null"),move.endNode)clog&&console.log("calling processendgame from forward move"),this.problem.processEndgame("",!0),this.toggleToMove(),this.updateToPlay();else{clog&&console.log("forwarding move:"+move.output());var t=null;piece=this.boardPieces[move.fromColumn][move.fromRow],move.promotion&&(t=move.promotion,piece.prePromotionColumn=null,piece.prePromotionRow=null),this.updatePiece(piece,move.toColumn,move.toRow,!0,!0,!1,t,!0),this.toggleToMove(),this.updateToPlay();t=this.currentMove;for(clog&&(t?console.log("after forward curmove:"+t.output()):console.log("after forward cur move null")),i=0;i<this.registeredForwardMovePostUpdateListeners.length;i++)this.registeredForwardMovePostUpdateListeners[i].forwardMovePostUpdateCallback(move)}else{clog&&console.log("already at end");for(var i=0;i<this.registeredForwardAtEndListeners.length;
6i++)this.registeredForwardAtEndListeners[i].forwardAtEndCallback()}this.blockForwardBack=!1}},Board.prototype.setupEventHandlers=function(){this.tlf=0,YAHOO.util.Event.addListener(document,"blur",this.lostFocus,this,!0),this.avoidMouseoverActive||YAHOO.util.Event.addListener(this.boardName+"-container","mouseover",function(e){activeBoard=this},this,!0),YAHOO.util.Event.addListener(this.boardName+"-container","click",this.selectDestSquare,this,!0);YAHOO.util.Event.addListener(document,"keydown",function(e){var t=e.target||e.srcElement;if(t.form)return!0;switch(t.tagName.toLowerCase()){case"input":case"textarea":case"select":return!0}if(activeBoard!=this)return!0;switch(YAHOO.util.Event.getCharCode(e)){case 37:this.backMove();break;case 39:this.forwardMove();break;case 32:var i=this.spaceBar();return i||YAHOO.util.Event.preventDefault(e),i}return!0},this,!0),YAHOO.util.Event.addListener(this.boardName+"-forward","click",this.forwardMove,this,!0),YAHOO.util.Event.addListener(this.boardName+"-back","click",this.backMove,this,!0),YAHOO.util.Event.addListener(this.boardName+"-start","click",this.gotoStart,this,!0),YAHOO.util.Event.addListener(this.boardName+"-end","click",this.gotoEnd,this,!0),YAHOO.util.Event.addListener(this.boardName+"-play","click",this.playMoves,this,!0),YAHOO.util.Event.addListener(this.boardName+"-stop","click",this.stopPlayingMoves,this,!0),this.r&&(YAHOO.util.Event.addListener(this.boardName+"-analyse","click",this.analysePosition,this,!0),YAHOO.util.Event.addListener(this.boardName+"-showfen","click",this.showBoardFen,this,!0)),this.canPasteFen&&YAHOO.util.Event.addListener(this.boardName+"-pastefen","click",this.pasteFen,this,!0),this.g2&&YAHOO.util.Event.addListener(this.boardName+"-playcomp","click",this.playComp,this,!0)},Board.prototype.addFlipListener=function(e){this.registeredFlipListeners.push(e)},Board.prototype.addSpaceListener=function(e){this.registeredSpaceListeners.push(e)},Board.prototype.flipBoard=function(){this.isUserFlipped=!this.isUserFlipped,this.isFlipped=!this.isFlipped,this.redrawBoard(),this.updateToPlay();for(var e=0;e<this.registeredFlipListeners.length;e++)this.registeredFlipListeners[e].boardFlipped(this)},Board.prototype.spaceBar=function(){for(var e=!0,t=0;t<this.registeredSpaceListeners.length;t++)e=this.registeredSpaceListeners[t].spacePressed(this);return e},Board.prototype.lostFocus=function(){this.tlf++},Board.prototype.redrawBoard=function(){for(var e,t,i,s,o=0;o<8;o++)for(var n=0;n<8;n++)(e=this.boardPieces[o][n])&&(t=e.getNewXYPosition(e.column,e.row),YAHOO.util.Dom.setXY(e.div,t,!1));if(this.moveArray)for(var r=this.moveArray[0];null!=r;)!r.taken||(e=r.taken).getNewXYPosition&&(t=e.getNewXYPosition(e.column,e.row),YAHOO.util.Dom.setXY(e.div,t,!1)),r=r.next;this.createBoardCoords(),this.oldSelectedSquare&&YAHOO.util.Dom.removeClass(this.oldSelectedSquare,"ct-source-square"),this.oldSelectedSquare=null,this.oldSelectedPiece=null,this.highlightFromTo&&(s=this.isFlipped?(i=YAHOO.util.Dom.get(this.boardName+"-s"+(7-this.lastFromColumn)+(7-this.lastFromRow)),YAHOO.util.Dom.get(this.boardName+"-s"+(7-this.lastToColumn)+(7-this.lastToRow))):(i=YAHOO.util.Dom.get(this.boardName+"-s"+this.lastFromColumn+this.lastFromRow),YAHOO.util.Dom.get(this.boardName+"-s"+this.lastToColumn+this.lastToRow)),this.updateFromTo(i,s,this.lastFromRow,this.lastFromColumn,this.lastToRow,this.lastToColumn))},Board.prototype.getMaxMoveNumber=function(e){e=this.getMaxPly(e);return 0<e?parseInt((e+1)/2):0},Board.prototype.getMaxPly=function(e){var t=null;if(e){if(!this.currentMove)return 0;if((t=this.currentMove).atEnd)return t.prev?t.prev.moveNum:0}else this.moveArray&&(t=this.moveArray[0]);if(!t)return 0;for(;null!=t;){if(t.atEnd)return t.prev?t.prev.moveNum:0;t=t.next}return 0},Board.fenPositionOnly=function(e){e=e.split(" ");return e[0]+" "+e[1]},Board.fenStripMoveClock=function(e){e=e.split(" ");return e[0]+" "+e[1]+" "+e[2]+" "+e[3]},Board.fenSamePosition=function(e,t,i){if(!e||!t)return!1;var s=null,o=null,o=i?(s=Board.fenPositionOnly(e),Board.fenPositionOnly(t)):(s=Board.fenStripMoveClock(e),Board.fenStripMoveClock(t));return s==o},Board.prototype.findFen=function(e,t,i,s){i=this.findFen2(e,t,i,!0);if(i.move)return i.move;if(s){if(i.clockStrip)return i.clockStrip;if(i.fullStrip)return i.fullStrip}return null},Board.prototype.findFen2=function(e,t,i,s){var o=t.cloneBoard(),n=Object(),r=null,a=null;n.move=null,s&&o.gotoMoveIndex(-1,!0,!0,!0,!0);for(var l=null;e;){var h=o.boardToFen();if(h==i)return n.move=l,n.clockStrip=null,n.fullStrip=null,n;if(Board.fenSamePosition(i,h)?r=l:Board.fenSamePosition(i,h,!0)&&(a=l),e.atEnd)break;if(e.vars&&0<e.vars.length)for(var u=0;u<e.vars.length;u++){var c=this.findFen2(e.vars[u],o,i,!1);if(c){if(c.move)return c;c.clockStrip?r=c.clockStrip:c.fullStrip&&(a=c.fullStrip)}}clog&&console.log("about to make mv:"+e.output()+" fen:"+o.boardToFen()),o.makeMove(e,o.boardPieces[e.fromColumn][e.fromRow],!1,this.moveAnimationLength,!1,!1),clog&&console.log("finished making mv"),e=(l=e).next,clog&&console.log("toMove:"+o.toMove),o.setCurrentMove(e),o.toggleToMove()}return r&&(n.clockStrip=r),a&&(n.fullStrip=a),n},Board.prototype.gotoFen=function(e,t){clog&&console.log("about to find fen for:"+e);t=this.findFen(this.moveArray[0],this,e,t);t?(clog&&console.log("found move:"+t.output()+" for fen:"+e),this.gotoMoveIndex(t.index)):clog&&console.log("didn't find move for fen:"+e)},Board.prototype.getMaxMoveIndex=function(){return this.moveArray.length-1},Board.prototype.gotoMoveIndex=function(e,t,i,s,o){clog&&console.log("going to move index:"+e);var n=!i;
6if(!(!this.moveArray||this.moveArray.length<=e||-1==e&&0==this.moveArray.length)){var r=this.boardName+"-piecestaken",r=YAHOO.util.Dom.get(r);if(r&&(r.innerHTML=""),-1!=e){var a=new Array,l=this.moveArray[e];clog&&l&&(console.log("gotomoveindex move:"+l.output()),l.next&&console.log("gotomoveindex move.next:"+l.next.output()),l.prev&&console.log("gotomoveindex move.prev:"+l.prev.output()));var h=0;for(null!=l.next?this.setCurrentMove(l.next,t):clog&&console.log("move next null with move:"+l.output());null!=l&&!l.dummy;)l=(a[h++]=l).prev;for(u=!1,this.prev_move&&!this.prev_move.prevMoveEnpassant&&(u=!0),this.setupFromFen(this.startFen,u,!1,!0),this.prev_move&&!this.prev_move.prevMoveEnpassant&&(clog&&console.log("gotomoveindex prev_move:"+this.prev_move.output()),this.makeMove(this.prev_move,this.boardPieces[this.prev_move.fromColumn][this.prev_move.fromRow],!1,this.moveAnimationLength,!0,!0),this.updateToPlay()),c=h-1;1<=c;c--)l=a[c],this.makeMove(l,this.boardPieces[l.fromColumn][l.fromRow],!1,this.moveAnimationLength,!0,!1),this.toggleToMove();if(t||this.convertPiecesFromLightWeight(e),l=a[0],this.makeMove(l,this.boardPieces[l.fromColumn][l.fromRow],n,this.moveAnimationLength,!0,!0),this.toggleToMove(),this.updateToPlay(),t||this.setForwardBack(),!s)for(c=0;c<this.registeredGotoMoveIndexListeners.length;c++)this.registeredGotoMoveIndexListeners[c].gotoMoveIndexCallback(e)}else{var u=!1;if(this.prev_move&&!this.prev_move.prevMoveEnpassant&&(u=!0),this.setupFromFen(this.startFen,u,!1,o),this.prev_move&&!this.prev_move.prevMoveEnpassant&&(this.makeMove(this.prev_move,this.boardPieces[this.prev_move.fromColumn][this.prev_move.fromRow],!i,this.moveAnimationLength,!0,!0),this.updateToPlay()),this.moveArray&&0<this.moveArray.length?this.setCurrentMove(this.moveArray[0],t):this.setCurrentMove(this.firstMove,t),t||this.setForwardBack(),!s)for(var c=0;c<this.registeredGotoMoveIndexListeners.length;c++)this.registeredGotoMoveIndexListeners[c].gotoMoveIndexCallback(e)}}},Board.prototype.gotoStart=function(e){this.disableNavigation||(this.lastFromSquare&&YAHOO.util.Dom.removeClass(this.lastFromSquare,"ct-from-square"),this.lastToSquare&&YAHOO.util.Dom.removeClass(this.lastToSquare,"ct-to-square"),this.gotoMoveIndex(-1),this.problem&&(this.currentMove&&this.currentMove.bestMoves?this.problem.showBestMoves(this.currentMove,this.currentMove.bestMoves,this.currentMove.correctMove,this.currentMove.wrongMove):this.problem.clearBestMoves()))},Board.prototype.gotoEnd=function(e){if(!this.disableNavigation){clog&&console.log("goto end called"),this.tactics&&this.tactics.problemActive&&(this.tactics.autoForward=!1,this.tactics.markProblem(!1,!1,"NULL","NULL")),clog&&console.log("jumping to start"),this.gotoMoveIndex(-1,!0,!0,!0);for(var t=0;this.currentMove&&null!=this.currentMove.next;){var i=this.currentMove;clog&&console.log("going to end move:"+i.output()),this.makeMove(i,this.boardPieces[i.fromColumn][i.fromRow],!1,this.moveAnimationLength,!0,!0),t=i.index,this.toggleToMove(),this.setCurrentMove(i.next)}for(var s=0;s<this.registeredGotoMoveIndexListeners.length;s++)this.registeredGotoMoveIndexListeners[s].gotoMoveIndexCallback(t)}},Board.prototype.gotoPly=function(e,t){clog&&console.log("goto ply called"),this.gotoMoveIndex(-1,!0,!0,!0);for(var i=1,s=0;i<=e&&this.currentMove&&null!=this.currentMove.next;){var o=this.currentMove;clog&&console.log("going to end move:"+o.output()),this.makeMove(o,this.boardPieces[o.fromColumn][o.fromRow],!1,this.moveAnimationLength,!0,!0),s=o.index,this.toggleToMove(),this.setCurrentMove(o.next),i++}if(t)for(var n=0;n<this.registeredGotoMoveIndexListeners.length;n++)this.registeredGotoMoveIndexListeners[n].gotoMoveIndexCallback(s)},Board.prototype.playMove=function(e){if(!e.keepPlayingMoves||!e.currentMove||!e.currentMove.next)return YAHOO.util.Dom.get(this.boardName+"-play").src=this.boardImagePath+"/images/control_play_blue"+this.getVersString()+".gif",void(e.keepPlayingMoves=!1);e.forwardMove(),setTimeout(function(){e.playMove(e)},e.pauseBetweenMoves)},Board.prototype.insertLineToMoveIndexPosition=function(e,t,i,s,o){var s=Board.copyMoves(s,!0,!0),n=null;if(!this.moveArray||0==this.moveArray.length||null==this.moveArray[0]||this.moveArray[0].atEnd||t==this.startFen)n=null,clog&&console.log("no moves or initial position, using first move");else if(clog&&console.log("calling find fen...."),0<=e&&(n=this.moveArray[e]),n=n||this.findFen(this.moveArray[0],this,t,!1),clog&&console.log("finished calling find fen"),!n)return;e=-1;this.currentMove&&this.currentMove.prev&&(e=this.currentMove.prev.
6index),i&&(s[0].beforeComment=i),clog&&(n?console.log("mv:"+n.output()+" mv next:"+n.next+" oldCurrentMoveIndex:"+e):console.log("mv: null oldCurrentMoveIndex:"+e));t=null,i=null;n&&n.next&&!n.next.atEnd?i=n.next:t=n,n?this.gotoMoveIndex(n.index):this.moveArray&&0<this.moveArray.length?(i=this.moveArray[0])&&(clog&&console.log("variation parent from first move:"+i.output()),this.gotoMoveIndex(-1)):this.currentMove=null,clog&&(this.currentMove?console.log("current move before insertline:"+this.currentMove.output()):console.log("no current move before insertline")),clog&&(i?console.log("var parent:"+i.output()):console.log("var null"),t?console.log("move ins after:"+t.output()):console.log("moveinsafter null")),this.insertMovesFromMoveList(s[0],!0,i,t,o),clog&&(this.currentMove?console.log("current move after insertline:"+this.currentMove.output()):console.log("no current move after insertline")),this.gotoMoveIndex(e)},Board.prototype.getVersString=function(){var e=".vers"+SITE_VERSION;return this.addVersion||(e=""),e},Board.prototype.playMoves=function(e){this.disableNavigation||(this.keepPlayingMoves=!0,YAHOO.util.Dom.get(this.boardName+"-play").src=this.boardImagePath+"/images/disabled_control_play_blue"+this.getVersString()+".gif",this.playMove(this))},Board.prototype.stopPlayingMoves=function(e){this.keepPlayingMoves=!1},Board.prototype.pasteFen=function(e){for(var t=0;t<this.registeredPasteFenClickedListeners.length;t++)this.registeredPasteFenClickedListeners[t].pasteFenClickedCallback()},Board.prototype.playComp=function(e){this.newAnalysis?this.analysePosition(null,null,!0):window.open("/play-computer/"+this.boardToFen())},Board.prototype.showBoardFen=function(e){var t=this.boardToFen(),i=new YAHOO.widget.SimpleDialog("fenDialog",{fixedcenter:!1,visible:!0,draggable:!0,constraintoviewport:!1,buttons:[{id:"linkbutton4",text:"Test"},{text:_js("Ok"),handler:function(){i.hide()},isDefault:!0}]});i.setHeader(_js("Position FEN")),i.setBody('<textarea class="showPgn" id="fenText" rows="1" readonly="true" cols="'+(t.length+9)+'">'+t+"</textarea>"),i.render(document.body),i.setFooter('<span id="copyToComment"></span><span id="fenok"></span>'),i.center();var s=this;this.problem&&this.problem.comments&&new YAHOO.widget.Button({type:"button",label:_js("Copy To Comment"),container:"fenok",onclick:{fn:function(){s.copyFenToComment(t,Board.COPY_COMMENT_PROBLEM),i.hide()}}}),this.gameComments&&new YAHOO.widget.Button({type:"button",label:_js("Copy To Game Comment"),container:"fenok",onclick:{fn:function(){s.copyFenToComment(t,Board.COPY_COMMENT_GAME),i.hide()}}}),this.playerComments&&new YAHOO.widget.Button({type:"button",label:_js("Copy To Player Comment"),container:"fenok",onclick:{fn:function(){s.copyFenToComment(t,Board.COPY_COMMENT_PLAYER),i.hide()}}}),this.openingComments&&new YAHOO.widget.Button({type:"button",label:_js("Copy To Opening Comment"),container:"fenok",onclick:{fn:function(){s.copyFenToComment(t,Board.COPY_COMMENT_OPENING),i.hide()}}}),new YAHOO.widget.Button({type:"button",label:_js("Ok"),container:"fenok",onclick:{fn:function(){i.hide()}}})},Board.prototype.copyFenToComment=function(e,t){switch(t){case Board.COPY_COMMENT_PROBLEM:var i;this.problem&&(i=!1,e.split(" ")[1]==this.startFen.split(" ")[1]&&(i=!0),this.problem.comments.copyFenToComment(e,i));break;case Board.COPY_COMMENT_GAME:this.gameComments.copyFenToComment(e);break;case Board.COPY_COMMENT_PLAYER:this.playerComments.copyFenToComment(e);break;case Board.COPY_COMMENT_OPENING:this.openingComments.copyFenToComment(e)}},Board.COPY_COMMENT_PROBLEM=0,Board.COPY_COMMENT_PLAYER=1,Board.COPY_COMMENT_GAME=2,Board.COPY_COMMENT_OPENING=3,Board.prototype.copyAnalysisToComment=function(e,t,i,s){switch(s){case Board.COPY_COMMENT_PROBLEM:this.problem&&this.problem.comments.copyAnalysisToComment(e,t,i);break;case Board.COPY_COMMENT_GAME:this.gameComments.copyAnalysisToComment(e,t,i);break;case Board.COPY_COMMENT_PLAYER:this.playerComments.copyAnalysisToComment(e,t,i);break;case Board.COPY_COMMENT_OPENING:this.openingComments.copyAnalysisToComment(e,t,i)}},Board.squareColours=new Array(8);for(var pCol=ChessPiece.BLACK,i=0;i<8;i++){Board.squareColours[i]=new Array(8);for(var j=0;j<8;j++)Board.squareColours[i][j]=pCol,pCol=Board.invertToMove(pCol);pCol=Board.invertToMove(pCol)}
6Board.getSquareColour=function(e,t){return Board.squareColours[e][t]},Board.prototype.isInsufficientMaterial=function(e){function t(){return!(0<i||0<s)&&(o==n==0||o==r&&0==n||n==a&&0==o||o==l&&n==u||o==h&&n==c||n==u&&o==l||o==c&&o==h)}for(var i=0,s=0,o=0,n=0,r=0,a=0,l=0,h=0,u=0,c=0,d=0;d<8;d++)for(var m=0;m<8;m++){var p=this.boardPieces[d][m];p&&(p.piece==ChessPiece.PAWN?p.colour==ChessPiece.WHITE?i++:s++:p.piece!=ChessPiece.KING&&(p.colour==ChessPiece.WHITE?(o++,p.piece==ChessPiece.KNIGHT?r++:p.piece==ChessPiece.BISHOP&&(Board.getSquareColour(d,m)==ChessPiece.WHITE?l++:h++)):(n++,p.piece==ChessPiece.KNIGHT?a++:p.piece==ChessPiece.BISHOP&&(Board.getSquareColour(d,m)==ChessPiece.WHITE?u++:c++))))}return-1==e?t():e==ChessPiece.WHITE?!!t()||!(0<i)&&(0==i&&0==o||o==l&&n==u||o==h&&n==c||o==r&&0==n&&0==s):!!t()||!(0<s)&&(0==s&&0==n||n==u&&o==l||n==c&&o==h||n==a&&0==o&&0==i)},Board.prototype.analysePosition=function(e,t,i){window.parentBoard=this,i&&window.opener&&(window.opener.parentPlayBoard=this);var s=8*this.pieceSize+450+50,o=8*this.pieceSize+250,n=i?"?pc=1":"";window.open("/windows/analyse.html"+n,i?"_blank":"_analysewin","width="+s+",height="+o+",resizable=1,scrollbars=1,location=0,copyhistory=0,status=0,toolbar=0,menubar=0").focus()},Board.prototype.backMove=function(e){if(!this.disableNavigation&&!this.blockFowardBack&&!this.deferredBlockForwardBack){var t=this.currentMove;if(!this.tactics||!this.tactics.problemActive){if(this.blockForwardBack=!0,this.currentMove&&null!=this.currentMove.prev){YAHOO.util.Dom.removeClass(this.lastFromSquare,"ct-from-square"),YAHOO.util.Dom.removeClass(this.lastToSquare,"ct-to-square"),this.lastFromRow=null,this.oldSelectedSquare&&YAHOO.util.Dom.removeClass(this.oldSelectedSquare,"ct-source-square"),this.oldSelectedSquare=null,this.oldSelectedPiece=null;var i=(i=this.toMove)==ChessPiece.WHITE?ChessPiece.BLACK:ChessPiece.WHITE;this.dontUpdatePositionReachedTable||(r=this.boardToUniqueFen(i),this.positionsSeen[r]&&this.positionsSeen[r]--),this.toggleToMove(),this.updateToPlay(),move=this.currentMove.prev,move&&clog&&console.log("backwards moving to prev move:"+move.output()+" from current move:"+this.currentMove.output()),this.setCurrentMove(move),piece=this.boardPieces[move.toColumn][move.toRow],piece||clog&&console.log("got empty piece in backMove"),takenPiece=move.taken,this.board_xy=null,piece.setPosition(move.fromColumn,move.fromRow,!0,null,this.moveAnimationLength),this.boardPieces[move.fromColumn][move.fromRow]=piece,move.promotion&&piece.changePiece("p"),piece.setVisible(!0),this.canCastleQueenSide[0]=move.preCastleQueenSide[0],this.canCastleQueenSide[1]=move.preCastleQueenSide[1],this.canCastleKingSide[0]=move.preCastleKingSide[0],this.canCastleKingSide[1]=move.preCastleKingSide[1],this.halfMoveNumber=move.preHalfMoveNumber;var s,o,n,r=!1;piece.piece==ChessPiece.KING&&1<Math.abs(move.fromColumn-move.toColumn)&&(r=!0),--this.moveNumber<=0&&(this.moveNumber=1),takenPiece&&!r?(this.board_xy=null,o=move.toColumn,n=move.toRow,piece.piece==ChessPiece.PAWN&&move.fromColumn!=move.toColumn&&takenPiece.enPassant&&(n=move.fromRow,this.boardPieces[move.toColumn][move.toRow]=null),takenPiece.setPosition(o,n,!1,null,this.moveAnimationLength),this.boardPieces[o][n]=takenPiece,move.taken=null,this.processTaken(takenPiece,!1)):this.boardPieces[move.toColumn][move.toRow]=null,r&&(o=move.toRow,n=move.fromColumn>move.toColumn?(s=0,3):(s=7,5),(r=this.boardPieces[n][o]).setPosition(s,o,!0,null,this.moveAnimationLength),this.boardPieces[s][o]=r,this.boardPieces[n][o]=null),null!=move&&null!=move.prev&&move.prev.next!=move&&(move=move.prev.next,clog&&(move?console.log("moving backwards out of variation moving to:"+move.output()):console.log("jumping out of variation to null move")));for(var a=0;a<this.registeredBackMovePreCurrentListeners.length;a++)this.registeredBackMovePreCurrentListeners[a].backMovePreCurrentCallback(move,t);this.setCurrentMove(move),this.setForwardBack()}this.blockForwardBack=!1}}},Board.prototype.getMovesToCurrent=function(){var e=[],t=[],i=this.currentMove;if(!i||!i.prev)return t;for(i=i.prev;i;)e.push(i),i=i.prev;
6for(var s=e.length-1;0<=s;s--)t.push(e[s].toMoveString());return t},Board.prototype.getAllMoves=function(){var e=null;if(!(e=this.moveArray&&0<this.moveArray.length?this.moveArray[0]:this.firstMove))return[];for(var t=[];e&&!e.atEnd;)t.push(e.toMoveString()),e=e.next;return t},Board.prototype.countPly=function(){for(var e=null,e=this.moveArray&&0<this.moveArray.length?this.moveArray[0]:this.firstMove,t=0;e&&!e.atEnd;)t++,e=e.next;return t},Board.prototype.processTaken=function(e,t){var i=this.boardName+"-piecestaken",s=YAHOO.util.Dom.get(i);if(s)if(t){e=get_image_str(ChessPiece.pieceIconNames[e.colour][e.piece],this.boardImagePath,this.pieceSet,this.pieceTakenSize,this.addVersion);s.innerHTML=s.innerHTML+'<img src="'+e+'"/>'}else{var o=s.innerHTML.split("<");s.innerHTML="";for(var n=1;n<o.length-1;n++)s.innerHTML=s.innerHTML+"<"+o[n]}},Pool=function(){this.pool=new Array,this.count=-1,this.numGot=0,this.numPut=0},Pool.prototype.getObject=function(){var e=null;return 0<=this.count&&(this.numGot++,e=this.pool[this.count--]),e},Pool.prototype.putObject=function(e){null!=e&&(this.numPut++,this.pool[++this.count]=e)};var boardPool=new Pool;function jsonResp(o){var c=jsonResponders[o.caller],p=c.board.problem.alk(o.p),root=eval("("+p+")");c.processPuzzleResponse(root)}FenBoard=function(e,t){void 0===t.pieceSize&&(t.pieceSize=24),t.fenBoard=!0,t.dontOutputNavButtons=!0,t.avoidMouseoverActive=!0,this.chessapp=new ChessApp(t),this.chessapp.init(),this.chessapp.board.disableUpdateToPlay=!0,this.chessapp.board.setupFromFen(e,!1,!1,!1),this.board=this.chessapp.board,this.board.startFen=e},ArbitraryMovementBoard=function(){},ArbitraryMovementBoard.prototype.setup=function(){alert("error: arbitraryMovementBoard.setup called on super class with no child implementation")},ArbitraryMovementBoard.prototype.arbitraryMovementBoardInit=function(e,t){var i=new BoardConfig;i.applyConfig(e),window._pvObject||(window._pvObject=new Array),window._pvObject[i.boardName]=this,(e=i).previewMode=!0,e.allowingFreeMovement=!0,e.ieFixCoordsOffsetSize=8,this.chessapp=new ChessApp(e),this.finishedCallback=t,this.chessapp.config.loadImmediately?this.setup():e.avoidDomReadySetup||YAHOO.util.Event.onDOMReady(this.setup,this,!0)},ArbitraryMovementBoard.prototype.copyMoveStr=function(e,t,i,s,o){var n=parseInt((t.moveNum+1)/2),r="";s==ChessPiece.BLACK?i&&(r=n+"..."):r=n+".";n=t.SAN;o&&(n=n.replace(" e.p.",""));var a=r+n+" ";t.beforeComment&&(a=" { "+t.beforeComment+" } "+a),t.afterComment&&(a+=" { "+t.afterComment+" } ");for(var l=0;l<t.numVars;l++){var h=t.vars[l];e[h.index]&&(a+="(",a+=this.copyMoveStr(e,h,!0,s,o),a+=") ")}return t.next&&e[t.next.index]?a+this.copyMoveStr(e,t.next,!1,Board.invertToMove(s),o):a},ArbitraryMovementBoard.prototype.copyMoveIndexes=function(e,t,i,s){t=this.board.moveArray[t];return this.copyMoveStr(e,t,!0,i,s)},ArbitraryMovementBoard.prototype.copyMovesHtml=function(e,t){for(var i=/board-m([0-9]+)/g,s=new Array,o=-1;match=i.exec(e);){var n=match[1];-1==o&&(o=n),s[n]=!0}if(-1!=o){clog&&(console.log("board fen:"+this.board.boardToFen()),this.board.prev_move&&console.log("board prev_move:"+this.board.prev_move.output()));var r=this.board.cloneBoard();clog&&(console.log("tmpboard fen:"+r.boardToFen()),r.prev_move&&console.log("tmpboard prev_move:"+r.prev_move.output())),r.gotoMoveIndex(-1,!0,!0,!0,!0),clog&&console.log("finished goto start move");var a=r.toMove;clog&&console.log("about to gotomoveindex:"+o),-1!=o&&r.gotoMoveIndex(o,!0,!0,!0,!0),clog&&console.log("finished goto first:"+o),r.backMove(),clog&&console.log("finished back move");var l=r.toMove;clog&&(console.log("startTomove:"+a+" toMove:"+r.toMove+" fen:"+r.boardToFen()),r.currentMove?r.currentMove.prev?console.log("tmp cur.prev:"+r.currentMove.prev.output()):console.log("tmp no cur prev"):console.log("tmp board no current move"),r.prev_move?console.log("tmpboard prev_move:"+r.prev_move.output()):console.log("tmpboard no prev move"));var h=r.boardToFen(),u=this.copyMoveIndexes(s,o,r.toMove,t),r=!1,t="false";return this.board.isUserFlipped&&(r=!0),a!=l&&(r=!r),r&&(t="true"),{moveList:u,flip:t,fen:h}}},ArbitraryMovementBoard.prototype.copyMovesToComment=function(e,t,i,s){this.parentBoard&&this.parentBoard.copyAnalysisToComment(e,t,i,s)},ArbitraryMovementBoard.prototype.liftVariation=function(){var e;this.board.currentMove&&this.board.currentMove.prev&&(e=this.board.currentMove.prev,(e=this.board.findVariationHeadFromMove(e))?this.board.liftVariation(e):alert(_js("Selected move is not part of a variation.")))},ArbitraryMovementBoard.prototype.arbitraryMovementBoardSetup=function(){ctime&&console.time("arbMovementBoardSetup"),this.chessapp.init(),this.board=this.chessapp.board,this.board.newAnalysis=this.newAnalysis||this.board.newAnalysis,this.board.allowingFreeMovement=!0,this.board.startFen=Board.INITIAL_FEN;var e=this.board.createMoveFromString("i1i2");e.prev=null,e.next=null,e.dummy=!0,e.atEnd=1,this.board.setCurrentMove(e),this.board.addUpdatePieceListener(this),this.board.addUpdatePieceFinis
6hedListener(this),this.board.addBackMovePreCurrentListener(this),this.board.addForwardMovePostUpdateListener(this),this.board.addGotoMoveIndexListener(this),ctime&&console.timeEnd("arbMovementBoardSetup")},ArbitraryMovementBoard.prototype.forwardMovePostUpdateCallback=function(e){this.postForwardMovePostUpdateCallback(e)},ArbitraryMovementBoard.prototype.backMovePreCurrentCallback=function(e,t){this.postBackMovePreCurrentCallback(e,t)},ArbitraryMovementBoard.prototype.postForwardMovePostUpdateCallback=function(e){alert("child postForwardMovePostUpdateCallback not implemented")},ArbitraryMovementBoard.prototype.postBackMovePreCurrentCallback=function(e){alert("child postForwardMovePostUpdateCallback not implemented")},ArbitraryMovementBoard.prototype.gotoMoveIndexCallback=function(e){var t;-1==e&&(this.board.currentMove&&(t=this.board.boardName+"-m"+this.board.currentMove.index,clog&&console.log("mvid:"+t),YAHOO.util.Dom.removeClass(t,"ct-board-move-current"),this.board.currentMove.prev&&(t=this.board.boardName+"-m"+this.board.currentMove.prev.index,clog&&console.log("mvid prev:"+t),YAHOO.util.Dom.removeClass(t,"ct-board-move-current"))),e=0),this.postGotoMoveIndexCallback(e)},ArbitraryMovementBoard.prototype.postGotoMoveIndexCallback=function(e){alert("child postGotoMoveIndexCallback not implemented")},ArbitraryMovementBoard.prototype.insertNewMove=function(e){var t,i;this.board.currentMove&&(s=this.board.boardName+"-m"+this.board.currentMove.index,clog&&console.log("mvid:"+s),YAHOO.util.Dom.removeClass(s,"ct-board-move-current"),this.board.currentMove.prev&&(s=this.board.boardName+"-m"+this.board.currentMove.prev.index,clog&&console.log("mvid prev:"+s),YAHOO.util.Dom.removeClass(s,"ct-board-move-current"))),this.board.currentMove&&this.board.currentMove.dummy?(t=this.board.currentMove,clog&&(t.prev?console.log("inserting after cm prev:"+t.prev.output()):console.log("inserting after null")),i=t.prev,this.board.insertMoveAfter(i,e),null==i&&(((e.next=t).prev=e).atEnd=!1),clog&&console.log("currentMove dummy insert")):this.board.currentMove?(clog&&console.log("before currentMove non-dummy replace currentMove:"+this.board.currentMove.output()+" move:"+e.output()),this.board.replaceMove(this.board.currentMove,e,!0,!0,!1,!1),clog&&console.log("after currentMove non-dummy replace currentMove:"+this.board.currentMove.output())):(this.board.insertMoveAfter(this.board.currentMove,e),clog&&console.log("currentMove non-dummy insert"));var s=this.board.boardName+"-m"+e.index;clog&&console.log("mvid cur:"+s),YAHOO.util.Dom.addClass(s,"ct-board-move-current")},ArbitraryMovementBoard.prototype.setupFromPGN=function(e,t,i){var s=this.chessapp.pgn;s&&!i||(s=new PGN(this.board.cloneBoard()));var o=s.parsePGN(e);if(!o.parsedOk)return o;i=o.pgnGames;return i&&0<i.length?(i[0].startFen?this.board.startFen=i[0].startFen:this.board.startFen=Board.INITIAL_FEN,this.initialFen=this.board.startFen,this.board.setupFromFen(this.board.startFen,t,!0,!0),s=i[0].movesseq,e=new Array,s&&0<s.length&&(e=s.replace(/\s+$/g,"").split(" ")),this.moveArray=new Array,i=this.board.lalgToMoveList(e,i[0].pgn_result,i[0].start_movenum,null,!0),this.board.insertMovesFromMoveList(i[0]),clog&&(console.log("moves:"+s+" fen:"+this.board.boardToFen()+" prev_move:"+this.board.prev_move),this.board.currentMove?(console.log("currentMove:"+this.board.currentMove.output()),this.board.currentMove.next?console.log("currentNext:"+this.board.currentMove.next.output()):console.log("no currentNext")):console.log("no current move set"))):this.board.setupFromFen(this.board.startFen,t,!0,!1),o},ArbitraryMovementBoard.prototype.updatePieceCallback=function(e,t,i,s,o,n,r,a,l,h,u,c){var d=new Object;d.move=c,d.allowMove=!0,d.dontMakeOpponentMove=!0;var m,p=u;return p&&(p.fromColumn!=t.column||p.fromRow!=t.row||p.toRow!=s||p.toColumn!=i||""!=e&&e!=p.promotion?(m=Board.getVarMove(p,s,i,t,e))&&(d.move=m):d.move=p),1==d.allowMove&&d.move==c&&this.insertNewMove(c),this.postUpdatePieceCallback(e,t,i,s,o,n,r,a,l,h,u,c,d),d},ArbitraryMovementBoard.prototype.postUpdatePieceCallback=function(e,t,i,s,o,n,r,a,l,h,u,c){alert("child postUpdatePieceCallback not implemented")}
6,ArbitraryMovementBoard.prototype.updatePieceFinishedCallback=function(e,t,i,s,o,n,r,a,l,h,u,c){l||(this.board.toggleToMove(),this.board.setForwardBack(),this.postUpdatePieceFinishedCallback(e,t,i,s,o,n,r,a,l,h,u,c))},ArbitraryMovementBoard.prototype.postUpdatePieceFinishedCallback=function(){alert("child postUpdatePieceFinishedCallback not implemented")},AnalysisBoard=function(e,t,i){e.pgnMode=!0,this.webuci=null,this.parentBoard=i,this.initialFen=e.initialFen,this.pgnMoves=e.pgnMoves,this.setupUsingParent=e.setupUsingParent,this.engineInitAtPageLoad=e.engineInitAtPageLoad,this.arbitraryMovementBoardInit(e,t),this.firstEngineOpened=!0},AnalysisBoard.prototype=new ArbitraryMovementBoard,AnalysisBoard.prototype.followMove=function(){this.webuci&&!this.webuci.engineLocked&&this.webuci.goingInfinite&&this.webuci.followMove()},AnalysisBoard.prototype.postForwardMovePostUpdateCallback=function(e){this.webuci&&!this.webuci.engineLocked&&this.webuci.goingInfinite&&this.webuci.followMove()},AnalysisBoard.prototype.postBackMovePreCurrentCallback=function(e){this.webuci&&!this.webuci.engineLocked&&this.webuci.goingInfinite&&this.webuci.followMove()},AnalysisBoard.prototype.makeMoveCallback=function(e){},AnalysisBoard.prototype.postUpdatePieceCallback=function(e,t,i,s,o,n,r,a,l,h,u,c){},AnalysisBoard.prototype.postUpdatePieceFinishedCallback=function(e,t,i,s,o,n,r,a,l,h,u,c){this.webuci&&!this.webuci.engineLocked&&this.webuci.goingInfinite&&this.webuci.followMove()},AnalysisBoard.prototype.postGotoMoveIndexCallback=function(e){this.webuci&&!this.webuci.engineLocked&&this.webuci.goingInfinite&&this.webuci.followMove()},AnalysisBoard.prototype.setWebUci=function(e){e&&(this.webuci=e,this.webuci.addMoveClickListener(this),this.webuci.addPlayBestListener(this),this.webuci.setParentBoard(this.board))},AnalysisBoard.prototype.spacePressed=function(e){return!this.webuci||this.webuci.playBest()},AnalysisBoard.prototype.playBestClicked=function(e,t,i,s){if(clog&&console.log("play best clicked:"+e),!this.board.blockFowardBack&&!this.board.deferredBlockForwardBack){this.board.blockForwardBack=!0;try{var o=e.pvInfo,n=WebUci.getFirstLalg(o.pv);clog&&console.log("play best:"+n+" analysisMoveIndex:"+o.analysisMoveIndex),this.board.gotoMoveIndex(o.analysisMoveIndex,!1,!0,!0,!1);n=this.board.createMoveFromString(n);clog&&console.log("about to makeMove:"+n.output()+" with board:"+this.board.boardToFen()+" analysisMoveIndex:"+i+" bestLineDetails fen:"+o.fen+" analysisPos:"+t),this.insertNewMove(n),this.board.makeMove(n,this.board.boardPieces[n.fromColumn][n.fromRow],!0,this.board.moveAnimationLength,!0,!0),this.board.toggleToMove(),this.board.setCurrentMove(n.next),this.board.blockForwardBack=!1,this.webuci&&!this.webuci.engineLocked&&this.webuci.goingInfinite&&this.webuci.followMove()}catch(e){this.board.blockForwardBack=!1}}},AnalysisBoard.prototype.toFen=function(){return this.board.boardToFen()},AnalysisBoard.prototype.analysisMoveClicked=function(e,t,i,s,o){i=parseInt(i);var n=-1;o&&(n=o.analysisMoveIndex),this.board.insertLineToMoveIndexPosition(n,s,e.pvInfo.scoreText,e.pvInfo.moves,i+1)},AnalysisBoard.prototype.saveComment=function(e,t){this.board.currentMove&&this.board.insertCommentIntoMoveDisplay(this.board.currentMove.prev,e,t)},AnalysisBoard.prototype.processMoveTransition=function(){},AnalysisBoard.prototype.setup=function(){if(this.arbitraryMovementBoardSetup(),this.board.disableUpdateToPlay=!0,this.board.addSpaceListener(this),this.parentBoard&&(this.board.problem=this.parentBoard.problem),this.setupUsingParent&&this.parentBoard&&this.parentBoard.startFen){this.board.startFen=this.parentBoard.startFen;var e=!1;this.parentBoard.prev_move&&!this.parentBoard.prev_move.prevMoveEnpassant&&(e=!0),this.board.setupFromFen(this.parentBoard.startFen,e,!1,!0,!0),this.parentBoard.prev_move&&!this.parentBoard.prev_move.prevMoveEnpassant&&(this.board.prev_move=this.parentBoard.prev_move.clone(),a=this.board.boardPieces[this.board.prev_move.fromColumn][this.board.prev_move.fromRow],this.board.makeMove(this.board.prev_move,a,!1,this.board.moveAnimationLength,!0,!0),this.board.updateToPlay()),this.board.moveNumber;var t=this.board.boardToFen();this.board.startFen=t,this.board.initialFen=t,this.board.prev_move=null,this.board.setupFromFen(t,!1,!1,!1,!0),this.parentBoard.isUserFlipped&&this.board.flipBoard();for(var i=[],s=this.parentBoard.currentMove;s&&s.prev;)i.push(s.prev),s=s.prev;if(this.board.currentMove=null,0<i.length){this.board.startMoveNum=this.board.moveNumber;for(var o,n,r=i.length-1;0<=r;r--)i[r]!=this.parentBoard.prev_move&&(o=i[r],n=this.board.createMoveFromString(o.moveString),this.board.insertMoveAfter(this.board.currentMove,n),o.beforeComment&&this.board.insertCommentIntoMoveDisplay(n,o.beforeComment,!1),o.afterComment&&this.board.insertCommentIntoMoveDisplay(n,o.afterComment,!0),this.board.makeMove(n,this.board.boardPieces[n.fromColumn][n.fromRow],!1,this.board.moveAnimationLength,!1,!1),this.board.setCurrentMove(n))}this.board.gotoEnd()}else{var a;this.initialFen&&(this.board.startFen=this.initialFen,this.board.initialFen=this.initialFen,this.pgnMoves?(a=this.setupFromPGN(this.pgnMoves,e)).parsedOk||(t=this.board.boardName+"-container",YAHOO.util.Dom.get(t).innerHTML='<div class="pgn-parser-error">'+a.errorString+"</div>"):this.board.setupFromFen(this.board.startFen,e,!0,!1))}},Puzzle=function(e){var t=(t=e.puzzleName)||"puzzle";e.puzzle=!0,e.googleWidget?this.googleWidget=!0:this.googleWidget=!1;var i=new BoardConfig;i.boardName=t,i.variationOnOwnLine=!0,i.movesFormat="main_on_own_line",i.autoScrollMoves=!0,i.showToMoveIndicators=!0,i.showCoordinates=!0,i.squareColorClass="-lightgrey",e&&i.applyConfig(e),e=i,this.chessapp=new ChessApp(e),YAHOO.util.Event.onDOMReady(this.setup,this,!0)},Puzzle.prototype.processPuzzleResponse=function(e){this.board.problem.processTacticData(e);var t=this;this.board.makeMove(this.board.prev_move,this.board.boardPieces[this.board.prev_move.fromColumn][this.board.prev_move.fromRow],!0,1,!1,!0,function(){t.board.updateToPlay()},t)};var jsonResponders=[];Puzzle.prototype.puzzleJsonp=function(e,t){e+="?difficulty="+t,e+="&ts="+(new Date).getTime().toString(),e+="&caller="+this.board.boardName,jsonResponders[this.board.boardName]=this;t=document.createElement("script");t.setAttribute("src",e),t.setAttribute("type","text/javascript"),document.body.appendChild(t)},Puzzle.prototype.getPuzzle=function(e){YAHOO.util.Dom.setStyle(this.board.boardName+"-nav-buttons-only","display","none"),YAHOO.util.Dom.setStyle(this.board.boardName+"-problemState","display","none"),this.board.pendingMovesOutput=null,this.board.currentMove=null,this.board.moveIndex=0,this.board.tactics.problemActive=!0,this.board.movesDisplay.firstNonMove=!1,this.board.movesDisplay.displayType=MovesDisplay.MAIN_ON_OWN_LINE,this.board.movesDisplay.variationOnOwnLine=!0,this.l&&this.puzzleJsonp("https://chesstempo.com/requests/get_puzzle.php",e)},Puzzle.prototype.setup=function(){var e;document.getElementById("puzzleCss")||(e=document.getElementsByTagName("head")[0],(t=document.createElement("link")).id="puzzleCss",t.rel="stylesheet",t.type="text/css",t.href="https://chesstempo.com/css/dailypuzzle.css",t.media="all",e.appendChild(t)),this.chessapp.init(),this.board=this.chessapp.board,this.l=!1,YAHOO.util.Dom.setStyle("nav
6-buttons-only","display","none"),YAHOO.util.Dom.setStyle("problemState","display","none"),YAHOO.util.Event.addListener(this.board.boardName+"-puzzleSolution","click",this.showPuzzleSolution,this,!0),YAHOO.util.Event.addListener(this.board.boardName+"-easyPuzzle","click",this.showPuzzleEasy,this,!0),YAHOO.util.Event.addListener(this.board.boardName+"-mediumPuzzle","click",this.showPuzzleMedium,this,!0),YAHOO.util.Event.addListener(this.board.boardName+"-hardPuzzle","click",this.showPuzzleHard,this,!0),YAHOO.util.Event.addListener(this.board.boardName+"-puzzleHelp","click",this.showHelp,this,!0),YAHOO.util.Dom.addClass(this.board.boardName+"-easyPuzzle","selected-puzzle-difficulty");var t=YAHOO.util.Dom.get("ct-link");t&&""!=function(e){for(var t=/\s/,i=(e=(e=e.replace(/&nbsp;/,"")).replace(/^\s\s*/,"")).length;t.test(e.charAt(--i)););return e.slice(0,i+1)}(t.innerHTML)&&-1!=t.href.toLowerCase().indexOf("chesstempo.com")&&(this.l=!0),this.getPuzzle("easy")},Puzzle.prototype.showHelp=function(e){var t="400px",i="410px",s="320px";this.googleWidget&&(t="240px",i="310px",s="220px");i=new YAHOO.widget.SimpleDialog("puzzleHelp",{width:t,height:i,fixedcenter:!1,modal:!1,visible:!0,draggable:!0,close:!0,iframe:!0,icon:YAHOO.widget.SimpleDialog.ICON_INFO,constraintoviewport:!1,buttons:[{text:'<span style="color:black;">'+_js("Ok")+"</span>",handler:function(){this.hide()},isDefault:!0}]});YAHOO.util.Dom.addClass(document.body,"yui-skin-sam"),this.googleWidget?i.setHeader(""):i.setHeader("<div>"+_js("Help")+"</div>"),i.setBody('<div style="overflow:auto;height:'+s+';width:auto;text-align:left"><h2>'+_js("Chess Tempo Daily Puzzle")+"</h2><p>"+_js("Play the correct moves by dragging the pieces on the board.  If you play an incorrect move, you will be marked wrong, and you'll be able to move through the solution with the arrow keys or navigation buttons. To show the list of moves and analysis of the top 5 moves at each point, press the 'Show' button. You can click on any of the sub-varation moves in the solution to jump to that position on the board. Three level of tactics are provided each day, easy, medium, and hard, you can change difficulty level by clicking on the appropriate buttons.")+"</p><p>"+_js('Thousands more positions are available at <a href="https://chesstempo.com/chess-tactics.html">Chess Tempo</a>.')+"</p><p>"+_js('Go to the <a href="https://chesstempo.com/widgets.html#dailyPuzzleWidget">Chess Tempo Widget Page</a> for instructions on how to install the daily puzzle widget on your own web page.')+"</p></div>"),i.render(document.body),i.show(),i.center()},Puzzle.prototype.showPuzzleEasy=function(e){this.getPuzzle("easy"),YAHOO.util.Dom.addClass(this.board.boardName+"-easyPuzzle","selected-puzzle-difficulty"),YAHOO.util.Dom.removeClass(this.board.boardName+"-mediumPuzzle","selected-puzzle-difficulty"),YAHOO.util.Dom.removeClass(this.board.boardName+"-hardPuzzle","selected-puzzle-difficulty")},Puzzle.prototype.showPuzzleMedium=function(e){this.getPuzzle("medium"),YAHOO.util.Dom.removeClass(this.board.boardName+"-easyPuzzle","selected-puzzle-difficulty"),YAHOO.util.Dom.removeClass(this.board.boardName+"-hardPuzzle","selected-puzzle-difficulty"),YAHOO.util.Dom.addClass(this.board.boardName+"-mediumPuzzle","selected-puzzle-difficulty")},Puzzle.prototype.showPuzzleHard=function(e){this.getPuzzle("hard"),YAHOO.util.Dom.removeClass(this.board.boardName+"-easyPuzzle","selected-puzzle-difficulty"),YAHOO.util.Dom.removeClass(this.board.boardName+"-mediumPuzzle","selected-puzzle-difficulty"),YAHOO.util.Dom.addClass(this.board.boardName+"-hardPuzzle","selected-puzzle-difficulty")},Puzzle.prototype.showPuzzleSolution=function(e){var t,i;if(this.board.tactics.markProblem(!1),this.solutionDialog?(t=this.solutionDialog,YAHOO.util.Dom.get(this.board.boardName+"-puzzleSolutionDiv").innerHTML=this.board.pendingMovesOutput):(i="300px",this.googleWidget&&(i="200px"),t=new YAHOO.widget.SimpleDialog("puzzleSolution",{width:i,height:"310px",fixedcenter:!1,modal:!1,visible:!0,draggable:!0,close:!0,iframe:!0,icon:YAHOO.widget.SimpleDialog.ICON_INFO,constraintoviewport:!1,buttons:[{text:'<span style="color:black;">'+_js("Ok")+"</span>",handler:function(){this.hide()},isDefault:!0}]}),YAHOO.util.Dom.addClass(document.body,"yui-skin-sam"),t.setHeader(_js("Solution")),YAHOO.util.Dom.get(this.board.boardName+"-puzzleSolutionDiv"),t.setBody('<div id="'+this.board.boardName+'-puzzleSolutionDiv" style="text-align:left;width:auto;height:220px;overflow:auto;color:black">'+this.board.pendingMovesOutput+"</div>")),(this.solutionDialog=t).render(document.body),t.show(),t.center(),this.board.movesDisplay&&(this.board.movesDisplay.moveListName=this.board.boardName+"-puzzleSolutionDiv",this.board.movesDisplay.cachedMovesDisplay=!1,this.board.movesDisplay.allreadyCachedMovesDisplay=!1,YAHOO.util.Event.purgeElement(this.board.movesDisplay.getMovesDisplay(),!0),this.board.movesDisplay))for(var s=0;s<this.board.pendingMovesOutputCount;s++){var o=YAHOO.util.Dom.get(this.board.boardName+"-m"+s);o&&YAHOO.util.Event.addListener(o,"click",this.board.movesDisplay.gotoMove,this.board.movesDisplay,!0)}};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.