/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var o=this,h,B=o.jQuery,s=o.$,r=o.jQuery=o.$=function(H,I){return new r.fn.init(H,I)},G=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,g=/^.[^:#\[\.,]*$/;r.fn=r.prototype={init:function(H,K){H=H||document;if(H.nodeType){this[0]=H;this.length=1;this.context=H;return this}if(typeof H==="string"){var J=G.exec(H);if(J&&(J[1]||!K)){if(J[1]){H=r.clean([J[1]],K)}else{var L=document.getElementById(J[3]);if(L&&L.id!=J[3]){return r().find(H)}var I=r(L||[]);I.context=document;I.selector=H;return I}}else{return r(K).find(H)}}else{if(r.isFunction(H)){return r(document).ready(H)}}if(H.selector&&H.context){this.selector=H.selector;this.context=H.context}return this.setArray(r.isArray(H)?H:r.makeArray(H))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(H){return H===h?Array.prototype.slice.call(this):this[H]},pushStack:function(I,K,H){var J=r(I);J.prevObject=this;J.context=this.context;if(K==="find"){J.selector=this.selector+(this.selector?" ":"")+H}else{if(K){J.selector=this.selector+"."+K+"("+H+")"}}return J},setArray:function(H){this.length=0;Array.prototype.push.apply(this,H);return this},each:function(I,H){return r.each(this,I,H)},index:function(H){return r.inArray(H&&H.jquery?H[0]:H,this)},attr:function(I,K,J){var H=I;if(typeof I==="string"){if(K===h){return this[0]&&r[J||"attr"](this[0],I)}else{H={};H[I]=K}}return this.each(function(L){for(I in H){r.attr(J?this.style:this,I,r.prop(this,H[I],J,L,I))}})},css:function(H,I){if((H=="width"||H=="height")&&parseFloat(I)<0){I=h}return this.attr(H,I,"curCSS")},text:function(I){if(typeof I!=="object"&&I!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(I))}var H="";r.each(I||this,function(){r.each(this.childNodes,function(){if(this.nodeType!=8){H+=this.nodeType!=1?this.nodeValue:r.fn.text([this])}})});return H},wrapAll:function(H){if(this[0]){var I=r(H,this[0].ownerDocument).clone();if(this[0].parentNode){I.insertBefore(this[0])}I.map(function(){var J=this;while(J.firstChild){J=J.firstChild}return J}).append(this)}return this},wrapInner:function(H){return this.each(function(){r(this).contents().wrapAll(H)})},wrap:function(H){return this.each(function(){r(this).wrapAll(H)})},append:function(){return this.domManip(arguments,true,function(H){if(this.nodeType==1){this.appendChild(H)}})},prepend:function(){return this.domManip(arguments,true,function(H){if(this.nodeType==1){this.insertBefore(H,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(H){this.parentNode.insertBefore(H,this)})},after:function(){return this.domManip(arguments,false,function(H){this.parentNode.insertBefore(H,this.nextSibling)})},end:function(){return this.prevObject||r([])},push:[].push,sort:[].sort,splice:[].splice,find:function(H){if(this.length===1){var I=this.pushStack([],"find",H);I.length=0;r.find(H,this[0],I);return I}else{return this.pushStack(r.unique(r.map(this,function(J){return r.find(H,J)})),"find",H)}},clone:function(J){var H=this.map(function(){if(!r.support.noCloneEvent&&!r.isXMLDoc(this)){var L=this.outerHTML;if(!L){var M=this.ownerDocument.createElement("div");M.appendChild(this.cloneNode(true));L=M.innerHTML}return r.clean([L.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(J===true){var K=this.find("*").andSelf(),I=0;H.find("*").andSelf().each(function(){if(this.nodeName!==K[I].nodeName){return}var L=r.data(K[I],"events");for(var N in L){for(var M in L[N]){r.event.add(this,N,L[N][M],L[N][M].data)}}I++})}return H},filter:function(H){return this.pushStack(r.isFunction(H)&&r.grep(this,function(J,I){return H.call(J,I)})||r.multiFilter(H,r.grep(this,function(I){return I.nodeType===1})),"filter",H)},closest:function(H){var J=r.expr.match.POS.test(H)?r(H):null,I=0;return this.map(function(){var K=this;while(K&&K.ownerDocument){if(J?J.index(K)>-1:r(K).is(H)){r.data(K,"closest",I);return K}K=K.parentNode;I++}})},not:function(H){if(typeof H==="string"){if(g.test(H)){return this.pushStack(r.multiFilter(H,this,true),"not",H)}else{H=r.multiFilter(H,this)}}var I=H.length&&H[H.length-1]!==h&&!H.nodeType;return this.filter(function(){return I?r.inArray(this,H)<0:this!=H})},add:function(H){return this.pushStack(r.unique(r.merge(this.get(),typeof H==="string"?r(H):r.makeArray(H))))},is:function(H){return !!H&&r.multiFilter(H,this).length>0},hasClass:function(H){return !!H&&this.is("."+H)},val:function(N){if(N===h){var H=this[0];if(H){if(r.nodeName(H,"option")){return(H.attributes.value||{}).specified?H.value:H.text}if(r.nodeName(H,"select")){var L=H.selectedIndex,O=[],P=H.options,K=H.type=="select-one";if(L<0){return null}for(var I=K?L:0,M=K?L+1:P.length;I<M;I++){var J=P[I];if(J.selected){N=r(J).val();if(K){return N}O.push(N)}}return O}return(H.value||"").replace(/\r/g,"")}return h}if(typeof N==="number"){N+=""}return this.each(function(){if(this.nodeType!=1){return}if(r.isArray(N)&&/radio|checkbox/.test(this.type)){this.checked=(r.inArray(this.value,N)>=0||r.inArray(this.name,N)>=0)}else{if(r.nodeName(this,"select")){var Q=r.makeArray(N);r("option",this).each(function(){this.selected=(r.inArray(this.value,Q)>=0||r.inArray(this.text,Q)>=0)});if(!Q.length){this.selectedIndex=-1}}else{this.value=N}}})},html:function(H){return H===h?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(H)},replaceWith:function(H){return this.after(H).remove()},eq:function(H){return this.slice(H,+H+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(H){return this.pushStack(r.map(this,function(J,I){return H.call(J,I,J)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(M,P,O){if(this[0]){var L=(this[0].ownerDocument||this[0]).createDocumentFragment(),I=r.clean(M,(this[0].ownerDocument||this[0]),L),K=L.firstChild;if(K){for(var J=0,H=this.length;J<H;J++){O.call(N(this[J],K),this.length>1||J>0?L.cloneNode(true):L)}}if(I){r.each(I,C)}}return this;function N(Q,R){return P&&r.nodeName(Q,"table")&&r.nodeName(R,"tr")?(Q.getElementsByTagName("tbody")[0]||Q.appendChild(Q.ownerDocument.createElement("tbody"))):Q}}};r.fn.init.prototype=r.fn;function C(H,I){if(I.src){r.ajax({url:I.src,async:false,dataType:"script"})}else{r.globalEval(I.text||I.textContent||I.innerHTML||"")}if(I.parentNode){I.parentNode.removeChild(I)}}function f(){return +new Date}r.extend=r.fn.extend=function(){var M=arguments[0]||{},K=1,L=arguments.length,H=false,J;if(typeof M==="boolean"){H=M;M=arguments[1]||{};K=2}if(typeof M!=="object"&&!r.isFunction(M)){M={}}if(L==K){M=this;--K}for(;K<L;K++){if((J=arguments[K])!=null){for(var I in J){var N=M[I],O=J[I];if(M===O){continue}if(H&&O&&typeof O==="object"&&!O.nodeType){M[I]=r.extend(H,N||(O.length!=null?[]:{}),O)}else{if(O!==h){M[I]=O}}}}}return M};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,t=document.defaultView||{},v=Object.prototype.toString;r.extend({noConflict:function(H){o.$=s;if(H){o.jQuery=B}return r},isFunction:function(H){return v.call(H)==="[object Function]"},isArray:function(H){return v.call(H)==="[object Array]"},isXMLDoc:function(H){return H.nodeType===9&&H.documentElement.nodeName!=="HTML"||!!H.ownerDocument&&r.isXMLDoc(H.ownerDocument)},globalEval:function(J){if(J&&/\S/.test(J)){var I=document.getElementsByTagName("head")[0]||document.documentElement,H=document.createElement("script");H.type="text/javascript";if(r.support.scriptEval){H.appendChild(document.createTextNode(J))}else{H.text=J}I.insertBefore(H,I.firstChild);I.removeChild(H)}},nodeName:function(I,H){return I.nodeName&&I.nodeName.toUpperCase()==H.toUpperCase()},each:function(J,N,I){var H,K=0,L=J.length;if(I){if(L===h){for(H in J){if(N.apply(J[H],I)===false){break}}}else{for(;K<L;){if(N.apply(J[K++],I)===false){break}}}}else{if(L===h){for(H in J){if(N.call(J[H],H,J[H])===false){break}}}else{for(var M=J[0];K<L&&N.call(M,K,M)!==false;M=J[++K]){}}}return J},prop:function(K,L,J,I,H){if(r.isFunction(L)){L=L.call(K,I)}return typeof L==="number"&&J=="curCSS"&&!b.test(H)?L+"px":L},className:{add:function(H,I){r.each((I||"").split(/\s+/),function(J,K){if(H.nodeType==1&&!r.className.has(H.className,K)){H.className+=(H.className?" ":"")+K}})},remove:function(H,I){if(H.nodeType==1){H.className=I!==h?r.grep(H.className.split(/\s+/),function(J){return !r.className.has(I,J)}).join(" "):""}},has:function(I,H){return I&&r.inArray(H,(I.className||I).toString().split(/\s+/))>-1}},swap:function(K,J,L){var H={};for(var I in J){H[I]=K.style[I];K.style[I]=J[I]}L.call(K);for(var I in J){K.style[I]=H[I]}},css:function(K,I,M,H){if(I=="width"||I=="height"){var O,J={position:"absolute",visibility:"hidden",display:"block"},N=I=="width"?["Left","Right"]:["Top","Bottom"];function L(){O=I=="width"?K.offsetWidth:K.offsetHeight;if(H==="border"){return}r.each(N,function(){if(!H){O-=parseFloat(r.curCSS(K,"padding"+this,true))||0}if(H==="margin"){O+=parseFloat(r.curCSS(K,"margin"+this,true))||0}else{O-=parseFloat(r.curCSS(K,"border"+this+"Width",true))||0}})}if(K.offsetWidth!==0){L()}else{r.swap(K,J,L)}return Math.max(0,Math.round(O))}return r.curCSS(K,I,M)},curCSS:function(L,I,J){var O,H=L.style;if(I=="opacity"&&!r.support.opacity){O=r.attr(H,"opacity");return O==""?"1":O}if(I.match(/float/i)){I=z}if(!J&&H&&H[I]){O=H[I]}else{if(t.getComputedStyle){if(I.match(/float/i)){I="float"}I=I.replace(/([A-Z])/g,"-$1").toLowerCase();var P=t.getComputedStyle(L,null);if(P){O=P.getPropertyValue(I)}if(I=="opacity"&&O==""){O="1"}}else{if(L.currentStyle){var M=I.replace(/\-(\w)/g,function(Q,R){return R.toUpperCase()});O=L.currentStyle[I]||L.currentStyle[M];if(!/^\d+(px)?$/i.test(O)&&/^\d/.test(O)){var K=H.left,N=L.runtimeStyle.left;L.runtimeStyle.left=L.currentStyle.left;H.left=O||0;O=H.pixelLeft+"px";H.left=K;L.runtimeStyle.left=N}}}}return O},clean:function(I,N,L){N=N||document;if(typeof N.createElement==="undefined"){N=N.ownerDocument||N[0]&&N[0].ownerDocument||document}if(!L&&I.length===1&&typeof I[0]==="string"){var K=/^<(\w+)\s*\/?>$/.exec(I[0]);if(K){return[N.createElement(K[1])]}}var J=[],H=[],O=N.createElement("div");r.each(I,function(S,V){if(typeof V==="number"){V+=""}if(!V){return}if(typeof V==="string"){V=V.replace(/(<(\w+)[^>]*?)\/>/g,function(X,Y,W){return W.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?X:Y+"></"+W+">"});var R=V.replace(/^\s+/,"").substring(0,10).toLowerCase();var T=!R.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!R.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||R.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!R.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!R.indexOf("<td")||!R.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!R.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!r.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];O.innerHTML=T[1]+V+T[2];while(T[0]--){O=O.lastChild}if(!r.support.tbody){var U=/<tbody/i.test(V),Q=!R.indexOf("<table")&&!U?O.firstChild&&O.firstChild.childNodes:T[1]=="<table>"&&!U?O.childNodes:[];for(var P=Q.length-1;P>=0;--P){if(r.nodeName(Q[P],"tbody")&&!Q[P].childNodes.length){Q[P].parentNode.removeChild(Q[P])}}}if(!r.support.leadingWhitespace&&/^\s/.test(V)){O.insertBefore(N.createTextNode(V.match(/^\s*/)[0]),O.firstChild)}V=r.makeArray(O.childNodes)}if(V.nodeType){J.push(V)}else{J=r.merge(J,V)}});if(L){for(var M=0;J[M];M++){if(r.nodeName(J[M],"script")&&(!J[M].type||J[M].type.toLowerCase()==="text/javascript")){H.push(J[M].parentNode?J[M].parentNode.removeChild(J[M]):J[M])}else{if(J[M].nodeType===1){J.splice.apply(J,[M+1,0].concat(r.makeArray(J[M].getElementsByTagName("script"))))}L.appendChild(J[M])}}return H}return J},attr:function(M,J,N){if(!M||M.nodeType==3||M.nodeType==8){return h}var K=!r.isXMLDoc(M),O=N!==h;J=K&&r.props[J]||J;if(M.tagName){var I=/href|src|style/.test(J);if(J=="selected"&&M.parentNode){M.parentNode.selectedIndex}if(J in M&&K&&!I){if(O){if(J=="type"&&r.nodeName(M,"input")&&M.parentNode){throw"type property can't be changed"}M[J]=N}if(r.nodeName(M,"form")&&M.getAttributeNode(J)){return M.getAttributeNode(J).nodeValue}if(J=="tabIndex"){var L=M.getAttributeNode("tabIndex");return L&&L.specified?L.value:M.nodeName.match(/(button|input|object|select|textarea)/i)?0:M.nodeName.match(/^(a|area)$/i)&&M.href?0:h}return M[J]}if(!r.support.style&&K&&J=="style"){return r.attr(M.style,"cssText",N)}if(O){M.setAttribute(J,""+N)}var H=!r.support.hrefNormalized&&K&&I?M.getAttribute(J,2):M.getAttribute(J);return H===null?h:H}if(!r.support.opacity&&J=="opacity"){if(O){M.zoom=1;M.filter=(M.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(N)+""=="NaN"?"":"alpha(opacity="+N*100+")")}return M.filter&&M.filter.indexOf("opacity=")>=0?(parseFloat(M.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}J=J.replace(/-([a-z])/ig,function(P,Q){return Q.toUpperCase()});if(O){M[J]=N}return M[J]},trim:function(H){return(H||"").replace(/^\s+|\s+$/g,"")},makeArray:function(J){var H=[];if(J!=null){var I=J.length;if(I==null||typeof J==="string"||r.isFunction(J)||J.setInterval){H[0]=J}else{while(I){H[--I]=J[I]}}}return H},inArray:function(J,K){for(var H=0,I=K.length;H<I;H++){if(K[H]===J){return H}}return -1},merge:function(K,H){var I=0,J,L=K.length;if(!r.support.getAll){while((J=H[I++])!=null){if(J.nodeType!=8){K[L++]=J}}}else{while((J=H[I++])!=null){K[L++]=J}}return K},unique:function(N){var I=[],H={};try{for(var J=0,K=N.length;J<K;J++){var M=r.data(N[J]);if(!H[M]){H[M]=true;I.push(N[J])}}}catch(L){I=N}return I},grep:function(I,M,H){var J=[];for(var K=0,L=I.length;K<L;K++){if(!H!=!M(I[K],K)){J.push(I[K])}}return J},map:function(H,M){var I=[];for(var J=0,K=H.length;J<K;J++){var L=M(H[J],J);if(L!=null){I[I.length]=L}}return I.concat.apply([],I)}});var F=navigator.userAgent.toLowerCase();r.browser={version:(F.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(F),opera:/opera/.test(F),msie:/msie/.test(F)&&!/opera/.test(F),mozilla:/mozilla/.test(F)&&!/(compatible|webkit)/.test(F)};r.each({parent:function(H){return H.parentNode},parents:function(H){return r.dir(H,"parentNode")},next:function(H){return r.nth(H,2,"nextSibling")},prev:function(H){return r.nth(H,2,"previousSibling")},nextAll:function(H){return r.dir(H,"nextSibling")},prevAll:function(H){return r.dir(H,"previousSibling")},siblings:function(H){return r.sibling(H.parentNode.firstChild,H)},children:function(H){return r.sibling(H.firstChild)},contents:function(H){return r.nodeName(H,"iframe")?H.contentDocument||H.contentWindow.document:r.makeArray(H.childNodes)}},function(H,I){r.fn[H]=function(J){var K=r.map(this,I);if(J&&typeof J=="string"){K=r.multiFilter(J,K)}return this.pushStack(r.unique(K),H,J)}});r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(H,I){r.fn[H]=function(J){var M=[],O=r(J);for(var N=0,K=O.length;N<K;N++){var L=(N>0?this.clone(true):this).get();r.fn[I].apply(r(O[N]),L);M=M.concat(L)}return this.pushStack(M,H,J)}});r.each({removeAttr:function(H){r.attr(this,H,"");if(this.nodeType==1){this.removeAttribute(H)}},addClass:function(H){r.className.add(this,H)},removeClass:function(H){r.className.remove(this,H)},toggleClass:function(I,H){if(typeof H!=="boolean"){H=!r.className.has(this,I)}r.className[H?"add":"remove"](this,I)},remove:function(H){if(!H||r.filter(H,[this]).length){r("*",this).add([this]).each(function(){r.event.remove(this);r.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){r(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(H,I){r.fn[H]=function(){return this.each(I,arguments)}});function m(H,I){return H[0]&&parseInt(r.curCSS(H[0],I,true),10)||0}var k="jQuery"+f(),y=0,D={};r.extend({cache:{},data:function(I,H,J){I=I==o?D:I;var K=I[k];if(!K){K=I[k]=++y}if(H&&!r.cache[K]){r.cache[K]={}}if(J!==h){r.cache[K][H]=J}return H?r.cache[K][H]:K},removeData:function(I,H){I=I==o?D:I;var K=I[k];if(H){if(r.cache[K]){delete r.cache[K][H];H="";for(H in r.cache[K]){break}if(!H){r.removeData(I)}}}else{try{delete I[k]}catch(J){if(I.removeAttribute){I.removeAttribute(k)}}delete r.cache[K]}},queue:function(I,H,K){if(I){H=(H||"fx")+"queue";var J=r.data(I,H);if(!J||r.isArray(K)){J=r.data(I,H,r.makeArray(K))}else{if(K){J.push(K)}}}return J},dequeue:function(K,J){var H=r.queue(K,J),I=H.shift();if(!J||J==="fx"){I=H[0]}if(I!==h){I.call(K)}}});r.fn.extend({data:function(H,J){var K=H.split(".");K[1]=K[1]?"."+K[1]:"";if(J===h){var I=this.triggerHandler("getData"+K[1]+"!",[K[0]]);if(I===h&&this.length){I=r.data(this[0],H)}return I===h&&K[1]?this.data(K[0]):I}else{return this.trigger("setData"+K[1]+"!",[K[0],J]).each(function(){r.data(this,H,J)})}},removeData:function(H){return this.each(function(){r.removeData(this,H)})},queue:function(H,I){if(typeof H!=="string"){I=H;H="fx"}if(I===h){return r.queue(this[0],H)}return this.each(function(){var J=r.queue(this,H,I);if(H=="fx"&&J.length==1){J[0].call(this)}})},dequeue:function(H){return this.each(function(){r.dequeue(this,H)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var U=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,O=0,K=Object.prototype.toString;var I=function(ab,X,ae,af){ae=ae||[];X=X||document;if(X.nodeType!==1&&X.nodeType!==9){return[]}if(!ab||typeof ab!=="string"){return ae}var ac=[],Z,ai,al,W,ag,Y,aa=true;U.lastIndex=0;while((Z=U.exec(ab))!==null){ac.push(Z[1]);if(Z[2]){Y=RegExp.rightContext;break}}if(ac.length>1&&P.exec(ab)){if(ac.length===2&&L.relative[ac[0]]){ai=M(ac[0]+ac[1],X)}else{ai=L.relative[ac[0]]?[X]:I(ac.shift(),X);while(ac.length){ab=ac.shift();if(L.relative[ab]){ab+=ac.shift()}ai=M(ab,ai)}}}else{var ah=af?{expr:ac.pop(),set:H(af)}:I.find(ac.pop(),ac.length===1&&X.parentNode?X.parentNode:X,T(X));ai=I.filter(ah.expr,ah.set);if(ac.length>0){al=H(ai)}else{aa=false}while(ac.length){var ak=ac.pop(),aj=ak;if(!L.relative[ak]){ak=""}else{aj=ac.pop()}if(aj==null){aj=X}L.relative[ak](al,aj,T(X))}}if(!al){al=ai}if(!al){throw"Syntax error, unrecognized expression: "+(ak||ab)}if(K.call(al)==="[object Array]"){if(!aa){ae.push.apply(ae,al)}else{if(X.nodeType===1){for(var ad=0;al[ad]!=null;ad++){if(al[ad]&&(al[ad]===true||al[ad].nodeType===1&&N(X,al[ad]))){ae.push(ai[ad])}}}else{for(var ad=0;al[ad]!=null;ad++){if(al[ad]&&al[ad].nodeType===1){ae.push(ai[ad])}}}}}else{H(al,ae)}if(Y){I(Y,X,ae,af);if(J){hasDuplicate=false;ae.sort(J);if(hasDuplicate){for(var ad=1;ad<ae.length;ad++){if(ae[ad]===ae[ad-1]){ae.splice(ad--,1)}}}}}return ae};I.matches=function(W,X){return I(W,null,null,X)};I.find=function(ad,W,ae){var ac,aa;if(!ad){return[]}for(var Z=0,Y=L.order.length;Z<Y;Z++){var ab=L.order[Z],aa;if((aa=L.match[ab].exec(ad))){var X=RegExp.leftContext;if(X.substr(X.length-1)!=="\\"){aa[1]=(aa[1]||"").replace(/\\/g,"");ac=L.find[ab](aa,W,ae);if(ac!=null){ad=ad.replace(L.match[ab],"");break}}}}if(!ac){ac=W.getElementsByTagName("*")}return{set:ac,expr:ad}};I.filter=function(ag,af,aj,Z){var Y=ag,al=[],ad=af,ab,W,ac=af&&af[0]&&T(af[0]);while(ag&&af.length){for(var ae in L.filter){if((ab=L.match[ae].exec(ag))!=null){var X=L.filter[ae],ak,ai;W=false;if(ad==al){al=[]}if(L.preFilter[ae]){ab=L.preFilter[ae](ab,ad,aj,al,Z,ac);if(!ab){W=ak=true}else{if(ab===true){continue}}}if(ab){for(var aa=0;(ai=ad[aa])!=null;aa++){if(ai){ak=X(ai,ab,aa,ad);var ah=Z^!!ak;if(aj&&ak!=null){if(ah){W=true}else{ad[aa]=false}}else{if(ah){al.push(ai);W=true}}}}}if(ak!==h){if(!aj){ad=al}ag=ag.replace(L.match[ae],"");if(!W){return[]}break}}}if(ag==Y){if(W==null){throw"Syntax error, unrecognized expression: "+ag}else{break}}Y=ag}return ad};var L=I.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(W){return W.getAttribute("href")}},relative:{"+":function(ad,W,ac){var aa=typeof W==="string",ae=aa&&!/\W/.test(W),ab=aa&&!ae;if(ae&&!ac){W=W.toUpperCase()}for(var Z=0,Y=ad.length,X;Z<Y;Z++){if((X=ad[Z])){while((X=X.previousSibling)&&X.nodeType!==1){}ad[Z]=ab||X&&X.nodeName===W?X||false:X===W}}if(ab){I.filter(W,ad,true)}},">":function(ac,X,ad){var aa=typeof X==="string";if(aa&&!/\W/.test(X)){X=ad?X:X.toUpperCase();for(var Y=0,W=ac.length;Y<W;Y++){var ab=ac[Y];if(ab){var Z=ab.parentNode;ac[Y]=Z.nodeName===X?Z:false}}}else{for(var Y=0,W=ac.length;Y<W;Y++){var ab=ac[Y];if(ab){ac[Y]=aa?ab.parentNode:ab.parentNode===X}}if(aa){I.filter(X,ac,true)}}},"":function(Z,X,ab){var Y=O++,W=V;if(!X.match(/\W/)){var aa=X=ab?X:X.toUpperCase();W=S}W("parentNode",X,Y,Z,aa,ab)},"~":function(Z,X,ab){var Y=O++,W=V;if(typeof X==="string"&&!X.match(/\W/)){var aa=X=ab?X:X.toUpperCase();W=S}W("previousSibling",X,Y,Z,aa,ab)}},find:{ID:function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?[W]:[]}},NAME:function(Y,ab,ac){if(typeof ab.getElementsByName!=="undefined"){var X=[],aa=ab.getElementsByName(Y[1]);for(var Z=0,W=aa.length;Z<W;Z++){if(aa[Z].getAttribute("name")===Y[1]){X.push(aa[Z])}}return X.length===0?null:X}},TAG:function(W,X){return X.getElementsByTagName(W[1])}},preFilter:{CLASS:function(Z,X,Y,W,ac,ad){Z=" "+Z[1].replace(/\\/g,"")+" ";if(ad){return Z}for(var aa=0,ab;(ab=X[aa])!=null;aa++){if(ab){if(ac^(ab.className&&(" "+ab.className+" ").indexOf(Z)>=0)){if(!Y){W.push(ab)}}else{if(Y){X[aa]=false}}}}return false},ID:function(W){return W[1].replace(/\\/g,"")},TAG:function(X,W){for(var Y=0;W[Y]===false;Y++){}return W[Y]&&T(W[Y])?X[1]:X[1].toUpperCase()},CHILD:function(W){if(W[1]=="nth"){var X=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(W[2]=="even"&&"2n"||W[2]=="odd"&&"2n+1"||!/\D/.test(W[2])&&"0n+"+W[2]||W[2]);W[2]=(X[1]+(X[2]||1))-0;W[3]=X[3]-0}W[0]=O++;return W},ATTR:function(aa,X,Y,W,ab,ac){var Z=aa[1].replace(/\\/g,"");if(!ac&&L.attrMap[Z]){aa[1]=L.attrMap[Z]}if(aa[2]==="~="){aa[4]=" "+aa[4]+" "}return aa},PSEUDO:function(aa,X,Y,W,ab){if(aa[1]==="not"){if(aa[3].match(U).length>1||/^\w/.test(aa[3])){aa[3]=I(aa[3],null,null,X)}else{var Z=I.filter(aa[3],X,Y,true^ab);if(!Y){W.push.apply(W,Z)}return false}}else{if(L.match.POS.test(aa[0])||L.match.CHILD.test(aa[0])){return true}}return aa},POS:function(W){W.unshift(true);return W}},filters:{enabled:function(W){return W.disabled===false&&W.type!=="hidden"},disabled:function(W){return W.disabled===true},checked:function(W){return W.checked===true},selected:function(W){W.parentNode.selectedIndex;return W.selected===true},parent:function(W){return !!W.firstChild},empty:function(W){return !W.firstChild},has:function(Y,X,W){return !!I(W[3],Y).length},header:function(W){return/h\d/i.test(W.nodeName)},text:function(W){return"text"===W.type},radio:function(W){return"radio"===W.type},checkbox:function(W){return"checkbox"===W.type},file:function(W){return"file"===W.type},password:function(W){return"password"===W.type},submit:function(W){return"submit"===W.type},image:function(W){return"image"===W.type},reset:function(W){return"reset"===W.type},button:function(W){return"button"===W.type||W.nodeName.toUpperCase()==="BUTTON"},input:function(W){return/input|select|textarea|button/i.test(W.nodeName)}},setFilters:{first:function(X,W){return W===0},last:function(Y,X,W,Z){return X===Z.length-1},even:function(X,W){return W%2===0},odd:function(X,W){return W%2===1},lt:function(Y,X,W){return X<W[3]-0},gt:function(Y,X,W){return X>W[3]-0},nth:function(Y,X,W){return W[3]-0==X},eq:function(Y,X,W){return W[3]-0==X}},filter:{PSEUDO:function(ac,Y,Z,ad){var X=Y[1],aa=L.filters[X];if(aa){return aa(ac,Z,Y,ad)}else{if(X==="contains"){return(ac.textContent||ac.innerText||"").indexOf(Y[3])>=0}else{if(X==="not"){var ab=Y[3];for(var Z=0,W=ab.length;Z<W;Z++){if(ab[Z]===ac){return false}}return true}}}},CHILD:function(W,Z){var ac=Z[1],X=W;switch(ac){case"only":case"first":while(X=X.previousSibling){if(X.nodeType===1){return false}}if(ac=="first"){return true}X=W;case"last":while(X=X.nextSibling){if(X.nodeType===1){return false}}return true;case"nth":var Y=Z[2],af=Z[3];if(Y==1&&af==0){return true}var ab=Z[0],ae=W.parentNode;if(ae&&(ae.sizcache!==ab||!W.nodeIndex)){var aa=0;for(X=ae.firstChild;X;X=X.nextSibling){if(X.nodeType===1){X.nodeIndex=++aa}}ae.sizcache=ab}var ad=W.nodeIndex-af;if(Y==0){return ad==0}else{return(ad%Y==0&&ad/Y>=0)}}},ID:function(X,W){return X.nodeType===1&&X.getAttribute("id")===W},TAG:function(X,W){return(W==="*"&&X.nodeType===1)||X.nodeName===W},CLASS:function(X,W){return(" "+(X.className||X.getAttribute("class"))+" ").indexOf(W)>-1},ATTR:function(ab,Z){var Y=Z[1],W=L.attrHandle[Y]?L.attrHandle[Y](ab):ab[Y]!=null?ab[Y]:ab.getAttribute(Y),ac=W+"",aa=Z[2],X=Z[4];return W==null?aa==="!=":aa==="="?ac===X:aa==="*="?ac.indexOf(X)>=0:aa==="~="?(" "+ac+" ").indexOf(X)>=0:!X?ac&&W!==false:aa==="!="?ac!=X:aa==="^="?ac.indexOf(X)===0:aa==="$="?ac.substr(ac.length-X.length)===X:aa==="|="?ac===X||ac.substr(0,X.length+1)===X+"-":false},POS:function(aa,X,Y,ab){var W=X[2],Z=L.setFilters[W];if(Z){return Z(aa,Y,X,ab)}}}};var P=L.match.POS;for(var R in L.match){L.match[R]=RegExp(L.match[R].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var H=function(X,W){X=Array.prototype.slice.call(X);if(W){W.push.apply(W,X);return W}return X};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(Q){H=function(aa,Z){var X=Z||[];if(K.call(aa)==="[object Array]"){Array.prototype.push.apply(X,aa)}else{if(typeof aa.length==="number"){for(var Y=0,W=aa.length;Y<W;Y++){X.push(aa[Y])}}else{for(var Y=0;aa[Y];Y++){X.push(aa[Y])}}}return X}}var J;if(document.documentElement.compareDocumentPosition){J=function(X,W){var Y=X.compareDocumentPosition(W)&4?-1:X===W?0:1;if(Y===0){hasDuplicate=true}return Y}}else{if("sourceIndex" in document.documentElement){J=function(X,W){var Y=X.sourceIndex-W.sourceIndex;if(Y===0){hasDuplicate=true}return Y}}else{if(document.createRange){J=function(Z,X){var Y=Z.ownerDocument.createRange(),W=X.ownerDocument.createRange();Y.selectNode(Z);Y.collapse(true);W.selectNode(X);W.collapse(true);var aa=Y.compareBoundaryPoints(Range.START_TO_END,W);if(aa===0){hasDuplicate=true}return aa}}}}(function(){var X=document.createElement("form"),Y="script"+(new Date).getTime();X.innerHTML="<input name='"+Y+"'/>";var W=document.documentElement;W.insertBefore(X,W.firstChild);if(!!document.getElementById(Y)){L.find.ID=function(aa,ab,ac){if(typeof ab.getElementById!=="undefined"&&!ac){var Z=ab.getElementById(aa[1]);return Z?Z.id===aa[1]||typeof Z.getAttributeNode!=="undefined"&&Z.getAttributeNode("id").nodeValue===aa[1]?[Z]:h:[]}};L.filter.ID=function(ab,Z){var aa=typeof ab.getAttributeNode!=="undefined"&&ab.getAttributeNode("id");return ab.nodeType===1&&aa&&aa.nodeValue===Z}}W.removeChild(X)})();(function(){var W=document.createElement("div");W.appendChild(document.createComment(""));if(W.getElementsByTagName("*").length>0){L.find.TAG=function(X,ab){var aa=ab.getElementsByTagName(X[1]);if(X[1]==="*"){var Z=[];for(var Y=0;aa[Y];Y++){if(aa[Y].nodeType===1){Z.push(aa[Y])}}aa=Z}return aa}}W.innerHTML="<a href='#'></a>";if(W.firstChild&&typeof W.firstChild.getAttribute!=="undefined"&&W.firstChild.getAttribute("href")!=="#"){L.attrHandle.href=function(X){return X.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var W=I,X=document.createElement("div");X.innerHTML="<p class='TEST'></p>";if(X.querySelectorAll&&X.querySelectorAll(".TEST").length===0){return}I=function(ab,aa,Y,Z){aa=aa||document;if(!Z&&aa.nodeType===9&&!T(aa)){try{return H(aa.querySelectorAll(ab),Y)}catch(ac){}}return W(ab,aa,Y,Z)};I.find=W.find;I.filter=W.filter;I.selectors=W.selectors;I.matches=W.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var W=document.createElement("div");W.innerHTML="<div class='test e'></div><div class='test'></div>";if(W.getElementsByClassName("e").length===0){return}W.lastChild.className="e";if(W.getElementsByClassName("e").length===1){return}L.order.splice(1,0,"CLASS");L.find.CLASS=function(X,Y,Z){if(typeof Y.getElementsByClassName!=="undefined"&&!Z){return Y.getElementsByClassName(X[1])}}})()}function S(X,ac,ab,ag,ad,af){var ae=X=="previousSibling"&&!af;for(var Z=0,Y=ag.length;Z<Y;Z++){var W=ag[Z];if(W){if(ae&&W.nodeType===1){W.sizcache=ab;W.sizset=Z}W=W[X];var aa=false;while(W){if(W.sizcache===ab){aa=ag[W.sizset];break}if(W.nodeType===1&&!af){W.sizcache=ab;W.sizset=Z}if(W.nodeName===ac){aa=W;break}W=W[X]}ag[Z]=aa}}}function V(X,ac,ab,ag,ad,af){var ae=X=="previousSibling"&&!af;for(var Z=0,Y=ag.length;Z<Y;Z++){var W=ag[Z];if(W){if(ae&&W.nodeType===1){W.sizcache=ab;W.sizset=Z}W=W[X];var aa=false;while(W){if(W.sizcache===ab){aa=ag[W.sizset];break}if(W.nodeType===1){if(!af){W.sizcache=ab;W.sizset=Z}if(typeof ac!=="string"){if(W===ac){aa=true;break}}else{if(I.filter(ac,[W]).length>0){aa=W;break}}}W=W[X]}ag[Z]=aa}}}var N=document.compareDocumentPosition?function(X,W){return X.compareDocumentPosition(W)&16}:function(X,W){return X!==W&&(X.contains?X.contains(W):true)};var T=function(W){return W.nodeType===9&&W.documentElement.nodeName!=="HTML"||!!W.ownerDocument&&T(W.ownerDocument)};var M=function(W,ad){var Z=[],aa="",ab,Y=ad.nodeType?[ad]:ad;while((ab=L.match.PSEUDO.exec(W))){aa+=ab[0];W=W.replace(L.match.PSEUDO,"")}W=L.relative[W]?W+"*":W;for(var ac=0,X=Y.length;ac<X;ac++){I(W,Y[ac],Z)}return I.filter(aa,Z)};r.find=I;r.filter=I.filter;r.expr=I.selectors;r.expr[":"]=r.expr.filters;I.selectors.filters.hidden=function(W){return W.offsetWidth===0||W.offsetHeight===0};I.selectors.filters.visible=function(W){return W.offsetWidth>0||W.offsetHeight>0};I.selectors.filters.animated=function(W){return r.grep(r.timers,function(X){return W===X.elem}).length};r.multiFilter=function(Y,W,X){if(X){Y=":not("+Y+")"}return I.matches(Y,W)};r.dir=function(Y,X){var W=[],Z=Y[X];while(Z&&Z!=document){if(Z.nodeType==1){W.push(Z)}Z=Z[X]}return W};r.nth=function(aa,W,Y,Z){W=W||1;var X=0;for(;aa;aa=aa[Y]){if(aa.nodeType==1&&++X==W){break}}return aa};r.sibling=function(Y,X){var W=[];for(;Y;Y=Y.nextSibling){if(Y.nodeType==1&&Y!=X){W.push(Y)}}return W};return;o.Sizzle=I})();r.event={add:function(L,I,K,N){if(L.nodeType==3||L.nodeType==8){return}if(L.setInterval&&L!=o){L=o}if(!K.guid){K.guid=this.guid++}if(N!==h){var J=K;K=this.proxy(J);K.data=N}var H=r.data(L,"events")||r.data(L,"events",{}),M=r.data(L,"handle")||r.data(L,"handle",function(){return typeof r!=="undefined"&&!r.event.triggered?r.event.handle.apply(arguments.callee.elem,arguments):h});M.elem=L;r.each(I.split(/\s+/),function(P,Q){var R=Q.split(".");Q=R.shift();K.type=R.slice().sort().join(".");var O=H[Q];if(r.event.specialAll[Q]){r.event.specialAll[Q].setup.call(L,N,R)}if(!O){O=H[Q]={};if(!r.event.special[Q]||r.event.special[Q].setup.call(L,N,R)===false){if(L.addEventListener){L.addEventListener(Q,M,false)}else{if(L.attachEvent){L.attachEvent("on"+Q,M)}}}}O[K.guid]=K;r.event.global[Q]=true});L=null},guid:1,global:{},remove:function(N,K,M){if(N.nodeType==3||N.nodeType==8){return}var J=r.data(N,"events"),I,H;if(J){if(K===h||(typeof K==="string"&&K.charAt(0)==".")){for(var L in J){this.remove(N,L+(K||""))}}else{if(K.type){M=K.handler;K=K.type}r.each(K.split(/\s+/),function(P,R){var T=R.split(".");R=T.shift();var Q=RegExp("(^|\\.)"+T.slice().sort().join(".*\\.")+"(\\.|$)");if(J[R]){if(M){delete J[R][M.guid]}else{for(var S in J[R]){if(Q.test(J[R][S].type)){delete J[R][S]}}}if(r.event.specialAll[R]){r.event.specialAll[R].teardown.call(N,T)}for(I in J[R]){break}if(!I){if(!r.event.special[R]||r.event.special[R].teardown.call(N,T)===false){if(N.removeEventListener){N.removeEventListener(R,r.data(N,"handle"),false)}else{if(N.detachEvent){N.detachEvent("on"+R,r.data(N,"handle"))}}}I=null;delete J[R]}}})}for(I in J){break}if(!I){var O=r.data(N,"handle");if(O){O.elem=null}r.removeData(N,"events");r.removeData(N,"handle")}}},trigger:function(L,N,K,H){var J=L.type||L;if(!H){L=typeof L==="object"?L[k]?L:r.extend(r.Event(J),L):r.Event(J);if(J.indexOf("!")>=0){L.type=J=J.slice(0,-1);L.exclusive=true}if(!K){L.stopPropagation();if(this.global[J]){r.each(r.cache,function(){if(this.events&&this.events[J]){r.event.trigger(L,N,this.handle.elem)}})}}if(!K||K.nodeType==3||K.nodeType==8){return h}L.result=h;L.target=K;N=r.makeArray(N);N.unshift(L)}L.currentTarget=K;var M=r.data(K,"handle");if(M){M.apply(K,N)}if((!K[J]||(r.nodeName(K,"a")&&J=="click"))&&K["on"+J]&&K["on"+J].apply(K,N)===false){L.result=false}if(!H&&K[J]&&!L.isDefaultPrevented()&&!(r.nodeName(K,"a")&&J=="click")){this.triggered=true;try{K[J]()}catch(O){}}this.triggered=false;if(!L.isPropagationStopped()){var I=K.parentNode||K.ownerDocument;if(I){r.event.trigger(L,N,I,true)}}},handle:function(N){var M,H;N=arguments[0]=r.event.fix(N||o.event);N.currentTarget=this;var O=N.type.split(".");N.type=O.shift();M=!O.length&&!N.exclusive;var L=RegExp("(^|\\.)"+O.slice().sort().join(".*\\.")+"(\\.|$)");H=(r.data(this,"events")||{})[N.type];for(var J in H){var K=H[J];if(M||L.test(K.type)){N.handler=K;N.data=K.data;var I=K.apply(this,arguments);if(I!==h){N.result=I;if(I===false){N.preventDefault();N.stopPropagation()}}if(N.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(K){if(K[k]){return K}var I=K;K=r.Event(I);for(var J=this.props.length,M;J;){M=this.props[--J];K[M]=I[M]}if(!K.target){K.target=K.srcElement||document}if(K.target.nodeType==3){K.target=K.target.parentNode}if(!K.relatedTarget&&K.fromElement){K.relatedTarget=K.fromElement==K.target?K.toElement:K.fromElement}if(K.pageX==null&&K.clientX!=null){var L=document.documentElement,H=document.body;K.pageX=K.clientX+(L&&L.scrollLeft||H&&H.scrollLeft||0)-(L.clientLeft||0);K.pageY=K.clientY+(L&&L.scrollTop||H&&H.scrollTop||0)-(L.clientTop||0)}if(!K.which&&((K.charCode||K.charCode===0)?K.charCode:K.keyCode)){K.which=K.charCode||K.keyCode}if(!K.metaKey&&K.ctrlKey){K.metaKey=K.ctrlKey}if(!K.which&&K.button){K.which=(K.button&1?1:(K.button&2?3:(K.button&4?2:0)))}return K},proxy:function(I,H){H=H||function(){return I.apply(this,arguments)};H.guid=I.guid=I.guid||H.guid||this.guid++;return H},special:{ready:{setup:E,teardown:function(){}}},specialAll:{live:{setup:function(H,I){r.event.add(this,I[0],c)},teardown:function(J){if(J.length){var H=0,I=RegExp("(^|\\.)"+J[0]+"(\\.|$)");r.each((r.data(this,"events").live||{}),function(){if(I.test(this.type)){H++}});if(H<1){r.event.remove(this,J[0],c)}}}}}};r.Event=function(H){if(!this.preventDefault){return new r.Event(H)}if(H&&H.type){this.originalEvent=H;this.type=H.type}else{this.type=H}this.timeStamp=f();this[k]=true};function n(){return false}function x(){return true}r.Event.prototype={preventDefault:function(){this.isDefaultPrevented=x;var H=this.originalEvent;if(!H){return}if(H.preventDefault){H.preventDefault()}H.returnValue=false},stopPropagation:function(){this.isPropagationStopped=x;var H=this.originalEvent;if(!H){return}if(H.stopPropagation){H.stopPropagation()}H.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=x;this.stopPropagation()},isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n};var a=function(I){var H=I.relatedTarget;while(H&&H!=this){try{H=H.parentNode}catch(J){H=this}}if(H!=this){I.type=I.data;r.event.handle.apply(this,arguments)}};r.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(I,H){r.event.special[H]={setup:function(){r.event.add(this,I,a,H)},teardown:function(){r.event.remove(this,I,a)}}});r.fn.extend({bind:function(I,J,H){return I=="unload"?this.one(I,J,H):this.each(function(){r.event.add(this,I,H||J,H&&J)})},one:function(J,K,I){var H=r.event.proxy(I||K,function(L){r(this).unbind(L,H);return(I||K).apply(this,arguments)});return this.each(function(){r.event.add(this,J,H,I&&K)})},unbind:function(I,H){return this.each(function(){r.event.remove(this,I,H)})},trigger:function(H,I){return this.each(function(){r.event.trigger(H,I,this)})},triggerHandler:function(H,J){if(this[0]){var I=r.Event(H);I.preventDefault();I.stopPropagation();r.event.trigger(I,J,this[0]);return I.result}},toggle:function(J){var H=arguments,I=1;while(I<H.length){r.event.proxy(J,H[I++])}return this.click(r.event.proxy(J,function(K){this.lastToggle=(this.lastToggle||0)%I;K.preventDefault();return H[this.lastToggle++].apply(this,arguments)||false}))},hover:function(H,I){return this.mouseenter(H).mouseleave(I)},ready:function(H){E();if(r.isReady){H.call(document,r)}else{r.readyList.push(H)}return this},live:function(J,I){var H=r.event.proxy(I);H.guid+=this.selector+J;r(document).bind(l(J,this.selector),this.selector,H);return this},die:function(I,H){r(document).unbind(l(I,this.selector),H?{guid:H.guid+this.selector+I}:null);return this}});function c(K){var H=RegExp("(^|\\.)"+K.type+"(\\.|$)"),J=true,I=[];r.each(r.data(this,"events").live||[],function(L,M){if(H.test(M.type)){var N=r(K.target).closest(M.data)[0];if(N){I.push({elem:N,fn:M})}}});I.sort(function(M,L){return r.data(M.elem,"closest")-r.data(L.elem,"closest")});r.each(I,function(){if(this.fn.call(this.elem,K,this.fn.data)===false){return(J=false)}});return J}function l(I,H){return["live",I,H.replace(/\./g,"`").replace(/ /g,"|")].join(".")}r.extend({isReady:false,readyList:[],ready:function(){if(!r.isReady){r.isReady=true;if(r.readyList){r.each(r.readyList,function(){this.call(document,r)});r.readyList=null}r(document).triggerHandler("ready")}}});var A=false;function E(){if(A){return}A=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);r.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);r.ready()}});if(document.documentElement.doScroll&&o==o.top){(function(){if(r.isReady){return}try{document.documentElement.doScroll("left")}catch(H){setTimeout(arguments.callee,0);return}r.ready()})()}}}r.event.add(o,"load",r.ready)}r.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(I,H){r.fn[H]=function(J){return J?this.bind(H,J):this.trigger(H)}});r(o).bind("unload",function(){for(var H in r.cache){if(H!=1&&r.cache[H].handle){r.event.remove(r.cache[H].handle.elem)}}});(function(){r.support={};var I=document.documentElement,J=document.createElement("script"),N=document.createElement("div"),M="script"+(new Date).getTime();N.style.display="none";N.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var K=N.getElementsByTagName("*"),H=N.getElementsByTagName("a")[0];if(!K||!K.length||!H){return}r.support={leadingWhitespace:N.firstChild.nodeType==3,tbody:!N.getElementsByTagName("tbody").length,objectAll:!!N.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!N.getElementsByTagName("link").length,style:/red/.test(H.getAttribute("style")),hrefNormalized:H.getAttribute("href")==="/a",opacity:H.style.opacity==="0.5",cssFloat:!!H.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};J.type="text/javascript";try{J.appendChild(document.createTextNode("window."+M+"=1;"))}catch(L){}I.insertBefore(J,I.firstChild);if(o[M]){r.support.scriptEval=true;delete o[M]}I.removeChild(J);if(N.attachEvent&&N.fireEvent){N.attachEvent("onclick",function(){r.support.noCloneEvent=false;N.detachEvent("onclick",arguments.callee)});N.cloneNode(true).fireEvent("onclick")}r(function(){var O=document.createElement("div");O.style.width=O.style.paddingLeft="1px";document.body.appendChild(O);r.boxModel=r.support.boxModel=O.offsetWidth===2;document.body.removeChild(O).style.display="none"})})();var z=r.support.cssFloat?"cssFloat":"styleFloat";r.props={"for":"htmlFor","class":"className","float":z,cssFloat:z,styleFloat:z,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};r.fn.extend({_load:r.fn.load,load:function(J,M,N){if(typeof J!=="string"){return this._load(J)}var L=J.indexOf(" ");if(L>=0){var H=J.slice(L,J.length);J=J.slice(0,L)}var K="GET";if(M){if(r.isFunction(M)){N=M;M=null}else{if(typeof M==="object"){M=r.param(M);K="POST"}}}var I=this;r.ajax({url:J,type:K,dataType:"html",data:M,complete:function(P,O){if(O=="success"||O=="notmodified"){I.html(H?r("<div/>").append(P.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(H):P.responseText)}if(N){I.each(N,[P.responseText,O,P])}}});return this},serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?r.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(H,I){var J=r(this).val();return J==null?null:r.isArray(J)?r.map(J,function(L,K){return{name:I.name,value:L}}):{name:I.name,value:J}}).get()}});r.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(H,I){r.fn[I]=function(J){return this.bind(I,J)}});var u=f();r.extend({get:function(H,J,K,I){if(r.isFunction(J)){K=J;J=null}return r.ajax({type:"GET",url:H,data:J,success:K,dataType:I})},getScript:function(H,I){return r.get(H,null,I,"script")},getJSON:function(H,I,J){return r.get(H,I,J,"json")},post:function(H,J,K,I){if(r.isFunction(J)){K=J;J={}}return r.ajax({type:"POST",url:H,data:J,success:K,dataType:I})},ajaxSetup:function(H){r.extend(r.ajaxSettings,H)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return o.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(P){P=r.extend(true,P,r.extend(true,{},r.ajaxSettings,P));var Z,I=/=\?(&|$)/g,U,Y,J=P.type.toUpperCase();if(P.data&&P.processData&&typeof P.data!=="string"){P.data=r.param(P.data)}if(P.dataType=="jsonp"){if(J=="GET"){if(!P.url.match(I)){P.url+=(P.url.match(/\?/)?"&":"?")+(P.jsonp||"callback")+"=?"}}else{if(!P.data||!P.data.match(I)){P.data=(P.data?P.data+"&":"")+(P.jsonp||"callback")+"=?"}}P.dataType="json"}if(P.dataType=="json"&&(P.data&&P.data.match(I)||P.url.match(I))){Z="jsonp"+u++;if(P.data){P.data=(P.data+"").replace(I,"="+Z+"$1")}P.url=P.url.replace(I,"="+Z+"$1");P.dataType="script";o[Z]=function(aa){Y=aa;L();O();o[Z]=h;try{delete o[Z]}catch(ab){}if(K){K.removeChild(W)}}}if(P.dataType=="script"&&P.cache==null){P.cache=false}if(P.cache===false&&J=="GET"){var H=f();var X=P.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+H+"$2");P.url=X+((X==P.url)?(P.url.match(/\?/)?"&":"?")+"_="+H:"")}if(P.data&&J=="GET"){P.url+=(P.url.match(/\?/)?"&":"?")+P.data;P.data=null}if(P.global&&!r.active++){r.event.trigger("ajaxStart")}var T=/^(\w+:)?\/\/([^\/?#]+)/.exec(P.url);if(P.dataType=="script"&&J=="GET"&&T&&(T[1]&&T[1]!=location.protocol||T[2]!=location.host)){var K=document.getElementsByTagName("head")[0];var W=document.createElement("script");W.src=P.url;if(P.scriptCharset){W.charset=P.scriptCharset}if(!Z){var R=false;W.onload=W.onreadystatechange=function(){if(!R&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){R=true;L();O();W.onload=W.onreadystatechange=null;K.removeChild(W)}}}K.appendChild(W);return h}var N=false;var M=P.xhr();if(P.username){M.open(J,P.url,P.async,P.username,P.password)}else{M.open(J,P.url,P.async)}try{if(P.data){M.setRequestHeader("Content-Type",P.contentType)}if(P.ifModified){M.setRequestHeader("If-Modified-Since",r.lastModified[P.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}M.setRequestHeader("X-Requested-With","XMLHttpRequest");M.setRequestHeader("Accept",P.dataType&&P.accepts[P.dataType]?P.accepts[P.dataType]+", */*":P.accepts._default)}catch(V){}if(P.beforeSend&&P.beforeSend(M,P)===false){if(P.global&&!--r.active){r.event.trigger("ajaxStop")}M.abort();return false}if(P.global){r.event.trigger("ajaxSend",[M,P])}var Q=function(aa){if(M.readyState==0){if(S){clearInterval(S);S=null;if(P.global&&!--r.active){r.event.trigger("ajaxStop")}}}else{if(!N&&M&&(M.readyState==4||aa=="timeout")){N=true;if(S){clearInterval(S);S=null}U=aa=="timeout"?"timeout":!r.httpSuccess(M)?"error":P.ifModified&&r.httpNotModified(M,P.url)?"notmodified":"success";if(U=="success"){try{Y=r.httpData(M,P.dataType,P)}catch(ac){U="parsererror"}}if(U=="success"){var ab;try{ab=M.getResponseHeader("Last-Modified")}catch(ac){}if(P.ifModified&&ab){r.lastModified[P.url]=ab}if(!Z){L()}}else{r.handleError(P,M,U)}O();if(aa){M.abort()}if(P.async){M=null}}}};if(P.async){var S=setInterval(Q,13);if(P.timeout>0){setTimeout(function(){if(M&&!N){Q("timeout")}},P.timeout)}}try{M.send(P.data)}catch(V){r.handleError(P,M,null,V)}if(!P.async){Q()}function L(){if(P.success){P.success(Y,U)}if(P.global){r.event.trigger("ajaxSuccess",[M,P])}}function O(){if(P.complete){P.complete(M,U)}if(P.global){r.event.trigger("ajaxComplete",[M,P])}if(P.global&&!--r.active){r.event.trigger("ajaxStop")}}return M},handleError:function(I,K,H,J){if(I.error){I.error(K,H,J)}if(I.global){r.event.trigger("ajaxError",[K,I,J])}},active:0,httpSuccess:function(I){try{return !I.status&&location.protocol=="file:"||(I.status>=200&&I.status<300)||I.status==304||I.status==1223}catch(H){}return false},httpNotModified:function(J,H){try{var K=J.getResponseHeader("Last-Modified");return J.status==304||K==r.lastModified[H]}catch(I){}return false},httpData:function(M,K,J){var I=M.getResponseHeader("content-type"),H=K=="xml"||!K&&I&&I.indexOf("xml")>=0,L=H?M.responseXML:M.responseText;if(H&&L.documentElement.tagName=="parsererror"){throw"parsererror"}if(J&&J.dataFilter){L=J.dataFilter(L,K)}if(typeof L==="string"){if(K=="script"){r.globalEval(L)}if(K=="json"){L=o["eval"]("("+L+")")}}return L},param:function(H){var J=[];function K(L,M){J[J.length]=encodeURIComponent(L)+"="+encodeURIComponent(M)}if(r.isArray(H)||H.jquery){r.each(H,function(){K(this.name,this.value)})}else{for(var I in H){if(r.isArray(H[I])){r.each(H[I],function(){K(I,this)})}else{K(I,r.isFunction(H[I])?H[I]():H[I])}}}return J.join("&").replace(/%20/g,"+")}});var p={},q,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function w(I,H){var J={};r.each(d.concat.apply([],d.slice(0,H)),function(){J[this]=I});return J}r.fn.extend({show:function(M,O){if(M){return this.animate(w("show",3),M,O)}else{for(var K=0,I=this.length;K<I;K++){var H=r.data(this[K],"olddisplay");this[K].style.display=H||"";if(r.css(this[K],"display")==="none"){var J=this[K].tagName,N;if(p[J]){N=p[J]}else{var L=r("<"+J+" />").appendTo("body");N=L.css("display");if(N==="none"){N="block"}L.remove();p[J]=N}r.data(this[K],"olddisplay",N)}}for(var K=0,I=this.length;K<I;K++){this[K].style.display=r.data(this[K],"olddisplay")||""}return this}},hide:function(K,L){if(K){return this.animate(w("hide",3),K,L)}else{for(var J=0,I=this.length;J<I;J++){var H=r.data(this[J],"olddisplay");if(!H&&H!=="none"){r.data(this[J],"olddisplay",r.css(this[J],"display"))}}for(var J=0,I=this.length;J<I;J++){this[J].style.display="none"}return this}},_toggle:r.fn.toggle,toggle:function(J,I){var H=typeof J==="boolean";return r.isFunction(J)&&r.isFunction(I)?this._toggle.apply(this,arguments):J==null||H?this.each(function(){var K=H?J:r(this).is(":hidden");r(this)[K?"show":"hide"]()}):this.animate(w("toggle",3),J,I)},fadeTo:function(H,J,I){return this.animate({opacity:J},H,I)},animate:function(L,I,K,J){var H=r.speed(I,K,J);return this[H.queue===false?"each":"queue"](function(){var N=r.extend({},H),P,O=this.nodeType==1&&r(this).is(":hidden"),M=this;for(P in L){if(L[P]=="hide"&&O||L[P]=="show"&&!O){return N.complete.call(this)}if((P=="height"||P=="width")&&this.style){N.display=r.css(this,"display");N.overflow=this.style.overflow}}if(N.overflow!=null){this.style.overflow="hidden"}N.curAnim=r.extend({},L);r.each(L,function(R,V){var U=new r.fx(M,N,R);if(/toggle|show|hide/.test(V)){U[V=="toggle"?O?"show":"hide":V](L)}else{var T=V.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),W=U.cur(true)||0;if(T){var Q=parseFloat(T[2]),S=T[3]||"px";if(S!="px"){M.style[R]=(Q||1)+S;W=((Q||1)/U.cur(true))*W;M.style[R]=W+S}if(T[1]){Q=((T[1]=="-="?-1:1)*Q)+W}U.custom(W,Q,S)}else{U.custom(W,V,"")}}});return true})},stop:function(I,H){var J=r.timers;if(I){this.queue([])}this.each(function(){for(var K=J.length-1;K>=0;K--){if(J[K].elem==this){if(H){J[K](true)}J.splice(K,1)}}});if(!H){this.dequeue()}return this}});r.each({slideDown:w("show",1),slideUp:w("hide",1),slideToggle:w("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(H,I){r.fn[H]=function(J,K){return this.animate(I,J,K)}});r.extend({speed:function(J,K,I){var H=typeof J==="object"?J:{complete:I||!I&&K||r.isFunction(J)&&J,duration:J,easing:I&&K||K&&!r.isFunction(K)&&K};H.duration=r.fx.off?0:typeof H.duration==="number"?H.duration:r.fx.speeds[H.duration]||r.fx.speeds._default;H.old=H.complete;H.complete=function(){if(H.queue!==false){r(this).dequeue()}if(r.isFunction(H.old)){H.old.call(this)}};return H},easing:{linear:function(J,K,H,I){return H+I*J},swing:function(J,K,H,I){return((-Math.cos(J*Math.PI)/2)+0.5)*I+H}},timers:[],fx:function(I,H,J){this.options=H;this.elem=I;this.prop=J;if(!H.orig){H.orig={}}}});r.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(r.fx.step[this.prop]||r.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(I){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var H=parseFloat(r.css(this.elem,this.prop,I));return H&&H>-10000?H:parseFloat(r.curCSS(this.elem,this.prop))||0},custom:function(L,K,J){this.startTime=f();this.start=L;this.end=K;this.unit=J||this.unit||"px";this.now=this.start;this.pos=this.state=0;var H=this;function I(M){return H.step(M)}I.elem=this.elem;if(I()&&r.timers.push(I)&&!q){q=setInterval(function(){var N=r.timers;for(var M=0;M<N.length;M++){if(!N[M]()){N.splice(M--,1)}}if(!N.length){clearInterval(q);q=h}},13)}},show:function(){this.options.orig[this.prop]=r.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());r(this.elem).show()},hide:function(){this.options.orig[this.prop]=r.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(K){var J=f();if(K||J>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var H=true;for(var I in this.options.curAnim){if(this.options.curAnim[I]!==true){H=false}}if(H){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(r.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){r(this.elem).hide()}if(this.options.hide||this.options.show){for(var L in this.options.curAnim){r.attr(this.elem.style,L,this.options.orig[L])}}this.options.complete.call(this.elem)}return false}else{var M=J-this.startTime;this.state=M/this.options.duration;this.pos=r.easing[this.options.easing||(r.easing.swing?"swing":"linear")](this.state,M,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};r.extend(r.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(H){r.attr(H.elem.style,"opacity",H.now)},_default:function(H){if(H.elem.style&&H.elem.style[H.prop]!=null){H.elem.style[H.prop]=H.now+H.unit}else{H.elem[H.prop]=H.now}}}});if(document.documentElement.getBoundingClientRect){r.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return r.offset.bodyOffset(this[0])}var J=this[0].getBoundingClientRect(),M=this[0].ownerDocument,I=M.body,H=M.documentElement,O=H.clientTop||I.clientTop||0,N=H.clientLeft||I.clientLeft||0,L=J.top+(self.pageYOffset||r.boxModel&&H.scrollTop||I.scrollTop)-O,K=J.left+(self.pageXOffset||r.boxModel&&H.scrollLeft||I.scrollLeft)-N;return{top:L,left:K}}}else{r.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return r.offset.bodyOffset(this[0])}r.offset.initialized||r.offset.initialize();var M=this[0],J=M.offsetParent,I=M,R=M.ownerDocument,P,K=R.documentElement,N=R.body,O=R.defaultView,H=O.getComputedStyle(M,null),Q=M.offsetTop,L=M.offsetLeft;while((M=M.parentNode)&&M!==N&&M!==K){P=O.getComputedStyle(M,null);Q-=M.scrollTop,L-=M.scrollLeft;if(M===J){Q+=M.offsetTop,L+=M.offsetLeft;if(r.offset.doesNotAddBorder&&!(r.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(M.tagName))){Q+=parseInt(P.borderTopWidth,10)||0,L+=parseInt(P.borderLeftWidth,10)||0}I=J,J=M.offsetParent}if(r.offset.subtractsBorderForOverflowNotVisible&&P.overflow!=="visible"){Q+=parseInt(P.borderTopWidth,10)||0,L+=parseInt(P.borderLeftWidth,10)||0}H=P}if(H.position==="relative"||H.position==="static"){Q+=N.offsetTop,L+=N.offsetLeft}if(H.position==="fixed"){Q+=Math.max(K.scrollTop,N.scrollTop),L+=Math.max(K.scrollLeft,N.scrollLeft)}return{top:Q,left:L}}}r.offset={initialize:function(){if(this.initialized){return}var O=document.body,I=document.createElement("div"),K,J,Q,L,P,H,M=O.style.marginTop,N='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';P={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(H in P){I.style[H]=P[H]}I.innerHTML=N;O.insertBefore(I,O.firstChild);K=I.firstChild,J=K.firstChild,L=K.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(J.offsetTop!==5);this.doesAddBorderForTableAndCells=(L.offsetTop===5);K.style.overflow="hidden",K.style.position="relative";this.subtractsBorderForOverflowNotVisible=(J.offsetTop===-5);O.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(O.offsetTop===0);O.style.marginTop=M;O.removeChild(I);this.initialized=true},bodyOffset:function(H){r.offset.initialized||r.offset.initialize();var J=H.offsetTop,I=H.offsetLeft;if(r.offset.doesNotIncludeMarginInBodyOffset){J+=parseInt(r.curCSS(H,"marginTop",true),10)||0,I+=parseInt(r.curCSS(H,"marginLeft",true),10)||0}return{top:J,left:I}}};r.fn.extend({position:function(){var L=0,K=0,I;if(this[0]){var J=this.offsetParent(),M=this.offset(),H=/^body|html$/i.test(J[0].tagName)?{top:0,left:0}:J.offset();M.top-=m(this,"marginTop");M.left-=m(this,"marginLeft");H.top+=m(J,"borderTopWidth");H.left+=m(J,"borderLeftWidth");I={top:M.top-H.top,left:M.left-H.left}}return I},offsetParent:function(){var H=this[0].offsetParent||document.body;while(H&&(!/^body|html$/i.test(H.tagName)&&r.css(H,"position")=="static")){H=H.offsetParent}return r(H)}});r.each(["Left","Top"],function(I,H){var J="scroll"+H;r.fn[J]=function(K){if(!this[0]){return null}return K!==h?this.each(function(){this==o||this==document?o.scrollTo(!I?K:r(o).scrollLeft(),I?K:r(o).scrollTop()):this[J]=K}):this[0]==o||this[0]==document?self[I?"pageYOffset":"pageXOffset"]||r.boxModel&&document.documentElement[J]||document.body[J]:this[0][J]}});r.each(["Height","Width"],function(L,J){var H=L?"Left":"Top",K=L?"Right":"Bottom",I=J.toLowerCase();r.fn["inner"+J]=function(){return this[0]?r.css(this[0],I,false,"padding"):null};r.fn["outer"+J]=function(N){return this[0]?r.css(this[0],I,false,N?"margin":"border"):null};var M=J.toLowerCase();r.fn[M]=function(N){return this[0]==o?document.compatMode=="CSS1Compat"&&document.documentElement["client"+J]||document.body["client"+J]:this[0]==document?Math.max(document.documentElement["client"+J],document.body["scroll"+J],document.documentElement["scroll"+J],document.body["offset"+J],document.documentElement["offset"+J]):N===h?(this.length?r.css(this[0],M):null):this.css(M,typeof N==="string"?N:N+"px")}})})();jQuery.ui||(function(c){var l=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.1",plugin:{add:function(n,o,q){var p=c.ui[n].prototype;for(var m in q){p.plugins[m]=p.plugins[m]||[];p.plugins[m].push([o,q[m]])}},call:function(m,o,n){var q=m.plugins[o];if(!q||!m.element[0].parentNode){return}for(var p=0;p<q.length;p++){if(m.options[q[p][0]]){q[p][1].apply(m.element,n)}}}},contains:function(n,m){return document.compareDocumentPosition?n.compareDocumentPosition(m)&16:n!==m&&n.contains(m)},hasScroll:function(p,n){if(c(p).css("overflow")=="hidden"){return false}var m=(n&&n=="left")?"scrollLeft":"scrollTop",o=false;if(p[m]>0){return true}p[m]=1;o=(p[m]>0);p[m]=0;return o},isOverAxis:function(n,m,o){return(n>m)&&(n<(m+o))},isOver:function(r,n,q,p,m,o){return c.ui.isOverAxis(r,q,m)&&c.ui.isOverAxis(n,p,o)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var g=c.attr,f=c.fn.removeAttr,k="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(n,m,o){var p=o!==undefined;return(m=="role"?(p?g.call(this,n,m,"wairole:"+o):(g.apply(this,arguments)||"").replace(b,"")):(a.test(m)?(p?n.setAttributeNS(k,m.replace(a,"aaa:"),o):g.call(this,n,m.replace(a,"aaa:"))):g.apply(this,arguments)))};c.fn.removeAttr=function(m){return(a.test(m)?this.each(function(){this.removeAttributeNS(k,m.replace(a,""))}):f.call(this,m))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return l.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var m;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){m=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{m=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!m.length?c(document):m}});c.extend(c.expr[":"],{data:function(o,n,m){return !!c.data(o,m[3])},focusable:function(n){var o=n.nodeName.toLowerCase(),m=c.attr(n,"tabindex");return(/input|select|textarea|button|object/.test(o)?!n.disabled:"a"==o||"area"==o?n.href||!isNaN(m):!isNaN(m))&&!c(n)["area"==o?"parents":"closest"](":hidden").length},tabbable:function(n){var m=c.attr(n,"tabindex");return(isNaN(m)||m>=0)&&c(n).is(":focusable")}});function h(p,q,r,o){function n(t){var s=c[p][q][t]||[];return(typeof s=="string"?s.split(/,?\s+/):s)}var m=n("getter");if(o.length==1&&typeof o[0]=="string"){m=m.concat(n("getterSetter"))}return(c.inArray(r,m)!=-1)}c.widget=function(n,m){var o=n.split(".")[0];n=n.split(".")[1];c.fn[n]=function(s){var q=(typeof s=="string"),r=Array.prototype.slice.call(arguments,1);if(q&&s.substring(0,1)=="_"){return this}if(q&&h(o,n,s,r)){var p=c.data(this[0],n);return(p?p[s].apply(p,r):undefined)}return this.each(function(){var t=c.data(this,n);(!t&&!q&&c.data(this,n,new c[o][n](this,s))._init());(t&&q&&c.isFunction(t[s])&&t[s].apply(t,r))})};c[o]=c[o]||{};c[o][n]=function(r,q){var p=this;this.namespace=o;this.widgetName=n;this.widgetEventPrefix=c[o][n].eventPrefix||n;this.widgetBaseClass=o+"-"+n;this.options=c.extend({},c.widget.defaults,c[o][n].defaults,c.metadata&&c.metadata.get(r)[n],q);this.element=c(r).bind("setData."+n,function(t,s,u){if(t.target==r){return p._setData(s,u)}}).bind("getData."+n,function(t,s){if(t.target==r){return p._getData(s)}}).bind("remove",function(){return p.destroy()})};c[o][n].prototype=c.extend({},c.widget.prototype,m);c[o][n].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(o,p){var n=o,m=this;if(typeof o=="string"){if(p===undefined){return this._getData(o)}n={};n[o]=p}c.each(n,function(q,r){m._setData(q,r)})},_getData:function(m){return this.options[m]},_setData:function(m,n){this.options[m]=n;if(m=="disabled"){this.element[n?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",n)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(o,p,q){var s=this.options[o],m=(o==this.widgetEventPrefix?o:this.widgetEventPrefix+o);p=c.Event(p);p.type=m;if(p.originalEvent){for(var n=c.event.props.length,r;n;){r=c.event.props[--n];p[r]=p.originalEvent[r]}}this.element.trigger(p,q);return !(c.isFunction(s)&&s.call(this.element[0],p,q)===false||p.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var m=this;this.element.bind("mousedown."+this.widgetName,function(n){return m._mouseDown(n)}).bind("click."+this.widgetName,function(n){if(m._preventClickEvent){m._preventClickEvent=false;n.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(o){o.originalEvent=o.originalEvent||{};if(o.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(o));this._mouseDownEvent=o;var n=this,p=(o.which==1),m=(typeof this.options.cancel=="string"?c(o.target).parents().add(o.target).filter(this.options.cancel).length:false);if(!p||m||!this._mouseCapture(o)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(o)&&this._mouseDelayMet(o)){this._mouseStarted=(this._mouseStart(o)!==false);if(!this._mouseStarted){o.preventDefault();return true}}this._mouseMoveDelegate=function(q){return n._mouseMove(q)};this._mouseUpDelegate=function(q){return n._mouseUp(q)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||o.preventDefault());o.originalEvent.mouseHandled=true;return true},_mouseMove:function(m){if(c.browser.msie&&!m.button){return this._mouseUp(m)}if(this._mouseStarted){this._mouseDrag(m);return m.preventDefault()}if(this._mouseDistanceMet(m)&&this._mouseDelayMet(m)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,m)!==false);(this._mouseStarted?this._mouseDrag(m):this._mouseUp(m))}return !this._mouseStarted},_mouseUp:function(m){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(m.target==this._mouseDownEvent.target);this._mouseStop(m)}return false},_mouseDistanceMet:function(m){return(Math.max(Math.abs(this._mouseDownEvent.pageX-m.pageX),Math.abs(this._mouseDownEvent.pageY-m.pageY))>=this.options.distance)},_mouseDelayMet:function(m){return this.mouseDelayMet},_mouseStart:function(m){},_mouseDrag:function(m){},_mouseStop:function(m){},_mouseCapture:function(m){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;this._keySliding=false;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");this.range=a([]);if(c.range){if(c.range===true){this.range=a("<div></div>");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length<c.values.length){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(l){var g=true;var f=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(l.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:g=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(l,f)}break}var h,d,k=b._step();if(b.options.values&&b.options.values.length){h=d=b.values(f)}else{h=d=b.value()}switch(l.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(h==b._valueMax()){return}d=h+k;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(h==b._valueMin()){return}d=h-k;break}b._slide(l,f,d);return g}).keyup(function(f){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(f,d);b._change(f,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var f=this.options;if(f.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var k={x:d.pageX,y:d.pageY};var m=this._normValueFromMouse(k);var c=this._valueMax()-this._valueMin()+1,g;var n=this,l;this.handles.each(function(o){var p=Math.abs(m-n.values(o));if(c>p){c=p;g=a(this);l=o}});if(f.range==true&&this.values(1)==f.min){g=a(this.handles[++l])}this._start(d,l);n._handleIndex=l;g.addClass("ui-state-active").focus();var h=g.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-h.left-(g.width()/2),top:d.pageY-h.top-(g.height()/2)-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)};m=this._normValueFromMouse(k);this._slide(d,l,m);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,k;if("horizontal"==this.orientation){c=this.elementSize.width;k=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;k=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var g=(k/c);if(g>1){g=1}if(g<0){g=0}if("vertical"==this.orientation){g=1-g}var f=this._valueMax()-this._valueMin(),l=g*f,b=l%this.options.step,h=this._valueMin()+l-b;if(b>(this.options.step/2)){h+=this.options.step}return parseFloat(h.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(g,f,d){var h=this.handles[f];if(this.options.values&&this.options.values.length){var b=this.values(f?0:1);if((f==0&&d>=b)||(f==1&&d<=b)){d=b}if(d!=this.values(f)){var c=this.values();c[f]=d;var k=this._trigger("slide",g,{handle:this.handles[f],value:d,values:c});var b=this.values(f?0:1);if(k!==false){this.values(f,d,(g.type=="mousedown"&&this.options.animate),true)}}}else{if(d!=this.value()){var k=this._trigger("slide",g,{handle:this.handles[f],value:d});if(k!==false){this._setData("value",d,(g.type=="mousedown"&&this.options.animate))}}}},_stop:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("stop",d,b)},_change:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("change",d,b)},value:function(b){if(arguments.length){this._setData("value",b);this._change(null,0)}return this._value()},values:function(b,f,c,d){if(arguments.length>1){this.options.values[b]=f;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(c<this._valueMin()){c=this._valueMin()}if(c>this._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var g=this.options.range,d=this.options,p=this;if(this.options.values&&this.options.values.length){var l,k;this.handles.each(function(s,q){var r=(p.values(s)-p._valueMin())/(p._valueMax()-p._valueMin())*100;var o={};o[p.orientation=="horizontal"?"left":"bottom"]=r+"%";a(this).stop(1,1)[c?"animate":"css"](o,d.animate);if(p.options.range===true){if(p.orientation=="horizontal"){(s==0)&&p.range.stop(1,1)[c?"animate":"css"]({left:r+"%"},d.animate);(s==1)&&p.range[c?"animate":"css"]({width:(r-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(s==0)&&p.range.stop(1,1)[c?"animate":"css"]({bottom:(r)+"%"},d.animate);(s==1)&&p.range[c?"animate":"css"]({height:(r-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=r})}else{var m=this.value(),h=this._valueMin(),n=this._valueMax(),f=n!=h?(m-h)/(n-h)*100:0;var b={};b[p.orientation=="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(g=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:f+"%"},d.animate);(g=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-f)+"%"},{queue:false,duration:d.animate});(g=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:f+"%"},d.animate);(g=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-f)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.1",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);jQuery.effects||(function(d){d.effects={version:"1.7.1",save:function(h,k){for(var g=0;g<k.length;g++){if(k[g]!==null){h.data("ec.storage."+k[g],h[0].style[k[g]])}}},restore:function(h,k){for(var g=0;g<k.length;g++){if(k[g]!==null){h.css(k[g],h.data("ec.storage."+k[g]))}}},setMode:function(g,h){if(h=="toggle"){h=g.is(":hidden")?"show":"hide"}return h},getBaseline:function(h,k){var l,g;switch(h[0]){case"top":l=0;break;case"middle":l=0.5;break;case"bottom":l=1;break;default:l=h[0]/k.height}switch(h[1]){case"left":g=0;break;case"center":g=0.5;break;case"right":g=1;break;default:g=h[1]/k.width}return{x:g,y:l}},createWrapper:function(g){if(g.parent().is(".ui-effects-wrapper")){return g.parent()}var h={width:g.outerWidth(true),height:g.outerHeight(true),"float":g.css("float")};g.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var m=g.parent();if(g.css("position")=="static"){m.css({position:"relative"});g.css({position:"relative"})}else{var l=g.css("top");if(isNaN(parseInt(l,10))){l="auto"}var k=g.css("left");if(isNaN(parseInt(k,10))){k="auto"}m.css({position:g.css("position"),top:l,left:k,zIndex:g.css("z-index")}).show();g.css({position:"relative",top:0,left:0})}m.css(h);return m},removeWrapper:function(g){if(g.parent().is(".ui-effects-wrapper")){return g.parent().replaceWith(g)}return g},setTransition:function(h,l,g,k){k=k||{};d.each(l,function(n,m){unit=h.cssUnit(m);if(unit[0]>0){k[m]=unit[0]*g+unit[1]}});return k},animateClass:function(k,l,n,m){var g=(typeof n=="function"?n:(m?m:null));var h=(typeof n=="string"?n:null);return this.each(function(){var s={};var q=d(this);var r=q.attr("style")||"";if(typeof r=="object"){r=r.cssText}if(k.toggle){q.hasClass(k.toggle)?k.remove=k.toggle:k.add=k.toggle}var o=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(k.add){q.addClass(k.add)}if(k.remove){q.removeClass(k.remove)}var p=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(k.add){q.removeClass(k.add)}if(k.remove){q.addClass(k.remove)}for(var t in p){if(typeof p[t]!="function"&&p[t]&&t.indexOf("Moz")==-1&&t.indexOf("length")==-1&&p[t]!=o[t]&&(t.match(/color/i)||(!t.match(/color/i)&&!isNaN(parseInt(p[t],10))))&&(o.position!="static"||(o.position=="static"&&!t.match(/left|top|bottom|right/)))){s[t]=p[t]}}q.animate(s,l,h,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=r}else{d(this).attr("style",r)}if(k.add){d(this).addClass(k.add)}if(k.remove){d(this).removeClass(k.remove)}if(g){g.apply(this,arguments)}})})}};function c(h,g){var l=h[1]&&h[1].constructor==Object?h[1]:{};if(g){l.mode=g}var k=h[1]&&h[1].constructor!=Object?h[1]:(l.duration?l.duration:h[2]);k=d.fx.off?0:typeof k==="number"?k:d.fx.speeds[k]||d.fx.speeds._default;var n=l.callback||(d.isFunction(h[1])&&h[1])||(d.isFunction(h[2])&&h[2])||(d.isFunction(h[3])&&h[3]);return[h[0],l,k,n]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(h,g,k,l){return d.effects[h]?d.effects[h].call(this,{method:h,options:g||{},duration:k,callback:l}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(h,g,l,k){return g?d.effects.animateClass.apply(this,[{add:h},g,l,k]):this._addClass(h)},removeClass:function(h,g,l,k){return g?d.effects.animateClass.apply(this,[{remove:h},g,l,k]):this._removeClass(h)},toggleClass:function(h,g,l,k){return((typeof g!=="boolean")&&g)?d.effects.animateClass.apply(this,[{toggle:h},g,l,k]):this._toggleClass(h,g)},morph:function(g,k,h,m,l){return d.effects.animateClass.apply(this,[{add:k,remove:g},h,m,l])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(g){var h=this.css(g),k=[];d.each(["em","px","%","pt"],function(l,m){if(h.indexOf(m)>0){k=[parseFloat(h),m]}});return k}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(h,g){d.fx.step[g]=function(k){if(k.state==0){k.start=f(k.elem,g);k.end=b(k.end)}k.elem.style[g]="rgb("+[Math.max(Math.min(parseInt((k.pos*(k.end[0]-k.start[0]))+k.start[0],10),255),0),Math.max(Math.min(parseInt((k.pos*(k.end[1]-k.start[1]))+k.start[1],10),255),0),Math.max(Math.min(parseInt((k.pos*(k.end[2]-k.start[2]))+k.start[2],10),255),0)].join(",")+")"}});function b(h){var g;if(h&&h.constructor==Array&&h.length==3){return h}if(g=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(h)){return[parseInt(g[1],10),parseInt(g[2],10),parseInt(g[3],10)]}if(g=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(h)){return[parseFloat(g[1])*2.55,parseFloat(g[2])*2.55,parseFloat(g[3])*2.55]}if(g=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(h)){return[parseInt(g[1],16),parseInt(g[2],16),parseInt(g[3],16)]}if(g=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(h)){return[parseInt(g[1]+g[1],16),parseInt(g[2]+g[2],16),parseInt(g[3]+g[3],16)]}if(g=/rgba\(0, 0, 0, 0\)/.exec(h)){return a.transparent}return a[d.trim(h).toLowerCase()]}function f(k,g){var h;do{h=d.curCSS(k,g);if(h!=""&&h!="transparent"||d.nodeName(k,"body")){break}g="backgroundColor"}while(k=k.parentNode);return b(h)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(h,k,g,m,l){return d.easing[d.easing.def](h,k,g,m,l)},easeInQuad:function(h,k,g,m,l){return m*(k/=l)*k+g},easeOutQuad:function(h,k,g,m,l){return -m*(k/=l)*(k-2)+g},easeInOutQuad:function(h,k,g,m,l){if((k/=l/2)<1){return m/2*k*k+g}return -m/2*((--k)*(k-2)-1)+g},easeInCubic:function(h,k,g,m,l){return m*(k/=l)*k*k+g},easeOutCubic:function(h,k,g,m,l){return m*((k=k/l-1)*k*k+1)+g},easeInOutCubic:function(h,k,g,m,l){if((k/=l/2)<1){return m/2*k*k*k+g}return m/2*((k-=2)*k*k+2)+g},easeInQuart:function(h,k,g,m,l){return m*(k/=l)*k*k*k+g},easeOutQuart:function(h,k,g,m,l){return -m*((k=k/l-1)*k*k*k-1)+g},easeInOutQuart:function(h,k,g,m,l){if((k/=l/2)<1){return m/2*k*k*k*k+g}return -m/2*((k-=2)*k*k*k-2)+g},easeInQuint:function(h,k,g,m,l){return m*(k/=l)*k*k*k*k+g},easeOutQuint:function(h,k,g,m,l){return m*((k=k/l-1)*k*k*k*k+1)+g},easeInOutQuint:function(h,k,g,m,l){if((k/=l/2)<1){return m/2*k*k*k*k*k+g}return m/2*((k-=2)*k*k*k*k+2)+g},easeInSine:function(h,k,g,m,l){return -m*Math.cos(k/l*(Math.PI/2))+m+g},easeOutSine:function(h,k,g,m,l){return m*Math.sin(k/l*(Math.PI/2))+g},easeInOutSine:function(h,k,g,m,l){return -m/2*(Math.cos(Math.PI*k/l)-1)+g},easeInExpo:function(h,k,g,m,l){return(k==0)?g:m*Math.pow(2,10*(k/l-1))+g},easeOutExpo:function(h,k,g,m,l){return(k==l)?g+m:m*(-Math.pow(2,-10*k/l)+1)+g},easeInOutExpo:function(h,k,g,m,l){if(k==0){return g}if(k==l){return g+m}if((k/=l/2)<1){return m/2*Math.pow(2,10*(k-1))+g}return m/2*(-Math.pow(2,-10*--k)+2)+g},easeInCirc:function(h,k,g,m,l){return -m*(Math.sqrt(1-(k/=l)*k)-1)+g},easeOutCirc:function(h,k,g,m,l){return m*Math.sqrt(1-(k=k/l-1)*k)+g},easeInOutCirc:function(h,k,g,m,l){if((k/=l/2)<1){return -m/2*(Math.sqrt(1-k*k)-1)+g}return m/2*(Math.sqrt(1-(k-=2)*k)+1)+g},easeInElastic:function(h,l,g,q,o){var m=1.70158;var n=0;var k=q;if(l==0){return g}if((l/=o)==1){return g+q}if(!n){n=o*0.3}if(k<Math.abs(q)){k=q;var m=n/4}else{var m=n/(2*Math.PI)*Math.asin(q/k)}return -(k*Math.pow(2,10*(l-=1))*Math.sin((l*o-m)*(2*Math.PI)/n))+g},easeOutElastic:function(h,l,g,q,o){var m=1.70158;var n=0;var k=q;if(l==0){return g}if((l/=o)==1){return g+q}if(!n){n=o*0.3}if(k<Math.abs(q)){k=q;var m=n/4}else{var m=n/(2*Math.PI)*Math.asin(q/k)}return k*Math.pow(2,-10*l)*Math.sin((l*o-m)*(2*Math.PI)/n)+q+g},easeInOutElastic:function(h,l,g,q,o){var m=1.70158;var n=0;var k=q;if(l==0){return g}if((l/=o/2)==2){return g+q}if(!n){n=o*(0.3*1.5)}if(k<Math.abs(q)){k=q;var m=n/4}else{var m=n/(2*Math.PI)*Math.asin(q/k)}if(l<1){return -0.5*(k*Math.pow(2,10*(l-=1))*Math.sin((l*o-m)*(2*Math.PI)/n))+g}return k*Math.pow(2,-10*(l-=1))*Math.sin((l*o-m)*(2*Math.PI)/n)*0.5+q+g},easeInBack:function(h,k,g,n,m,l){if(l==undefined){l=1.70158}return n*(k/=m)*k*((l+1)*k-l)+g},easeOutBack:function(h,k,g,n,m,l){if(l==undefined){l=1.70158}return n*((k=k/m-1)*k*((l+1)*k+l)+1)+g},easeInOutBack:function(h,k,g,n,m,l){if(l==undefined){l=1.70158}if((k/=m/2)<1){return n/2*(k*k*(((l*=(1.525))+1)*k-l))+g}return n/2*((k-=2)*k*(((l*=(1.525))+1)*k+l)+2)+g},easeInBounce:function(h,k,g,m,l){return m-d.easing.easeOutBounce(h,l-k,0,m,l)+g},easeOutBounce:function(h,k,g,m,l){if((k/=l)<(1/2.75)){return m*(7.5625*k*k)+g}else{if(k<(2/2.75)){return m*(7.5625*(k-=(1.5/2.75))*k+0.75)+g}else{if(k<(2.5/2.75)){return m*(7.5625*(k-=(2.25/2.75))*k+0.9375)+g}else{return m*(7.5625*(k-=(2.625/2.75))*k+0.984375)+g}}}},easeInOutBounce:function(h,k,g,m,l){if(k<l/2){return d.easing.easeInBounce(h,k*2,0,m,l)*0.5+g}return d.easing.easeOutBounce(h,k*2-l,0,m,l)*0.5+m*0.5+g}})})(jQuery);(function(a){a.effects.blind=function(b){return this.queue(function(){var d=a(this),c=["position","top","left"];var k=a.effects.setMode(d,b.options.mode||"hide");var h=b.options.direction||"vertical";a.effects.save(d,c);d.show();var m=a.effects.createWrapper(d).css({overflow:"hidden"});var f=(h=="vertical")?"height":"width";var l=(h=="vertical")?m.height():m.width();if(k=="show"){m.css(f,0)}var g={};g[f]=k=="show"?l:0;m.animate(g,b.duration,b.options.easing,function(){if(k=="hide"){d.hide()}a.effects.restore(d,c);a.effects.removeWrapper(d);if(b.callback){b.callback.apply(d[0],arguments)}d.dequeue()})})}})(jQuery);(function(a){a.effects.bounce=function(b){return this.queue(function(){var f=a(this),n=["position","top","left"];var m=a.effects.setMode(f,b.options.mode||"effect");var p=b.options.direction||"up";var c=b.options.distance||20;var d=b.options.times||5;var h=b.duration||250;if(/show|hide/.test(m)){n.push("opacity")}a.effects.save(f,n);f.show();a.effects.createWrapper(f);var g=(p=="up"||p=="down")?"top":"left";var r=(p=="up"||p=="left")?"pos":"neg";var c=b.options.distance||(g=="top"?f.outerHeight({margin:true})/3:f.outerWidth({margin:true})/3);if(m=="show"){f.css("opacity",0).css(g,r=="pos"?-c:c)}if(m=="hide"){c=c/(d*2)}if(m!="hide"){d--}if(m=="show"){var k={opacity:1};k[g]=(r=="pos"?"+=":"-=")+c;f.animate(k,h/2,b.options.easing);c=c/2;d--}for(var l=0;l<d;l++){var q={},o={};q[g]=(r=="pos"?"-=":"+=")+c;o[g]=(r=="pos"?"+=":"-=")+c;f.animate(q,h/2,b.options.easing).animate(o,h/2,b.options.easing);c=(m=="hide")?c*2:c/2}if(m=="hide"){var k={opacity:0};k[g]=(r=="pos"?"-=":"+=")+c;f.animate(k,h/2,b.options.easing,function(){f.hide();a.effects.restore(f,n);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(this,arguments)}})}else{var q={},o={};q[g]=(r=="pos"?"-=":"+=")+c;o[g]=(r=="pos"?"+=":"-=")+c;f.animate(q,h/2,b.options.easing).animate(o,h/2,b.options.easing,function(){a.effects.restore(f,n);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(this,arguments)}})}f.queue("fx",function(){f.dequeue()});f.dequeue()})}})(jQuery);(function(a){a.effects.clip=function(b){return this.queue(function(){var g=a(this),m=["position","top","left","height","width"];var l=a.effects.setMode(g,b.options.mode||"hide");var n=b.options.direction||"vertical";a.effects.save(g,m);g.show();var c=a.effects.createWrapper(g).css({overflow:"hidden"});var f=g[0].tagName=="IMG"?c:g;var h={size:(n=="vertical")?"height":"width",position:(n=="vertical")?"top":"left"};var d=(n=="vertical")?f.height():f.width();if(l=="show"){f.css(h.size,0);f.css(h.position,d/2)}var k={};k[h.size]=l=="show"?d:0;k[h.position]=l=="show"?0:d/2;f.animate(k,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(l=="hide"){g.hide()}a.effects.restore(g,m);a.effects.removeWrapper(g);if(b.callback){b.callback.apply(g[0],arguments)}g.dequeue()}})})}})(jQuery);(function(a){a.effects.drop=function(b){return this.queue(function(){var f=a(this),d=["position","top","left","opacity"];var l=a.effects.setMode(f,b.options.mode||"hide");var k=b.options.direction||"left";a.effects.save(f,d);f.show();a.effects.createWrapper(f);var g=(k=="up"||k=="down")?"top":"left";var c=(k=="up"||k=="left")?"pos":"neg";var m=b.options.distance||(g=="top"?f.outerHeight({margin:true})/2:f.outerWidth({margin:true})/2);if(l=="show"){f.css("opacity",0).css(g,c=="pos"?-m:m)}var h={opacity:l=="show"?1:0};h[g]=(l=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+m;f.animate(h,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(l=="hide"){f.hide()}a.effects.restore(f,d);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(this,arguments)}f.dequeue()}})})}})(jQuery);(function(a){a.effects.explode=function(b){return this.queue(function(){var l=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;var f=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?(a(this).is(":visible")?"hide":"show"):b.options.mode;var k=a(this).show().css("visibility","hidden");var m=k.offset();m.top-=parseInt(k.css("marginTop"),10)||0;m.left-=parseInt(k.css("marginLeft"),10)||0;var h=k.outerWidth(true);var c=k.outerHeight(true);for(var g=0;g<l;g++){for(var d=0;d<f;d++){k.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-d*(h/f),top:-g*(c/l)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/f,height:c/l,left:m.left+d*(h/f)+(b.options.mode=="show"?(d-Math.floor(f/2))*(h/f):0),top:m.top+g*(c/l)+(b.options.mode=="show"?(g-Math.floor(l/2))*(c/l):0),opacity:b.options.mode=="show"?0:1}).animate({left:m.left+d*(h/f)+(b.options.mode=="show"?0:(d-Math.floor(f/2))*(h/f)),top:m.top+g*(c/l)+(b.options.mode=="show"?0:(g-Math.floor(l/2))*(c/l)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?k.css({visibility:"visible"}):k.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(k[0])}k.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);(function(a){a.effects.fold=function(b){return this.queue(function(){var f=a(this),n=["position","top","left"];var k=a.effects.setMode(f,b.options.mode||"hide");var r=b.options.size||15;var q=!(!b.options.horizFirst);var h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(f,n);f.show();var d=a.effects.createWrapper(f).css({overflow:"hidden"});var l=((k=="show")!=q);var g=l?["width","height"]:["height","width"];var c=l?[d.width(),d.height()]:[d.height(),d.width()];var m=/([0-9]+)%/.exec(r);if(m){r=parseInt(m[1],10)/100*c[k=="hide"?0:1]}if(k=="show"){d.css(q?{height:0,width:r}:{height:r,width:0})}var p={},o={};p[g[0]]=k=="show"?c[0]:r;o[g[1]]=k=="show"?c[1]:0;d.animate(p,h,b.options.easing).animate(o,h,b.options.easing,function(){if(k=="hide"){f.hide()}a.effects.restore(f,n);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(f[0],arguments)}f.dequeue()})})}})(jQuery);(function(a){a.effects.highlight=function(b){return this.queue(function(){var f=a(this),d=["backgroundImage","backgroundColor","opacity"];var k=a.effects.setMode(f,b.options.mode||"show");var c=b.options.color||"#ffff99";var h=f.css("backgroundColor");a.effects.save(f,d);f.show();f.css({backgroundImage:"none",backgroundColor:c});var g={backgroundColor:h};if(k=="hide"){g.opacity=0}f.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(k=="hide"){f.hide()}a.effects.restore(f,d);if(k=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}f.dequeue()}})})}})(jQuery);(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var h=a.effects.setMode(d,b.options.mode||"show");var g=b.options.times||5;var f=b.duration?b.duration/2:a.fx.speeds._default/2;if(h=="hide"){g--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},f,b.options.easing);g=g-2}for(var c=0;c<g;c++){d.animate({opacity:0},f,b.options.easing).animate({opacity:1},f,b.options.easing)}if(h=="hide"){d.animate({opacity:0},f,b.options.easing,function(){d.hide();if(b.callback){b.callback.apply(this,arguments)}})}else{d.animate({opacity:0},f,b.options.easing).animate({opacity:1},f,b.options.easing,function(){if(b.callback){b.callback.apply(this,arguments)}})}d.queue("fx",function(){d.dequeue()});d.dequeue()})}})(jQuery);(function(a){a.effects.puff=function(b){return this.queue(function(){var g=a(this);var c=a.extend(true,{},b.options);var k=a.effects.setMode(g,b.options.mode||"hide");var h=parseInt(b.options.percent,10)||150;c.fade=true;var f={height:g.height(),width:g.width()};var d=h/100;g.from=(k=="hide")?f:{height:f.height*d,width:f.width*d};c.from=g.from;c.percent=(k=="hide")?h:100;c.mode=k;g.effect("scale",c,b.duration,b.callback);g.dequeue()})};a.effects.scale=function(b){return this.queue(function(){var h=a(this);var d=a.extend(true,{},b.options);var m=a.effects.setMode(h,b.options.mode||"effect");var k=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:(m=="hide"?0:100));var l=b.options.direction||"both";var c=b.options.origin;if(m!="effect"){d.origin=c||["middle","center"];d.restore=true}var g={height:h.height(),width:h.width()};h.from=b.options.from||(m=="show"?{height:0,width:0}:g);var f={y:l!="horizontal"?(k/100):1,x:l!="vertical"?(k/100):1};h.to={height:g.height*f.y,width:g.width*f.x};if(b.options.fade){if(m=="show"){h.from.opacity=0;h.to.opacity=1}if(m=="hide"){h.from.opacity=1;h.to.opacity=0}}d.from=h.from;d.to=h.to;d.mode=m;h.effect("size",d,b.duration,b.callback);h.dequeue()})};a.effects.size=function(b){return this.queue(function(){var c=a(this),q=["position","top","left","width","height","overflow","opacity"];var p=["position","top","left","overflow","opacity"];var m=["width","height","overflow"];var s=["fontSize"];var n=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var g=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var h=a.effects.setMode(c,b.options.mode||"effect");var l=b.options.restore||false;var f=b.options.scale||"both";var r=b.options.origin;var d={height:c.height(),width:c.width()};c.from=b.options.from||d;c.to=b.options.to||d;if(r){var k=a.effects.getBaseline(r,d);c.from.top=(d.height-c.from.height)*k.y;c.from.left=(d.width-c.from.width)*k.x;c.to.top=(d.height-c.to.height)*k.y;c.to.left=(d.width-c.to.width)*k.x}var o={from:{y:c.from.height/d.height,x:c.from.width/d.width},to:{y:c.to.height/d.height,x:c.to.width/d.width}};if(f=="box"||f=="both"){if(o.from.y!=o.to.y){q=q.concat(n);c.from=a.effects.setTransition(c,n,o.from.y,c.from);c.to=a.effects.setTransition(c,n,o.to.y,c.to)}if(o.from.x!=o.to.x){q=q.concat(g);c.from=a.effects.setTransition(c,g,o.from.x,c.from);c.to=a.effects.setTransition(c,g,o.to.x,c.to)}}if(f=="content"||f=="both"){if(o.from.y!=o.to.y){q=q.concat(s);c.from=a.effects.setTransition(c,s,o.from.y,c.from);c.to=a.effects.setTransition(c,s,o.to.y,c.to)}}a.effects.save(c,l?q:p);c.show();a.effects.createWrapper(c);c.css("overflow","hidden").css(c.from);if(f=="content"||f=="both"){n=n.concat(["marginTop","marginBottom"]).concat(s);g=g.concat(["marginLeft","marginRight"]);m=q.concat(n).concat(g);c.find("*[width]").each(function(){child=a(this);if(l){a.effects.save(child,m)}var t={height:child.height(),width:child.width()};child.from={height:t.height*o.from.y,width:t.width*o.from.x};child.to={height:t.height*o.to.y,width:t.width*o.to.x};if(o.from.y!=o.to.y){child.from=a.effects.setTransition(child,n,o.from.y,child.from);child.to=a.effects.setTransition(child,n,o.to.y,child.to)}if(o.from.x!=o.to.x){child.from=a.effects.setTransition(child,g,o.from.x,child.from);child.to=a.effects.setTransition(child,g,o.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){if(l){a.effects.restore(child,m)}})})}c.animate(c.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){c.hide()}a.effects.restore(c,l?q:p);a.effects.removeWrapper(c);if(b.callback){b.callback.apply(this,arguments)}c.dequeue()}})})}})(jQuery);(function(a){a.effects.shake=function(b){return this.queue(function(){var f=a(this),n=["position","top","left"];var m=a.effects.setMode(f,b.options.mode||"effect");var p=b.options.direction||"left";var c=b.options.distance||20;var d=b.options.times||3;var h=b.duration||b.options.duration||140;a.effects.save(f,n);f.show();a.effects.createWrapper(f);var g=(p=="up"||p=="down")?"top":"left";var r=(p=="up"||p=="left")?"pos":"neg";var k={},q={},o={};k[g]=(r=="pos"?"-=":"+=")+c;q[g]=(r=="pos"?"+=":"-=")+c*2;o[g]=(r=="pos"?"-=":"+=")+c*2;f.animate(k,h,b.options.easing);for(var l=1;l<d;l++){f.animate(q,h,b.options.easing).animate(o,h,b.options.easing)}f.animate(q,h,b.options.easing).animate(k,h/2,b.options.easing,function(){a.effects.restore(f,n);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(this,arguments)}});f.queue("fx",function(){f.dequeue()});f.dequeue()})}})(jQuery);(function(a){a.effects.slide=function(b){return this.queue(function(){var f=a(this),d=["position","top","left"];var l=a.effects.setMode(f,b.options.mode||"show");var k=b.options.direction||"left";a.effects.save(f,d);f.show();a.effects.createWrapper(f).css({overflow:"hidden"});var g=(k=="up"||k=="down")?"top":"left";var c=(k=="up"||k=="left")?"pos":"neg";var m=b.options.distance||(g=="top"?f.outerHeight({margin:true}):f.outerWidth({margin:true}));if(l=="show"){f.css(g,c=="pos"?-m:m)}var h={};h[g]=(l=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+m;f.animate(h,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(l=="hide"){f.hide()}a.effects.restore(f,d);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(this,arguments)}f.dequeue()}})})}})(jQuery);(function(a){a.effects.transfer=function(b){return this.queue(function(){var g=a(this),k=a(b.options.to),f=k.offset(),h={top:f.top,left:f.left,height:k.innerHeight(),width:k.innerWidth()},d=g.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:g.innerHeight(),width:g.innerWidth(),position:"absolute"}).animate(h,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(g[0],arguments));g.dequeue()})})}})(jQuery);(function(c){var a="2.25";var k=c.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);function g(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments,""))}}c.fn.cycle=function(l){return this.each(function(){if(l===undefined||l===null){l={}}if(l.constructor==String){switch(l){case"stop":if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;c(this).data("cycle.opts","");return;case"pause":this.cyclePause=1;return;case"resume":this.cyclePause=0;return;default:l={fx:l}}}else{if(l.constructor==Number){var r=l;l=c(this).data("cycle.opts");if(!l){g("options not found, can not advance slide");return}if(r<0||r>=l.elements.length){g("invalid slide index: "+r);return}l.nextSlide=r;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);this.cycleTimeout=0}f(l.elements,l,1,1);return}}if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var o=c(this);var q=l.slideExpr?c(l.slideExpr,this):o.children();var u=q.get();if(u.length<2){g("terminating; too few slides: "+u.length);return}var v=c.extend({},c.fn.cycle.defaults,l||{},c.metadata?o.metadata():c.meta?o.data():{});if(v.autostop){v.countdown=v.autostopCount||u.length}o.data("cycle.opts",v);v.container=this;v.elements=u;v.before=v.before?[v.before]:[];v.after=v.after?[v.after]:[];v.after.unshift(function(){v.busy=0});if(v.continuous){v.after.push(function(){f(u,v,0,!v.rev)})}if(k&&v.cleartype&&!v.cleartypeNoBg){h(q)}var m=this.className;v.width=parseInt((m.match(/w:(\d+)/)||[])[1])||v.width;v.height=parseInt((m.match(/h:(\d+)/)||[])[1])||v.height;v.timeout=parseInt((m.match(/t:(\d+)/)||[])[1])||v.timeout;if(o.css("position")=="static"){o.css("position","relative")}if(v.width){o.width(v.width)}if(v.height&&v.height!="auto"){o.height(v.height)}if(v.random){v.randomMap=[];for(var t=0;t<u.length;t++){v.randomMap.push(t)}v.randomMap.sort(function(w,x){return Math.random()-0.5});v.randomIndex=0;v.startingSlide=v.randomMap[0]}else{if(v.startingSlide>=u.length){v.startingSlide=0}}var s=v.startingSlide||0;q.css({position:"absolute",top:0,left:0}).hide().each(function(x){var w=s?x>=s?u.length-(x-s):s-x:u.length-x;c(this).css("z-index",w)});c(u[s]).css("opacity",1).show();if(c.browser.msie){u[s].style.removeAttribute("filter")}if(v.fit&&v.width){q.width(v.width)}if(v.fit&&v.height&&v.height!="auto"){q.height(v.height)}if(v.pause){o.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}var n=c.fn.cycle.transitions[v.fx];if(c.isFunction(n)){n(o,q,v)}else{if(v.fx!="custom"){g("unknown transition: "+v.fx)}}q.each(function(){var w=c(this);this.cycleH=(v.fit&&v.height)?v.height:w.height();this.cycleW=(v.fit&&v.width)?v.width:w.width()});v.cssBefore=v.cssBefore||{};v.animIn=v.animIn||{};v.animOut=v.animOut||{};q.not(":eq("+s+")").css(v.cssBefore);if(v.cssFirst){c(q[s]).css(v.cssFirst)}if(v.timeout){if(v.speed.constructor==String){v.speed={slow:600,fast:200}[v.speed]||400}if(!v.sync){v.speed=v.speed/2}while((v.timeout-v.speed)<250){v.timeout+=v.speed}}if(v.easing){v.easeIn=v.easeOut=v.easing}if(!v.speedIn){v.speedIn=v.speed}if(!v.speedOut){v.speedOut=v.speed}v.slideCount=u.length;v.currSlide=s;if(v.random){v.nextSlide=v.currSlide;if(++v.randomIndex==u.length){v.randomIndex=0}v.nextSlide=v.randomMap[v.randomIndex]}else{v.nextSlide=v.startingSlide>=(u.length-1)?0:v.startingSlide+1}var p=q[s];if(v.before.length){v.before[0].apply(p,[p,p,v,true])}if(v.after.length>1){v.after[1].apply(p,[p,p,v,true])}if(v.click&&!v.next){v.next=v.click}if(v.next){c(v.next).bind("click",function(){return d(u,v,v.rev?-1:1)})}if(v.prev){c(v.prev).bind("click",function(){return d(u,v,v.rev?1:-1)})}if(v.pager){b(u,v)}v.addSlide=function(x){var y=c(x),w=y[0];if(!v.autostopCount){v.countdown++}u.push(w);if(v.els){v.els.push(w)}v.slideCount=u.length;y.css("position","absolute").appendTo(o);if(k&&v.cleartype&&!v.cleartypeNoBg){h(y)}if(v.fit&&v.width){y.width(v.width)}if(v.fit&&v.height&&v.height!="auto"){q.height(v.height)}w.cycleH=(v.fit&&v.height)?v.height:y.height();w.cycleW=(v.fit&&v.width)?v.width:y.width();y.css(v.cssBefore);if(v.pager){c.fn.cycle.createPagerAnchor(u.length-1,w,c(v.pager),u,v)}if(typeof v.onAddSlide=="function"){v.onAddSlide(y)}};if(v.timeout||v.continuous){this.cycleTimeout=setTimeout(function(){f(u,v,0,!v.rev)},v.continuous?10:v.timeout+(v.delay||0))}})};function f(o,t,p,n){if(t.busy){return}var q=t.container,l=o[t.currSlide],m=o[t.nextSlide];if(q.cycleTimeout===0&&!p){return}if(!p&&!q.cyclePause&&((t.autostop&&(--t.countdown<=0))||(t.nowrap&&!t.random&&t.nextSlide<t.currSlide))){if(t.end){t.end(t)}return}if(p||!q.cyclePause){if(t.before.length){c.each(t.before,function(v,u){u.apply(m,[l,m,t,n])})}var s=function(){if(c.browser.msie&&t.cleartype){this.style.removeAttribute("filter")}c.each(t.after,function(v,u){u.apply(m,[l,m,t,n])})};if(t.nextSlide!=t.currSlide){t.busy=1;if(t.fxFn){t.fxFn(l,m,t,s,n)}else{if(c.isFunction(c.fn.cycle[t.fx])){c.fn.cycle[t.fx](l,m,t,s)}else{c.fn.cycle.custom(l,m,t,s,p&&t.fastOnEvent)}}}if(t.random){t.currSlide=t.nextSlide;if(++t.randomIndex==o.length){t.randomIndex=0}t.nextSlide=t.randomMap[t.randomIndex]}else{var r=(t.nextSlide+1)==o.length;t.nextSlide=r?0:t.nextSlide+1;t.currSlide=r?o.length-1:t.nextSlide-1}if(t.pager){c.fn.cycle.updateActivePagerLink(t.pager,t.currSlide)}}if(t.timeout&&!t.continuous){q.cycleTimeout=setTimeout(function(){f(o,t,0,!t.rev)},t.timeout)}else{if(t.continuous&&q.cyclePause){q.cycleTimeout=setTimeout(function(){f(o,t,0,!t.rev)},10)}}}c.fn.cycle.updateActivePagerLink=function(m,l){c(m).find("a").removeClass("activeSlide").filter("a:eq("+l+")").addClass("activeSlide")};function d(o,n,p){var l=n.container,m=l.cycleTimeout;if(m){clearTimeout(m);l.cycleTimeout=0}if(n.random&&p<0){n.randomIndex--;if(--n.randomIndex==-2){n.randomIndex=o.length-2}else{if(n.randomIndex==-1){n.randomIndex=o.length-1}}n.nextSlide=n.randomMap[n.randomIndex]}else{if(n.random){if(++n.randomIndex==o.length){n.randomIndex=0}n.nextSlide=n.randomMap[n.randomIndex]}else{n.nextSlide=n.currSlide+p;if(n.nextSlide<0){if(n.nowrap){return false}n.nextSlide=o.length-1}else{if(n.nextSlide>=o.length){if(n.nowrap){return false}n.nextSlide=0}}}}if(n.prevNextClick&&typeof n.prevNextClick=="function"){n.prevNextClick(p>0,n.nextSlide,o[n.nextSlide])}f(o,n,1,p>=0);return false}function b(m,l){var n=c(l.pager);c.each(m,function(o,p){c.fn.cycle.createPagerAnchor(o,p,n,m,l)});c.fn.cycle.updateActivePagerLink(l.pager,l.startingSlide)}c.fn.cycle.createPagerAnchor=function(m,l,o,n,q){var p=(typeof q.pagerAnchorBuilder=="function")?c(q.pagerAnchorBuilder(m,l)):c('<a href="#">'+(m+1)+"</a>");if(p.parents("body").length==0){p.appendTo(o)}p.bind(q.pagerEvent,function(){q.nextSlide=m;var r=q.container,s=r.cycleTimeout;if(s){clearTimeout(s);r.cycleTimeout=0}if(typeof q.pagerClick=="function"){q.pagerClick(q.nextSlide,n[q.nextSlide])}f(n,q,1,q.currSlide<m);return false})};function h(l){function m(o){var o=parseInt(o).toString(16);return o.length<2?"0"+o:o}function n(p){for(;p&&p.nodeName.toLowerCase()!="html";p=p.parentNode){var o=c.css(p,"background-color");if(o.indexOf("rgb")>=0){var q=o.match(/\d+/g);return"#"+m(q[0])+m(q[1])+m(q[2])}if(o&&o!="transparent"){return o}}return"#ffffff"}l.each(function(){c(this).css("background-color",n(this))})}c.fn.cycle.custom=function(l,r,w,u,v){var m=c(l),q=c(r);q.css(w.cssBefore);var t=v?1:w.speedIn;var n=v?1:w.speedOut;var s=v?null:w.easeIn;var o=v?null:w.easeOut;var p=function(){q.animate(w.animIn,t,s,u)};m.animate(w.animOut,n,o,function(){if(w.cssAfter){m.css(w.cssAfter)}if(!w.sync){p()}});if(w.sync){p()}};c.fn.cycle.transitions={fade:function(m,l,n){l.not(":eq("+n.startingSlide+")").css("opacity",0);n.before.push(function(){c(this).show()});n.animIn={opacity:1};n.animOut={opacity:0};n.cssBefore={opacity:0};n.cssAfter={display:"none"}}};c.fn.cycle.ver=function(){return a};c.fn.cycle.defaults={fx:"fade",timeout:4000,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,pager:null,pagerClick:null,pagerEvent:"click",pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,pause:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:0,nowrap:0,fastOnEvent:0}})(jQuery);(function(a){a.fn.cycle.transitions.scrollUp=function(c,b,d){c.css("overflow","hidden");d.before.push(function(f,h,g){a(this).show();g.cssBefore.top=h.offsetHeight;g.animOut.top=0-f.offsetHeight});d.cssFirst={top:0};d.animIn={top:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.scrollDown=function(c,b,d){c.css("overflow","hidden");d.before.push(function(f,h,g){a(this).show();g.cssBefore.top=0-h.offsetHeight;g.animOut.top=f.offsetHeight});d.cssFirst={top:0};d.animIn={top:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.scrollLeft=function(c,b,d){c.css("overflow","hidden");d.before.push(function(f,h,g){a(this).show();g.cssBefore.left=h.offsetWidth;g.animOut.left=0-f.offsetWidth});d.cssFirst={left:0};d.animIn={left:0}};a.fn.cycle.transitions.scrollRight=function(c,b,d){c.css("overflow","hidden");d.before.push(function(f,h,g){a(this).show();g.cssBefore.left=0-h.offsetWidth;g.animOut.left=f.offsetWidth});d.cssFirst={left:0};d.animIn={left:0}};a.fn.cycle.transitions.scrollHorz=function(c,b,d){c.css("overflow","hidden").width();d.before.push(function(g,k,h,l){a(this).show();var m=g.offsetWidth,f=k.offsetWidth;h.cssBefore=l?{left:f}:{left:-f};h.animIn.left=0;h.animOut.left=l?-m:m;b.not(g).css(h.cssBefore)});d.cssFirst={left:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.scrollVert=function(c,b,d){c.css("overflow","hidden");d.before.push(function(f,k,h,l){a(this).show();var g=f.offsetHeight,m=k.offsetHeight;h.cssBefore=l?{top:-m}:{top:m};h.animIn.top=0;h.animOut.top=l?g:-g;b.not(f).css(h.cssBefore)});d.cssFirst={top:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.slideX=function(c,b,d){d.before.push(function(f,h,g){a(f).css("zIndex",1)});d.onAddSlide=function(f){f.hide()};d.cssBefore={zIndex:2};d.animIn={width:"show"};d.animOut={width:"hide"}};a.fn.cycle.transitions.slideY=function(c,b,d){d.before.push(function(f,h,g){a(f).css("zIndex",1)});d.onAddSlide=function(f){f.hide()};d.cssBefore={zIndex:2};d.animIn={height:"show"};d.animOut={height:"hide"}};a.fn.cycle.transitions.shuffle=function(c,b,d){var g=c.css("overflow","visible").width();b.css({left:0,top:0});d.before.push(function(){a(this).show()});d.speed=d.speed/2;d.random=0;d.shuffle=d.shuffle||{left:-g,top:15};d.els=[];for(var f=0;f<b.length;f++){d.els.push(b[f])}for(var f=0;f<d.startingSlide;f++){d.els.push(d.els.shift())}d.fxFn=function(h,l,k,o,m){var n=m?a(h):a(l);n.animate(k.shuffle,k.speedIn,k.easeIn,function(){m?k.els.push(k.els.shift()):k.els.unshift(k.els.pop());if(m){for(var q=0,r=k.els.length;q<r;q++){a(k.els[q]).css("z-index",r-q)}}else{var p=a(h).css("z-index");n.css("z-index",parseInt(p)+1)}n.animate({left:0,top:0},k.speedOut,k.easeOut,function(){a(m?this:h).hide();if(o){o()}})})};d.onAddSlide=function(h){h.hide()}};a.fn.cycle.transitions.turnUp=function(c,b,d){d.before.push(function(f,h,g){a(this).show();g.cssBefore.top=h.cycleH;g.animIn.height=h.cycleH});d.onAddSlide=function(f){f.hide()};d.cssFirst={top:0};d.cssBefore={height:0};d.animIn={top:0};d.animOut={height:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.turnDown=function(c,b,d){d.before.push(function(f,h,g){a(this).show();g.animIn.height=h.cycleH;g.animOut.top=f.cycleH});d.onAddSlide=function(f){f.hide()};d.cssFirst={top:0};d.cssBefore={top:0,height:0};d.animOut={height:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.turnLeft=function(c,b,d){d.before.push(function(f,h,g){a(this).show();g.cssBefore.left=h.cycleW;g.animIn.width=h.cycleW});d.onAddSlide=function(f){f.hide()};d.cssBefore={width:0};d.animIn={left:0};d.animOut={width:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.turnRight=function(c,b,d){d.before.push(function(f,h,g){a(this).show();g.animIn.width=h.cycleW;g.animOut.left=f.cycleW});d.onAddSlide=function(f){f.hide()};d.cssBefore={left:0,width:0};d.animIn={left:0};d.animOut={width:0};d.cssAfter={display:"none"}};a.fn.cycle.transitions.zoom=function(c,b,d){d.cssFirst={top:0,left:0};d.cssAfter={display:"none"};d.before.push(function(f,h,g){a(this).show();g.cssBefore={width:0,height:0,top:h.cycleH/2,left:h.cycleW/2};g.cssAfter={display:"none"};g.animIn={top:0,left:0,width:h.cycleW,height:h.cycleH};g.animOut={width:0,height:0,top:f.cycleH/2,left:f.cycleW/2};a(f).css("zIndex",2);a(h).css("zIndex",1)});d.onAddSlide=function(f){f.hide()}};a.fn.cycle.transitions.fadeZoom=function(c,b,d){d.before.push(function(f,h,g){g.cssBefore={width:0,height:0,opacity:1,left:h.cycleW/2,top:h.cycleH/2,zIndex:1};g.animIn={top:0,left:0,width:h.cycleW,height:h.cycleH}});d.animOut={opacity:0};d.cssAfter={zIndex:0}};a.fn.cycle.transitions.blindX=function(c,b,d){var f=c.css("overflow","hidden").width();b.show();d.before.push(function(g,k,h){a(g).css("zIndex",1)});d.cssBefore={left:f,zIndex:2};d.cssAfter={zIndex:1};d.animIn={left:0};d.animOut={left:f}};a.fn.cycle.transitions.blindY=function(c,b,d){var f=c.css("overflow","hidden").height();b.show();d.before.push(function(g,k,h){a(g).css("zIndex",1)});d.cssBefore={top:f,zIndex:2};d.cssAfter={zIndex:1};d.animIn={top:0};d.animOut={top:f}};a.fn.cycle.transitions.blindZ=function(c,b,d){var f=c.css("overflow","hidden").height();var g=c.width();b.show();d.before.push(function(h,l,k){a(h).css("zIndex",1)});d.cssBefore={top:f,left:g,zIndex:2};d.cssAfter={zIndex:1};d.animIn={top:0,left:0};d.animOut={top:f,left:g}};a.fn.cycle.transitions.growX=function(c,b,d){d.before.push(function(f,h,g){g.cssBefore={left:this.cycleW/2,width:0,zIndex:2};g.animIn={left:0,width:this.cycleW};g.animOut={left:0};a(f).css("zIndex",1)});d.onAddSlide=function(f){f.hide().css("zIndex",1)}};a.fn.cycle.transitions.growY=function(c,b,d){d.before.push(function(f,h,g){g.cssBefore={top:this.cycleH/2,height:0,zIndex:2};g.animIn={top:0,height:this.cycleH};g.animOut={top:0};a(f).css("zIndex",1)});d.onAddSlide=function(f){f.hide().css("zIndex",1)}};a.fn.cycle.transitions.curtainX=function(c,b,d){d.before.push(function(f,h,g){g.cssBefore={left:h.cycleW/2,width:0,zIndex:1,display:"block"};g.animIn={left:0,width:this.cycleW};g.animOut={left:f.cycleW/2,width:0};a(f).css("zIndex",2)});d.onAddSlide=function(f){f.hide()};d.cssAfter={zIndex:1,display:"none"}};a.fn.cycle.transitions.curtainY=function(c,b,d){d.before.push(function(f,h,g){g.cssBefore={top:h.cycleH/2,height:0,zIndex:1,display:"block"};g.animIn={top:0,height:this.cycleH};g.animOut={top:f.cycleH/2,height:0};a(f).css("zIndex",2)});d.onAddSlide=function(f){f.hide()};d.cssAfter={zIndex:1,display:"none"}};a.fn.cycle.transitions.cover=function(d,c,f){var b=f.direction||"left";var h=d.css("overflow","hidden").width();var g=d.height();f.before.push(function(k,m,l){l.cssBefore=l.cssBefore||{};l.cssBefore.zIndex=2;l.cssBefore.display="block";if(b=="right"){l.cssBefore.left=-h}else{if(b=="up"){l.cssBefore.top=g}else{if(b=="down"){l.cssBefore.top=-g}else{l.cssBefore.left=h}}}a(k).css("zIndex",1)});if(!f.animIn){f.animIn={left:0,top:0}}if(!f.animOut){f.animOut={left:0,top:0}}f.cssAfter=f.cssAfter||{};f.cssAfter.zIndex=2;f.cssAfter.display="none"};a.fn.cycle.transitions.uncover=function(d,c,f){var b=f.direction||"left";var h=d.css("overflow","hidden").width();var g=d.height();f.before.push(function(k,m,l){l.cssBefore.display="block";if(b=="right"){l.animOut.left=h}else{if(b=="up"){l.animOut.top=-g}else{if(b=="down"){l.animOut.top=g}else{l.animOut.left=-h}}}a(k).css("zIndex",2);a(m).css("zIndex",1)});f.onAddSlide=function(k){k.hide()};if(!f.animIn){f.animIn={left:0,top:0}}f.cssBefore=f.cssBefore||{};f.cssBefore.top=0;f.cssBefore.left=0;f.cssAfter=f.cssAfter||{};f.cssAfter.zIndex=1;f.cssAfter.display="none"};a.fn.cycle.transitions.toss=function(c,b,d){var g=c.css("overflow","visible").width();var f=c.height();d.before.push(function(h,l,k){a(h).css("zIndex",2);k.cssBefore.display="block";if(!k.animOut.left&&!k.animOut.top){k.animOut={left:g*2,top:-f/2,opacity:0}}else{k.animOut.opacity=0}});d.onAddSlide=function(h){h.hide()};d.cssBefore={left:0,top:0,zIndex:1,opacity:1};d.animIn={left:0};d.cssAfter={zIndex:2,display:"none"}};a.fn.cycle.transitions.wipe=function(g,l,c){var h=g.css("overflow","hidden").width();var n=g.height();c.cssBefore=c.cssBefore||{};var b;if(c.clip){if(/l2r/.test(c.clip)){b="rect(0px 0px "+n+"px 0px)"}else{if(/r2l/.test(c.clip)){b="rect(0px "+h+"px "+n+"px "+h+"px)"}else{if(/t2b/.test(c.clip)){b="rect(0px "+h+"px 0px 0px)"}else{if(/b2t/.test(c.clip)){b="rect("+n+"px "+h+"px "+n+"px 0px)"}else{if(/zoom/.test(c.clip)){var f=parseInt(n/2);var o=parseInt(h/2);b="rect("+f+"px "+o+"px "+f+"px "+o+"px)"}}}}}}c.cssBefore.clip=c.cssBefore.clip||b||"rect(0px 0px 0px 0px)";var m=c.cssBefore.clip.match(/(\d+)/g);var f=parseInt(m[0]),d=parseInt(m[1]),k=parseInt(m[2]),o=parseInt(m[3]);c.before.push(function(p,u,r){if(p==u){return}var v=a(p).css("zIndex",2);var w=a(u).css({zIndex:3,display:"block"});var s=1,t=parseInt((r.speedIn/13))-1;function q(){var y=f?f-parseInt(s*(f/t)):0;var x=o?o-parseInt(s*(o/t)):0;var A=k<n?k+parseInt(s*((n-k)/t||1)):n;var z=d<h?d+parseInt(s*((h-d)/t||1)):h;w.css({clip:"rect("+y+"px "+z+"px "+A+"px "+x+"px)"});(s++<=t)?setTimeout(q,13):v.css("display","none")}q()});c.cssAfter={};c.animIn={left:0};c.animOut={left:0}}})(jQuery);jQuery.noConflict();(function(b){b.dimensions={version:"1.2"};b.each(["Height","Width"],function(d,c){b.fn["inner"+c]=function(){if(!this[0]){return}var g=c=="Height"?"Top":"Left",f=c=="Height"?"Bottom":"Right";return this.is(":visible")?this[0]["client"+c]:a(this,c.toLowerCase())+a(this,"padding"+g)+a(this,"padding"+f)};b.fn["outer"+c]=function(g){if(!this[0]){return}var k=c=="Height"?"Top":"Left",f=c=="Height"?"Bottom":"Right";g=b.extend({margin:false},g||{});var h=this.is(":visible")?this[0]["offset"+c]:a(this,c.toLowerCase())+a(this,"border"+k+"Width")+a(this,"border"+f+"Width")+a(this,"padding"+k)+a(this,"padding"+f);return h+(g.margin?(a(this,"margin"+k)+a(this,"margin"+f)):0)}});b.each(["Left","Top"],function(d,c){b.fn["scroll"+c]=function(f){if(!this[0]){return}return f!=undefined?this.each(function(){this==window||this==document?window.scrollTo(c=="Left"?f:b(window)["scrollLeft"](),c=="Top"?f:b(window)["scrollTop"]()):this["scroll"+c]=f}):this[0]==window||this[0]==document?self[(c=="Left"?"pageXOffset":"pageYOffset")]||b.boxModel&&document.documentElement["scroll"+c]||document.body["scroll"+c]:this[0]["scroll"+c]}});b.fn.extend({position:function(){var k=0,h=0,g=this[0],l,c,f,d;if(g){f=this.offsetParent();l=this.offset();c=f.offset();l.top-=a(g,"marginTop");l.left-=a(g,"marginLeft");c.top+=a(f,"borderTopWidth");c.left+=a(f,"borderLeftWidth");d={top:l.top-c.top,left:l.left-c.left}}return d},offsetParent:function(){var c=this[0].offsetParent;while(c&&(!/^body|html$/i.test(c.tagName)&&b.css(c,"position")=="static")){c=c.offsetParent}return b(c)}});function a(c,d){return parseInt(b.curCSS(c.jquery?c[0]:c,d,true))||0}})(jQuery);(function(f){var b={},n,p,r,m=f.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),a=false;f.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){f.tooltip.blocked=!f.tooltip.blocked}};f.fn.extend({tooltip:function(s){s=f.extend({},f.tooltip.defaults,s);k(s);return this.each(function(){f.data(this,"tooltip",s);this.tOpacity=b.parent.css("opacity");this.tooltipText=this.title;f(this).removeAttr("title");this.alt=""}).mouseover(o).mouseout(g).click(g)},fixPNG:m?function(){return this.each(function(){var s=f(this).css("backgroundImage");if(s.match(/^url\(["']?(.*\.png)["']?\)$/i)){s=RegExp.$1;f(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+s+"')"}).each(function(){var t=f(this).css("position");if(t!="absolute"&&t!="relative"){f(this).css("position","relative")}})}})}:function(){return this},unfixPNG:m?function(){return this.each(function(){f(this).css({filter:"",backgroundImage:""})})}:function(){return this},hideWhenEmpty:function(){return this.each(function(){f(this)[f(this).html()?"show":"hide"]()})},url:function(){return this.attr("href")||this.attr("src")}});function k(s){if(b.parent){return}b.parent=f('<div id="'+s.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if(f.fn.bgiframe){b.parent.bgiframe()}b.title=f("h3",b.parent);b.body=f("div.body",b.parent);b.url=f("div.url",b.parent)}function c(s){return f.data(s,"tooltip")}function h(s){if(c(this).delay){r=setTimeout(q,c(this).delay)}else{q()}a=!!c(this).track;f(document.body).bind("mousemove",d);d(s)}function o(){if(f.tooltip.blocked||this==n||(!this.tooltipText&&!c(this).bodyHandler)){return}n=this;p=this.tooltipText;if(c(this).bodyHandler){b.title.hide();var v=c(this).bodyHandler.call(this);if(v.nodeType||v.jquery){b.body.empty().append(v)}else{b.body.html(v)}b.body.show()}else{if(c(this).showBody){var u=p.split(c(this).showBody);b.title.html(u.shift()).show();b.body.empty();for(var t=0,s;(s=u[t]);t++){if(t>0){b.body.append("<br/>")}b.body.append(s)}b.body.hideWhenEmpty()}else{b.title.html(p).show();b.body.hide()}}if(c(this).showURL&&f(this).url()){b.url.html(f(this).url().replace("http://","")).show()}else{b.url.hide()}b.parent.addClass(c(this).extraClass);if(c(this).fixPNG){b.parent.fixPNG()}h.apply(this,arguments)}function q(){r=null;if((!m||!f.fn.bgiframe)&&c(n).fade){if(b.parent.is(":animated")){b.parent.stop().show().fadeTo(c(n).fade,n.tOpacity)}else{b.parent.is(":visible")?b.parent.fadeTo(c(n).fade,n.tOpacity):b.parent.fadeIn(c(n).fade)}}else{b.parent.show()}d()}function d(w){if(f.tooltip.blocked){return}if(w&&w.target.tagName=="OPTION"){return}if(!a&&b.parent.is(":visible")){f(document.body).unbind("mousemove",d)}if(n==null){f(document.body).unbind("mousemove",d);return}b.parent.removeClass("viewport-right").removeClass("viewport-bottom");var y=b.parent[0].offsetLeft;var x=b.parent[0].offsetTop;if(w){y=w.pageX+c(n).left;x=w.pageY+c(n).top;var t="auto";if(c(n).positionLeft){t=f(window).width()-y;y="auto"}b.parent.css({left:y,right:t,top:x})}var s=l(),u=b.parent[0];if(s.x+s.cx<u.offsetLeft+u.offsetWidth){y-=u.offsetWidth+20+c(n).left;b.parent.css({left:y+"px"}).addClass("viewport-right")}if(s.y+s.cy<u.offsetTop+u.offsetHeight){x-=u.offsetHeight+20+c(n).top;b.parent.css({top:x+"px"}).addClass("viewport-bottom")}}function l(){return{x:f(window).scrollLeft(),y:f(window).scrollTop(),cx:f(window).width(),cy:f(window).height()}}function g(u){if(f.tooltip.blocked){return}if(r){clearTimeout(r)}n=null;var t=c(this);function s(){b.parent.removeClass(t.extraClass).hide().css("opacity","")}if((!m||!f.fn.bgiframe)&&t.fade){if(b.parent.is(":animated")){b.parent.stop().fadeTo(t.fade,0,s)}else{b.parent.stop().fadeOut(t.fade,s)}}else{s()}if(c(this).fixPNG){b.parent.unfixPNG()}}})(jQuery);(function(a){a.jScrollPane={active:[]};a.fn.jScrollPane=function(c){c=a.extend({},a.fn.jScrollPane.defaults,c);var b=function(){return false};return this.each(function(){var s=a(this);s.css("overflow","hidden");var B=this;if(a(this).parent().is(".jScrollPaneContainer")){var af=c.maintainPosition?s.position().top:0;var o=a(this).parent();var H=o.innerWidth();var ag=o.outerHeight();var q=ag;a(">.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown",o).remove();s.css({top:0})}else{var af=0;this.originalPadding=s.css("paddingTop")+" "+s.css("paddingRight")+" "+s.css("paddingBottom")+" "+s.css("paddingLeft");this.originalSidePaddingTotal=(parseInt(s.css("paddingLeft"))||0)+(parseInt(s.css("paddingRight"))||0);var H=s.innerWidth();var ag=s.innerHeight();var q=ag;s.wrap(a("<div></div>").attr({className:"jScrollPaneContainer"}).css({height:ag+"px",width:H+"px"}));a(document).bind("emchange",function(ah,ai,p){s.jScrollPane(c)})}if(c.reinitialiseOnImageLoad){var r=a.data(B,"jScrollPaneImagesToLoad")||a("img",s);var h=[];if(r.length){r.each(function(p,ah){a(this).bind("load",function(){if(a.inArray(p,h)==-1){h.push(ah);r=a.grep(r,function(aj,ai){return aj!=ah});a.data(B,"jScrollPaneImagesToLoad",r);c.reinitialiseOnImageLoad=false;s.jScrollPane(c)}}).each(function(ai,aj){if(this.complete||this.complete===undefined){this.src=this.src}})})}}var S=this.originalSidePaddingTotal;var P={height:"auto",width:H-c.scrollbarWidth-c.scrollbarMargin-S+"px"};if(c.scrollbarOnLeft){P.paddingLeft=c.scrollbarMargin+c.scrollbarWidth+"px"}else{P.paddingRight=c.scrollbarMargin+"px"}s.css(P);var Q=s.outerHeight();var M=ag/Q;if(M<0.99){var k=s.parent();k.append(a("<div></div>").attr({className:"jScrollPaneTrack"}).css({width:c.scrollbarWidth+"px"}).append(a("<div></div>").attr({className:"jScrollPaneDrag"}).css({width:c.scrollbarWidth+"px"}).append(a("<div></div>").attr({className:"jScrollPaneDragTop"}).css({width:c.scrollbarWidth+"px"}),a("<div></div>").attr({className:"jScrollPaneDragBottom"}).css({width:c.scrollbarWidth+"px"}))));var ac=a(">.jScrollPaneTrack",k);var t=a(">.jScrollPaneTrack .jScrollPaneDrag",k);if(c.showArrows){var K;var ae;var w;var U;var N=function(){if(U>4||U%4==0){ab(X+ae*F)}U++};var n=function(p){a("html").unbind("mouseup",n);K.removeClass("jScrollActiveArrowButton");clearInterval(w)};var D=function(){a("html").bind("mouseup",n);K.addClass("jScrollActiveArrowButton");U=0;N();w=setInterval(N,100)};k.append(a("<a></a>").attr({href:"javascript:;",className:"jScrollArrowUp"}).css({width:c.scrollbarWidth+"px"}).html("Scroll up").bind("mousedown",function(){K=a(this);ae=-1;D();this.blur();return false}).bind("click",b),a("<a></a>").attr({href:"javascript:;",className:"jScrollArrowDown"}).css({width:c.scrollbarWidth+"px"}).html("Scroll down").bind("mousedown",function(){K=a(this);ae=1;D();this.blur();return false}).bind("click",b));var u=a(">.jScrollArrowUp",k);var m=a(">.jScrollArrowDown",k);if(c.arrowSize){q=ag-c.arrowSize-c.arrowSize;ac.css({height:q+"px",top:c.arrowSize+"px"})}else{var V=u.height();c.arrowSize=V;q=ag-V-m.height();ac.css({height:q+"px",top:V+"px"})}}var Z=a(this).css({position:"absolute",overflow:"visible"});var d;var C;var F;var X=0;var z=M*ag/2;var E=function(ah,aj){var ai=aj=="X"?"Left":"Top";return ah["page"+aj]||(ah["client"+aj]+(document.documentElement["scroll"+ai]||document.body["scroll"+ai]))||0};var J=function(){return false};var Y=function(){R();d=t.offset(false);d.top-=X;C=q-t[0].offsetHeight;F=2*c.wheelSpeed*C/Q};var f=function(p){Y();z=E(p,"Y")-X-d.top;a("html").bind("mouseup",x).bind("mousemove",L);if(a.browser.msie){a("html").bind("dragstart",J).bind("selectstart",J)}return false};var x=function(){a("html").unbind("mouseup",x).unbind("mousemove",L);z=M*ag/2;if(a.browser.msie){a("html").unbind("dragstart",J).unbind("selectstart",J)}};var ab=function(ah){ah=ah<0?0:(ah>C?C:ah);X=ah;t.css({top:ah+"px"});var ai=ah/C;s.data("jScrollPanePosition",(ag-Q)*-ai);Z.css({top:((ag-Q)*ai)+"px"});s.trigger("scroll");if(c.showArrows){u[ah==0?"addClass":"removeClass"]("disabled");m[ah==C?"addClass":"removeClass"]("disabled")}};var L=function(p){ab(E(p,"Y")-d.top-z)};var T=Math.max(Math.min(M*(ag-c.arrowSize*2),c.dragMaxHeight),c.dragMinHeight);t.css({height:T+"px"}).bind("mousedown",f);var O;var v;var l;var W=function(){if(v>8||v%4==0){ab((X-((X-l)/2)))}v++};var ad=function(){clearInterval(O);a("html").unbind("mouseup",ad).unbind("mousemove",I)};var I=function(p){l=E(p,"Y")-d.top-z};var y=function(p){Y();I(p);v=0;a("html").bind("mouseup",ad).bind("mousemove",I);O=setInterval(W,100);W()};ac.bind("mousedown",y);k.bind("mousewheel",function(ah,aj){Y();R();var ai=X;ab(X-aj*F);var p=ai!=X;return !p});var g;var A;function G(){var p=(g-X)/c.animateStep;if(p>1||p<-1){ab(X+p)}else{ab(g);R()}}var R=function(){if(A){clearInterval(A);delete g}};var aa=function(aj,p){if(typeof aj=="string"){$e=a(aj,s);if(!$e.length){return}aj=$e.offset().top-s.offset().top}k.scrollTop(0);R();var ai=Q-ag;aj=aj>ai?ai:aj;s.data("jScrollPaneMaxScroll",ai);var ah=aj/ai*C;if(p||!c.animateTo){ab(ah)}else{g=ah;A=setInterval(G,c.animateInterval)}};s[0].scrollTo=aa;s[0].scrollBy=function(ah){var p=-parseInt(Z.css("top"))||0;aa(p+ah)};Y();aa(-af,true);a("*",this).bind("focus",function(ak){var aj=a(this);var am=0;while(aj[0]!=s[0]){am+=aj.position().top;aj=aj.offsetParent()}var p=-parseInt(Z.css("top"))||0;var al=p+ag;var ai=am>p&&am<al;if(!ai){var ah=am-c.scrollbarMargin;if(am>p){ah+=a(this).height()+15+c.scrollbarMargin-ag}aa(ah)}});if(location.hash){aa(location.hash)}a(document).bind("click",function(ah){$target=a(ah.target);if($target.is("a")){var p=$target.attr("href");if(p.substr(0,1)=="#"){aa(p)}}});a.jScrollPane.active.push(s[0])}else{s.css({height:ag+"px",width:H-this.originalSidePaddingTotal+"px",padding:this.originalPadding});s.parent().unbind("mousewheel")}})};a.fn.jScrollPaneRemove=function(){a(this).each(function(){$this=a(this);var b=$this.parent();if(b.is(".jScrollPaneContainer")){$this.css({top:"",height:"",width:"",padding:"",overflow:"",position:""});b.after($this).remove()}})};a.fn.jScrollPane.defaults={scrollbarWidth:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,reinitialiseOnImageLoad:false};a(window).bind("unload",function(){var c=a.jScrollPane.active;for(var b=0;b<c.length;b++){c[b].scrollTo=c[b].scrollBy=null}})})(jQuery);function require(obj,lib,handler){if(Object.prototype.toString.call(obj)!=="[object Array]"){obj=[obj]}if(typeof(lib)==="function"){handler=lib;lib=undefined}var badnews=[],len=obj.length,i;for(i=0;i<len;i++){try{if(eval("typeof("+obj[i]+") === 'undefined'")){throw"Bad voodoo"}}catch(e){badnews.push(obj[i])}}if(badnews.length){if(typeof(handler)==="function"){handler()}else{throw lib?lib+" requires "+badnews.join(" and ")+" to be loaded":badnews.join(" and ")+" "+(badnews.length>1?"are":"is")+" required to be loaded"}}}require("jQuery","CG");require("console",function(){window.console={log:function(){}}});(function(a){CG=a.extend(true,typeof(CG)==="undefined"?{}:CG,{options:typeof(CG)==="undefined"?{}:CG.options||{},GAMES:{1:{name:"Duels",link:"http://www.duels.com",hasBulletins:true},2:{name:"Baseball Boss",link:"http://www.baseballboss.com",hasBulletins:true},3:{name:"Warstorm",link:"http://www.warstorm.com",hasBulletins:true},6:{name:"MechDuels",link:"http://www.mechduels.com",hasBulletins:true},7:{name:"Planetstorm",link:"http://www.planetstorm.com",hasBulletins:false},dd:{name:"Duels Defense",link:"http://www.duelsdefense.com",hasBulletins:false}},DEBUG:2,events:{startup:(function(){a(document).ready(function(){require("CG.Event","CG");CG.events.startup.fire()});return null})()}})})(jQuery);require(["jQuery","CG"],"CG.Event");(function(a){CG.Event=function(b){this._scope=b||window;this._handlers=[];this._firing=false};CG.Event.prototype={subscribe:function(d,b,c){if(this.checkHandler(d)===-1){var c=c||this._scope,b=b||0,f=this._handlers.length;a.each(this._handlers,function(g,k){if(k.p>b){f=g;return false}});this._handlers.splice(f,0,{f:d,p:b,s:c})}return this},unsubscribe:function(c){var b=this.checkHandler(c);if(b!==-1){this._handlers.splice(b,1)}return this},fire:function(d){var f=this;if(!this._firing){this._firing=true;var b=this._handlers.slice(),c=[],d=d||{};(function g(){if(b.length){var l=b.shift(),k=l.f.call(l.s,f,d)||true;c.push(k);if(k===false){b=[]}setTimeout(g,10)}else{f._firing=false}})()}else{setTimeout(function(){f.fire(d)},10)}return this},checkHandler:function(b){var c;a.each(this._handlers,function(d,f){if(f.f&&f.f===b){c=d}});return c===undefined?-1:c}};if(CG.events){CG.events.startup=new CG.Event()}})(jQuery);require(["jQuery","CG","CG.Event"],"CG.Overlay");(function(a){CG.Overlay=(function(){var c,d=new CG.Event(),f=new CG.Event(),b=function(){if(!c){c=new g()}return c},g=function(){var m=this,h,l,o=function(){l=a('<iframe id="top_bar_shim" frameborder="0" src="javascript:void(0);"/>').css({position:"absolute",filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0);",top:0,left:0,width:"100%",display:"none"}).insertBefore("#top_bar");h=a('<div id="top_bar_overlay"></div>').css({background:"#000",top:0,left:0,width:"100%",display:"none"}).insertBefore(l);l.css("zIndex",h.css("zIndex")-1);a.extend(m,{hide:k,show:p,visible:n})},n=function(){return h.is(":visible")},k=function(){h.animate({opacity:0},300,function(){f.fire()}).hide();l.hide();return m},p=function(){var q=a(document).height();if(h.height()<q){h.height(q);l.height(q)}d.fire();h.css("opacity",0).show().animate({opacity:0.75},300);l.show();return m};o()};return{getInstance:b,events:{beforeShow:d,afterHide:f}}})()})(jQuery);require(["jQuery","CG","CG.Event","CG.Overlay"],"CG.TopBarDropdown");(function(a){CG.TopBarDropdown=function(g){var q=this,u=a(g),h=++CG.TopBarDropdown.id_count,A=u.parents("#top_bar"),t=u.find("> a"),p=u.find("> .sub_content"),n,B=false,b=CG.TopBarDropdown.animating,x=false,r=function(){a(document.body).click(l);t.click(w);CG.TopBarDropdown.events.beforeShow.subscribe(o);CG.TopBarDropdown.events.afterShow.subscribe(k);CG.TopBarDropdown.events.beforeHide.subscribe(z);CG.TopBarDropdown.events.afterHide.subscribe(y);a.extend(q,{_topBar:A,_container:p,_title:t,getId:d,show:s,hide:f,toggle:c,_checkId:m})},d=function(){return h},m=function(C){return C===h},v=function(){p.css("backgroundPosition","-"+(p.offset().left-((A.width()-1194)/2))+"px 1px")},s=function(){if(!B&&!b){b=true;if(!n){n=CG.Overlay.getInstance()}CG.TopBarDropdown.events.beforeShow.fire({id:h});p.slideDown(500,function(){B=true;b=false;CG.TopBarDropdown.events.afterShow.fire({id:h})})}return q},f=function(){if(B&&!b){b=true;CG.TopBarDropdown.events.beforeHide.fire({id:h});p.slideUp(500,function(){B=false;b=false;CG.TopBarDropdown.events.afterHide.fire({id:h})})}return q},c=function(){B?f():s();return q},o=function(D,C){if(m(C.id)){CG.TopBarDropdown.animating=true;if(CG.TopBarDropdown.open_count==0){n.show()}CG.TopBarDropdown.open_count++}},k=function(D,C){if(m(C.id)){CG.TopBarDropdown.animating=false;if(!x){v()}x=true}},z=function(D,C){if(m(C.id)){CG.TopBarDropdown.animating=true}},y=function(D,C){if(m(C.id)){CG.TopBarDropdown.open_count--;if(CG.TopBarDropdown.open_count==0){n.hide()}CG.TopBarDropdown.animating=false}},w=function(C){c()},l=function(C){if(C==undefined||(C.type=="click"&&a(C.target).parents().index(p.get(0))==-1)){f()}if(a(C.target).get(0)==t.get(0)){return false}};r()};a.extend(CG.TopBarDropdown,{id_count:0,open_count:0,animating:false,events:{beforeShow:new CG.Event(),afterShow:new CG.Event(),beforeHide:new CG.Event(),afterHide:new CG.Event()}})})(jQuery);require("jQuery","CG.Util");(function($){$.fn.getData=function(key){var att=this.attr("data-"+key),data;if(att){try{data=eval("("+att+")")}catch(e){data=att}}return data};$.fn.truncate=function(length,elips){var length=length||20,elips=elips||"...";return this.each(function(){var obj=$(this),content=obj.text();if(content.length>length){obj.text(content.substr(0,length)+elips)}})}})(jQuery);(function(d){d.fn.jqm=function(m){var f={overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:p,ajaxText:"",target:p,modal:p,toTop:p,onShow:p,onHide:p,onLoad:p};return this.each(function(){if(this._jqm){return o[this._jqm].c=d.extend({},o[this._jqm].c,m)}q++;this._jqm=q;o[q]={c:d.extend(f,d.jqm.params,m),a:p,w:d(this).addClass("jqmID"+q),s:q};if(f.trigger){d(this).jqmAddTrigger(f.trigger)}})};d.fn.jqmAddClose=function(f){return n(this,f,"jqmHide")};d.fn.jqmAddTrigger=function(f){return n(this,f,"jqmShow")};d.fn.jqmShow=function(f){return this.each(function(){f=f||window.event;d.jqm.open(this._jqm,f)})};d.fn.jqmHide=function(f){return this.each(function(){f=f||window.event;d.jqm.close(this._jqm,f)})};d.jqm={hash:{},open:function(E,D){var w=o[E],x=w.c,v="."+x.closeClass,A=(parseInt(w.w.css("z-index"))),A=(A>0)?A:3000,m=d("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":A-1,opacity:x.overlay/100});if(w.a){return p}w.t=D;w.a=true;w.w.css("z-index",A);if(x.modal){if(!a[0]){l("bind")}a.push(E)}else{if(x.overlay>0){w.w.jqmAddClose(m)}else{m=p}}w.o=(m)?m.addClass(x.overlayClass).prependTo("body"):p;if(c){d("html,body").css({height:"100%",width:"100%"});if(m){m=m.css({position:"absolute"})[0];for(var B in {Top:1,Left:1}){m.style.setExpression(B.toLowerCase(),"(_=(document.documentElement.scroll"+B+" || document.body.scroll"+B+"))+'px'")}}}if(x.ajax){var f=x.target||w.w,C=x.ajax,f=(typeof f=="string")?d(f,w.w):d(f),C=(C.substr(0,1)=="@")?d(D).attr(C.substring(1)):C;f.html(x.ajaxText).load(C,function(){if(x.onLoad){x.onLoad.call(this,w)}if(v){w.w.jqmAddClose(d(v,w.w))}k(w)})}else{if(v){w.w.jqmAddClose(d(v,w.w))}}if(x.toTop&&w.o){w.w.before('<span id="jqmP'+w.w[0]._jqm+'"></span>').insertAfter(w.o)}(x.onShow)?x.onShow(w):w.w.show();k(w);return p},close:function(m){var f=o[m];if(!f.a){return p}f.a=p;if(a[0]){a.pop();if(!a[0]){l("unbind")}}if(f.c.toTop&&f.o){d("#jqmP"+f.w[0]._jqm).after(f.w).remove()}if(f.c.onHide){f.c.onHide(f)}else{f.w.hide();if(f.o){f.o.remove()}}return p},params:{}};var q=0,o=d.jqm.hash,a=[],c=d.browser.msie&&(d.browser.version=="6.0"),p=false,g=d('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),k=function(f){if(c){if(f.o){f.o.html('<p style="width:100%;height:100%"/>').prepend(g)}else{if(!d("iframe.jqm",f.w)[0]){f.w.prepend(g)}}}h(f)},h=function(m){try{d(":input:visible",m.w)[0].focus()}catch(f){}},l=function(f){d()[f]("keypress",b)[f]("keydown",b)[f]("mousedown",b)},b=function(s){var f=o[a[a.length-1]],m=(!d(s.target).parents(".jqmID"+f.s)[0]);if(m){h(f)}return !m},n=function(f,m,r){return f.each(function(){var t=this._jqm;d(m).each(function(){if(!this[r]){this[r]=[];d(this).click(function(){for(var u in {jqmShow:1,jqmHide:1}){for(var v in this[u]){if(o[this[u][v]]){o[this[u][v]].w[u](this)}}}return p})}this[r].push(t)})})}})(jQuery);(function(d){d.growl=function(k,g,h,f){a(k,g,h,f)};d.growl.version="1.0.0-b2";function b(g){var f=document.getElementById("growlDock");if(!f||g){f=d(d.growl.settings.dockTemplate).attr("id","growlDock").addClass("growl");if(d.growl.settings.defaultStylesheet){d("head").append('<link rel="stylesheet" type="text/css" href="'+d.growl.settings.defaultStylesheet+'" />')}}else{f=d(f)}d("body").append(f.css(d.growl.settings.dockCss));return f}function c(h,f,g){while(f.test(h)){h=h.replace(f,g)}return h}function a(n,k,m,h){var f=b();var g=d.growl.settings.noticeTemplate;if(typeof(g)=="object"){g=d(g).html()}g=c(g,/%message%/,(k?k:""));g=c(g,/%title%/,(n?n:""));g=c(g,/%image%/,(m?m:d.growl.settings.defaultImage));g=c(g,/%priority%/,(h?h:"normal"));var l=d(g).hide().css(d.growl.settings.noticeCss).fadeIn(d.growl.settings.notice);d.growl.settings.noticeDisplay(l);f.append(l);d('a[rel="close"]',l).click(function(){l.remove()});if(d.growl.settings.displayTimeout>0){setTimeout(function(){d.growl.settings.noticeRemove(l,function(){l.remove()})},d.growl.settings.displayTimeout)}}d.growl.settings={dockTemplate:"<div></div>",dockCss:{position:"fixed",top:"10px",right:"10px",width:"300px",zIndex:50000},noticeTemplate:'<div class="cg-growl-notice"><a rel="close" class="cg-growl-close" href="#">close</a> <h3>%title%</h3> <p>%message%</p></div>',noticeCss:{opacity:0.75,backgroundColor:"#333333",color:"#ffffff",padding:"15px",marginBottom:"15px"},noticeDisplay:function(f){f.css({opacity:"0"}).fadeIn(d.growl.settings.noticeFadeTimeout)},noticeRemove:function(f,g){f.animate({opacity:"0",height:"0px"},{duration:d.growl.settings.noticeFadeTimeout,complete:g})},noticeFadeTimeout:"slow",displayTimeout:3500,defaultImage:"growl.jpg",defaultStylesheet:null,noticeElement:function(f){d.growl.settings.noticeTemplate=d(f)}}})(jQuery);CG=typeof(CG)=="undefined"?{}:CG;CG.options={FriendManager:{defaultGame:2,FB:{inviteMessage:"Come play Warstorm! Collect virtual cards, use them to make an army and compete against other players online. Get a starter pack when you register. And oh yeah, it&#39;s free to play, so enter the storm now!",inviteType:"Warstorm",inviteLanding:"http://www.warstorm.com/promos/landing/ws-fbc-invite"}},AwardManager:{redeem:"http://www.warstorm.com/marketplace#market_tabs:rewards"}};CG=typeof(CG)=="undefined"?{}:CG;CG.options={FriendManager:{defaultGame:2,FB:{inviteMessage:"Come play Planetstorm! Collect virtual cards, use them to make an army and compete against other players online. Get a starter pack when you register. And oh yeah, it&#39;s free to play, so enter the storm now!",inviteType:"Planetstorm",inviteLanding:"http://www.planetstorm.com/promos/landing/ws-fbc-invite"}},AwardManager:{redeem:"http://www.planetstorm.com/marketplace#market_tabs:rewards"}};(function(a){a.event.special.mousewheel={setup:function(){var b=a.event.special.mousewheel.handler;if(a.browser.mozilla){a(this).bind("mousemove.mousewheel",function(c){a.data(this,"mwcursorposdata",{pageX:c.pageX,pageY:c.pageY,clientX:c.clientX,clientY:c.clientY})})}if(this.addEventListener){this.addEventListener((a.browser.mozilla?"DOMMouseScroll":"mousewheel"),b,false)}else{this.onmousewheel=b}},teardown:function(){var b=a.event.special.mousewheel.handler;a(this).unbind("mousemove.mousewheel");if(this.removeEventListener){this.removeEventListener((a.browser.mozilla?"DOMMouseScroll":"mousewheel"),b,false)}else{this.onmousewheel=function(){}}a.removeData(this,"mwcursorposdata")},handler:function(d){var b=Array.prototype.slice.call(arguments,1);d=a.event.fix(d||window.event);a.extend(d,a.data(this,"mwcursorposdata")||{});var f=0,c=true;if(d.wheelDelta){f=d.wheelDelta/120}if(d.detail){f=-d.detail/3}d.data=d.data||{};d.type="mousewheel";b.unshift(f);b.unshift(d);return a.event.handle.apply(this,b)}};a.fn.extend({mousewheel:function(b){return b?this.bind("mousewheel",b):this.trigger("mousewheel")},unmousewheel:function(b){return this.unbind("mousewheel",b)}})})(jQuery);var Prototype={Version:"1.6.0.2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class={create:function(){var f=null,d=$A(arguments);if(Object.isFunction(d[0])){f=d.shift()}function a(){this.initialize.apply(this,arguments)}Object.extend(a,Class.Methods);a.superclass=f;a.subclasses=[];if(f){var b=function(){};b.prototype=f.prototype;a.prototype=new b;f.subclasses.push(a)}for(var c=0;c<d.length;c++){a.addMethods(d[c])}if(!a.prototype.initialize){a.prototype.initialize=Prototype.emptyFunction}a.prototype.constructor=a;return a}};Class.Methods={addMethods:function(h){var c=this.superclass&&this.superclass.prototype;var b=Object.keys(h);if(!Object.keys({toString:true}).length){b.push("toString","valueOf")}for(var a=0,d=b.length;a<d;a++){var g=b[a],f=h[g];if(c&&Object.isFunction(f)&&f.argumentNames().first()=="$super"){var k=f,f=Object.extend((function(l){return function(){return c[l].apply(this,arguments)}})(g).wrap(k),{valueOf:function(){return k},toString:function(){return k.toString()}})}this.prototype[g]=f}return this}};var Abstract={};Object.extend=function(a,c){for(var b in c){a[b]=c[b]}return a};Object.extend(Object,{inspect:function(a){try{if(Object.isUndefined(a)){return"undefined"}if(a===null){return"null"}return a.inspect?a.inspect():String(a)}catch(b){if(b instanceof RangeError){return"..."}throw b}},toJSON:function(a){var c=typeof a;switch(c){case"undefined":case"function":case"unknown":return;case"boolean":return a.toString()}if(a===null){return"null"}if(a.toJSON){return a.toJSON()}if(Object.isElement(a)){return}var b=[];for(var f in a){var d=Object.toJSON(a[f]);if(!Object.isUndefined(d)){b.push(f.toJSON()+": "+d)}}return"{"+b.join(", ")+"}"},toQueryString:function(a){return $H(a).toQueryString()},toHTML:function(a){return a&&a.toHTML?a.toHTML():String.interpret(a)},keys:function(a){var b=[];for(var c in a){b.push(c)}return b},values:function(b){var a=[];for(var c in b){a.push(b[c])}return a},clone:function(a){return Object.extend({},a)},isElement:function(a){return a&&a.nodeType==1},isArray:function(a){return a!=null&&typeof a=="object"&&"splice" in a&&"join" in a},isHash:function(a){return a instanceof Hash},isFunction:function(a){return typeof a=="function"},isString:function(a){return typeof a=="string"},isNumber:function(a){return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var a=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return a.length==1&&!a[0]?[]:a},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var a=this,c=$A(arguments),b=c.shift();return function(){return a.apply(b,c.concat($A(arguments)))}},bindAsEventListener:function(){var a=this,c=$A(arguments),b=c.shift();return function(d){return a.apply(b,[d||window.event].concat(c))}},curry:function(){if(!arguments.length){return this}var a=this,b=$A(arguments);return function(){return a.apply(this,b.concat($A(arguments)))}},delay:function(){var a=this,b=$A(arguments),c=b.shift()*1000;return window.setTimeout(function(){return a.apply(a,b)},c)},wrap:function(b){var a=this;return function(){return b.apply(this,[a.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized){return this._methodized}var a=this;return this._methodized=function(){return a.apply(null,[this].concat($A(arguments)))}}});Function.prototype.defer=Function.prototype.delay.curry(0.01);Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute()}finally{this.currentlyExecuting=false}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(f,c){var a="",d=this,b;c=arguments.callee.prepareReplacement(c);while(d.length>0){if(b=d.match(f)){a+=d.slice(0,b.index);a+=String.interpret(c(b));d=d.slice(b.index+b[0].length)}else{a+=d,d=""}}return a},sub:function(c,a,b){a=this.gsub.prepareReplacement(a);b=Object.isUndefined(b)?1:b;return this.gsub(c,function(d){if(--b<0){return d[0]}return a(d)})},scan:function(b,a){this.gsub(b,a);return String(this)},truncate:function(b,a){b=b||30;a=Object.isUndefined(a)?"...":a;return this.length>b?this.slice(0,b-a.length)+a:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img");var a=new RegExp(Prototype.ScriptFragment,"im");return(this.match(b)||[]).map(function(c){return(c.match(a)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var a=arguments.callee;a.text.data=this;return a.div.innerHTML},unescapeHTML:function(){var a=new Element("div");a.innerHTML=this.stripTags();return a.childNodes[0]?(a.childNodes.length>1?$A(a.childNodes).inject("",function(b,c){return b+c.nodeValue}):a.childNodes[0].nodeValue):""},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a){return{}}return a[1].split(b||"&").inject({},function(f,g){if((g=g.split("="))[0]){var c=decodeURIComponent(g.shift());var d=g.length>1?g.join("="):g[0];if(d!=undefined){d=decodeURIComponent(d)}if(c in f){if(!Object.isArray(f[c])){f[c]=[f[c]]}f[c].push(d)}else{f[c]=d}}return f})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(a){return a<1?"":new Array(a+1).join(this)},camelize:function(){var d=this.split("-"),a=d.length;if(a==1){return d[0]}var c=this.charAt(0)=="-"?d[0].charAt(0).toUpperCase()+d[0].substring(1):d[0];for(var b=1;b<a;b++){c+=d[b].charAt(0).toUpperCase()+d[b].substring(1)}return c},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(b){var a=this.gsub(/[\x00-\x1f\\]/,function(c){var d=String.specialChar[c[0]];return d?d:"\\u00"+c[0].charCodeAt().toPaddedString(2,16)});if(b){return'"'+a.replace(/"/g,'\\"')+'"'}return"'"+a.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){var a=this;if(a.blank()){return false}a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(a)},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(a){return this.indexOf(a)>-1},startsWith:function(a){return this.indexOf(a)===0},endsWith:function(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(a,b){return new Template(this,b).evaluate(a)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(b){if(Object.isFunction(b)){return b}var a=new Template(b);return function(c){return a.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text)}var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(d){if(a==null){return""}var g=d[1]||"";if(g=="\\"){return d[2]}var b=a,h=d[3];var f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;d=f.exec(h);if(d==null){return g}while(d!=null){var c=d[1].startsWith("[")?d[2].gsub("\\\\]","]"):d[1];b=b[c];if(null==b||""==d[3]){break}h=h.substring("["==d[3]?d[1].length:d[0].length);d=f.exec(h)}return g+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(c,b){var a=0;c=c.bind(b);try{this._each(function(f){c(f,a++)})}catch(d){if(d!=$break){throw d}}return this},eachSlice:function(d,c,b){c=c?c.bind(b):Prototype.K;var a=-d,f=[],g=this.toArray();while((a+=d)<g.length){f.push(g.slice(a,a+d))}return f.collect(c,b)},all:function(c,b){c=c?c.bind(b):Prototype.K;var a=true;this.each(function(f,d){a=a&&!!c(f,d);if(!a){throw $break}});return a},any:function(c,b){c=c?c.bind(b):Prototype.K;var a=false;this.each(function(f,d){if(a=!!c(f,d)){throw $break}});return a},collect:function(c,b){c=c?c.bind(b):Prototype.K;var a=[];this.each(function(f,d){a.push(c(f,d))});return a},detect:function(c,b){c=c.bind(b);var a;this.each(function(f,d){if(c(f,d)){a=f;throw $break}});return a},findAll:function(c,b){c=c.bind(b);var a=[];this.each(function(f,d){if(c(f,d)){a.push(f)}});return a},grep:function(d,c,b){c=c?c.bind(b):Prototype.K;var a=[];if(Object.isString(d)){d=new RegExp(d)}this.each(function(g,f){if(d.match(g)){a.push(c(g,f))}});return a},include:function(a){if(Object.isFunction(this.indexOf)){if(this.indexOf(a)!=-1){return true}}var b=false;this.each(function(c){if(c==a){b=true;throw $break}});return b},inGroupsOf:function(b,a){a=Object.isUndefined(a)?null:a;return this.eachSlice(b,function(c){while(c.length<b){c.push(a)}return c})},inject:function(a,c,b){c=c.bind(b);this.each(function(f,d){a=c(a,f,d)});return a},invoke:function(b){var a=$A(arguments).slice(1);return this.map(function(c){return c[b].apply(c,a)})},max:function(c,b){c=c?c.bind(b):Prototype.K;var a;this.each(function(f,d){f=c(f,d);if(a==null||f>=a){a=f}});return a},min:function(c,b){c=c?c.bind(b):Prototype.K;var a;this.each(function(f,d){f=c(f,d);if(a==null||f<a){a=f}});return a},partition:function(d,b){d=d?d.bind(b):Prototype.K;var c=[],a=[];this.each(function(g,f){(d(g,f)?c:a).push(g)});return[c,a]},pluck:function(b){var a=[];this.each(function(c){a.push(c[b])});return a},reject:function(c,b){c=c.bind(b);var a=[];this.each(function(f,d){if(!c(f,d)){a.push(f)}});return a},sortBy:function(b,a){b=b.bind(a);return this.map(function(d,c){return{value:d,criteria:b(d,c)}}).sort(function(g,f){var d=g.criteria,c=f.criteria;return d<c?-1:d>c?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var b=Prototype.K,a=$A(arguments);if(Object.isFunction(a.last())){b=a.pop()}var c=[this].concat(a).map($A);return this.map(function(f,d){return b(c.pluck(d))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(c){if(!c){return[]}if(c.toArray){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}if(Prototype.Browser.WebKit){$A=function(c){if(!c){return[]}if(!(Object.isFunction(c)&&c=="[object NodeList]")&&c.toArray){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(b){for(var a=0,c=this.length;a<c;a++){b(this[a])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(b,a){return b.concat(Object.isArray(a)?a.flatten():[a])})},without:function(){var a=$A(arguments);return this.select(function(b){return !a.include(b)})},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(a){return this.inject([],function(d,c,b){if(0==b||(a?d.last()!=c:!d.include(c))){d.push(c)}return d})},intersect:function(a){return this.uniq().findAll(function(b){return a.detect(function(c){return b===c})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var a=[];this.each(function(b){var c=Object.toJSON(b);if(!Object.isUndefined(c)){a.push(c)}});return"["+a.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(c,a){a||(a=0);var b=this.length;if(a<0){a=b+a}for(;a<b;a++){if(this[a]===c){return a}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(b,a){a=isNaN(a)?this.length:(a<0?this.length+a:a)+1;var c=this.slice(0,a).reverse().indexOf(b);return(c<0)?c:a-c-1}}Array.prototype.toArray=Array.prototype.clone;function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var f=[];for(var b=0,c=this.length;b<c;b++){f.push(this[b])}for(var b=0,c=arguments.length;b<c;b++){if(Object.isArray(arguments[b])){for(var a=0,d=arguments[b].length;a<d;a++){f.push(arguments[b][a])}}else{f.push(arguments[b])}}return f}}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this},toPaddedString:function(c,b){var a=this.toString(b||10);return"0".times(c-a.length)+a},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(a){Number.prototype[a]=Math[a].methodize()});function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function a(b,c){if(Object.isUndefined(c)){return b}return b+"="+encodeURIComponent(String.interpret(c))}return{initialize:function(b){this._object=Object.isHash(b)?b.toObject():Object.clone(b)},_each:function(c){for(var b in this._object){var d=this._object[b],f=[b,d];f.key=b;f.value=d;c(f)}},set:function(b,c){return this._object[b]=c},get:function(b){return this._object[b]},unset:function(b){var c=this._object[b];delete this._object[b];return c},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(c){var b=this.detect(function(d){return d.value===c});return b&&b.key},merge:function(b){return this.clone().update(b)},update:function(b){return new Hash(b).inject(this,function(c,d){c.set(d.key,d.value);return c})},toQueryString:function(){return this.map(function(d){var c=encodeURIComponent(d.key),b=d.value;if(b&&typeof b=="object"){if(Object.isArray(b)){return b.map(a.curry(c)).join("&")}}return a(c,b)}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(b){return b.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(c,a,b){this.start=c;this.end=a;this.exclusive=b},_each:function(a){var b=this.start;while(this.include(b)){a(b);b=b.succ()}},include:function(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}});var $R=function(c,a,b){return new ObjectRange(c,a,b)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(d,b,c,a){this.each(function(f){if(Object.isFunction(f[d])){try{f[d].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var d=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){d._method=this.method;this.method="post"}this.parameters=d;if(d=Object.toQueryString(d)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+d}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){d+="&_="}}}try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var f={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){f["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){f.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,d=c.length;b<d;b+=2){f[c[b]]=c[b+1]}}else{$H(c).each(function(g){f[g.key]=g.value})}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(d){this.dispatchException(d)}var f=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&f&&f.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var d=this.transport=c.transport,a=this.readyState=d.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(d.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=d.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var d=b.onComplete;b.onComplete=(function(f,g){this.updateContent(f.responseText);if(Object.isFunction(d)){d(f,g)}}).bind(this);$super(c,b)},updateContent:function(d){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){d=d.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=d;c.insert(b)}else{a.insertion(c,d)}}else{c.update(d)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push($(arguments[a]))}return d}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(g,a){var c=[];var f=document.evaluate(g,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,d=f.snapshotLength;b<d;b++){c.push(Element.extend(f.snapshotItem(b)))}return c}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(){var a=this.Element;this.Element=function(d,c){c=c||{};d=d.toLowerCase();var b=Element.cache;if(Prototype.Browser.IE&&c.name){d="<"+d+' name="'+c.name+'">';delete c.name;return Element.writeAttribute(document.createElement(d),c)}if(!b[d]){b[d]=Element.extend(document.createElement(d))}return Element.writeAttribute(b[d].cloneNode(false),c)};Object.extend(this.Element,a||{})}).call(window);Element.cache={};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){$(a).style.display="none";return a},show:function(a){$(a).style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(a,b){a=$(a);if(b&&b.toElement){b=b.toElement()}if(Object.isElement(b)){return a.update().insert(b)}b=Object.toHTML(b);a.innerHTML=b.stripScripts();b.evalScripts.bind(b).defer();return a},replace:function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}else{if(!Object.isElement(c)){c=Object.toHTML(c);var a=b.ownerDocument.createRange();a.selectNode(b);c.evalScripts.bind(c).defer();c=a.createContextualFragment(c.stripScripts())}}b.parentNode.replaceChild(c,b);return b},insert:function(c,f){c=$(c);if(Object.isString(f)||Object.isNumber(f)||Object.isElement(f)||(f&&(f.toElement||f.toHTML))){f={bottom:f}}var d,g,b,h;for(var a in f){d=f[a];a=a.toLowerCase();g=Element._insertionTranslations[a];if(d&&d.toElement){d=d.toElement()}if(Object.isElement(d)){g(c,d);continue}d=Object.toHTML(d);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();h=Element._getContentFromAnonymousElement(b,d.stripScripts());if(a=="top"||a=="after"){h.reverse()}h.each(g.curry(c));d.evalScripts.bind(d).defer()}return c},wrap:function(b,c,a){b=$(b);if(Object.isElement(c)){$(c).writeAttribute(a||{})}else{if(Object.isString(c)){c=new Element(c,a)}else{c=new Element("div",c)}}if(b.parentNode){b.parentNode.replaceChild(c,b)}c.appendChild(b);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(g){var f=g.first(),c=g.last();var d=(b[f]||"").toString();if(d){a+=" "+c+"="+d.inspect(true)}});return a+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $(a).select("*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(b,a){if(Object.isString(a)){a=new Selector(a)}return a.match($(b))},up:function(b,d,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=b.ancestors();return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},down:function(b,c,a){b=$(b);if(arguments.length==1){return b.firstDescendant()}return Object.isNumber(c)?b.descendants()[c]:b.select(c)[a||0]},previous:function(b,d,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var c=b.previousSiblings();return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},next:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=c.nextSiblings();return Object.isNumber(d)?a[d]:Selector.findElement(a,d,b)},select:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},adjacent:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b.parentNode,a).without(b)},identify:function(b){b=$(b);var c=b.readAttribute("id"),a=arguments.callee;if(c){return c}do{c="anonymous_element_"+a.counter++}while($(c));b.writeAttribute("id",c);return c},readAttribute:function(c,a){c=$(c);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!c.attributes||!c.attributes[a])?null:c.attributes[a].value}}return c.getAttribute(a)},writeAttribute:function(f,c,g){f=$(f);var b={},d=Element._attributeTranslations.write;if(typeof c=="object"){b=c}else{b[c]=Object.isUndefined(g)?true:g}for(var a in b){c=d.names[a]||a;g=b[a];if(d.values[a]){c=d.values[a](f,g)}if(g===false||g===null){f.removeAttribute(c)}else{if(g===true){f.setAttribute(c,c)}else{f.setAttribute(c,g)}}}return f},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},addClassName:function(a,b){if(!(a=$(a))){return}if(!a.hasClassName(b)){a.className+=(a.className?" ":"")+b}return a},removeClassName:function(a,b){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a))){return}return a[a.hasClassName(b)?"removeClassName":"addClassName"](b)},cleanWhitespace:function(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(f,d){f=$(f),d=$(d);var h=d;if(f.compareDocumentPosition){return(f.compareDocumentPosition(d)&8)===8}if(f.sourceIndex&&!Prototype.Browser.Opera){var g=f.sourceIndex,c=d.sourceIndex,b=d.nextSibling;if(!b){do{d=d.parentNode}while(!(b=d.nextSibling)&&d.parentNode)}if(b&&b.sourceIndex){return(g>c&&g<b.sourceIndex)}}while(f=f.parentNode){if(f==h){return true}}return false},scrollTo:function(a){a=$(a);var b=a.cumulativeOffset();window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}if(c=="opacity"){return d?parseFloat(d):1}return d=="auto"?null:d},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,c){b=$(b);var f=b.style,a;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var d in c){if(d=="opacity"){b.setOpacity(c[d])}else{f[(d=="float"||d=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):d]=c[d]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(c){c=$(c);var h=$(c).getStyle("display");if(h!="none"&&h!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var g=b.visibility;var d=b.position;var a=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var k=c.clientWidth;var f=c.clientHeight;b.display=a;b.position=d;b.visibility=g;return{width:k,height:f}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(window.opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(c,a)},positionedOffset:function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName=="BODY"){break}var c=Element.getStyle(b,"position");if(c!=="static"){break}}}while(b);return Element._returnOffset(d,a)},absolutize:function(b){b=$(b);if(b.getStyle("position")=="absolute"){return}var d=b.positionedOffset();var g=d[1];var f=d[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=f-parseFloat(b.style.left||0);b._originalTop=g-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=g+"px";b.style.left=f+"px";b.style.width=c+"px";b.style.height=a+"px";return b},relativize:function(a){a=$(a);if(a.getStyle("position")=="relative"){return}a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(c,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(d){var a=0,c=0;var b=d;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body&&Element.getStyle(b,"position")=="absolute"){break}}while(b=b.offsetParent);b=d;do{if(!Prototype.Browser.Opera||b.tagName=="BODY"){a-=b.scrollTop||0;c-=b.scrollLeft||0}}while(b=b.parentNode);return Element._returnOffset(c,a)},clonePosition:function(b,d){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});d=$(d);var f=d.viewportOffset();b=$(b);var g=[0,0];var c=null;if(Element.getStyle(b,"position")=="absolute"){c=b.getOffsetParent();g=c.viewportOffset()}if(c==document.body){g[0]-=document.body.offsetLeft;g[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(f[0]-g[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(f[1]-g[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=d.offsetWidth+"px"}if(a.setHeight){b.style.height=d.offsetHeight+"px"}return b}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(d,b,c){switch(c){case"left":case"top":case"right":case"bottom":if(d(b,"position")==="static"){return null}case"height":case"width":if(!Element.visible(b)){return null}var f=parseInt(d(b,c),10);if(f!==b["offset"+c.capitalize()]){return f+"px"}var a;if(c==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(f,function(g,h){var k=d(b,h);return k===null?g:g-parseInt(k,10)})+"px";default:return d(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(c,a,b){if(b==="title"){return a.title}return c(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(c,b){b=$(b);var a=b.getStyle("position");if(a!=="static"){return c(b)}b.setStyle({position:"relative"});var d=c(b);b.setStyle({position:a});return d});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(f,c){c=$(c);var b=c.getStyle("position");if(b!=="static"){return f(c)}var d=c.getOffsetParent();if(d&&d.getStyle("position")==="fixed"){d.setStyle({zoom:1})}c.setStyle({position:"relative"});var g=f(c);c.setStyle({position:b});return g})});Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(b,f){function g(h){return h.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var d=b.getStyle("filter"),c=b.style;if(f==1||f===""){(d=g(d))?c.filter=d:c.removeAttribute("filter");return b}else{if(f<0.00001){f=0}}c.filter=g(d)+"alpha(opacity="+(f*100)+")";return b};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_getAttrNode:function(a,c){var b=a.getAttributeNode(c);return b?b.value:""},_getEv:function(a,b){b=a.getAttribute(b);return b?b.toString().slice(23,-2):null},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){return a.title}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr,src:a._getAttr,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values)}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName=="IMG"&&a.width){a.width++;a.width--}else{try{var d=document.createTextNode(" ");a.appendChild(d);a.removeChild(d)}catch(c){}}}return a};Element.Methods.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return Element._returnOffset(c,a)}}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}if(Object.isElement(c)){return b.update().insert(c)}c=Object.toHTML(c);var a=b.tagName.toUpperCase();if(a in Element._insertionTranslations.tags){$A(b.childNodes).each(function(d){b.removeChild(d)});Element._getContentFromAnonymousElement(a,c.stripScripts()).each(function(d){b.appendChild(d)})}else{b.innerHTML=c.stripScripts()}c.evalScripts.bind(c).defer();return b}}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(c,f){c=$(c);if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){c.parentNode.replaceChild(f,c);return c}f=Object.toHTML(f);var d=c.parentNode,b=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var g=c.next();var a=Element._getContentFromAnonymousElement(b,f.stripScripts());d.removeChild(c);if(g){a.each(function(h){d.insertBefore(h,g)})}else{a.each(function(h){d.appendChild(h)})}}else{c.outerHTML=f.stripScripts()}f.evalScripts.bind(f).defer();return c}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(c,b){var d=new Element("div"),a=Element._insertionTranslations.tags[c];if(a){d.innerHTML=a[0]+b+a[1];a[2].times(function(){d=d.firstChild})}else{d.innerHTML=b}return $A(d.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(a,c){c=Element._attributeTranslations.has[c]||c;var b=$(a).getAttributeNode(c);return b&&b.specified}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K}var a={},b=Element.Methods.ByTag;var c=Object.extend(function(g){if(!g||g._extendedByPrototype||g.nodeType!=1||g==window){return g}var d=Object.clone(a),f=g.tagName,k,h;if(b[f]){Object.extend(d,b[f])}for(k in d){h=d[k];if(Object.isFunction(h)&&!(k in g)){g[k]=h.methodize()}}g._extendedByPrototype=Prototype.emptyFunction;return g},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});c.refresh();return c})();Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(c){var k=Prototype.BrowserFeatures,d=Element.Methods.ByTag;if(!c){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(Object.isArray(b)){b.each(h)}else{h(b)}}function h(m){m=m.toUpperCase();if(!Element.Methods.ByTag[m]){Element.Methods.ByTag[m]={}}Object.extend(Element.Methods.ByTag[m],c)}function a(o,n,m){m=m||false;for(var q in o){var p=o[q];if(!Object.isFunction(p)){continue}if(!m||!(q in n)){n[q]=p.methodize()}}}function f(o){var m;var n={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(n[o]){m="HTML"+n[o]+"Element"}if(window[m]){return window[m]}m="HTML"+o+"Element";if(window[m]){return window[m]}m="HTML"+o.capitalize()+"Element";if(window[m]){return window[m]}window[m]={};window[m].prototype=document.createElement(o).__proto__;return window[m]}if(k.ElementExtensions){a(Element.Methods,HTMLElement.prototype);a(Element.Methods.Simulated,HTMLElement.prototype,true)}if(k.SpecificElementExtensions){for(var l in Element.Methods.ByTag){var g=f(l);if(Object.isUndefined(g)){continue}a(d[l],g.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var a={};var b=Prototype.Browser;$w("width height").each(function(f){var c=f.capitalize();a[f]=(b.WebKit&&!document.evaluate)?self["inner"+c]:(b.Opera)?document.body["client"+c]:document.documentElement["client"+c]});return a},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(a){this.expression=a.strip();this.compileMatcher()},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false}var a=this.expression;if(Prototype.Browser.WebKit&&(a.include("-of-type")||a.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(this.expression)){return false}return true},compileMatcher:function(){if(this.shouldUseXPath()){return this.compileXPathMatcher()}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var f=this.expression,g=Selector.patterns,b=Selector.xpath,d,a;if(Selector._cache[f]){this.xpath=Selector._cache[f];return}this.matcher=[".//*"];while(f&&d!=f&&(/\S/).test(f)){d=f;for(var c in g){if(a=f.match(g[c])){this.matcher.push(Object.isFunction(b[c])?b[c](a):new Template(b[c]).evaluate(a));f=f.replace(a[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;if(this.xpath){return document._getElementsByXPath(this.xpath,a)}return this.matcher(a)},match:function(k){this.tokens=[];var q=this.expression,a=Selector.patterns,f=Selector.assertions;var b,d,g;while(q&&b!==q&&(/\S/).test(q)){b=q;for(var l in a){d=a[l];if(g=q.match(d)){if(f[l]){this.tokens.push([l,Object.clone(g)]);q=q.replace(g[0],"")}else{return this.findElements(document).include(k)}}}}var o=true,c,n;for(var l=0,h;h=this.tokens[l];l++){c=h[0],n=h[1];if(!Selector.assertions[c](k,n)){o=false;break}}return o},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return new Template("[@#{1}]").evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(Object.isFunction(b)){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(b){var k=b[6],h=Selector.patterns,a=Selector.xpath,f,c;var g=[];while(k&&f!=k&&(/\S/).test(k)){f=k;for(var d in h){if(b=k.match(h[d])){c=Object.isFunction(a[d])?a[d](b):new Template(a[d]).evaluate(b);g.push("("+c.substring(1,c.length-1)+")");k=k.replace(b[0],"");break}}}return"[not("+g.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(h,f){var k,l=f[6],d;if(l=="even"){l="2n+0"}if(l=="odd"){l="2n+1"}if(k=l.match(/^(\d+)$/)){return"["+h+"= "+k[1]+"]"}if(k=l.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(k[1]=="-"){k[1]=-1}var g=k[1]?Number(k[1]):1;var c=k[2]?Number(k[2]):0;d="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(d).evaluate({fragment:h,a:g,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(b,c){var a=Element.readAttribute(b,c[1]);return a&&Selector.operators[c[2]](a,c[5]||c[6])}},handlers:{concat:function(d,c){for(var f=0,g;g=c[f];f++){d.push(g)}return d},mark:function(a){var d=Prototype.emptyFunction;for(var b=0,c;c=a[b];b++){c._countedByPrototype=d}return a},unmark:function(a){for(var b=0,c;c=a[b];b++){c._countedByPrototype=undefined}return a},index:function(a,d,h){a._countedByPrototype=Prototype.emptyFunction;if(d){for(var b=a.childNodes,f=b.length-1,c=1;f>=0;f--){var g=b[f];if(g.nodeType==1&&(!h||g._countedByPrototype)){g.nodeIndex=c++}}}else{for(var f=0,c=1,b=a.childNodes;g=b[f];f++){if(g.nodeType==1&&(!h||g._countedByPrototype)){g.nodeIndex=c++}}}},unique:function(b){if(b.length==0){return b}var d=[],f;for(var c=0,a=b.length;c<a;c++){if(!(f=b[c])._countedByPrototype){f._countedByPrototype=Prototype.emptyFunction;d.push(Element.extend(f))}}return Selector.handlers.unmark(d)},descendant:function(a){var d=Selector.handlers;for(var c=0,b=[],f;f=a[c];c++){d.concat(b,f.getElementsByTagName("*"))}return b},child:function(a){var f=Selector.handlers;for(var d=0,c=[],g;g=a[d];d++){for(var b=0,k;k=g.childNodes[b];b++){if(k.nodeType==1&&k.tagName!="!"){c.push(k)}}}return c},adjacent:function(a){for(var c=0,b=[],f;f=a[c];c++){var d=this.nextElementSibling(f);if(d){b.push(d)}}return b},laterSibling:function(a){var d=Selector.handlers;for(var c=0,b=[],f;f=a[c];c++){d.concat(b,Element.nextSiblings(f))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(a,l,c,b){var m=c.toUpperCase();var f=[],k=Selector.handlers;if(a){if(b){if(b=="descendant"){for(var g=0,d;d=a[g];g++){k.concat(f,d.getElementsByTagName(c))}return f}else{a=this[b](a)}if(c=="*"){return a}}for(var g=0,d;d=a[g];g++){if(d.tagName.toUpperCase()===m){f.push(d)}}return f}else{return l.getElementsByTagName(c)}},id:function(b,a,l,g){var k=$(l),d=Selector.handlers;if(!k){return[]}if(!b&&a==document){return[k]}if(b){if(g){if(g=="child"){for(var c=0,f;f=b[c];c++){if(k.parentNode==f){return[k]}}}else{if(g=="descendant"){for(var c=0,f;f=b[c];c++){if(Element.descendantOf(k,f)){return[k]}}}else{if(g=="adjacent"){for(var c=0,f;f=b[c];c++){if(Selector.handlers.previousElementSibling(k)==f){return[k]}}}else{b=d[g](b)}}}}for(var c=0,f;f=b[c];c++){if(f==k){return[k]}}return[]}return(k&&Element.descendantOf(k,a))?[k]:[]},className:function(b,a,c,d){if(b&&d){b=this[d](b)}return Selector.handlers.byClassName(b,a,c)},byClassName:function(c,b,g){if(!c){c=Selector.handlers.descendant([b])}var k=" "+g+" ";for(var f=0,d=[],h,a;h=c[f];f++){a=h.className;if(a.length==0){continue}if(a==g||(" "+a+" ").include(k)){d.push(h)}}return d},attrPresence:function(c,b,a,h){if(!c){c=b.getElementsByTagName("*")}if(c&&h){c=this[h](c)}var f=[];for(var d=0,g;g=c[d];d++){if(Element.hasAttribute(g,a)){f.push(g)}}return f},attr:function(a,l,k,m,c,b){if(!a){a=l.getElementsByTagName("*")}if(a&&b){a=this[b](a)}var n=Selector.operators[c],g=[];for(var f=0,d;d=a[f];f++){var h=Element.readAttribute(d,k);if(h===null){continue}if(n(h,m)){g.push(d)}}return g},pseudo:function(b,c,f,a,d){if(b&&d){b=this[d](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[c](b,f,a)}},pseudos:{"first-child":function(b,g,a){for(var d=0,c=[],f;f=b[d];d++){if(Selector.handlers.previousElementSibling(f)){continue}c.push(f)}return c},"last-child":function(b,g,a){for(var d=0,c=[],f;f=b[d];d++){if(Selector.handlers.nextElementSibling(f)){continue}c.push(f)}return c},"only-child":function(b,k,a){var f=Selector.handlers;for(var d=0,c=[],g;g=b[d];d++){if(!f.previousElementSibling(g)&&!f.nextElementSibling(g)){c.push(g)}}return c},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,d,a){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](b,d,a),d,a)},getIndices:function(d,c,f){if(d==0){return c>0?[c]:[]}return $R(1,f).inject([],function(a,b){if(0==(b-c)%d&&(b-c)/d>=0){a.push(b)}return a})},nth:function(c,t,v,s,f){if(c.length==0){return[]}if(t=="even"){t="2n+0"}if(t=="odd"){t="2n+1"}var r=Selector.handlers,q=[],d=[],k;r.mark(c);for(var p=0,g;g=c[p];p++){if(!g.parentNode._countedByPrototype){r.index(g.parentNode,s,f);d.push(g.parentNode)}}if(t.match(/^\d+$/)){t=Number(t);for(var p=0,g;g=c[p];p++){if(g.nodeIndex==t){q.push(g)}}}else{if(k=t.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(k[1]=="-"){k[1]=-1}var w=k[1]?Number(k[1]):1;var u=k[2]?Number(k[2]):0;var x=Selector.pseudos.getIndices(w,u,c.length);for(var p=0,g,n=x.length;g=c[p];p++){for(var o=0;o<n;o++){if(g.nodeIndex==x[o]){q.push(g)}}}}}r.unmark(c);r.unmark(d);return q},empty:function(b,g,a){for(var d=0,c=[],f;f=b[d];d++){if(f.tagName=="!"||(f.firstChild&&!f.innerHTML.match(/^\s*$/))){continue}c.push(f)}return c},not:function(a,d,n){var k=Selector.handlers,o,c;var l=new Selector(d).findElements(n);k.mark(l);for(var g=0,f=[],b;b=a[g];g++){if(!b._countedByPrototype){f.push(b)}}k.unmark(l);return f},enabled:function(b,g,a){for(var d=0,c=[],f;f=b[d];d++){if(!f.disabled){c.push(f)}}return c},disabled:function(b,g,a){for(var d=0,c=[],f;f=b[d];d++){if(f.disabled){c.push(f)}}return c},checked:function(b,g,a){for(var d=0,c=[],f;f=b[d];d++){if(f.checked){c.push(f)}}return c}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b.startsWith(a)},"$=":function(b,a){return b.endsWith(a)},"*=":function(b,a){return b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+b.toUpperCase()+"-").include("-"+a.toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){a.push(c[1].strip())});return a},matchElements:function(g,k){var f=$$(k),d=Selector.handlers;d.mark(f);for(var c=0,b=[],a;a=g[c];c++){if(a._countedByPrototype){b.push(a)}}d.unmark(f);return b},findElement:function(b,c,a){if(Object.isNumber(c)){a=c;c=false}return Selector.matchElements(b,c||"*")[a||0]},findChildElements:function(f,k){k=Selector.split(k.join(","));var d=[],g=Selector.handlers;for(var c=0,b=k.length,a;c<b;c++){a=new Selector(k[c].strip());g.concat(d,a.findElements(f))}return(b>1)?g.unique(d):d}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(d,c){for(var f=0,g;g=c[f];f++){if(g.tagName!=="!"){d.push(g)}}return d},unmark:function(a){for(var b=0,c;c=a[b];b++){c.removeAttribute("_countedByPrototype")}return a}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(h,b){if(typeof b!="object"){b={hash:!!b}}else{if(Object.isUndefined(b.hash)){b.hash=true}}var c,g,a=false,f=b.submit;var d=h.inject({},function(k,l){if(!l.disabled&&l.name){c=l.name;g=$(l).getValue();if(g!=null&&(l.type!="submit"||(!a&&f!==false&&(!f||c==f)&&(a=true)))){if(c in k){if(!Object.isArray(k[c])){k[c]=[k[c]]}k[c].push(g)}else{k[c]=g}}}return k});return b.hash?d:Object.toQueryString(d)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){if(Form.Element.Serializers[c.tagName.toLowerCase()]){b.push(Element.extend(c))}return b})},getInputs:function(h,c,d){h=$(h);var a=h.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var f=0,k=[],g=a.length;f<g;f++){var b=a[f];if((c&&b.type!=c)||(d&&b.name!=d)){continue}k.push(Element.extend(b))}return k},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var c=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var a=c.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return a?a:c.find(function(d){return["input","select","textarea"].include(d.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var d=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(a.parameters,d)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.blur();a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b)){return a.checked?a.value:null}else{a.checked=!!b}},textarea:function(a,b){if(Object.isUndefined(b)){return a.value}else{a.value=b}},select:function(d,a){if(Object.isUndefined(a)){return this[d.type=="select-one"?"selectOne":"selectMany"](d)}else{var c,g,h=!Object.isArray(a);for(var b=0,f=d.length;b<f;b++){c=d.options[b];g=this.optionValue(c);if(h){if(g==a){c.selected=true;return}}else{c.selected=a.include(g)}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(d){var a,f=d.length;if(!f){return null}for(var c=0,a=[];c<f;c++){var b=d.options[c];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event={}}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(b){var a;switch(b.type){case"mouseover":a=b.fromElement;break;case"mouseout":a=b.toElement;break;default:return null}return Element.extend(a)}});Event.Methods=(function(){var a;if(Prototype.Browser.IE){var b={0:1,1:4,2:2};a=function(d,c){return d.button==b[c]}}else{if(Prototype.Browser.WebKit){a=function(d,c){switch(c){case 0:return d.which==1&&!d.metaKey;case 1:return d.which==1&&d.metaKey;default:return false}}}else{a=function(d,c){return d.which?(d.which===c+1):(d.button===c)}}}return{isLeftClick:function(c){return a(c,0)},isMiddleClick:function(c){return a(c,1)},isRightClick:function(c){return a(c,2)},element:function(d){var c=Event.extend(d).target;return Element.extend(c.nodeType==Node.TEXT_NODE?c.parentNode:c)},findElement:function(d,g){var c=Event.element(d);if(!g){return c}var f=[c].concat(c.ancestors());return Selector.findElement(f,g,0)},pointer:function(c){return{x:c.pageX||(c.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:c.pageY||(c.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}},pointerX:function(c){return Event.pointer(c).x},pointerY:function(c){return Event.pointer(c).y},stop:function(c){Event.extend(c);c.preventDefault();c.stopPropagation();c.stopped=true}}})();Event.extend=(function(){var a=Object.keys(Event.Methods).inject({},function(b,c){b[c]=Event.Methods[c].methodize();return b});if(Prototype.Browser.IE){Object.extend(a,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(b){if(!b){return false}if(b._extendedByPrototype){return b}b._extendedByPrototype=Prototype.emptyFunction;var c=Event.pointer(b);Object.extend(b,{target:b.srcElement,relatedTarget:Event.relatedTarget(b),pageX:c.x,pageY:c.y});return Object.extend(b,a)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,a);return Prototype.K}})();Object.extend(Event,(function(){var b=Event.cache;function c(m){if(m._prototypeEventID){return m._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return m._prototypeEventID=[++arguments.callee.id]}function h(m){if(m&&m.include(":")){return"dataavailable"}return m}function a(m){return b[m]=b[m]||{}}function g(o,m){var n=a(o);return n[m]=n[m]||[]}function k(n,m,o){var r=c(n);var q=g(r,m);if(q.pluck("handler").include(o)){return false}var p=function(s){if(!Event||!Event.extend||(s.eventName&&s.eventName!=m)){return false}Event.extend(s);o.call(n,s)};p.handler=o;q.push(p);return p}function l(p,m,n){var o=g(p,m);return o.find(function(q){return q.handler==n})}function d(p,m,n){var o=a(p);if(!o[m]){return false}o[m]=o[m].without(l(p,m,n))}function f(){for(var n in b){for(var m in b[n]){b[n][m]=null}}}if(window.attachEvent){window.attachEvent("onunload",f)}return{observe:function(o,m,p){o=$(o);var n=h(m);var q=k(o,m,p);if(!q){return o}if(o.addEventListener){o.addEventListener(n,q,false)}else{o.attachEvent("on"+n,q)}return o},stopObserving:function(o,m,p){o=$(o);var r=c(o),n=h(m);if(!p&&m){g(r,m).each(function(s){o.stopObserving(m,s.handler)});return o}else{if(!m){Object.keys(a(r)).each(function(s){o.stopObserving(s)});return o}}var q=l(r,m,p);if(!q){return o}if(o.removeEventListener){o.removeEventListener(n,q,false)}else{o.detachEvent("on"+n,q)}d(r,m,p);return o},fire:function(o,n,m){o=$(o);if(o==document&&document.createEvent&&!o.dispatchEvent){o=document.documentElement}var p;if(document.createEvent){p=document.createEvent("HTMLEvents");p.initEvent("dataavailable",true,true)}else{p=document.createEventObject();p.eventType="ondataavailable"}p.eventName=n;p.memo=m||{};if(document.createEvent){o.dispatchEvent(p)}else{o.fireEvent(p.eventType,p)}return Event.extend(p)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var b;function a(){if(document.loaded){return}if(b){window.clearInterval(b)}document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){b=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){a()}},0);Event.observe(window,"load",a)}else{document.addEventListener("DOMContentLoaded",a,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;a()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,f){f=f.toString().strip();var d=/\s/.test(f)?$w(f).map(a).join(""):a(f);return d?document._getElementsByXPath(".//*"+d,c):[]}:function(f,g){g=g.toString().strip();var h=[],k=(/\s/.test(g)?$w(g):null);if(!k&&!g){return h}var c=$(f).getElementsByTagName("*");g=" "+g+" ";for(var d=0,m,l;m=c[d];d++){if(m.className&&(l=" "+m.className+" ")&&(l.include(g)||(k&&k.all(function(n){return !n.toString().blank()&&l.include(" "+n+" ")})))){h.push(Element.extend(m))}}return h};return function(d,c){return $(c||document.body).getElementsByClassName(d)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){a=a||5;return(((b%(1/a))*a).round()==0?((b*a*2)-(b*a*2).floor()):1-((b*a*2)-(b*a*2).floor()))},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(new Element("span",{style:b}).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(b,c){var f;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){f=b}else{f=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;$A(f).each(function(h,g){new c(h,Object.extend(a,{delay:g*a.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c){b=$(b);c=(c||"appear").toLowerCase();var a=Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},arguments[2]||{});Effect[b.visible()?Effect.PAIRS[c][1]:Effect.PAIRS[c][0]](b,a)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=Object.isString(b.options.queue)?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)}}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+"Internal"]?"this.options."+eventName+"Internal(this);":"")+(options[eventName]?"this.options."+eventName+"(this);":""))}if(options&&options.transition===false){options.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval('this.render = function(pos){ if (this.state=="idle"){this.state="running";'+codeForEvent(this.options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(this.options,"afterSetup")+'};if (this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(this.options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(this.options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=(b*this.totalFrames).round();if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(c,g,f){c=Object.isString(c)?$(c):c;var b=$A(arguments),d=b.last(),a=b.length==5?b[3]:null;this.method=Object.isFunction(d)?d.bind(c):Object.isFunction(c[d])?c[d].bind(c):function(h){c[d]=h};this.start(Object.extend({from:g,to:f},a||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,f){var g={};if(this.options.scaleX){g.width=f.round()+"px"}if(this.options.scaleY){g.height=a.round()+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(f-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){g.top=this.originalTop-c+"px"}if(this.options.scaleX){g.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){g.top=-c+"px"}if(this.options.scaleX){g.left=-b+"px"}}}this.element.setStyle(g)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+((this._base[d]+(this._delta[d]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(d){var c=arguments[1]||{},b=document.viewport.getScrollOffsets(),f=$(d).cumulativeOffset(),a=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(c.offset){f[1]+=c.offset}return new Effect.Tween(null,b.top,f[1]>a?a:f[1],c,function(g){scrollTo(b.left,g.round())})};Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(d){d=$(d);var b=Object.extend({distance:20,duration:0.5},arguments[1]||{});var f=parseFloat(b.distance);var c=parseFloat(b.duration)/10;var a={top:d.getStyle("top"),left:d.getStyle("left")};return new Effect.Move(d,{x:f,y:0,duration:c,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-f*2,y:0,duration:c*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:f*2,y:0,duration:c*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-f*2,y:0,duration:c*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:f*2,y:0,duration:c*2,afterFinishInternal:function(m){new Effect.Move(m.element,{x:-f,y:0,duration:c,afterFinishInternal:function(n){n.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var h=c.getDimensions();var k,g;var f,d;switch(b.direction){case"top-left":k=g=f=d=0;break;case"top-right":k=h.width;g=d=0;f=-h.width;break;case"bottom-left":k=f=0;g=h.height;d=-h.height;break;case"bottom-right":k=h.width;g=h.height;f=-h.width;d=-h.height;break;case"center":k=h.width/2;g=h.height/2;f=-h.width/2;d=-h.height/2;break}return new Effect.Move(c,{x:k,y:g,duration:0.01,beforeSetup:function(l){l.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(l){new Effect.Parallel([new Effect.Opacity(l.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(l.element,{x:f,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(l.element,100,{scaleMode:{originalHeight:h.height,originalWidth:h.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(m){m.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(m){m.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var g=c.getDimensions();var f,d;switch(b.direction){case"top-left":f=d=0;break;case"top-right":f=g.width;d=0;break;case"bottom-left":f=0;d=g.height;break;case"bottom-right":f=g.width;d=g.height;break;case"center":f=g.width/2;d=g.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:f,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(h){h.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(h){h.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{};var a=c.getInlineOpacity();var f=b.transition||Effect.Transitions.sinoidal;var d=function(g){return f(1-Effect.Transitions.pulse(g,b.pulses))};d.bind(f);return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(g){g.element.setStyle({opacity:a})}},b),{transition:d}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var b=this.element.getStyles();this.style=this.style.reject(function(d){return d.value==b[d.key]});a.afterFinishInternal=function(d){d.element.addClassName(d.options.style);d.transforms.each(function(f){d.element.style[f.style]=""})}}}this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(h){var g=h[0],f=h[1],d=null;if(f.parseColor("#zzzzzz")!="#zzzzzz"){f=f.parseColor();d="color"}else{if(g=="opacity"){f=parseFloat(f);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(f)){var c=f.match(/^([\+\-]?[0-9\.]+)(.*)$/);f=parseFloat(c[1]);d=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(g);return{style:g.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(f):f,unit:d}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var d={},b,c=this.transforms.length;while(c--){d[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():(b.originalValue+(b.targetValue-b.originalValue)*a).toFixed(3)+(b.unit===null?"":b.unit)}this.element.setStyle(d,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var d=a.get("ids"),c=a.get("effect"),b=a.get("options");var f=[$(d)||$$(d)].flatten();return f.map(function(g){return new c(g,Object.extend({sync:true},b))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var b,a=$H();if(Prototype.Browser.WebKit){b=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';b=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(b[c]){a.set(c,b[c])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(c,d){c[d]=a[d];return c})}}else{Element.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(d,f){d[f]=a[f];return d});if(!c.opacity){c.opacity=b.getOpacity()}return c}}Effect.Methods={morph:function(a,b){a=$(a);new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(c,f,b){c=$(c);var d=f.dasherize().camelize(),a=d.charAt(0).toUpperCase()+d.substring(1);new Effect[a](c,b);return c},highlight:function(b,a){b=$(b);new Effect.Highlight(b,a);return b}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(c,b){c=$(c);Effect[a.charAt(0).toUpperCase()+a.substring(1)](c,b);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(typeof Effect=="undefined"){throw ("lightwindow.js requires including script.aculo.us' effects.js library!")}try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}var lightwindow=Class.create();lightwindow.prototype={element:null,contentToFetch:null,windowActive:false,dataEffects:[],dimensions:{cruft:null,container:null,viewport:{height:null,width:null,offsetTop:null,offsetLeft:null}},pagePosition:{x:0,y:0},pageDimensions:{width:null,height:null},preloadImage:[],preloadedImage:[],galleries:[],resizeTo:{height:null,heightPercent:null,width:null,widthPercent:null,fixedTop:null,fixedLeft:null},scrollbarOffset:18,navigationObservers:{previous:null,next:null},containerChange:{height:0,width:0},activeGallery:false,galleryLocation:{current:0,total:0},initialize:function(a){this.options=Object.extend({resizeSpeed:8,contentOffset:{height:20,width:20},dimensions:{image:{height:250,width:250},page:{height:250,width:250},inline:{height:250,width:250},media:{height:250,width:250},external:{height:250,width:250},titleHeight:25},classNames:{standard:"lightwindow",action:"lightwindow_action"},fileTypes:{page:["asp","aspx","cgi","cfm","htm","html","pl","php4","php3","php","php5","phtml","rhtml","shtml","txt","vbs","rb"],media:["aif","aiff","asf","avi","divx","m1v","m2a","m2v","m3u","mid","midi","mov","moov","movie","mp2","mp3","mpa","mpa","mpe","mpeg","mpg","mpg","mpga","pps","qt","rm","ram","swf","viv","vivo","wav"],image:["bmp","gif","jpg","png","tiff"]},mimeTypes:{avi:"video/avi",aif:"audio/aiff",aiff:"audio/aiff",gif:"image/gif",bmp:"image/bmp",jpeg:"image/jpeg",m1v:"video/mpeg",m2a:"audio/mpeg",m2v:"video/mpeg",m3u:"audio/x-mpequrl",mid:"audio/x-midi",midi:"audio/x-midi",mjpg:"video/x-motion-jpeg",moov:"video/quicktime",mov:"video/quicktime",movie:"video/x-sgi-movie",mp2:"audio/mpeg",mp3:"audio/mpeg3",mpa:"audio/mpeg",mpa:"video/mpeg",mpe:"video/mpeg",mpeg:"video/mpeg",mpg:"audio/mpeg",mpg:"video/mpeg",mpga:"audio/mpeg",pdf:"application/pdf",png:"image/png",pps:"application/mspowerpoint",qt:"video/quicktime",ram:"audio/x-pn-realaudio-plugin",rm:"application/vnd.rn-realmedia",swf:"application/x-shockwave-flash",tiff:"image/tiff",viv:"video/vivo",vivo:"video/vivo",wav:"audio/wav",wmv:"application/x-mplayer2"},classids:{mov:"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",swf:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",wmv:"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"},codebases:{mov:"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0",swf:"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0",wmv:"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"},viewportPadding:10,EOLASFix:"swf,wmv,fla,flv",overlay:{opacity:0.9,image:"/img/black.png",presetImage:"/img/black-70.png"},skin:{main:'<div id="lightwindow_container" ><div id="lightwindow_title_bar" ><div id="lightwindow_title_bar_inner" ><span id="lightwindow_title_bar_title"></span><a id="lightwindow_title_bar_close_link" >close</a></div></div><div id="lightwindow_stage" ><div id="lightwindow_contents" ></div><div id="lightwindow_navigation" ><a href="#" id="lightwindow_previous" ><span id="lightwindow_previous_title"></span></a><a href="#" id="lightwindow_next" ><span id="lightwindow_next_title"></span></a><iframe name="lightwindow_navigation_shim" id="lightwindow_navigation_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe></div><div id="lightwindow_galleries"><div id="lightwindow_galleries_tab_container" ><a href="#" id="lightwindow_galleries_tab" ><span id="lightwindow_galleries_tab_span" class="up" >Galleries</span></a></div><div id="lightwindow_galleries_list" ></div></div></div><div id="lightwindow_data_slide" ><div id="lightwindow_data_slide_inner" ><div id="lightwindow_data_details" ><div id="lightwindow_data_gallery_container" ><span id="lightwindow_data_gallery_current"></span> of <span id="lightwindow_data_gallery_total"></span></div><div id="lightwindow_data_author_container" >by <span id="lightwindow_data_author"></span></div></div><div id="lightwindow_data_caption" ></div></div></div></div>',loading:'<div id="lightwindow_loading" ><span>Loading</span><iframe name="lightwindow_loading_shim" id="lightwindow_loading_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe></div>',iframe:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><body>{body_replace}</body></html>',gallery:{top:'<div class="lightwindow_galleries_list"><h1>{gallery_title_replace}</h1><ul>',middle:"<li>{gallery_link_replace}</li>",bottom:"</ul></div>"}},formMethod:"get",hideFlash:false,hideGalleryTab:false,showTitleBar:true,animationHandler:false,navigationHandler:false,transitionHandler:false,finalAnimationHandler:false,formHandler:false,galleryAnimationHandler:false,showGalleryCount:true},a||{});this.duration=((11-this.options.resizeSpeed)*0.1);this._setupLinks();this._getScroll();this._getPageDimensions();this._browserDimensions();this._addLightWindowMarkup(false);this._setupDimensions();this.buildGalleryList()},activate:function(b,a){this._clearWindowContents(true);this._addLoadingWindowMarkup();this._setupWindowElements(a);this._getScroll();this._browserDimensions();this._setupDimensions();this._toggleTroubleElements("hidden",false);this._displayLightWindow("block","hidden");this._setStatus(true);this._monitorKeyboard(true);this._prepareIE(true);this._loadWindow()},deactivate:function(){this.windowActive=false;this.activeGallery=false;if(!this.options.hideGalleryTab){this._handleGalleryAnimation(false)}this.animating=false;this.element=null;this._displayLightWindow("none","visible");this._clearWindowContents(false);var a=Effect.Queues.get("lightwindowAnimation").each(function(b){b.cancel()});this._prepareIE(false);this._setupDimensions();this._toggleTroubleElements("visible",false);this._monitorKeyboard(false)},createWindow:function(b,a){this._processLink($(b))},activateWindow:function(a){this.element=Object.extend({href:null,title:null,author:null,caption:null,rel:null,top:null,left:null,type:null,showImages:null,height:null,width:null,loadingAnimation:null,iframeEmbed:null,form:null},a||{});this.contentToFetch=this.element.href;this.windowType=this.element.type?this.element.type:this._fileType(this.element.href);this._clearWindowContents(true);this._addLoadingWindowMarkup();this._getScroll();this._browserDimensions();this._setupDimensions();this._getPageDimensions();$("lightwindow_overlay").setStyle({height:this.pageDimensions.height+"px"});this._toggleTroubleElements("hidden",false);this._displayLightWindow("block","hidden");this._setStatus(true);this._monitorKeyboard(true);this._prepareIE(true);this._loadWindow()},submitForm:function(a){if(this.options.formHandler){this.options.formHandler(a)}else{this._defaultFormHandler(a)}},openWindow:function(a){var a=$(a);this.windowActive=true;this._clearWindowContents(true);this._addLoadingWindowMarkup();this._setupWindowElements(a);this._setStatus(true);this._handleTransition()},navigateWindow:function(a){this._handleNavigation(false);if(a=="previous"){this.openWindow(this.navigationObservers.previous)}else{if(a=="next"){this.openWindow(this.navigationObservers.next)}}},buildGalleryList:function(){var a="";var b;for(i in this.galleries){if(typeof this.galleries[i]=="object"){a+=(this.options.skin.gallery.top).replace("{gallery_title_replace}",unescape(i));for(j in this.galleries[i]){if(typeof this.galleries[i][j]=="object"){b='<a href="#" id="lightwindow_gallery_'+i+"_"+j+'" >'+unescape(j)+"</a>";a+=(this.options.skin.gallery.middle).replace("{gallery_link_replace}",b)}}a+=this.options.skin.gallery.bottom}}new Insertion.Top("lightwindow_galleries_list",a);for(i in this.galleries){if(typeof this.galleries[i]=="object"){for(j in this.galleries[i]){if(typeof this.galleries[i][j]=="object"){Event.observe($("lightwindow_gallery_"+i+"_"+j),"click",this.openWindow.bind(this,this.galleries[i][j][0]),false);$("lightwindow_gallery_"+i+"_"+j).onclick=function(){return false}}}}}},_setupLinks:function(){var a=$$("."+this.options.classNames.standard);a.each(function(b){this._processLink(b)}.bind(this))},_processLink:function(c){if((this._fileType(c.getAttribute("href"))=="image"||this._fileType(c.getAttribute("href"))=="media")){if(gallery=this._getGalleryInfo(c.rel)){if(!this.galleries[gallery[0]]){this.galleries[gallery[0]]=new Array()}if(!this.galleries[gallery[0]][gallery[1]]){this.galleries[gallery[0]][gallery[1]]=new Array()}this.galleries[gallery[0]][gallery[1]].push(c)}}var b=c.getAttribute("href");if(b.indexOf("?")>-1){b=b.substring(0,b.indexOf("?"))}var a=b.substring(b.indexOf("#")+1);if($(a)){$(a).setStyle({display:"none"})}Event.observe(c,"click",this.activate.bindAsEventListener(this,c),false);c.onclick=function(){return false}},_setupActions:function(){var a=$$("#lightwindow_container ."+this.options.classNames.action);a.each(function(b){Event.observe(b,"click",this[b.getAttribute("rel")].bindAsEventListener(this,b),false);b.onclick=function(){return false}}.bind(this))},_addLightWindowMarkup:function(b){var c=Element.extend(document.createElement("div"));c.setAttribute("id","lightwindow_overlay");if(Prototype.Browser.Gecko){c.setStyle({backgroundImage:"url("+this.options.overlay.presetImage+")",backgroundRepeat:"repeat",height:this.pageDimensions.height+"px"})}else{c.setStyle({opacity:this.options.overlay.opacity,backgroundImage:"url("+this.options.overlay.image+")",backgroundRepeat:"repeat",height:this.pageDimensions.height+"px"})}var d=document.createElement("div");d.setAttribute("id","lightwindow");d.innerHTML=this.options.skin.main;var a=document.getElementsByTagName("body")[0];a.appendChild(c);a.appendChild(d);if($("lightwindow_title_bar_close_link")){Event.observe("lightwindow_title_bar_close_link","click",this.deactivate.bindAsEventListener(this));$("lightwindow_title_bar_close_link").onclick=function(){return false}}if($("lightwindow_overlay")){Event.observe("lightwindow_overlay","click",this.deactivate.bindAsEventListener(this));$("lightwindow_overlay").onclick=function(){return false}}Event.observe($("lightwindow_previous"),"click",this.navigateWindow.bind(this,"previous"),false);$("lightwindow_previous").onclick=function(){return false};Event.observe($("lightwindow_next"),"click",this.navigateWindow.bind(this,"next"),false);$("lightwindow_next").onclick=function(){return false};if(!this.options.hideGalleryTab){Event.observe($("lightwindow_galleries_tab"),"click",this._handleGalleryAnimation.bind(this,true),false);$("lightwindow_galleries_tab").onclick=function(){return false}}if(Prototype.Browser.IE){Event.observe(document,"mousewheel",this._stopScrolling.bindAsEventListener(this),false)}else{Event.observe(window,"DOMMouseScroll",this._stopScrolling.bindAsEventListener(this),false)}c.onclick=function(){return false}},_addLoadingWindowMarkup:function(){$("lightwindow_contents").innerHTML+=this.options.skin.loading},_setupWindowElements:function(a){this.element=a;this.element.title=null?"":a.getAttribute("title");this.element.author=null?"":a.getAttribute("author");this.element.caption=null?"":a.getAttribute("caption");this.element.rel=null?"":a.getAttribute("rel");this.element.params=null?"":a.getAttribute("params");this.contentToFetch=this.element.href;this.windowType=this._getParameter("lightwindow_type")?this._getParameter("lightwindow_type"):this._fileType(this.contentToFetch)},_clearWindowContents:function(a){if($("lightwindow_iframe")){Element.remove($("lightwindow_iframe"))}if($("lightwindow_media_primary")){try{$("lightwindow_media_primary").Stop()}catch(b){}Element.remove($("lightwindow_media_primary"))}if($("lightwindow_media_secondary")){try{$("lightwindow_media_secondary").Stop()}catch(b){}Element.remove($("lightwindow_media_secondary"))}this.activeGallery=false;this._handleNavigation(this.activeGallery);if(a){$("lightwindow_contents").innerHTML="";$("lightwindow_contents").setStyle({overflow:"hidden"});if(!this.windowActive){$("lightwindow_data_slide_inner").setStyle({display:"none"});$("lightwindow_title_bar_title").innerHTML=""}$("lightwindow_data_slide").setStyle({height:"auto"})}this.resizeTo.height=null;this.resizeTo.width=null},_setStatus:function(a){this.animating=a;if(a){Element.show("lightwindow_loading")}if(!(/MSIE 6./i.test(navigator.userAgent))){this._fixedWindow(a)}},_fixedWindow:function(a){if(a){if(this.windowActive){this._getScroll();$("lightwindow").setStyle({position:"absolute",top:parseFloat($("lightwindow").getStyle("top"))+this.pagePosition.y+"px",left:parseFloat($("lightwindow").getStyle("left"))+this.pagePosition.x+"px"})}else{$("lightwindow").setStyle({position:"absolute"})}}else{if(this.windowActive){this._getScroll();$("lightwindow").setStyle({position:"fixed",top:parseFloat($("lightwindow").getStyle("top"))-this.pagePosition.y+"px",left:parseFloat($("lightwindow").getStyle("left"))-this.pagePosition.x+"px"})}else{if($("lightwindow_iframe")){this._browserDimensions()}$("lightwindow").setStyle({position:"fixed",top:(parseFloat(this._getParameter("lightwindow_top"))?parseFloat(this._getParameter("lightwindow_top"))+"px":this.dimensions.viewport.height/2+"px"),left:(parseFloat(this._getParameter("lightwindow_left"))?parseFloat(this._getParameter("lightwindow_left"))+"px":this.dimensions.viewport.width/2+"px")})}}},_prepareIE:function(c){if(Prototype.Browser.IE){var b,f,d;if(c){var b="100%"}else{var b="auto"}var a=document.getElementsByTagName("body")[0];var g=document.getElementsByTagName("html")[0];g.style.height=a.style.height=b}},_stopScrolling:function(a){if(this.animating){if(a.preventDefault){a.preventDefault()}a.returnValue=false}},_getScroll:function(){if(typeof(window.pageYOffset)=="number"){this.pagePosition.x=window.pageXOffset;this.pagePosition.y=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){this.pagePosition.x=document.body.scrollLeft;this.pagePosition.y=document.body.scrollTop}else{if(document.documentElement){this.pagePosition.x=document.documentElement.scrollLeft;this.pagePosition.y=document.documentElement.scrollTop}}}},_setScroll:function(a,b){document.documentElement.scrollLeft=a;document.documentElement.scrollTop=b},_toggleTroubleElements:function(a,d){if(d){var c=$("lightwindow_contents").getElementsByTagName("select")}else{var c=document.getElementsByTagName("select")}for(var b=0;b<c.length;b++){c[b].style.visibility=a}if(!d){if(this.options.hideFlash){var g=document.getElementsByTagName("object");for(b=0;b!=g.length;b++){g[b].style.visibility=a}var f=document.getElementsByTagName("embed");for(b=0;b!=f.length;b++){f[b].style.visibility=a}}var h=document.getElementsByTagName("iframe");for(b=0;b!=h.length;b++){h[b].style.visibility=a}}},_getPageDimensions:function(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){b=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){this.pageDimensions.height=d}else{this.pageDimensions.height=a}if(c<b){this.pageDimensions.width=b}else{this.pageDimensions.width=c}},_displayLightWindow:function(b,a){$("lightwindow_overlay").style.display=$("lightwindow").style.display=$("lightwindow_container").style.display=b;$("lightwindow_overlay").style.visibility=$("lightwindow").style.visibility=$("lightwindow_container").style.visibility=a},_setupDimensions:function(){var c,d;switch(this.windowType){case"page":c=this.options.dimensions.page.height;d=this.options.dimensions.page.width;break;case"image":c=this.options.dimensions.image.height;d=this.options.dimensions.image.width;break;case"media":c=this.options.dimensions.media.height;d=this.options.dimensions.media.width;break;case"external":c=this.options.dimensions.external.height;d=this.options.dimensions.external.width;break;case"inline":c=this.options.dimensions.inline.height;d=this.options.dimensions.inline.width;break;default:c=this.options.dimensions.page.height;d=this.options.dimensions.page.width;break}var a=this._getParameter("lightwindow_top")?parseFloat(this._getParameter("lightwindow_top"))+this.pagePosition.y:this.dimensions.viewport.height/2+this.pagePosition.y;var b=this._getParameter("lightwindow_left")?parseFloat(this._getParameter("lightwindow_left"))+this.pagePosition.x:this.dimensions.viewport.width/2+this.pagePosition.x;$("lightwindow").setStyle({top:a+"px",left:b+"px"});$("lightwindow_container").setStyle({height:c+"px",width:d+"px",left:-(d/2)+"px",top:-(c/2)+"px"});$("lightwindow_contents").setStyle({height:c+"px",width:d+"px"})},_fileType:function(a){var f=new RegExp("[^.].("+this.options.fileTypes.image.join("|")+")s*$","i");if(f.test(a)){return"image"}if(a.indexOf("#")>-1&&(document.domain==this._getDomain(a))){return"inline"}if(a.indexOf("?")>-1){a=a.substring(0,a.indexOf("?"))}var b="unknown";var c=new RegExp("[^.].("+this.options.fileTypes.page.join("|")+")s*$","i");var d=new RegExp("[^.].("+this.options.fileTypes.media.join("|")+")s*$","i");if(document.domain!=this._getDomain(a)){b="external"}if(d.test(a)){b="media"}if(b=="external"||b=="media"){return b}if(c.test(a)||a.substr((a.length-1),a.length)=="/"){b="page"}return b},_fileExtension:function(c){if(c.indexOf("?")>-1){c=c.substring(0,c.indexOf("?"))}var b="";for(var a=(c.length-1);a>-1;a--){if(c.charAt(a)=="."){return b}b=c.charAt(a)+b}},_monitorKeyboard:function(a){if(a){document.onkeydown=this._eventKeypress.bind(this)}else{document.onkeydown=""}},_eventKeypress:function(b){if(b==null){var a=event.keyCode}else{var a=b.which}switch(a){case 27:this.deactivate();break;case 13:return;default:break}if(this.animating){return false}switch(String.fromCharCode(a).toLowerCase()){case"p":if(this.navigationObservers.previous){this.navigateWindow("previous")}break;case"n":if(this.navigationObservers.next){this.navigateWindow("next")}break;default:break}},_getGalleryInfo:function(a){if(!a){return false}if(a.indexOf("[")>-1){return new Array(escape(a.substring(0,a.indexOf("["))),escape(a.substring(a.indexOf("[")+1,a.indexOf("]"))))}else{return false}},_getDomain:function(f){var h=f.indexOf("//");var b=h+2;var d=f.substring(b,f.length);var a=d.indexOf("/");var g=d.substring(0,a);if(g.indexOf(":")>-1){var c=g.indexOf(":");g=g.substring(0,c)}return g},_getParameter:function(k,d){if(!this.element){return false}if(k=="lightwindow_top"&&this.element.top){return unescape(this.element.top)}else{if(k=="lightwindow_left"&&this.element.left){return unescape(this.element.left)}else{if(k=="lightwindow_type"&&this.element.type){return unescape(this.element.type)}else{if(k=="lightwindow_show_images"&&this.element.showImages){return unescape(this.element.showImages)}else{if(k=="lightwindow_height"&&this.element.height){return unescape(this.element.height)}else{if(k=="lightwindow_width"&&this.element.width){return unescape(this.element.width)}else{if(k=="lightwindow_loading_animation"&&this.element.loadingAnimation){return unescape(this.element.loadingAnimation)}else{if(k=="lightwindow_iframe_embed"&&this.element.iframeEmbed){return unescape(this.element.iframeEmbed)}else{if(k=="lightwindow_form"&&this.element.form){return unescape(this.element.form)}else{if(!d){if(this.element.params){d=this.element.params}else{return}}var g;var f=d.split(",");var c=k+"=";var h=c.length;for(var b=0;b<f.length;b++){if(f[b].substr(0,h)==c){var a=f[b].split("=");g=a[1];break}}if(!g){return false}else{return unescape(g)}}}}}}}}}}},_browserDimensions:function(){if(Prototype.Browser.IE){this.dimensions.viewport.height=document.documentElement.clientHeight;this.dimensions.viewport.width=document.documentElement.clientWidth}else{this.dimensions.viewport.height=window.innerHeight;this.dimensions.viewport.width=document.width||document.body.offsetWidth}},_getScrollerWidth:function(){var f=Element.extend(document.createElement("div"));f.setAttribute("id","lightwindow_scroll_div");f.setStyle({position:"absolute",top:"-10000px",left:"-10000px",width:"100px",height:"100px",overflow:"hidden"});var c=Element.extend(document.createElement("div"));c.setAttribute("id","lightwindow_content_scroll_div");c.setStyle({width:"100%",height:"200px"});f.appendChild(c);var b=document.getElementsByTagName("body")[0];b.appendChild(f);var d=$("lightwindow_content_scroll_div").offsetWidth;f.style.overflow="auto";var a=$("lightwindow_content_scroll_div").offsetWidth;Element.remove($("lightwindow_scroll_div"));this.scrollbarOffset=d-a},_addParamToObject:function(b,c,a,f){var d=document.createElement("param");d.setAttribute("value",c);d.setAttribute("name",b);if(f){d.setAttribute("id",f)}a.appendChild(d);return a},_outerHTML:function(a){if(Prototype.Browser.IE){return a.outerHTML}else{var c=a.cloneNode(true);var b=document.createElement("div");b.appendChild(c);return b.innerHTML}},_convertToMarkup:function(c,b){var a=this._outerHTML(c).replace("</"+b+">","");if(Prototype.Browser.IE){for(var d=0;d<c.childNodes.length;d++){a+=this._outerHTML(c.childNodes[d])}a+="</"+b+">"}return a},_appendObject:function(c,b,a){if(Prototype.Browser.IE){a.innerHTML+=this._convertToMarkup(c,b);if(this.options.EOLASFix.indexOf(this._fileType(this.element.href))>-1){var f=document.getElementsByTagName("object");for(var d=0;d<f.length;d++){if(f[d].getAttribute("data")){f[d].removeAttribute("data")}f[d].outerHTML=f[d].outerHTML;f[d].style.visibility="visible"}}}else{a.appendChild(c)}},_appendIframe:function(a){var b=document.createElement("iframe");b.setAttribute("id","lightwindow_iframe");b.setAttribute("name","lightwindow_iframe");b.setAttribute("src","about:blank");b.setAttribute("height","100%");b.setAttribute("width","100%");b.setAttribute("frameborder","0");b.setAttribute("marginwidth","0");b.setAttribute("marginheight","0");b.setAttribute("scrolling",a);this._appendObject(b,"iframe",$("lightwindow_contents"))},_writeToIframe:function(b){var a=this.options.skin.iframe;a=a.replace("{body_replace}",b);if($("lightwindow_iframe").contentWindow){$("lightwindow_iframe").contentWindow.document.open();$("lightwindow_iframe").contentWindow.document.write(a);$("lightwindow_iframe").contentWindow.document.close()}else{$("lightwindow_iframe").contentDocument.open();$("lightwindow_iframe").contentDocument.write(a);$("lightwindow_iframe").contentDocument.close()}},_loadWindow:function(){switch(this.windowType){case"image":var f=0;var a=[];this.checkImage=[];this.resizeTo.height=this.resizeTo.width=0;this.imageCount=this._getParameter("lightwindow_show_images")?parseInt(this._getParameter("lightwindow_show_images")):1;if(gallery=this._getGalleryInfo(this.element.rel)){for(f=0;f<this.galleries[gallery[0]][gallery[1]].length;f++){if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][f].href)>-1){break}}if(this.galleries[gallery[0]][gallery[1]][f-this.imageCount]){this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][f-this.imageCount]}else{this.navigationObservers.previous=false}if(this.galleries[gallery[0]][gallery[1]][f+this.imageCount]){this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][f+this.imageCount]}else{this.navigationObservers.next=false}this.activeGallery=true}else{this.navigationObservers.previous=false;this.navigationObservers.next=false;this.activeGallery=false}for(var c=f;c<(f+this.imageCount);c++){if(gallery&&this.galleries[gallery[0]][gallery[1]][c]){this.contentToFetch=this.galleries[gallery[0]][gallery[1]][c].href;this.galleryLocation={current:(c+1)/this.imageCount,total:(this.galleries[gallery[0]][gallery[1]].length)/this.imageCount};if(!this.galleries[gallery[0]][gallery[1]][c+this.imageCount]){$("lightwindow_next").setStyle({display:"none"})}else{$("lightwindow_next").setStyle({display:"block"});$("lightwindow_next_title").innerHTML=this.galleries[gallery[0]][gallery[1]][c+this.imageCount].title}if(!this.galleries[gallery[0]][gallery[1]][c-this.imageCount]){$("lightwindow_previous").setStyle({display:"none"})}else{$("lightwindow_previous").setStyle({display:"block"});$("lightwindow_previous_title").innerHTML=this.galleries[gallery[0]][gallery[1]][c-this.imageCount].title}}a[c]=document.createElement("img");a[c].setAttribute("id","lightwindow_image_"+c);a[c].setAttribute("border","0");a[c].setAttribute("src",this.contentToFetch);$("lightwindow_contents").appendChild(a[c]);this.checkImage[c]=new PeriodicalExecuter(function(h){if(!(typeof $("lightwindow_image_"+h).naturalWidth!="undefined"&&$("lightwindow_image_"+h).naturalWidth==0)){this.checkImage[h].stop();var g=$("lightwindow_image_"+h).getHeight();if(g>this.resizeTo.height){this.resizeTo.height=g}this.resizeTo.width+=$("lightwindow_image_"+h).getWidth();this.imageCount--;$("lightwindow_image_"+h).setStyle({height:"100%"});if(this.imageCount==0){this._processWindow()}}}.bind(this,c),1)}break;case"media":var f=0;this.resizeTo.height=this.resizeTo.width=0;if(gallery=this._getGalleryInfo(this.element.rel)){for(f=0;f<this.galleries[gallery[0]][gallery[1]].length;f++){if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][f].href)>-1){break}}if(this.galleries[gallery[0]][gallery[1]][f-1]){this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][f-1]}else{this.navigationObservers.previous=false}if(this.galleries[gallery[0]][gallery[1]][f+1]){this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][f+1]}else{this.navigationObservers.next=false}this.activeGallery=true}else{this.navigationObservers.previous=false;this.navigationObservers.next=false;this.activeGallery=false}if(gallery&&this.galleries[gallery[0]][gallery[1]][f]){this.contentToFetch=this.galleries[gallery[0]][gallery[1]][f].href;this.galleryLocation={current:f+1,total:this.galleries[gallery[0]][gallery[1]].length};if(!this.galleries[gallery[0]][gallery[1]][f+1]){$("lightwindow_next").setStyle({display:"none"})}else{$("lightwindow_next").setStyle({display:"block"});$("lightwindow_next_title").innerHTML=this.galleries[gallery[0]][gallery[1]][f+1].title}if(!this.galleries[gallery[0]][gallery[1]][f-1]){$("lightwindow_previous").setStyle({display:"none"})}else{$("lightwindow_previous").setStyle({display:"block"});$("lightwindow_previous_title").innerHTML=this.galleries[gallery[0]][gallery[1]][f-1].title}}if(this._getParameter("lightwindow_iframe_embed")){this.resizeTo.height=this.dimensions.viewport.height;this.resizeTo.width=this.dimensions.viewport.width}else{this.resizeTo.height=this._getParameter("lightwindow_height");this.resizeTo.width=this._getParameter("lightwindow_width")}this._processWindow();break;case"external":this._appendIframe("auto");this.resizeTo.height=this.dimensions.viewport.height;this.resizeTo.width=this.dimensions.viewport.width;this._processWindow();break;case"page":var b=new Ajax.Request(this.contentToFetch,{method:"get",parameters:"",onComplete:function(g){$("lightwindow_contents").innerHTML+=g.responseText;this.resizeTo.height=$("lightwindow_contents").scrollHeight+(this.options.contentOffset.height);this.resizeTo.width=$("lightwindow_contents").scrollWidth+(this.options.contentOffset.width);this._processWindow()}.bind(this)});break;case"inline":var d=this.contentToFetch;if(d.indexOf("?")>-1){d=d.substring(0,d.indexOf("?"))}d=d.substring(d.indexOf("#")+1);new Insertion.Top($("lightwindow_contents"),$(d).innerHTML);this.resizeTo.height=$("lightwindow_contents").scrollHeight+(this.options.contentOffset.height);this.resizeTo.width=$("lightwindow_contents").scrollWidth+(this.options.contentOffset.width);this._toggleTroubleElements("hidden",true);this._processWindow();break;default:throw ("Page Type could not be determined, please amend this lightwindow URL "+this.contentToFetch);break}},_resizeWindowToFit:function(){if(this.resizeTo.height+this.dimensions.cruft.height>this.dimensions.viewport.height){var a=this.resizeTo.height/this.resizeTo.width;this.resizeTo.height=this.dimensions.viewport.height-this.dimensions.cruft.height-(2*this.options.viewportPadding);if(this.windowType=="image"||(this.windowType=="media"&&!this._getParameter("lightwindow_iframe_embed"))){this.resizeTo.width=this.resizeTo.height/a;$("lightwindow_data_slide_inner").setStyle({width:this.resizeTo.width+"px"})}}if(this.resizeTo.width+this.dimensions.cruft.width>this.dimensions.viewport.width){var b=this.resizeTo.width/this.resizeTo.height;this.resizeTo.width=this.dimensions.viewport.width-2*this.dimensions.cruft.width-(2*this.options.viewportPadding);if(this.windowType=="image"||(this.windowType=="media"&&!this._getParameter("lightwindow_iframe_embed"))){this.resizeTo.height=this.resizeTo.width/b;$("lightwindow_data_slide_inner").setStyle({height:this.resizeTo.height+"px"})}}},_presetWindowSize:function(){if(this._getParameter("lightwindow_height")){this.resizeTo.height=parseFloat(this._getParameter("lightwindow_height"))}if(this._getParameter("lightwindow_width")){this.resizeTo.width=parseFloat(this._getParameter("lightwindow_width"))}},_processWindow:function(){this.dimensions.dataEffects=[];if(this.element.caption||this.element.author||(this.activeGallery&&this.options.showGalleryCount)){if(this.element.caption){$("lightwindow_data_caption").innerHTML=this.element.caption;$("lightwindow_data_caption").setStyle({display:"block"})}else{$("lightwindow_data_caption").setStyle({display:"none"})}if(this.element.author){$("lightwindow_data_author").innerHTML=this.element.author;$("lightwindow_data_author_container").setStyle({display:"block"})}else{$("lightwindow_data_author_container").setStyle({display:"none"})}if(this.activeGallery&&this.options.showGalleryCount){$("lightwindow_data_gallery_current").innerHTML=this.galleryLocation.current;$("lightwindow_data_gallery_total").innerHTML=this.galleryLocation.total;$("lightwindow_data_gallery_container").setStyle({display:"block"})}else{$("lightwindow_data_gallery_container").setStyle({display:"none"})}$("lightwindow_data_slide_inner").setStyle({width:this.resizeTo.width+"px",height:"auto",visibility:"visible",display:"block"});$("lightwindow_data_slide").setStyle({height:$("lightwindow_data_slide").getHeight()+"px",width:"1px",overflow:"hidden",display:"block"})}else{$("lightwindow_data_slide").setStyle({display:"none",width:"auto"});$("lightwindow_data_slide_inner").setStyle({display:"none",visibility:"hidden",width:this.resizeTo.width+"px",height:"0px"})}if(this.element.title!=null){$("lightwindow_title_bar_title").innerHTML=this.element.title}else{$("lightwindow_title_bar_title").innerHTML=""}var b={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};$("lightwindow_container").setStyle({height:"auto",width:$("lightwindow_container").getWidth()+this.options.contentOffset.width-(this.windowActive?this.options.contentOffset.width:0)+"px"});var a={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};this.containerChange={height:b.height-a.height,width:b.width-a.width};this.dimensions.container={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};this.dimensions.cruft={height:this.dimensions.container.height-$("lightwindow_contents").getHeight()+this.options.contentOffset.height,width:this.dimensions.container.width-$("lightwindow_contents").getWidth()+this.options.contentOffset.width};this._presetWindowSize();this._resizeWindowToFit();if(!this.windowActive){$("lightwindow_container").setStyle({left:-(this.dimensions.container.width/2)+"px",top:-(this.dimensions.container.height/2)+"px"})}$("lightwindow_container").setStyle({height:this.dimensions.container.height+"px",width:this.dimensions.container.width+"px"});this._displayLightWindow("block","visible");this._animateLightWindow()},_animateLightWindow:function(){if(this.options.animationHandler){this.options.animationHandler().bind(this)}else{this._defaultAnimationHandler()}},_handleNavigation:function(a){if(this.options.navigationHandler){this.options.navigationHandler().bind(this,a)}else{this._defaultDisplayNavigation(a)}},_handleTransition:function(){if(this.options.transitionHandler){this.options.transitionHandler().bind(this)}else{this._defaultTransitionHandler()}},_handleFinalWindowAnimation:function(a){if(this.options.finalAnimationHandler){this.options.finalAnimationHandler().bind(this,a)}else{this._defaultfinalWindowAnimationHandler(a)}},_handleGalleryAnimation:function(a){if(this.options.galleryAnimationHandler){this.options.galleryAnimationHandler().bind(this,a)}else{this._defaultGalleryAnimationHandler(a)}},_defaultDisplayNavigation:function(a){if(a){$("lightwindow_navigation").setStyle({display:"block",height:$("lightwindow_contents").getHeight()+"px",width:"100%",marginTop:this.options.dimensions.titleHeight+"px"})}else{$("lightwindow_navigation").setStyle({display:"none",height:"auto",width:"auto"})}},_defaultAnimationHandler:function(){if(this.element.caption||this.element.author||(this.activeGallery&&this.options.showGalleryCount)){$("lightwindow_data_slide").setStyle({display:"none",width:"auto"});this.dimensions.dataEffects.push(new Effect.SlideDown("lightwindow_data_slide",{sync:true}),new Effect.Appear("lightwindow_data_slide",{sync:true,from:0,to:1}))}$("lightwindow_title_bar_inner").setStyle({height:"0px",marginTop:this.options.dimensions.titleHeight+"px"});this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_title_bar_inner",{sync:true,style:{height:this.options.dimensions.titleHeight+"px",marginTop:"0px"}}),new Effect.Appear("lightwindow_title_bar_inner",{sync:true,from:0,to:1}));if(!this.options.hideGalleryTab){this._handleGalleryAnimation(false);if($("lightwindow_galleries_tab_container").getHeight()==0){this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_tab_container",{sync:true,style:{height:"20px",marginTop:"0px"}}));$("lightwindow_galleries").setStyle({width:"0px"})}}var a=false;var b=this.dimensions.container.width-$("lightwindow_contents").getWidth()+this.resizeTo.width+this.options.contentOffset.width;if(b!=$("lightwindow_container").getWidth()){new Effect.Parallel([new Effect.Scale("lightwindow_contents",100*(this.resizeTo.width/$("lightwindow_contents").getWidth()),{scaleFrom:100*($("lightwindow_contents").getWidth()/($("lightwindow_contents").getWidth()+(this.options.contentOffset.width))),sync:true,scaleY:false,scaleContent:false}),new Effect.Scale("lightwindow_container",100*(b/(this.dimensions.container.width)),{sync:true,scaleY:false,scaleFromCenter:true,scaleContent:false})],{duration:this.duration,delay:0.05,queue:{position:"end",scope:"lightwindowAnimation"}})}b=this.dimensions.container.height-$("lightwindow_contents").getHeight()+this.resizeTo.height+this.options.contentOffset.height;if(b!=$("lightwindow_container").getHeight()){new Effect.Parallel([new Effect.Scale("lightwindow_contents",100*(this.resizeTo.height/$("lightwindow_contents").getHeight()),{scaleFrom:100*($("lightwindow_contents").getHeight()/($("lightwindow_contents").getHeight()+(this.options.contentOffset.height))),sync:true,scaleX:false,scaleContent:false}),new Effect.Scale("lightwindow_container",100*(b/(this.dimensions.container.height)),{sync:true,scaleX:false,scaleFromCenter:true,scaleContent:false})],{duration:this.duration,afterFinish:function(){if(this.dimensions.dataEffects.length>0){if(!this.options.hideGalleryTab){$("lightwindow_galleries").setStyle({width:this.resizeTo.width+"px"})}new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._finishWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})}}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}});a=true}if(!a&&this.dimensions.dataEffects.length>0){new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,beforeStart:function(){if(!this.options.hideGalleryTab){$("lightwindow_galleries").setStyle({width:this.resizeTo.width+"px"})}if(this.containerChange.height!=0||this.containerChange.width!=0){new Effect.MoveBy("lightwindow_container",this.containerChange.height,this.containerChange.width,{transition:Effect.Transitions.sinoidal})}}.bind(this),afterFinish:function(){this._finishWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})}},_defaultfinalWindowAnimationHandler:function(a){if(this.windowType=="media"||this._getParameter("lightwindow_loading_animation")){Element.hide("lightwindow_loading");this._handleNavigation(this.activeGallery);this._setStatus(false)}else{Effect.Fade("lightwindow_loading",{duration:0.5,delay:0.25,afterFinish:function(){if(this.windowType!="image"&&this.windowType!="media"&&this.windowType!="external"){$("lightwindow_contents").setStyle({overflow:"auto"})}this._handleNavigation(this.activeGallery);this._defaultGalleryAnimationHandler();this._setStatus(false)}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})}},_defaultGalleryAnimationHandler:function(b){if(this.activeGallery){$("lightwindow_galleries").setStyle({display:"block",marginBottom:$("lightwindow_data_slide").getHeight()+this.options.contentOffset.height/2+"px"});$("lightwindow_navigation").setStyle({height:$("lightwindow_contents").getHeight()-20+"px"})}else{$("lightwindow_galleries").setStyle({display:"none"});$("lightwindow_galleries_tab_container").setStyle({height:"0px",marginTop:"20px"});$("lightwindow_galleries_list").setStyle({height:"0px"});return false}if(b){if($("lightwindow_galleries_list").getHeight()==0){var a=$("lightwindow_contents").getHeight()*0.8;$("lightwindow_galleries_tab_span").className="down"}else{var a=0;$("lightwindow_galleries_tab_span").className="up"}new Effect.Morph("lightwindow_galleries_list",{duration:this.duration,transition:Effect.Transitions.sinoidal,style:{height:a+"px"},beforeStart:function(){$("lightwindow_galleries_list").setStyle({overflow:"hidden"})},afterFinish:function(){$("lightwindow_galleries_list").setStyle({overflow:"auto"})},queue:{position:"end",scope:"lightwindowAnimation"}})}},_defaultTransitionHandler:function(){this.dimensions.dataEffects=[];if($("lightwindow_data_slide").getStyle("display")!="none"){this.dimensions.dataEffects.push(new Effect.SlideUp("lightwindow_data_slide",{sync:true}),new Effect.Fade("lightwindow_data_slide",{sync:true,from:1,to:0}))}if(!this.options.hideGalleryTab){if($("lightwindow_galleries").getHeight()!=0&&!this.options.hideGalleryTab){this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_tab_container",{sync:true,style:{height:"0px",marginTop:"20px"}}))}if($("lightwindow_galleries_list").getHeight()!=0){$("lightwindow_galleries_tab_span").className="up";this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_list",{sync:true,style:{height:"0px"},transition:Effect.Transitions.sinoidal,beforeStart:function(){$("lightwindow_galleries_list").setStyle({overflow:"hidden"})},afterFinish:function(){$("lightwindow_galleries_list").setStyle({overflow:"auto"})}}))}}this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_title_bar_inner",{sync:true,style:{height:"0px",marginTop:this.options.dimensions.titleHeight+"px"}}),new Effect.Fade("lightwindow_title_bar_inner",{sync:true,from:1,to:0}));new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._loadWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})},_defaultFormHandler:function(d){var b=Event.element(d).parentNode;var c=Form.serialize(this._getParameter("lightwindow_form",b.getAttribute("params")));if(this.options.formMethod=="post"){var a=new Ajax.Request(b.href,{method:"post",postBody:c,onComplete:this.openWindow.bind(this,b)})}else{if(this.options.formMethod=="get"){var a=new Ajax.Request(b.href,{method:"get",parameters:c,onComplete:this.openWindow.bind(this,b)})}}},_finishWindow:function(){if(this.windowType=="external"){$("lightwindow_iframe").setAttribute("src",this.element.href);this._handleFinalWindowAnimation(1)}else{if(this.windowType=="media"){var b=document.createElement("object");b.setAttribute("classid",this.options.classids[this._fileExtension(this.contentToFetch)]);b.setAttribute("codebase",this.options.codebases[this._fileExtension(this.contentToFetch)]);b.setAttribute("id","lightwindow_media_primary");b.setAttribute("name","lightwindow_media_primary");b.setAttribute("width",this.resizeTo.width);b.setAttribute("height",this.resizeTo.height);b=this._addParamToObject("movie",this.contentToFetch,b);b=this._addParamToObject("src",this.contentToFetch,b);b=this._addParamToObject("controller","true",b);b=this._addParamToObject("wmode","transparent",b);b=this._addParamToObject("cache","false",b);b=this._addParamToObject("quality","high",b);if(!Prototype.Browser.IE){var a=document.createElement("object");a.setAttribute("type",this.options.mimeTypes[this._fileExtension(this.contentToFetch)]);a.setAttribute("data",this.contentToFetch);a.setAttribute("id","lightwindow_media_secondary");a.setAttribute("name","lightwindow_media_secondary");a.setAttribute("width",this.resizeTo.width);a.setAttribute("height",this.resizeTo.height);a=this._addParamToObject("controller","true",a);a=this._addParamToObject("wmode","transparent",a);a=this._addParamToObject("cache","false",a);a=this._addParamToObject("quality","high",a);b.appendChild(a)}if(this._getParameter("lightwindow_iframe_embed")){this._appendIframe("no");this._writeToIframe(this._convertToMarkup(b,"object"))}else{this._appendObject(b,"object",$("lightwindow_contents"))}this._handleFinalWindowAnimation(0)}else{this._handleFinalWindowAnimation(0)}}this._setupActions()}};Event.observe(window,"load",lightwindowInit,false);var myLightWindow=null;function lightwindowInit(){myLightWindow=new lightwindow()}(function(a){a.ui=a.ui||{};a.extend(a.ui,{plugin:{add:function(c,d,g){var f=a.ui[c].prototype;for(var b in g){f.plugins[b]=f.plugins[b]||[];f.plugins[b].push([d,g[b]])}},call:function(b,c,f){var g=b.plugins[c];if(!g){return}for(var d=0;d<g.length;d++){if(b.options[g[d][0]]){g[d][1].apply(b.element,f)}}}},cssCache:{},css:function(b){if(a.ui.cssCache[b]){return a.ui.cssCache[b]}var c=a("<div class='ui-resizable-gen'>").addClass(b).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");a.ui.cssCache[b]=!!((/^[1-9]/.test(c.css("height"))||/^[1-9]/.test(c.css("width"))||!/none/.test(c.css("backgroundImage"))||!/transparent|rgba\(0, 0, 0, 0\)/.test(c.css("backgroundColor"))));try{a("body").get(0).removeChild(c.get(0))}catch(d){}return a.ui.cssCache[b]},disableSelection:function(b){if(!b){return}b.unselectable="on";b.onselectstart=function(){return false};if(b.style){b.style.MozUserSelect="none"}},enableSelection:function(b){if(!b){return}b.unselectable="off";b.onselectstart=function(){return true};if(b.style){b.style.MozUserSelect=""}}});a.fn.extend({mouseInteraction:function(b){return this.each(function(){new a.ui.mouseInteraction(this,b)})},removeMouseInteraction:function(b){return this.each(function(){if(a.data(this,"ui-mouse")){a.data(this,"ui-mouse").destroy()}})}});a.ui.mouseInteraction=function(d,c){var b=this;this.element=d;a.data(this.element,"ui-mouse",this);this.options=a.extend({},c);a(d).bind("mousedown.draggable",function(){return b.click.apply(b,arguments)});if(a.browser.msie){a(d).attr("unselectable","on")}};a.extend(a.ui.mouseInteraction.prototype,{destroy:function(){a(this.element).unbind("mousedown.draggable")},trigger:function(){return this.click.apply(this,arguments)},click:function(d){if(d.which!=1||a.inArray(d.target.nodeName.toLowerCase(),this.options.dragPrevention)!=-1||(this.options.condition&&!this.options.condition.apply(this.options.executor||this,[d,this.element]))){return true}var c=this;var b=function(){window.focus();c._MP={left:d.pageX,top:d.pageY};a(document).bind("mouseup.draggable",function(){return c.stop.apply(c,arguments)});a(document).bind("mousemove.draggable",function(){return c.drag.apply(c,arguments)})};if(this.options.delay){if(this.timer){clearInterval(this.timer)}this.timer=setTimeout(b,this.options.delay)}else{b()}return false},stop:function(b){var c=this.options;if(!this.initialized){return a(document).unbind("mouseup.draggable").unbind("mousemove.draggable")}if(this.options.stop){this.options.stop.call(this.options.executor||this,b,this.element)}a(document).unbind("mouseup.draggable").unbind("mousemove.draggable");this.initialized=false;return false},drag:function(b){var c=this.options;if(a.browser.msie&&!b.button){return this.stop.apply(this,[b])}if(!this.initialized&&(Math.abs(this._MP.left-b.pageX)>=c.distance||Math.abs(this._MP.top-b.pageY)>=c.distance)){if(this.options.start){this.options.start.call(this.options.executor||this,b,this.element)}this.initialized=true}else{if(!this.initialized){return false}}if(c.drag){c.drag.call(this.options.executor||this,b,this.element)}return false}})})(jQuery);function customFlashEvent(a,b){jQuery(document).trigger(a+".gameFlash",b)}var handledHash="";var markHashes=false;var markParams=Array();var ajaxBookmarkRunning=false;function ajaxBookmark(f){if(ajaxBookmarkRunning==false){ajaxBookmarkRunning=true;var d=window.location.hash;d=d.replace("#","/");d=d.replace(handledHash,"").replace(/^\//,"");hashes=d.split("/");if(d.length==0){if(f.length==0||handledHash.match(f)!=null){return}hashes=f.split("/")}var k=hashes.length;var b=null;var h=null;var c=null;var g=null;do{if(k>0&&hashes[0].match(":")==":"){currentHash=hashes.shift();b=currentHash.split(":");h=b[1].split(";");markParams=Array();if(typeof(h[1])!="undefined"){b[1]=h[0];c=h[1].split(",");for(var a=0;a<c.length;a++){g=c[a].split("=");markParams[g[0]]=g[1]}}jQuery.ajaxSetup({async:false});jQuery("#"+b[1],"#"+b[0]).click();jQuery.ajaxSetup({async:true})}}while(hashes.length>0);markHashes=true;ajaxBookmarkRunning=false}}function mysqlTimeStampToDate(c,a){a=typeof(a)!="undefined"?a:0;var b=/^([0-9]{2,4})-([0-1][0-9])-([0-3][0-9]) (?:([0-2][0-9]):([0-5][0-9]):([0-5][0-9]))?$/;var d=c.replace(b,"$1 $2 $3 $4 $5 $6").split(" ");d[3]=Number(d[3])+a;return new Date(d[0],d[1]-1,d[2],d[3],d[4],d[5])}function textBorders(){var b;var a;jQuery(".text_border").each(function(c){jQuery(this).removeClass("text_border");jQuery(this).clone(false).addClass("text_top").insertBefore(this);jQuery(this).clone(false).addClass("text_right").insertBefore(this);jQuery(this).clone(false).addClass("text_bottom").insertBefore(this);jQuery(this).clone(false).addClass("text_left").insertBefore(this);jQuery(this).clone(false).addClass("text_top text_left").insertBefore(this);jQuery(this).clone(false).addClass("text_top text_right").insertBefore(this);jQuery(this).clone(false).addClass("text_top text_left").insertBefore(this);jQuery(this).clone(false).addClass("text_top text_right").insertBefore(this)})}function updateHUD(b){var a;switch(b){case"packs":a="#supplies_1 #hud_stat_packs";break;case"cards":a="#supplies_1 #hud_stat_cards";break;case"challenge_coins":a="#supplies_2 #hud_stat_challenge_coins";break;case"war_supplies":a="#supplies_2 #hud_stat_coppers";break}jQuery.ajax({url:"/avatars/getuserstat/"+b,cache:false,success:function(c){jQuery(a).fadeOut("normal",function(){jQuery(this).html(c).fadeIn("normal")})}})}jQuery(document).ready(function(){jQuery(".fourway").live("mouseover",function(){if(!jQuery(this).hasClass("hold")){jQuery(this).css("backgroundPosition","bottom left")}});jQuery(".fourway").live("mouseout",function(){if(!jQuery(this).hasClass("hold")){jQuery(this).css("backgroundPosition","top left")}});jQuery(".fourway").live("mousedown",function(){if(!jQuery(this).hasClass("hold")){jQuery(this).css("backgroundPosition","bottom right")}});jQuery(".fourway").live("click",function(){if(!jQuery(this).hasClass("hold")){var a;if(jQuery(this).hasClass("secondary_nav")){a="secondary_nav"}else{a="primary_nav"}jQuery(".fourway.hold."+a).each(function(b,c){jQuery(c).css("backgroundPosition","top left");jQuery(c).removeClass("hold")});jQuery(this).addClass("hold");jQuery(this).css("backgroundPosition","top right")}});planetstorm.window={createModal:_createModal,closeModals:_closeModals,events:{createModal:new CG.Event(),closeModal:new CG.Event(),loadModal:new CG.Event()}};jQuery(".modal_trigger").live("click",function(){modal_source=jQuery(this).getData("modal_source");modal_params=jQuery(this).getData("modal_params");planetstorm.window.createModal(modal_source,modal_params);return false});jQuery("tr.listing").live("mouseover",function(){jQuery(this).children("td").css("borderTop","1px solid #f39f0d");jQuery(this).children("td").css("borderBottom","1px solid #f39f0d");jQuery(this).children("td.first").css("borderLeft","1px solid #f39f0d");jQuery(this).children("td.last").css("borderRight","1px solid #f39f0d");jQuery(this).addClass("green");jQuery(this).children("td").children("a").css("textDecoration","underline !important")});jQuery("tr.listing").live("mouseout",function(){jQuery(this).removeClass("green");jQuery(this).children("td").css("borderTop","1px solid transparent");jQuery(this).children("td").css("borderBottom","1px solid transparent");jQuery(this).children("td.first").css("borderLeft","1px solid transparent");jQuery(this).children("td.last").css("borderRight","1px solid transparent");jQuery(this).children("td").children("a").css("textDecoration","none")});jQuery(".hover_button_container").live("mouseover",function(){jQuery(this).find(".rollover").css("backgroundPosition","bottom left")});jQuery(".hover_button_container").live("mouseout",function(){jQuery(this).find(".rollover").css("backgroundPosition","top left")});jQuery("table.tabbed td.tab").live("mouseover",function(){if(!jQuery(this).hasClass("hold")){jQuery(this).addClass("selected");jQuery(this).prev("td").addClass("selected");jQuery(this).next("td").addClass("selected");jQuery(this).children("div").css("backgroundPosition","bottom")}});jQuery("table.tabbed td.tab").live("mouseout",function(){if(!jQuery(this).hasClass("hold")){jQuery(this).removeClass("selected");jQuery(this).prev("td").removeClass("selected");jQuery(this).next("td").removeClass("selected");jQuery(this).children("div").css("backgroundPosition","top")}});jQuery("table.tabbed td.tab").live("click",function(){if(!jQuery(this).hasClass("hold")){jQuery(this).siblings("td.hold").each(function(){jQuery(this).removeClass("hold");jQuery(this).removeClass("selected");jQuery(this).prev("td").removeClass("selected");jQuery(this).next("td").removeClass("selected");jQuery(this).children("div").css("backgroundPosition","top")});jQuery(this).addClass("hold");jQuery(this).addClass("selected");jQuery(this).prev("td").addClass("selected");jQuery(this).next("td").addClass("selected");jQuery(this).children("div").css("backgroundPosition","bottom")}});jQuery("#login_email, #login_password").click(function(){if(jQuery(this).val()=="Enter Email"||jQuery(this).val()=="Enter Password"){jQuery(this).val("")}});jQuery(".rollover").live("mouseover",function(){jQuery(this).css("backgroundPosition","bottom left")});jQuery(".rollover").live("mouseout",function(){jQuery(this).css("backgroundPosition","top left")})});function showDailyDeal(){if(planetstorm.showDailyDeal){planetstorm.window.createModal("/users2/awards/daily_deal",{width:580,height:493})}}var _modalCount=0;_createModal=function(b,m){var m=jQuery.extend(true,{closeOnClick:true,sourceMode:"ajax",width:400,height:400,className:"modal_container",top:100,left:(jQuery(window).width()-(m&&m.width?m.width:920))/2,afterClose:function(){},afterOpen:function(){}},m||{}),g=CG.Overlay.getInstance().show(),k=function(n){n.w.show();if(m.sourceMode=="iframe"){iframehtml='<iframe width="100%" height="100%" src="'+b+'"></iframe>';n.w.prepend(iframehtml);n.w.prepend(d)}if(m.closeOnClick){n.w.jqmAddClose(".close_button");n.w.jqmAddClose("#top_bar_overlay")}m.afterOpen.call(n.w)},f=function(n){n.w.remove();g.hide();m.afterClose.call(n.w)},l=function(n){n.w.prepend('<div id="themed_modal_close" class="close_button"></div>');if(m.closeOnClick){n.w.jqmAddClose(".close_button")}};var c=jQuery('<div id="planetstorm_modal_'+(_modalCount++)+'" class="'+m.className+'"></div>');var d=jQuery('<div id="themed_modal_close" class="close_button"></div>');switch(m.sourceMode){case"ajax":ajax=b;break;case"div":ajax=false;try{var a=jQuery(b);if(a.length==0){throw ("source is not found in the dom")}c.append(d);c.append(a.html())}catch(h){}break;case"iframe":ajax=false;break}_modal=c.css({width:m.width+"px",height:m.height+"px",top:m.top+"px",left:m.left+"px"}).prependTo(document.body).jqm({ajax:ajax,ajaxText:'<img src="/img/new/loaders/ajax-loader.gif" style="position: absolute; top: 100px; left: '+((m.width-16)/2)+'px"/>',overlay:0,closeClass:"modal_close",onShow:k,onHide:f,onLoad:l}).jqmShow()},_closeModals=function(){if(_modal){_modal.jqmHide()}};function Planetstorm(d){var a=this;this.getImageUrl=b;this.params=d;function c(){jQuery.extend(a,{setShowDailyDeal:setShowDailyDeal,getCookie:_getCookie,setCookie:_setCookie,fetchMessages:_fetchMessages});a.setShowDailyDeal()}function b(f){return"http://"+a.params.staticServer+"/themed/planetstorm/img/"+f}setShowDailyDeal=function(){if((!_getCookie("Planetstorm_Daily_Deal"))&&a.params.avatar_id){_setCookie("Planetstorm_Daily_Deal","1",1);a.showDailyDeal=true}else{a.showDailyDeal=false}};_getCookie=function(g){var k=g+"=";var f=document.cookie.split(";");for(var h=0;h<f.length;h++){var l=f[h];while(l.charAt(0)==" "){l=l.substring(1,l.length)}if(l.indexOf(k)==0){return l.substring(k.length,l.length)}}return null};_setCookie=function(h,k,l){if(l){var g=new Date();g.setTime(g.getTime()+(l*24*60*60*1000));var f="; expires="+g.toGMTString()}else{var f=""}document.cookie=h+"="+k+f+"; path=/"};_fetchMessages=function(){jQuery.ajax({url:"/messages/fetch/json/",dataType:"json",success:function(f){a.messageData=f;setTimeout(_displayMessagesInUserBar,3000);_displayMessagesInGrowl()}})};_displayMessagesInUserBar=function(){msgs=a.messageData.messages;var f="";for(var g in msgs){if(msgs.hasOwnProperty(g)){f+='<a href="/messages/view/'+msgs[g].id+'">'+msgs[g].subject.substring(0,30)+"...</a><br />"}}jQuery("div#messages_count").text(a.messageData.messageCount);jQuery("div#messages_text").html(f)};_displayMessagesInGrowl=function(){msgs=a.messageData.messages;var f=[];for(var h in msgs){if(msgs.hasOwnProperty(h)){f.push({subject:msgs[h].subject,body:msgs[h].body,date:msgs[h].updated})}}jQuery.growl.settings.displayTimeout=1500*f.length+1;var k=a.params.cakeController+a.params.cakeAction;if(a.params.previousPageload){a.params.previousPageload=mysqlTimeStampToDate(a.params.previousPageload,0)}for(var g=0;g<f.length;g++){messageTime=mysqlTimeStampToDate(f[g].date,0);if(a.params.previousPageload<messageTime&&k!="battleview"&&k!="battlewinnings"){if(f[g].subject==f[g].body){jQuery.growl(f[g].subject,"")}else{jQuery.growl(f[g].subject,f[g].body)}}}};c()}function Walkthrough(){var v=false;var f=0;var a=false;var w=false;var c="human";var s=[{name:"avatar",nextButton:true},{name:"hero",nextButton:true,heading:"walkthrough/here_is_your_first_leader.png",text:"These cards are serious",height:500},{name:"squad",nextButton:true,heading:"walkthrough/make_your_first_squad.png",text:"Building your first squad is pretty fun",height:621},{name:"battle",nextButton:false,heading:"walkthrough/your_first_battle.png",text:"This is your first fight so it better be awesome.",height:557}];this.setSaving=m;this.getSaving=t;this.saveAvatar=u;this.resetButton=k;this.help=p;q();function q(){try{r()}catch(y){}}function m(y){v=y}function t(){return v}function l(){if(w==true){return false}switch(s[f].name){case"avatar":o();break;case"hero":g();break;case"squad":b();break}}function n(){jQuery("#next-step").fadeOut("fast")}function g(){w=true;jQuery("#steps").animate({height:s[f+1].height},500,function(){jQuery("#step"+f).addClass("hide");f++;var y=Math.ceil((f/(s.length-1))*100);jQuery(".mega-xp").animate({width:y+"%"},800,function(){jQuery("#walkthrough div.box img").css("display","none").attr("src",planetstorm.getImageUrl(s[f].heading)).css("display","block");k();jQuery("#step"+f).removeClass("hide");w=false;p()})})}function k(){jQuery("#next-step").removeClass("hold").css("backgroundPosition","top left")}function p(){if(s[f].name=="squad"){planetstorm.window.createModal("/help/squadbuilder",{sourceMode:"iframe",width:700,height:457})}if(s[f].name=="battle"){planetstorm.window.createModal("/help/battleviewer",{sourceMode:"iframe",width:700,height:457})}}function r(){jQuery("#next-step").click(function(){l()})}function b(){jQuery.ajax({url:"/avatars/hassquads",dataType:"html",success:function(y){a=jQuery(y).hasClass("hassquads");if(a==true){h()}else{k();alert("You must save your squad before continuing.")}}})}function h(){d();jQuery.ajax({url:"/challenges/walkthrough_challenge",dataType:"html",success:function(y){var z=jQuery(y).find("form").serialize();jQuery.ajax({url:"/challenges/attack",dataType:"html",type:"POST",data:z,success:function(A){jQuery("#step"+(f+1)).html(A);n();g()}})}})}function d(){jQuery("#next-step").css("backgroundPosition","top right").addClass("hold")}function o(){if(!v){v=true;x("EmbeddedFlashElement").saveAvatar()}}function u(){jQuery.ajax({url:"/avatars/give_starter_pack/",dataType:"html",type:"POST",success:function(y){g()}})}function x(y){if(navigator.appName.indexOf("Microsoft")!=-1){return window[y]}else{return document[y]}}}(function(a){a(function(){CG=typeof(CG)=="undefined"?{}:CG;var p=new CG.TopBarDropdown("#external_friend_manager"),w=false,q={defaultGame:null,urls:{everyone:"/social_widgets/social_widgets/relations/all",online:"/social_widgets/social_widgets/relations/online",pending:"/social_widgets/social_widgets/relations/pending",summary:"/social_widgets/social_widgets/relations/summary",detail:"/social_widgets/social_widgets/relations/detail/",invite:"/social_widgets/social_widgets/invite"},defaultGroup:"online",visibleGroupSize:7,FB:{inviteMessage:"Come play with me",inviteType:"Challenge Games",inviteTitle:"Invite Your Friends",inviteRedirect:window.location,inviteLanding:""}},k={dataLoaded:new CG.Event(),detailSelected:new CG.Event(),groupScroll:new CG.Event(),facebookStatusConfirmation:new CG.Event()},v={everyone:"All Friends",online:"Online Friends",pending:"Pending Invites"},l=p._topBar,r=p._container,o=p._title,u=a("span#friendmanager_count"),d=a("ul#frienditem_container"),m=a("div#frienditem_wrapper"),g=function(){a.extend(true,CG.FriendManager.options,CG.options&&CG.options.FriendManager?CG.options.FriendManager:{});var y=null,z=0;if(r.length){for(var x in v){var A=new b(x);if(x==q.defaultGroup){y=A}}new t();CG.TopBarDropdown.events.beforeShow.subscribe(function(C,B){if(B.id&&f(B.id)&&z==0&&y!=null){y.toggle()}z++});k.dataLoaded.subscribe(function(D,C){if(C.type=="summary"&&C.data.online!=null&&C.data.everyone!=null){var B=C.data.online;u.text("("+B+"/"+C.data.everyone+")");setTimeout(function(){u.css("width","50px");setTimeout(function(){u.css("width","auto")},500)},250);if(B){o.addClass("active")}else{o.removeClass("active")}}});s("summary")}},f=p._checkId,s=function(A,z){if(a.inArray(A,q.urls)){if(A=="summary"){var y={};var x=a.grep(document.cookie.split(";"),function(C){if(a.trim(C.split("=")[0]).indexOf("FriendManager."+A+".")===0){var B=a.trim(C.split("=")[0]).substr(("FriendManager."+A+".").length);y[B]=C.split("=")[1]||false}});y=n(y)?y:null}if(typeof(y)!="undefined"&&y){k.dataLoaded.fire({type:A,data:y,id:z})}else{a.getJSON(q.urls[A]+(z||"")+"?"+Math.random(),{},function(C,D){if(A=="summary"){var B=(new Date());B.setMinutes(B.getMinutes()+2);B=B.toGMTString();a.each(C,function(E,F){document.cookie="FriendManager."+A+"."+E+"="+escape(F)+";path=/;expires="+B})}k.dataLoaded.fire({type:A,data:C,id:z})})}}},n=function(z){var x=0;for(var y in z){if(z.hasOwnProperty(y)){x++}}return x},c=function(z,E,B,V,D,Q,ac,H){var ad=this,T=z,P=B,O=E,C=V,Z=D,y=a("<span>"+(O||Z)+"</span>").truncate(15).text(),X=Q,K=X.length,J=X[0],W=ac==1,x=Z=="invitation",G=Z=="fbinvitation",M=x||G,S=a('<li class="frienditem_'+(W?"online":"offline")+'"><img src="/common/img/c.gif" alt="" class="game_account account_'+J+'"/></li>'),ab=a('<a href="#" onclick="return false;">'+a("<span>"+P+"</span>").truncate(M?25:10).text()+(M?"":" ("+y+")")+"</a>").appendTo(S),F,aa=M?null:a('<a href="#" class="frienditem_selecticon" onclick="return false"><img src="/common/img/c.gif" alt="" /></a>').prependTo(S),L=function(){if(K>1){for(var ag=1;ag<K;ag++){ab.after(' <img src="/common/img/c.gif" class="game_account account_'+X[ag]+'" />')}}if(!M){ab.bind("click",Y);aa.bind("click",Y)}else{if(x){var af=a('<a href="#" class="frienditem_action" onclick="return false;">Remind</a>').prependTo(ab.parent()),ae=a('<img class="frienditem_action" src="/common/img/ajax_load.gif" />'),ah=a('<span class="frienditem_action completed">Reminded</span>');af.click(function(ai){ai.stopPropagation();af.replaceWith(ae);a.get("/social_widgets/remind/"+T,{},function(){ae.replaceWith(ah)})})}}k.detailSelected.subscribe(U);CG.TopBarDropdown.events.beforeHide.subscribe(function(aj,ai){if(ai.id&&f(ai.id)){U()}});k.groupScroll.subscribe(U)},Y=function(ae){if(!F){F=new h(T,C)}k.detailSelected.fire({detail:ad});F.show(S.offset().top-m.offset().top,m.innerWidth()+(m.outerWidth()-m.innerWidth())/2)},I=function(ae){},U=function(af,ae){if(F&&(ae==undefined||ae.detail==undefined||ae.detail!=ad)){F.hide()}},A=function(){S.hide();return ad},R=function(){S.show();return ad},N=function(ae){S.appendTo(ae);return ad};this.hide=A;this.show=R;this.appendTo=N;L()},h=function(y,C){var K=y,D=a('<ul class="frienditem_detail" style="position: absolute; display: none; z-index: 1001;"><li class="loading_img" ><img src="/common/img/c.gif" alt="" /></li></ul>').appendTo(m),F=a('<li class="frienditem_detailimage"><img src="'+C+'" alt="" /></li>').appendTo(D).hide(),B=a('<li class="frienditem_detailaccounts"><span class="frienditem_accounts label">Accounts</span><ul></ul></li>').appendTo(D).hide(),H=a('<li class="frienditem_detailnews"><span class="frienditem_accounts label">Latest News</span><ul></ul></li>').appendTo(D).hide(),z=null,J=false,E=false,I=function(){k.dataLoaded.subscribe(x)},A=function(){D.hide()},G=function(M,L){D.css({top:M+"px",left:L+"px"}).show();if(!J&&!E){E=true;s("detail",y)}},x=function(P,O){if(O.type!=undefined&&O.type=="detail"&&O.id==K){var Q=O.data.avatars.length,L=O.data.bulletins.length;E=false;J=true;D.find("li").show();D.find("li.loading_img").hide();a.each(O.data.avatars,function(){var R=this.icon;a('<li class="frienditem_'+(this.online?"online":"offline")+'"><img src="/common/img/c.gif" alt="" class="game_account account_'+this.game+'"/><a href="'+this.link+'">'+this.name+"</a></li>").appendTo(B.find("ul")).find("a, img").hover(function(){F.find("img").get(0).src=R},function(){F.find("img").get(0).src=C})});if(L){for(var M=0;M<L;M++){if(O.data.bulletins[M].type=="comment"){var N='New Comment: "'+O.data.bulletins[M].content+'"'}else{var N=O.data.bulletins[M].content}H.find("ul").append('<li><img src="/common/img/c.gif" alt="" class="game_account account_'+O.data.bulletins[M].game+'"/><span>'+N+"</span></li>")}}else{H.find("ul").append("<li>No recent news</li>")}}};this.hide=A;this.show=G;I()},b=function(Q){var L={everyone:"No Friends",online:"No Online Friends",pending:"No Pending Invitations"},G=Q,y=[],x=false,A=false,C=false,K=0,E=0,N=false,F=a('<li class="frienditem_group"><a href="#" onclick="return false;"><span class="frienditem_groupname">'+v[G]+"</span></a></li>").appendTo(d),I=a('<a href="#" onclick="return false"><img src="/common/img/c.gif" class="frienditem_groupselector" /></a>').prependTo(F),O=a('<span class="frienditem_groupcount">0</span>').prependTo(F),B=a('<div class="frienditem_groupwrapper"></div>').css({position:"relative",overflow:"hidden",display:"none"}).appendTo(F),M=a('<ul><li class="loading_img" ><img src="/common/img/c.gif" alt="" /></li></ul>').appendTo(B),D=function(){F.find("a").bind("click",H);k.dataLoaded.subscribe(J)},H=function(){if(x){F.removeClass("selected");B.hide();F.find(".frienditem_groupcontrols").hide()}else{F.addClass("selected");F.find(".frienditem_groupcontrols").show();B.show();if(!A&&!C){C=true;s(G)}}k.detailSelected.fire({detail:null});x=!x},J=function(X,V){var R=[];if(V.type=="summary"&&V.data[G]!=undefined){P(V.data[G])}else{if(V.type==G){C=false;A=true;K=V.data.length;M.find(".loading_img").hide();if(K){for(var T=0;T<K;T++){var U=V.data[T],S=(new c(U.user_id,U.user_name,U.avatar_name,U.user_image,U.relation_type,U.user_accounts,U.online,U.extras||{})).appendTo(M);y.push(S);if(T>=q.visibleGroupSize){F.addClass("overflow");S.hide();R.push(S)}}}else{a("<li>"+L[G]+"</li>").appendTo(M)}function W(ab,aa){if((aa==undefined||(aa.id&&f(aa.id)))&&m.is(":visible")){var Y=R.length;if(Y){B.css({height:M.find("li:visible:first").height()*q.visibleGroupSize});for(var Z=0;Z<Y;Z++){R[Z].show()}z();R=[]}}}CG.TopBarDropdown.events.beforeShow.subscribe(W);W()}}},z=function(){var U=a('<a href="#" onclick="return false;" class="navUp frienditem_groupcontrols"></a>').css({opacity:0.75}).insertBefore(B),S=a('<a class="navDown frienditem_groupcontrols" href="#" onclick="return false;"></a>').css({opacity:0.75}).insertBefore(B),V=M.find("li:eq(1)").height();function R(){E>0?U.show():U.hide();E+q.visibleGroupSize<K?S.show():S.hide()}function T(ab){if(!N){N=true;var Z=a(ab.target).hasClass("navUp"),X=Z?-Math.min(q.visibleGroupSize,E):Math.min(q.visibleGroupSize,K-E-q.visibleGroupSize),aa=M.find("li:visible:eq("+E+")").offset().top,W=M.find("li:visible:eq("+(E+X)+")"),Y=aa-W.offset().top;k.groupScroll.fire();M.animate({top:"+="+Y+"px"},500,null,function(){M.css({top:(parseInt(M.css("top"),10)+aa-W.offset().top)+"px"});E+=X;R();N=false})}}U.bind("click",T);S.bind("click",T);R()},P=function(R){O.text(R)};this.toggle=H;D()},t=function(){var A=false,y=false,x=false,E=a('<li class="misc_group"><ul></ul></li>').appendTo(d),F=a('<li style="display: none;"><a href="#" onclick="return false;"><img class="game_account account_facebook" src="/common/img/c.gif" />Connect Your Account With Facebook</a></li>').appendTo(E.find("ul")),D=a('<li style="display: none;"><a href="#" onclick="return false;"><img class="game_account account_cg" src="/common/img/c.gif" />Invite Your Friends</a><div id="invite_container" style="display: none;"><p>Add up to 5 email addresses separated by a comma:</p><textarea></textarea><a href="#" onclick="return false;">Submit</a><p id="message_response"></p></div></li>').appendTo(E.find("ul")),I=a('<li style="display: none;"><a href="#" onclick="return false;"><img class="game_account account_facebook" src="/common/img/c.gif" />Invite your Facebook Friends</a></li>').appendTo(E.find("ul")),H=function(){k.facebookStatusConfirmation.subscribe(C);if(typeof(FB)!="undefined"&&typeof(FB_RequireFeatures)!="undefined"){FB_RequireFeatures(["Connect","XFBML"],function(){FB.Connect.ifUserConnected(function(){A=true;k.facebookStatusConfirmation.fire()},function(){A=false;k.facebookStatusConfirmation.fire()})})}D.find("#invite_container a").click(G);D.show().find("> a").click(function(){D.find("#invite_container").toggle()})},C=function(){k.facebookStatusConfirmation.unsubscribe(C);if(A){if(typeof(q.FB.inviteLink)==="string"){I.show().find("a").attr({href:q.FB.inviteLink,onclick:""})}else{I.show().find("a").bind("click",B)}}else{F.show().find("a").bind("click",z)}x=true},z=function(K){try{FB.Connect.requireSession();FB.Facebook.get_sessionState().waitUntilReady(function(){setTimeout("window.location = '/users/facebookautoregister';",1200)})}catch(J){}},B=function(L){var K="",R=q.FB.inviteTitle,S=q.FB.inviteMessage,O=q.FB.inviteType,P="http://"+window.location.host+"/external_accounts/facebook/processinvites?next="+encodeURIComponent(q.FB.inviteRedirect),Q=q.FB.inviteLanding,J=760,N='<fb:fbml><fb:request-form action="'+P+'" close_dialog="1" method="POST" invite="true" type="'+O+'" content="'+S+"<fb:req-choice url='"+Q+'\' label=\'Accept\' />"><fb:multi-friend-selector rows="4" showborder="false" actiontext="'+R+'" exclude_ids="" /></fb:request-form></fb:fbml>',M=new FB.UI.FBMLPopupDialog(K,N);M.set_placement(FB.UI.PopupPlacement.topCenter);M.setContentWidth(J);M.show()},G=function(M){if(!y){var J=q.urls.invite,N=D.find("#invite_container textarea").get(0),K="An error occured while processing your emails, please try again later",L=D.find("#message_response");y=true;a.post(J,{invite_emails:N.value},function(O){y=false;if(O.emails){K="Invitations were successfully sent to the following emails:<br />"+O.emails.join("<br /> ")}else{if(O.message){K=O.message}}D.find("#invite_container").animate({opacity:1},250);L.html(K)},"json");N.value="";D.find("#invite_container").animate({opacity:0.01},2000)}};H()};CG.FriendManager=a.extend(p,{options:q});g()})})(jQuery);(function(a){a(function(){CG=typeof(CG)=="undefined"?{}:CG;var u=new CG.TopBarDropdown("#external_account_manager"),o=false,r=false,n=false,m={},s={url:"/users2/accounts/accounts"},h={dataLoaded:new CG.Event()},c=u._topBar,p=u._container,l=u._title,t=a("div#accountitem_wrapper"),g=a("ul#accountitem_container").html('<li class="loading_img" ><img src="/common/img/ajax_load.gif" alt="" /></li>'),q=function(){a.extend(true,s,CG.options&&CG.options.AccountManager?CG.options.AccountManager:{});CG.TopBarDropdown.events.beforeShow.subscribe(function(w,v){if(v.id&&k(v.id)){if(!r&&!n&&CG.GAMES){a.each(CG.GAMES,function(y,x){m[y]=new f(y,x.name,x.link)});g.append('<li id="accountitem_account_cg"><img src="/common/img/c.gif" alt="" class="game_account account_cg"/><a href="http://www.challengegames.com/">Challenge Games Corporate Site</a></li>');b()}}});h.dataLoaded.subscribe(function(w,v){p.find("li.loading_img").hide();if(v.accounts&&v.accounts.length){a.each(v.accounts,function(){if(m[this.game_id]){m[this.game_id].addAccount(new d(this.name,this.game_id,this.link,this.icon))}})}})},k=u._checkId,b=function(){n=true;a.getJSON(s.url,{},function(v,w){h.dataLoaded.fire({accounts:v});r=true;n=false})},f=function(C,w,y){var x=this,B=a("<li accountitem_account_"+C+'><img src="/common/img/c.gif" alt="" class="game_account account_'+C+'"/><a href="'+y+'">'+w+"</a></li>").appendTo(g),v=a('<ul style="display: none;"></ul>').appendTo(B),A=function(){a.extend(x,{addAccount:z})},z=function(D){D.appendTo(v.show())};A()},d=function(w,v,A,z){var y=this,C=a('<li><img src="'+z+'" alt="" /><a href="'+A+'">'+w+"</a></li>"),B=function(){a.extend(y,{appendTo:x})},x=function(D){C.appendTo(D);return y};B()};CG.AccountManager=a.extend(u,{options:s});q()})})(jQuery);(function(a){a(function(){CG=typeof(CG)=="undefined"?{}:CG;var p=new CG.TopBarDropdown("#external_award_manager"),v=false,d={all:false,summary:false},g={all:false,summary:false},q={urls:{all:"/users2/awards/transactions/RP",summary:"/users2/awards/summary/RP"},redeem:null,info:"http://www.challengegames.com/rewardpoints.php"},k={dataLoaded:new CG.Event()},m=p._topBar,r=p._container,o=p._title,u=a("span#awardmanager_count"),n=a("div#awarditem_wrapper"),c=a("ul#awarditem_container").html('<li class="loading_img" ><img src="/common/img/ajax_load.gif" alt="" /></li>'),l="dataLoaded",h=function(){a.extend(true,q,CG.options&&CG.options.AwardManager?CG.options.AwardManager:{});if(r.length){t("summary")}o.click(function(w){if(!d.all&&!g.all){t("all")}});k.dataLoaded.subscribe(function(C,B){if(B){if(B.type=="all"){var x=B?B.data:[],w=x?x.length:0;r.find("li.loading_img").hide();if(q.redeem||q.info){var y='<li class="misc_group"><ul>'+(q.redeem?'<li><a href="'+q.redeem+'">Redeem Reward Points</a></li>':"")+(q.info?"<li><a href='#' onclick=\"window.open('"+q.info+"', 'share', 'width=680,height=650,menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=1'); return false;\" target=\"_blank\">About Reward Points</a></li>":"")+"</ul></li>";c.html(y)}if(w>0){var A=a("<li>Last "+w+" Transactions:</li>").appendTo(c);for(var z=0;z<w;z++){new b(x[z].id,Math.floor(parseInt(x[z].amount,10)),x[z].transaction_date,""+x[z].transaction_type,""+x[z].memo)}o.addClass("active")}else{var A=a("<li>You have not earned any reward points.</li>").appendTo(c);o.removeClass("active")}}else{if(B.type=="summary"){u.html("("+(B.data||0)+")").show();setTimeout(function(){u.css("width","300px");setTimeout(function(){u.css("width","auto")},500)},500)}}}})},f=p._checkId,t=function(w){g[w]=true;if(a.inArray(w,q.urls)){a.getJSON(q.urls[w]+"?"+Math.random(),{},function(x,y){k.dataLoaded.fire({type:w,data:x});d[w]=true;g[w]=false})}},s=function(z){z+="";var A=z.split(".");var x=A[0];var w=A.length>1?"."+A[1]:"";var y=/(\d+)(\d{3})/;while(y.test(x)){x=x.replace(y,"$1,$2")}return x+w},b=function(B,y,x,A,w){var z=a('<li><img src="/common/img/c.gif" alt="" class="game_award"/></li>');var x=a('<span class="award_date">'+x.substr(0,16)+"</span>").appendTo(z),y=a('<span class="award_amount '+((y>0)?'award_amount_inc">+':'award_amount_dec">')+s(y)+"</span>").appendTo(z),w=a('<span class="award_memo" title="'+w.replace("'","\\'")+'">'+w+"</span>").truncate(20).appendTo(z);z.appendTo(c)};CG.AwardManager=a.extend(p,{options:q});h()})})(jQuery);(function(a){a(function(){CG=typeof(CG)=="undefined"?{}:CG;var r=new CG.TopBarDropdown("#external_feed_manager"),s={url:"/messaging/bulletins/feed"},m={afterDataLoad:new CG.Event(),afterFilterSelection:new CG.Event()},w=false,b=false,k=false,g=false,u=["January","February","March","April","May","June","July","August","September","October","November","December"],o=r._topBar,t=r._container,q=r._title,p=a("#feeditem_wrapper"),f=a("#feeditem_container"),l=function(){a.extend(true,s,CG.options&&CG.options.FeedManager?CG.options.FeedManager:{});m.afterDataLoad.subscribe(c);CG.TopBarDropdown.events.beforeShow.subscribe(function(y,x){if(x.id&&h(x.id)){if(!g&&!k){n();new v("all","All","cg");p.find("li.feedfilter_item").eq(0).click();if(CG.GAMES){a.each(CG.GAMES,function(A,z){if(z.hasBulletins){new v(A,z.name,A)}})}k=true}}})},h=r._checkId,n=function(){f.css({overflow:"auto"});p.prepend('<ul class="feedfilter_container"></ul>');f.append('<div class="loading_img" style="display: none;"><img src="/common/img/c.gif" /></div>')},c=function(A){var B=a(window).height(),z=a(window).scrollTop(),x=f.offset().top-z,y=(B-x-50);f.css("height",Math.min(f.height(),y)+"px")},d=function(T,I,X,B,V,ab,C,D,F,A){var ad=this,z=T,L,R,G,aa,x,Z,ac,Q=[],Y,W,K,H=function(){L=B=="comment";R=A?true:false;G=a('<li class="feeditem_itemcontainer feeditem_type_'+I+'"><div class="feeditem_bg">&nbsp;</div></li>');aa=a('<div class="feeditem_authoricon"><img src="'+C.iconUrl+'" alt="" /><img class="game_account account_'+C.gameId+'" src="/common/img/c.gif" alt="" /></div>').appendTo(G);x=a('<div class="feeditem_content"><a class="feeditem_authorname feeditem_headline" href="'+C.linkUrl+'">'+C.name+"</a> </div>").appendTo(G);Z=a('<ul class="feeditem_actions"></ul>').appendTo(G);G.append('<div class="clear_fix"></div>');ac=a('<ul class="feeditem_comments"></ul>').appendTo(G);W=A||a('<li class="feeditem_reply" style="display: none;"><div class="feeditem_bg"></div></li>');a.data(G.get(0),"itemObj",ad);if(L&&D){x.append('<span class="feeditem_headline">wrote on</span> <span class="feeditem_headline feeditem_feed">'+D.name+':</span><br /><span class="feeditem_text">'+X+"</span>")}else{x.append(X)}Y=a('<a href="#" class="feeditem_reply" onclick="return false;">Reply</a>').appendTo(Z).wrap("<li></li>");Y.click(M);if(F){var ae=F.length,af;if(ae){for(af=0;af<ae;af++){Q.push((new d(F[af].id,I,F[af].content,"comment",V,F[af].created,F[af].author,null,[],W)).appendTo(ac).hide())}if(ae>2){Q[0].show();Q[ae-1].show();K=a('<a href="#" onclick="return false;">Show all '+ae+" comments...</a>").insertAfter(ac.find("li.feeditem_itemcontainer:first")).wrap('<li class="feeditem_showmore"></li>');K.click(E)}else{for(af=0;af<ae;af++){Q[af].show()}}}}if(!R){var ag=a('<a href="#" onclick="return false;">Submit</a>');ag.bind("click",S);W.append("<textarea></textarea>").append(ag).appendTo(ac)}},E=function(ag){if(K){K.parent().hide()}var ae=Q.length;for(var af=0;af<ae;af++){Q[af].show()}},S=function(af){var ah=W.find("textarea").get(0),ae=ah.value,ag=a.data(W.parents(".feeditem_itemcontainer").get(0),"itemObj").id;W.animate({opacity:0.01},500).slideUp(500);if(ae){ah.value="";a.post("/messaging/bulletins/feedreply",{content:ae,id:ag},function(ai){if(ai.id){(new d(ai.id,I,ai.content,"comment",ai.author.game_id,ai.created,ai.author,null,[],W)).hide().insertBefore(W).appear()}},"json")}},J=function(ae){G.appendTo(ae);return ad},U=function(ae){G.prependTo(ae);return ad},P=function(ae){G.insertBefore(ae);return ad},y=function(){G.css("display","none");return ad},O=function(){G.show();if(!G.find(".feeditem_bg").height()){setTimeout(function(){G.find(".feeditem_bg").css("height","100%")},50)}return ad},N=function(){G.hide().css("opacity",0).slideDown(1000).animate({opacity:1},1000);G.find(".feeditem_bg").css("height","100%");return ad},M=function(ae){f.find("li.feeditem_reply").hide();W.show().find("textarea").get(0).focus()};a.extend(this,{id:z,appendTo:J,prependTo:U,insertBefore:P,hide:y,show:O,appear:N});H()},v=function(y,x,C){var B=a('<li class="feedfilter_item"><a href="#" onclick="return false;"><img class="game_account account_'+C+'" src="/common/img/c.gif" />'+x+"</a></li>").appendTo(p.find("ul.feedfilter_container")),A=a('<ul class="feedfilter_filtercontainer"></ul>').appendTo(f),G=false,E=function(){B.bind("click",F);m.afterFilterSelection.subscribe(D)},z=function(H){if(!k){k=true;a.getJSON(s.url+"/"+(H=="all"?"":H),function(N){k=false;g=true;G=true;f.find("> .loading_img").hide();var M=N.length,K,I,J,L;if(M){for(K=0;K<M;K++){J=new Date(N[K].created);L=u[J.getUTCMonth()]+" "+J.getUTCDate()+", "+J.getUTCFullYear();if(I!=L){I=L;A.append('<li class="feeditem_type_'+H+' feeditem_date">'+L+"</li>")}(new d(N[K].id,H,N[K].content,N[K].type,N[K].game_id,J,N[K].author,N[K].feed,N[K].comments)).appendTo(A)}}else{f.append('<li class="no_items feeditem_type_'+H+'">No recent activity...</li>')}A.show();m.afterDataLoad.fire({id:H})})}},F=function(H){f.find("ul.feedfilter_filtercontainer").hide();f.find(".loading_img").show();if(!G){z(y)}else{f.find(".loading_img").hide();A.show()}m.afterFilterSelection.fire({id:y})},D=function(I,H){if(H.id==y){B.addClass("selected")}else{B.removeClass("selected")}};E()};CGFeedManager=a.extend(r,{options:s});l()})})(jQuery);var tournamentsLoaded=false;var t_faction;var t_squadSlots=new Array();var t_squadIds=new Array();var t_squadLimit;var t_squadIndex;var t_factionImage;var t_squadId;var tournamentPages;var tournaments=new Array();var tournamentRegistrants;var tournamentRegistrantsInterval;var tournamentInterval;var tournamentsPage=1;var redraw=false;var animate;var tournamentCount=0;jQuery(document).ready(function(){jQuery("#tournaments_table tr td").live("click",function(){if(!jQuery(this).parent("tr").hasClass("watchable")){jQuery("#tournamentsListing").css("display","none");currentTournament=jQuery(this).parent("tr").attr("id");loadTournamentRegistration(currentTournament);jQuery("#tournamentregistration").css("display","block")}});jQuery("#tournament_select_squads").live("click",function(){loadTournamentSquadSelection(currentTournament)});jQuery("#tournaments_tab, #tournament_back").live("click",function(){jQuery("#tournamentsListing").css("display","block");jQuery("#tournamentregistration").css("display","none");t_squadSlots=[];t_squadIds=[];if(tournamentsLoaded==false){tournamentsLoaded=true;loadTournaments(tournamentsPage)}else{refreshTournaments(tournamentsPage)}});jQuery("#tournament_squad_back").live("click",function(){loadTournamentRegistration(currentTournament)});jQuery("#tournament_squad_selection div.tournament_squad").live("click",function(){t_squadId=jQuery(this).attr("id");t_faction=jQuery(this).children("input").val();if(jQuery(this).hasClass("selected_squad")){jQuery(this).css("border","2px solid gray");jQuery(this).removeClass("selected_squad");t_squadIndex=jQuery.inArray(t_faction,t_squadSlots);t_squadSlots.splice(t_squadIndex,1);t_squadIds=jQuery.grep(t_squadIds,function(b){return b!=t_squadId});t_resetSquadIcons(t_squadSlots)}else{if(t_squadSlots.length<t_squadLimit){t_squadIds.push(t_squadId);jQuery(this).fadeTo("fast","1");jQuery(this).css("border","2px solid red");jQuery(this).addClass("selected_squad");t_squadSlots.push(t_faction);t_drawSquadIcons(t_squadSlots)}}});jQuery("#tournament_confirm_squads").live("click",function(){registerForTournament(currentTournament)})});function t_drawSquadIcons(b){for(var a=0;a<b.length;a++){t_faction=b[a];t_factionImage="url(/img/faction-icon-"+t_faction+".png) no-repeat";jQuery("#tournament_squad_slot_container #slot"+(a+1)).css("background",t_factionImage)}}function t_resetSquadIcons(a){jQuery("#tournament_squad_slot_container div").each(function(){jQuery(this).css("background","url(/img/faction-icon-empty.png) no-repeat")});t_drawSquadIcons(a)}function getRegistrants(){jQuery.getJSON("/challenges/getallregistrants/",function(d){var a;var f=0;var b;if((tournamentCount)!=d.count){loadTournaments(tournamentsPage)}tournamentRegistrants=d;for(var c=0;c<d.id_list.length;c++){a=d.id_list[c];if(typeof(tournaments[a])!="undefined"){f=d[a].length;jQuery("#tournament_percent_display_"+a).html(f);jQuery("#tournament_percentage_"+a).val(Math.floor((f/tournaments[a].size_max)*100));b="";if(f==tournaments[a].size_max){jQuery("#tournament_"+a).find(".achievements_percentage").addClass("green");jQuery("#tournament_"+a).addClass("watchable");b+='<a class="orange" href="/challenges/watchtournament/'+tournaments[a].uuid+'">Watch</a>'}else{if(tournaments[a].eligible==true){if(tournaments[a].registered==true){b+='<img src="http://'+staticServer+'/themed/planetstorm/img/layout/flare/flag.png"/>'}else{b+='<img src="http://'+staticServer+'/themed/planetstorm/img/layout/flare/check.png"/>'}}else{b+="No"}}}jQuery("#tournament_qualify_"+a).html(b)}animateRegistrants()})}function loadRegistrants(d,a){var b="";if(d.watchable==true){b="";jQuery("#tournament_message").html("This tournament has started.  Click watch to view");jQuery("#tournament_buttons").html('<a href="/challenges/watchtournament/'+d.uuid+'"><h3 style="text-align:center;margin:0 auto;" class="center auto small_button watch rollover">Watch</h3></a>')}else{if(typeof(d.registrants)!="undefined"){b='<h3 style="margin-bottom:10px">Current Registrants ('+d.registrants.length+"/"+tournaments[a].size_max+")</h3>";for(var c=0;c<d.registrants.length;c++){b+='<div class="left" style="width:12%;margin-bottom:10px;height:100px"><div style="margin:0 auto;padding:0;width:50px;height:50px;border:1px solid black"><a href="/'+d.registrants[c].encoded_name+'"><img src="http://'+logoServer+"/img/avatars/thumb/"+d.registrants[c].thumb_image+'" /></a></div><p style="text-align:center;margin:0 auto;padding:0;"><a href="/'+d.registrants[c].encoded_name+'">'+d.registrants[c].name+"</a></p></div></a>"}}else{b=""}}jQuery("#tournament_registrants").html(b)}function drawTournamentList(d){tournamentCount=d.header.count;if(d.header.page<d.header.pages){jQuery("#tournamentsListing input.next, #tournamentsListing span.next_text").css("display","block")}else{jQuery("#tournamentsListing input.next, #tournamentsListing span.next_text").css("display","none")}if(d.header.page>1){jQuery("#tournamentsListing input.prev, #tournamentsListing span.prev_text").css("display","block")}else{jQuery("#tournamentsListing input.prev, #tournamentsListing span.prev_text").css("display","none")}jQuery("#tournamentsListing").find("span.page_count").html(d.header.pages);jQuery("#tournamentsListing").find("span.current_page").html(d.header.page);tournamentPages=d.header.pages;if(tournamentsPage!=d.header.page){jQuery("#tournamentsListing").find("div.data_wrapper table tbody").html("")}var a="";var b;for(var c=0;c<d.rows.length;c++){tournaments[d.rows[c].id]=d.rows[c];b=(c%2==0)?"even":"scratchy_row";a+='<tr id="tournament_'+d.rows[c].id+'" class=" hover listing '+b+'"><td class="name first" style="font-weight:bold;height:30px;padding-left:5px"><a class="pointer">'+d.rows[c].name+'</a></td><td><div style="width:100px;position:relative;top:1px;height:20px;margin:0" class="achievements_progress center pointer"><div style="font-weight: bold; width: 100px; height: 20px; color: white; position: absolute;z-index:2;" class="progress_container"><div style="margin-top: 4px;z-index:3" ><span id="tournament_percent_display_'+d.rows[c].id+'">0</span>/'+d.rows[c].size_max+'</div></div><div class="achievements_percentage" style="left:0;position:absolute;height:20px"><input id="tournament_percentage_'+d.rows[c].id+'" type="hidden" value="0"/></div></div></td><td>'+d.rows[c].squad_size+"</td><td>"+d.rows[c].fee+'</td><td class="last" id="tournament_qualify_'+d.rows[c].id+'">';a+="</td></tr>"}jQuery("#tournaments_table tbody").html(a)}function loadTournaments(a){if(a>tournamentPages){return false}tournamentsPage=a;jQuery.getJSON("/challenges/tournamentdata/"+a,function(b){drawTournamentList(b);getRegistrants(b);if(typeof(tournamentRegistrantsInterval)!="undefined"){clearInterval(tournamentRegistrantsInterval)}tournamentRegistrantsInterval=setInterval("getRegistrants()",60000)})}function refreshTournaments(a){jQuery.getJSON("/challenges/tournamentdata/"+a,function(b){getRegistrants(b);drawTournamentList(b)})}function refreshRegistrants(a){jQuery.getJSON("/challenges/getallregistrants",function(b){tournamentRegistrants=new Array();tournamentRegistrants=b})}function loadTournamentRegistration(h){var c=h.split("_");var a=c[1];jQuery("#tournament_registrants").html("");jQuery("#tournament_squad_selection").css("display","none");jQuery("#tournament_details").css("display","block");jQuery("#tournament_name").html(tournaments[a].name);jQuery("#tournament_rules").html("<tr><td>Squad Size</td><td>"+tournaments[a].squad_size+"</td></tr>");jQuery("#tournament_rules").append("<tr><td>Fee</td><td>"+tournaments[a].fee+"</td></tr>");for(var f=0;f<tournaments[a].requirements.length;f++){jQuery("#tournament_rules").append("<tr><td>"+tournaments[a].requirements[f].label+"</td><td>"+tournaments[a].requirements[f].value+"</td></tr>")}jQuery("#tournament_rewards").html("");for(var f=0;f<tournaments[a].rewards.length;f++){jQuery("#tournament_rewards").append("<tr><td>"+tournaments[a].rewards[f].label+"</td><td>"+tournaments[a].rewards[f].value+"</td></tr>")}jQuery("#tournament_details").append('<div id="tournament_registrants></div>"');if(typeof(tournamentRegistrants[tournaments[a].id])!="undefined"){var b="";var g=tournamentRegistrants[tournaments[a].id];var d=g.length;if(tournamentRegistrants[tournaments[a]]==tournaments[a].size_max){jQuery("#tournament_message").html("This tournament has started.  Click watch to view");jQuery("#tournament_buttons").html('<a href="/challenges/watchtournament/'+tournaments[a].uuid+'"><h3 style="text-align:center;margin:0 auto;" class="center auto small_button watch rollover">Watch</h3></a>')}else{if(d>0){b='<h3 style="margin-bottom:10px">Current Registrants ('+d+"/"+tournaments[a].size_max+")</h3>";for(var f=0;f<d;f++){b+='<div class="left" style="width:12%;margin-bottom:10px;height:100px"><div style="margin:0 auto;padding:0;width:50px;height:50px;border:1px solid black"><a href="/'+g[f].encoded_name+'"><img src="http://'+logoServer+"/img/avatars/thumb/"+g[f].thumb_image+'" /></a></div><p style="text-align:center;margin:0 auto;padding:0;"><a href="/'+g[f].encoded_name+'">'+g[f].name+"</a></p></div></a>"}}}jQuery("#tournament_registrants").html(b)}jQuery("#tournament_message").html(tournaments[a].message);if(tournaments[a].eligible==true&&tournaments[a].registered==false){jQuery("#tournament_buttons").html('<h3 id="tournament_back"  class="left small_button back rollover">Back</h3>');jQuery("#tournament_buttons").append('<h3 id="tournament_select_squads"  class="right small_button register rollover">Register</h3>')}else{jQuery("#tournament_buttons").html('<h3 style="text-align:center;margin:0 auto;" id="tournament_back"  class="center auto small_button back rollover">Back</h3>')}jQuery("#tournament_buttons").css("display","block")}function loadTournamentSquadSelection(f){var c=f.split("_");var a=c[1];t_squadLimit=tournaments[a].squad_size;jQuery("#tournament_details").css("display","none");jQuery("#tournament_message").html("Select your squads by clicking on the hero images and click confirm to join this tournament.");jQuery("#tournament_squad_selection").html("");jQuery("#tournament_squad_selection").append('<h1 id="tournament_name" style="margin:0 0 20px 0;text-align:center">'+tournaments[a].name+"</h1>");jQuery("#tournament_squad_selection").append('<h3 id="tournament_squad_text" style="margin-bottom:10px">Select Your Squads To Enter</h3>');jQuery("#tournament_buttons").html('<h3 id="tournament_squad_back"  class="left small_button back rollover">Back</h3>');jQuery("#tournament_buttons").append('<h3 id="tournament_confirm_squads"  class="right small_button confirm rollover">Confirm</h3>');jQuery("#tournament_buttons").append('<div style="height:350px">');for(var d=0;d<tournaments[a].squads.length;d++){jQuery("#tournament_squad_selection").append("<div id="+tournaments[a].squads[d].id+' style="float:left;margin:5px;width:65px;height:90px;border:2px solid gray" class="tournament_squad"><input type="hidden" value="'+tournaments[a].squads[d].faction+'"/><img src="http://'+staticServer+"/img/cardstats/card_sm_set"+tournaments[a].squads[d].set+"_"+tournaments[a].squads[d].image_name+'.jpg" /></div>')}jQuery("#tournament_buttons").append("</div>");b+='<br class="clear" />';var b='<div id="tournament_squad_slot_container" class="squad_slot_container center clear" style="margin:20px auto;width:'+((tournaments[a].squad_size)*28)+'px">';for(d=0;d<tournaments[a].squad_size;d++){b+='<a><div id="slot'+(d+1)+'" class="center" style="float:left"></div></a>'}jQuery("#tournament_squad_selection").append('<br class="clear" />');b+='<br class="clear" />';jQuery("#tournament_squad_selection").append(b);jQuery("#tournament_squad_selection").css("display","block")}function registerForTournament(d){var b=d.split("_");var a=b[1];if(t_squadIds.length==tournaments[a].squad_size){jQuery("#tournament_buttons").css("display","none");jQuery("#tournament_squad_selection").css("display","none");var c=t_squadIds.join(",");jQuery("#tournament_message").html("Attempting registration...");jQuery.post("/challenges/registerfortournament/",{tournamentId:a,squads:c},function(f){refreshRegistrants();loadTournamentRegistration(d);jQuery("#tournament_buttons").html('<h3 style="text-align:center;margin:0 auto;" id="tournament_back"  class="center auto small_button back rollover">Back</h3>').css("display","block");currentTournament=d;if(f.registered==true){tournaments[a].registered=true;updateHUD("challenge_coins");tournamentsLoaded=false}jQuery.getJSON("/challenges/getallregistrants",function(g){tournamentRegistrants=g;loadTournamentRegistration(d);jQuery("#tournament_message").html(f.message);jQuery("#tournamentregistration").css("display","block")})},"json")}else{jQuery("#tournament_squad_text").fadeOut("normal",function(){jQuery(this).html("Fill In All Squad Slots").fadeIn("normal")})}}function animateRegistrants(){jQuery("#tournamentsListing").find("div.achievements_percentage").each(function(){jQuery(this).animate({width:jQuery("input:first",this).val()})})}function LeagueHandler(){var k;var z;var x;var h;var f=false;var c=false;var q;var l;var s;var r=null;var y=false;var g={history:{base_url:"/leagues/history/"+ladderId,url:"/leagues/history/"+ladderId+"/1",extra:"/"+avatarId+"/",method:"json",columns:2,loaded:false,container:".history_container .data_wrapper table",parent:".history_container",paginated:true},rankings:{columns:2,loaded:false},squads:{url:"/leagues/squadbuilder/"+leagueId,method:"ajax",container:".squads_content",columns:1,loaded:false,paginated:false},cards:{url:"/collections/cardsajax",extra:"/"+avatarId+"/",container:".cards_content .standard_container .content",method:"json",columns:1,loaded:false,paginated:false}};this.init=v;this.loadPanel=b;this.draw=o;this.next=u;this.prev=t;this.load=n;this.updateUrlExtra=m;this.fetchState=a;this.setMember=w;this.countdown=p;function v(A){z="history";k=A;currentLayout=g[k].columns;staticPath=(gameId==7)?"/themed/planetstorm":null;jQuery("div.banner .secondary_nav").click(function(){console.log(jQuery(this).attr("id"));if(jQuery(this).attr("id")!=k){z=k;k=jQuery(this).attr("id");b()}});a();x=setInterval(function(){a()},10000);b()}function w(A){c=A}function a(){jQuery.getJSON("/leagues/getstate/"+leagueId,function(A){var B;if(typeof(h)=="undefined"||h.status!=A.status){f=true}else{f=false}h=A;d()})}function d(){switch(h.status){case"open":if(f==true){jQuery("#league_status").animate({height:"162"},"normal",function(){var D='<h2 class="huge center" style="margin:0 0 15px 0"><span id="open_registrants">'+h.registrants+"</span>/"+h.size+'</h2><h2 class="fancy" style="font-size:2em;"><span style="color:white" id="open_needed">'+h.needed+"</span> More Needed To Start</h2>";if(c==true){D+='<p class="fancy">You are a member of this league</p>'}else{D+='<h3 class="register small_button rollover" id="league_register" style="margin:0 auto 10px">Join</h3>'}jQuery("#league_status").html(D)})}else{var B=parseInt(jQuery("#open_registrants").html());if(h.registrants!=B){jQuery("#open_registrants").fadeOut("fast").html(h.registrants).fadeIn("fast");jQuery("#open_needed").fadeOut("fast").html(h.needed).fadeIn("fast")}}break;case"starting":if(f==true){jQuery("#league_status").animate({height:"162px"},"normal",function(){l=parseInt(h.timeLeft);var D='<h2 class="huge" id="starting_countdown" style="text-align:center;margin:10px 0 20px 0"></h2><h2 class="fancy" style="font-size:2em">Until Fighting May Begin</h2><p class="fancy">Make Sure Your Squads Are Ready!</p>';p();jQuery("#league_status").html(D);q=setInterval(function(){p()},1000)})}break;case"in-progress":if(f==true){jQuery("#league_status").animate({height:"162px"},"normal",function(){var D='<h2 class="fancy" style="margin-bottom:5px">League In-Progress</h2>';if(c==true){D+='<div id="league_battle_box" class="left center" style="width:50%"><p>Battles Left</p><h2 class="huge" id="battles_left">'+h.battles_left+"</h2>";if(parseInt(h.battles_left)>0){D+='<h3 class="small_button battle_now rollover" style="margin:10px auto" id="leagues_battle_now">Battle Now</h3>'}else{if(typeof(h.next_battle_period)!="undefined"){D+='<p class="center" id="next_battles" style="margin-top:12px">Resumes '+h.next_battle_period+"</p>"}}D+='</div><div class="left center" id="booster_box" style="width:50%"><p>Boosters Available</p><h2 class="huge" id="boosters_left">'+h.boosters_left+"</h2>";if(parseInt(h.boosters_left)>0){D+='<h3 class="small_button buy_now rollover" style="margin:10px auto" id="buy_booster">Buy</h3>'}else{if(typeof(h.next_booster_date)!="undefined"){D+='<p class="center" id="next_booster" style="margin-top:12px;">Next On '+h.next_booster_date+"</p>"}}D+='</div><br style="clear:both;margin:0" />'}jQuery("#league_status").html(D)})}else{var A=parseInt(jQuery("#battles_left").html());var C=parseInt(jQuery("#boosters_left").html());if(parseInt(h.battles_left)!=A){jQuery("#battles_left").fadeOut("fast").html(h.battles_left).fadeIn("fast");if(parseInt(h.battles_left)>0){jQuery("#leagues_battle_now").remove();jQuery("#next_battles").remove();jQuery("#league_battle_box").append('<h3 class="small_button battle_now rollover" style="margin:10px auto" id="leagues_battle_now">Battle Now</h3>')}else{jQuery("#leagues_battle_now").remove();jQuery("#league_battle_box").append('<p class="center" id="next_battles" style="margin-top:12px">Resumes '+h.next_battle_period+"</p>")}}if(parseInt(h.boosters_left)!=C){jQuery("#boosters_left").fadeOut("fast").html(h.boosters_left).fadeIn("fast");if(parseInt(h.boosters_left)>0){jQuery("#buy_booster").remove();jQuery("#next_booster").remove();jQuery("#booster_box").append('<h3 class="small_button buy_now rollover" style="margin:10px auto" id="buy_booster">Buy</h3>')}else{jQuery("#buy_booster").remove();jQuery("#booster_box").append('<p class="center" id="next_booster" style="margin-top:12px;">Next On '+h.next_booster_date+"</p>")}}}break;case"completed":if(f==true){jQuery("#league_status").html('<h2 class="fancy" style="margin:0">League Completed</h2>')}clearInterval(x);break}}function p(){l--;if(l==0){clearInterval(q)}var B=Math.floor(l/60);var C=Math.floor(l%60);var A=B+":";if(C<10){A+="0"}A+=C;jQuery("#starting_countdown").html(A)}function u(){if(y){return false}y=true;if(parseInt(g[k].page)+1<=g[k].pages){if((parseInt(g[k].page)+1)==g[k].pages){jQuery(g[k].parent).find("input.next, span.next_text").css("display","none")}jQuery(g[k].parent).find("input.prev, span.prev_text").css("display","block");g[k].page++;g[k].url=g[k].base_url+"/"+g[k].page;g[k].loaded=false;n()}}function t(){if(y){return false}y=true;if(parseInt(g[k].page)-1>0){if((parseInt(g[k].page)-1)==1){jQuery(g[k].parent).find("input.prev, span.prev_text").css("display","none")}jQuery(g[k].parent).find("input.next, span.next_text").css("display","block");g[k].page--;g[k].url=g[k].base_url+"/"+g[k].page;g[k].loaded=false;n()}}function m(A){g[k].extra=A;g[k].page=1;g[k].url=g[k].base_url+"/"+g[k].page;g[k].loaded=false;jQuery(g[k].parent).find("input.prev, span.prev_text").css("display","none");n()}function b(){jQuery("."+z+"_content").each(function(){jQuery(this).css("display","none")});if(g[z].columns!=g[k].columns){jQuery("#layout_"+g[z].columns+"_column").each(function(){jQuery(this).css("display","none");jQuery("#layout_"+g[k].columns+"_column").each(function(){jQuery(this).css("display","block");jQuery(this).fadeIn("fast")})})}n();if(k=="history"){s=setInterval(function(){n()},10000)}else{if(typeof(s)!="undefined"){clearInterval(s)}}jQuery("."+k+"_content").each(function(){jQuery(this).css("display","block")})}function n(){if(typeof(g[k].url)!="undefined"&&(g[k].loaded==false)){if(g[k].method=="ajax"){jQuery.ajax({url:g[k].url,success:function(A){g[k].loaded=true;jQuery(g[k].container).html(A)}})}else{if(g[k].method=="json"){jQuery.getJSON(g[k].url+g[k].extra,function(A){g[k].data=A;if(g[k].paginated==true){g[k].page=g[k].data[0].page;g[k].pages=g[k].data[0].pages;jQuery(g[k].parent).find("span.page_count").html(g[k].pages);jQuery(g[k].parent).find("span.current_page").html(g[k].page);if(g[k].pages==0){jQuery(g[k].parent).find("span.page_count").html("1");jQuery(g[k].parent).find("span.current_page").html("1")}if((parseInt(g[k].page)+1)<=g[k].pages){jQuery(g[k].parent).find("input.next, span.next_text").css("display","block")}if((parseInt(g[k].page)-1)==1){jQuery(g[k].parent).find("input.prev, span.prev_text").css("display","block")}}y=false;o()})}}}}function o(){switch(k){case"history":var B="";var F;var G;var D;if(g[k].pages==0){B='<tr class="even hover"><td class="first last name bold">No battles have been fought in this league</td></tr>'}else{for(var E=0;E<g[k].data.length;E++){F="";G="";D=(E%2!=0)?"even":"scratchy_row";D+=g[k].data[E].row_class;if(g[k].data[E]["challenger"].army_type!=null){for(var C=0;C<g[k].data[E]["challenger"].army_type.length;C++){F+="<img title='Squad"+(C+1)+"' alt='Squad"+(C+1)+"'   src='http://"+staticServer+staticPath+"/img/faction_icons/faction"+g[k].data[E]["challenger"].army_type.charAt(C)+".png'>"}}if(g[k].data[E]["defender"].army_type!=null){for(var C=0;C<g[k].data[E]["defender"].army_type.length;C++){G+="<img title='Squad"+(C+1)+"' alt='Squad"+(C+1)+"'  src='http://"+staticServer+staticPath+"/img/faction_icons/faction"+g[k].data[E]["defender"].army_type.charAt(C)+".png'>"}}B+='<tr class="hover '+D+'"><td class="first"><img class="'+g[k].data[E]["challenger"].headshot_frame+'" src="http://'+logoServer+staticPath+"/img/avatars/thumb/"+g[k].data[E]["challenger"].thumb_image+'" /></td><td><h3>'+g[k].data[E]["challenger"].name+"</h3>"+F+'</td><td><img class="'+g[k].data[E]["defender"].headshot_frame+'" src="http://'+logoServer+staticPath+"/img/avatars/thumb/"+g[k].data[E]["defender"].thumb_image+'" /></td><td><h3>'+g[k].data[E]["defender"].name+"</h3>"+G+'</td><td class="last"><p>'+g[k].data[E].time+'</p><a href="/battle/view/'+g[k].data[E].battle_result_id+'"><h3 class="small_button watch rollover">Watch</h3></a></td></tr>'}}jQuery(g[k].container).html(B);break;case"cards":var A=new CardLoader(g[k].data,g[k].container);g[k].loaded=true;A.process();break}}}function CardLoader(json,target){var cards=json;var container=target;var collectionProcessor;var busy;var processIndex=0;var toolTipSettings={showBody:" - ",delay:0,opacity:0.8,track:true};this.process=process;function process(callback){if(typeof(callback)=="undeclared"){callback=null}var i=0,limit=0,busy=false;var queueLength=cards.length;var numCards;var j=0;collectionProcessor=setInterval(function(){if(!busy&&queueLength>0){busy=true;if(queueLength>=5){numCards=5}else{numCards=queueLength}for(j=0;j<numCards;j++){processCardLoad();processIndex++;queueLength--}if(queueLength<=0){clearInterval(collectionProcessor);eval(callback)}busy=false}},100)}function processCardLoad(){var card=cards[processIndex];var output='<div class="card" id="card-'+processIndex+'"><img src="http://'+staticServer+staticPath+"/img/cardstats/card_md_set"+card.s+"_"+card.i+'.jpg" /><a class="tooltip" title=""><div class="specials_hover"><img src="http://'+staticServer+staticPath+'/img/blank.gif"/></div></a>';if(card.o>0){output+='<div class="collection_control_middle"><p>'+card.o+" Card";output+=(card.o>1)?"s":""}output+="</p></div></div>";jQuery(container).prepend(output);if(card.sd.length>0){jQuery(".tooltip","#card-"+processIndex).attr("title",card.sn+" - "+card.sd).tooltip(toolTipSettings)}}}var leagueLadderPage=1;var leagueLadderPages=1;var leagueLadderSortDir="desc";var leagueLadderSortType=null;var leagueLadderLoaded=false;function loadLeagueLadder(c){if(c>leagueLadderPages){return false}leagueLadderPage=c;var d=leagueId+"/"+c;if(leagueLadderSortType!=null){d+="/"+leagueLadderSortType+"/"+leagueLadderSortDir}else{d+="/null/null"}var a=jQuery("#ladder_online:checked").val();if(a=="on"){d+="/true"}else{d+="/false"}var b=jQuery("#ladder_search").val();if(b!=""&&b!="Enter avatar search"){d+="/"+b}jQuery.getJSON("/leagues/ladderdata/"+d,function(l){if(l.header.pages==0){jQuery("#ladder").find("div.data_wrapper table tbody").html("");jQuery("#ladder").find("span.page_count").html("1");jQuery("#ladder").find("div.data_wrapper table tbody").append('<tr colspan="7"><td style="height:20px;font-weight:bold;vertical-align:middle" class="first last name">No avatars match this search</td></tr>');return}leagueLadderPages=l.header.pages;if(l.header.page<l.header.pages){jQuery("#ladder input.next, #ladder span.next_text").css("display","block")}else{jQuery("#ladder input.next, #ladder span.next_text").css("display","none")}if(l.header.page>1){jQuery("#ladder input.prev, #ladder span.prev_text").css("display","block")}else{jQuery("#ladder input.prev, #ladder span.prev_text").css("display","none")}jQuery("#ladder").find("span.page_count").html(l.header.pages);jQuery("#ladder").find("span.current_page").html(l.header.page);if(typeof(l.my_wins)!="undefined"){jQuery("#your_position").html(l.my_rank+" ("+l.my_wins+" Wins)")}jQuery("#ladder").find("div.data_wrapper table tbody").html("");var f="";var h;for(var k=0;k<l.rows.length;k++){h=(k%2==0)?"even":"scratchy_row";f+='<tr class=" hover '+h+'"><td class="name" style="font-weight:bold;height:23px;padding-left:5px">';f+=(l.rows[k].online==true)?'<img src="http://'+staticServer+'/img/new/icons/icon_online.png" alt="" />&nbsp;&nbsp;':'<img src="http://'+staticServer+'/img/new/icons/icon_offline.png" alt="" />&nbsp;&nbsp;';f+='<a href="/'+l.rows[k].encoded_name+'">'+l.rows[k].name+"</a></td><td>"+l.rows[k].ladder_rank+"</td><td>"+l.rows[k].wins+"</td><td>"+l.rows[k].todays_wins+"</td><td>";f+=(l.rows[k].level>1)?"<img title='Level "+l.rows[k].level+"' src='http://"+staticServer+"/img/new/badges/levels/level"+(l.rows[k].level-1)+".png' />":"&nbsp;";f+="</td><td>";if(l.rows[k].army_type!=null&&l.rows[k].army_type.length>1){for(var g=0;g<l.rows[k].army_type.length;g++){f+="<img title='Squad"+(g+1)+"' alt='Squad"+(g+1)+"' style='width:13px;height:13';  src='http://"+staticServer+staticPath+"/img/faction_icons/faction"+l.rows[k].army_type.charAt(g)+".png'>"}}f+="</td></tr>"}jQuery("#ladder_table tbody").append(f)})};