/*
  window.onerror (Yaffle http://hostel6.ru)
*/
window.onerror=(function(){var a={},d,c,b;return function(k,f,e){try{if(k==="Error loading script"||e===0){return;}b=window.location.href;}catch(j){}try{d={location:b||"?",msg:k||"?",err_url:f||"?",line:e||"?",browser:(window.navigator.userAgent||"?"),platform:(window.navigator.platform||"?"),plugins:"?"};c=[];for(var g in d){if(d.hasOwnProperty(g)){c.push(encodeURIComponent(g)+"="+encodeURIComponent(d[g]));}}c="http://hostel6.ru/tv/jserrors.php?"+c.join("&");if(!a.hasOwnProperty(c)){a[c]=1;(new window.Image()).src=c+"&nc="+Math.random();}}catch(h){}};}());
/*
    URI.js
    <matri-tri-ca@narod.ru>
    yaffle
    18:42 14.08.2009
*/
String.prototype.trim=function(){return String(this).replace(/^\s+/,"").replace(/\s+$/,"");};String.prototype.parseURI=function(){var a=this.match(/^((?:[^:\/?#]+):)?(\/\/((?:(?:([^:@]*):?([^:@]*))?@)?(([^\/?#:]*)(?::(\d*))?)))?([^?#]*)(\?(?:[^#]*))?(#(?:[\s\S]*))?/);return(a?{user:a[4]||"",pass:a[5]||"",authority:a[2]?(a[3]||""):null,href:a[0]||"",protocol:a[1]||"",host:a[2]?(a[6]||""):null,hostname:a[7]||"",port:a[8]||"",pathname:a[9]||"",search:a[10]||"",hash:a[11]||""}:null);};String.prototype.parsePath=function(){var c=this.lastIndexOf("/")+1,a=this.substr(c),d=a.lastIndexOf(".");return{dirname:this.substr(0,c),basename:a,extension:(d<0?"":a.substr(d))};};function absolutizeURI(c,a){function d(e){var h=/^\/\.\.(?:\/|$)/,g,f=[];e=e.replace(/^(?:\.\.?\/)+/,"").replace(/\/\.$/,"/").replace(/\/(?:\.\/)+/g,"/");while("..".indexOf(e)===-1){if(h.test(e)){e=e.replace(h,"/");f.pop();}else{g=e.indexOf("/",1);f.push(g>=0?e.substr(0,g):e);e=(g>=0?e.substr(g):"");}}return f.join("");}a=a.trim().parseURI();c=c.trim().parseURI();if(a===null||c===null){return null;}var b={};if(a.protocol||a.authority){b.authority=a.authority;b.pathname=d(a.pathname);b.search=a.search;}else{if(!a.pathname){b.pathname=c.pathname;b.search=a.search||c.search;}else{if(a.pathname.charAt(0)==="/"){b.pathname=d(a.pathname);}else{if(c.authority!==null&&!c.pathname){b.pathname=d("/"+a.pathname);}else{b.pathname=d(c.pathname.parsePath().dirname+a.pathname);}}b.search=a.search;}b.authority=c.authority;}b.protocol=a.protocol||c.protocol;b.hash=a.hash;return b.protocol+(b.authority===null?"":"//"+b.authority)+b.pathname+b.search+b.hash;}
/* Cross-Browser Split 1.0.1
(c) Steven Levithan <stevenlevithan.com>; MIT License
An ECMA-compliant, uniform cross-browser split method */
var cbSplit;if(!cbSplit){cbSplit=function(i,f,e){if(Object.prototype.toString.call(f)!=="[object RegExp]"){return cbSplit._nativeSplit.call(i,f,e);}var c=[],a=0,d=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.sticky?"y":""),f=RegExp(f.source,d+"g"),b,g,h,j;i=i+"";if(!cbSplit._compliantExecNpcg){b=RegExp("^"+f.source+"$(?!\\s)",d);}if(e===undefined||+e<0){e=Infinity;}else{e=Math.floor(+e);if(!e){return[];}}while(g=f.exec(i)){h=g.index+g[0].length;if(h>a){c.push(i.slice(a,g.index));if(!cbSplit._compliantExecNpcg&&g.length>1){g[0].replace(b,function(){for(var k=1;k<arguments.length-2;k++){if(arguments[k]===undefined){g[k]=undefined;}}});}if(g.length>1&&g.index<i.length){Array.prototype.push.apply(c,g.slice(1));}j=g[0].length;a=h;if(c.length>=e){break;}}if(f.lastIndex===g.index){f.lastIndex++;}}if(a===i.length){if(j||!f.test("")){c.push("");}}else{c.push(i.slice(a));}return c.length>e?c.slice(0,e):c;};cbSplit._compliantExecNpcg=/()??/.exec("")[1]===undefined;cbSplit._nativeSplit=String.prototype.split;}String.prototype.split=function(b,a){return cbSplit(this,b,a);};
/* prototype from git with changes... */
/*  Prototype JavaScript framework, version 1.6.1
 *  (c) 2005-2009 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
 *
 *--------------------------------------------------------------------------*/
var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)};})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype);})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true;}var c=document.createElement("div"),b=document.createElement("form"),a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true;}c=b=null;return a;})()},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 Abstract={};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;}};var Class=(function(){var d=(function(){for(var e in {toString:1}){if(e==="toString"){return false;}}return true;})();function a(){}function b(){var h=null,g=$A(arguments);if(Object.isFunction(g[0])){h=g.shift();}function e(){this.initialize.apply(this,arguments);}Object.extend(e,Class.Methods);e.superclass=h;e.subclasses=[];if(h){a.prototype=h.prototype;e.prototype=new a;h.subclasses.push(e);}for(var f=0,j=g.length;f<j;f++){e.addMethods(g[f]);}if(!e.prototype.initialize){e.prototype.initialize=Prototype.emptyFunction;}e.prototype.constructor=e;return e;}function c(l){var g=this.superclass&&this.superclass.prototype,f=Object.keys(l);if(d){if(l.toString!=Object.prototype.toString){f.push("toString");}if(l.valueOf!=Object.prototype.valueOf){f.push("valueOf");}}for(var e=0,h=f.length;e<h;e++){var k=f[e],j=l[k];if(g&&Object.isFunction(j)&&j.argumentNames()[0]=="$super"){var m=j;j=(function(i){return function(){return g[i].apply(this,arguments);};})(k).wrap(m);j.valueOf=m.valueOf.bind(m);j.toString=m.toString.bind(m);}this.prototype[k]=j;}return this;}return{create:b,Methods:{addMethods:c}};})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r];}return q;}function l(q){try{if(e(q)){return"undefined";}if(q===null){return"null";}return q.inspect?q.inspect():String(q);}catch(r){if(r instanceof RangeError){return"...";}throw r;}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString();}if(q===null){return"null";}if(q.toJSON){return q.toJSON();}if(h(q)){return;}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t);}}return"{"+r.join(", ")+"}";}function c(q){return $H(q).toQueryString();}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q);}function o(q){var r=[];for(var s in q){r.push(s);}return r;}function m(q){var r=[];for(var s in q){r.push(q[s]);}return r;}function j(q){return i({},q);}function h(q){return !!(q&&q.nodeType==1);}function g(q){return d.call(q)=="[object Array]";}function p(q){return q instanceof Hash;}function b(q){return typeof q==="function";}function a(q){return d.call(q)=="[object String]";}function n(q){return d.call(q)=="[object Number]";}function e(q){return typeof q==="undefined";}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e});})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m];}return o;}function i(m,l){m=k.call(m,0);return d(m,l);}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return l.length==1&&!l[0]?[]:l;}function h(n){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this;}var l=this,m=k.call(arguments,1);return function(){var o=i(m,arguments);return l.apply(n,o);};}function f(n){var l=this,m=k.call(arguments,1);return function(p){var o=d([p||window.event],m);return l.apply(n,o);};}function j(){if(!arguments.length){return this;}var l=this,m=k.call(arguments,0);return function(){var n=i(m,arguments);return l.apply(this,n);};}function e(n){var l=this,m=k.call(arguments,1);n=n*1000;return window.setTimeout(function(){return l.apply(l,m);},n);}function a(){var l=d([0.01],arguments);return this.delay.apply(this,l);}function c(m){var l=this;return function(){var n=d([l.bind(this)],arguments);return m.apply(this,n);};}function b(){if(this._methodized){return this._methodized;}var l=this;return this._methodized=function(){var m=d([this],arguments);return l.apply(null,m);};}return{argumentNames:g,bind:h,bindAsEventListener:f,curry:j,delay:e,defer:a,wrap:c,methodize:b};})());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"';};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();this.currentlyExecuting=false;}catch(a){this.currentlyExecuting=false;throw a;}}}});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,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement;}var template=new Template(replacement);return function(match){return template.evaluate(match);};}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern);}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement;}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source="";}}return result;}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0];}return replacement(match);});}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this);}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"");}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"");}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1];});}function evalScripts(){return this.extractScripts().map(function(script){return eval(script);});}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{};}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value);}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]];}hash[key].push(value);}else{hash[key]=value;}}return hash;});}function toArray(){return this.split("");}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);}function times(count){return count<1?"":new Array(count+1).join(this);}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():"";});}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase();}function dasherize(){return this.replace(/_/g,"-");}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character];}return"\\u00"+character.charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"';}return"'"+escapedString.replace(/'/g,"\\'")+"'";}function toJSON(){return this.inspect(true);}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1");}function isJSON(){var str=this;if(str.blank()){return false;}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")");}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect());}function include(pattern){return this.indexOf(pattern)>-1;}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0;}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d;}function empty(){return this=="";}function blank(){return/^\s*$/.test(this);}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object);}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate};})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern;},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements();}return this.template.gsub(this.pattern,function(d){if(a==null){return(d[1]+"");}var f=d[1]||"";if(f=="\\"){return d[2];}var b=a,g=d[3],e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;d=e.exec(g);if(d==null){return f;}while(d!=null){var c=d[1].startsWith("[")?d[2].replace(/\\\\]/g,"]"):d[1];b=b[c];if(null==b||""==d[3]){break;}g=g.substring("["==d[3]?d[1].length:d[0].length);d=e.exec(g);}return f+String.interpret(b);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(y,x){var w=0;try{this._each(function(A){y.call(x,A,w++);});}catch(z){if(z!=$break){throw z;}}return this;}function r(z,y,x){var w=-z,A=[],B=this.toArray();if(z<1){return B;}while((w+=z)<B.length){A.push(B.slice(w,w+z));}return A.collect(y,x);}function b(y,x){y=y||Prototype.K;var w=true;this.each(function(A,z){w=w&&!!y.call(x,A,z);if(!w){throw $break;}});return w;}function i(y,x){y=y||Prototype.K;var w=false;this.each(function(A,z){if(w=!!y.call(x,A,z)){throw $break;}});return w;}function j(y,x){y=y||Prototype.K;var w=[];this.each(function(A,z){w.push(y.call(x,A,z));});return w;}function t(y,x){var w;this.each(function(A,z){if(y.call(x,A,z)){w=A;throw $break;}});return w;}function h(y,x){var w=[];this.each(function(A,z){if(y.call(x,A,z)){w.push(A);}});return w;}function g(z,y,x){y=y||Prototype.K;var w=[];if(Object.isString(z)){z=new RegExp(RegExp.escape(z));}this.each(function(B,A){if(z.match(B)){w.push(y.call(x,B,A));}});return w;}function a(w){if(Object.isFunction(this.indexOf)){if(this.indexOf(w)!=-1){return true;}}var x=false;this.each(function(y){if(y==w){x=true;throw $break;}});return x;}function q(x,w){w=Object.isUndefined(w)?null:w;return this.eachSlice(x,function(y){while(y.length<x){y.push(w);}return y;});}function l(w,y,x){this.each(function(A,z){w=y.call(x,w,A,z);});return w;}function v(x){var w=$A(arguments).slice(1);return this.map(function(y){return y[x].apply(y,w);});}function p(y,x){y=y||Prototype.K;var w;this.each(function(A,z){A=y.call(x,A,z);if(w==null||A>=w){w=A;}});return w;}function n(y,x){y=y||Prototype.K;var w;this.each(function(A,z){A=y.call(x,A,z);if(w==null||A<w){w=A;}});return w;}function e(z,x){z=z||Prototype.K;var y=[],w=[];this.each(function(B,A){(z.call(x,B,A)?y:w).push(B);});return[y,w];}function f(x){var w=[];this.each(function(y){w.push(y[x]);});return w;}function d(y,x){var w=[];this.each(function(A,z){if(!y.call(x,A,z)){w.push(A);}});return w;}function m(x,w){return this.map(function(z,y){return{value:z,criteria:x.call(w,z,y)};}).sort(function(B,A){var z=B.criteria,y=A.criteria;return z<y?-1:z>y?1:0;}).pluck("value");}function o(){return this.map();}function s(){var x=Prototype.K,w=$A(arguments);if(Object.isFunction(w.last())){x=w.pop();}var y=[this].concat(w).map($A);return this.map(function(A,z){return x(y.pluck(z));});}function k(){return this.toArray().length;}function u(){return"#<Enumerable:"+this.toArray().inspect()+">";}return{each:c,eachSlice:r,all:b,every:b,any:i,some:i,collect:j,map:j,detect:t,findAll:h,select:h,filter:h,grep:g,include:a,member:a,inGroupsOf:q,inject:l,invoke:v,max:p,min:n,partition:e,pluck:f,reject:d,sortBy:m,toArray:o,entries:o,zip:s,size:k,inspect:u,find:t};})();function $A(c){if(!c){return[];}if("toArray" in Object(c)){return c.toArray();}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b];}return a;}function $w(a){if(!Object.isString(a)){return[];}a=a.strip();return a?a.split(/\s+/):[];}Array.from=$A;(function(){var s=Array.prototype,m=s.slice,o=s.forEach;function b(w){for(var v=0,x=this.length;v<x;v++){w(this[v]);}}if(!o){o=b;}function l(){this.length=0;return this;}function d(){return this[0];}function g(){return this[this.length-1];}function i(){return this.select(function(v){return v!=null;});}function u(){return this.inject([],function(w,v){if(Object.isArray(v)){return w.concat(v.flatten());}w.push(v);return w;});}function h(){var v=m.call(arguments,0);return this.select(function(w){return !v.include(w);});}function f(v){return(v===false?this.toArray():this)._reverse();}function k(v){return this.inject([],function(y,x,w){if(0==w||(v?y.last()!=x:!y.include(x))){y.push(x);}return y;});}function p(v){return this.uniq().findAll(function(w){return v.detect(function(x){return w===x;});});}function q(){return m.call(this,0);}function j(){return this.length;}function t(){return"["+this.map(Object.inspect).join(", ")+"]";}function r(){var v=[];this.each(function(w){var x=Object.toJSON(w);if(!Object.isUndefined(x)){v.push(x);}});return"["+v.join(", ")+"]";}function a(x,v){v||(v=0);var w=this.length;if(v<0){v=w+v;}for(;v<w;v++){if(this[v]===x){return v;}}return -1;}function n(w,v){v=isNaN(v)?this.length:(v<0?this.length+v:v)+1;var x=this.slice(0,v).reverse().indexOf(w);return(x<0)?x:v-x-1;}function c(){var A=m.call(this,0),y;for(var w=0,x=arguments.length;w<x;w++){y=arguments[w];if(Object.isArray(y)&&!("callee" in y)){for(var v=0,z=y.length;v<z;v++){A.push(y[v]);}}else{A.push(y);}}return A;}Object.extend(s,Enumerable);if(!s._reverse){s._reverse=s.reverse;}Object.extend(s,{_each:o,clear:l,first:d,last:g,compact:i,flatten:u,without:h,reverse:f,uniq:k,intersect:p,clone:q,toArray:q,size:j,inspect:t,toJSON:r});var e=(function(){return[].concat(arguments)[0][0]!==1;})(1,2);if(e){s.concat=c;}if(!s.indexOf){s.indexOf=a;}if(!s.lastIndexOf){s.lastIndexOf=n;}})();function $H(a){return new Hash(a);}var Hash=Class.create(Enumerable,(function(){function e(q){this._object=Object.isHash(q)?q.toObject():Object.clone(q);}function f(r){for(var q in this._object){var s=this._object[q],t=[q,s];t.key=q;t.value=s;r(t);}}function k(q,r){return this._object[q]=r;}function c(q){if(this._object[q]!==Object.prototype[q]){return this._object[q];}}function n(q){var r=this._object[q];delete this._object[q];return r;}function p(){return Object.clone(this._object);}function o(){return this.pluck("key");}function m(){return this.pluck("value");}function g(r){var q=this.detect(function(s){return s.value===r;});return q&&q.key;}function i(q){return this.clone().update(q);}function d(q){return new Hash(q).inject(this,function(r,s){r.set(s.key,s.value);return r;});}function b(q,r){if(Object.isUndefined(r)){return q;}return q+"="+encodeURIComponent(String.interpret(r));}function a(){return this.inject([],function(s,t){var r=encodeURIComponent(t.key),q=t.value;if(q&&typeof q=="object"){if(Object.isArray(q)){return s.concat(q.map(b.curry(r)));}}else{s.push(b(r,q));}return s;}).join("&");}function l(){return"#<Hash:{"+this.map(function(q){return q.map(Object.inspect).join(": ");}).join(", ")+"}>";}function j(){return Object.toJSON(this.toObject());}function h(){return new Hash(this);}return{initialize:e,_each:f,set:k,get:c,unset:n,toObject:p,toTemplateReplacements:p,keys:o,values:m,index:g,merge:i,update:d,toQueryString:a,inspect:l,toJSON:j,clone:h};})());Hash.from=$H;Object.extend(Number.prototype,(function(){function d(){return this.toPaddedString(2,16);}function e(){return this+1;}function a(k,j){$R(0,this,true).each(k,j);return this;}function b(l,k){var j=this.toString(k||10);return"0".times(l-j.length)+j;}function f(){return isFinite(this)?this.toString():"null";}function i(){return Math.abs(this);}function h(){return Math.round(this);}function g(){return Math.ceil(this);}function c(){return Math.floor(this);}return{toColorPart:d,succ:e,times:a,toPaddedString:b,toJSON:f,abs:i,round:h,ceil:g,floor:c};})());function $R(c,a,b){return new ObjectRange(c,a,b);}var ObjectRange=Class.create(Enumerable,(function(){function b(f,d,e){this.start=f;this.end=d;this.exclusive=e;}function c(d){var e=this.start;while(this.include(e)){d(e);e=e.succ();}}function a(d){if(d<this.start){return false;}if(this.exclusive){return d<this.end;}return d<=this.end;}return{initialize:b,_each:c,include:a};})());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 e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["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){e.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){e[c[b]]=c[b+1];}}else{$H(c).each(function(f){e[f.key]=f.value;});}}for(var a in e){this.transport.setRequestHeader(a,e[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(e,f){this.updateContent(e.responseText);if(Object.isFunction(d)){d(e,f);}}).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(f,a){var c=[];var e=document.evaluate(f,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,d=e.snapshotLength;b<d;b++){c.push(Element.extend(e.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(c){var b=(function(){var f=document.createElement("form"),e=document.createElement("input"),d=document.documentElement;e.setAttribute("name","test");f.appendChild(e);d.appendChild(f);var g=f.elements?(typeof f.elements.test=="undefined"):null;d.removeChild(f);f=e=null;return g;})();var a=c.Element;c.Element=function(f,e){e=e||{};f=f.toLowerCase();var d=Element.cache;if(b&&e.name){f="<"+f+' name="'+e.name+'">';delete e.name;return Element.writeAttribute(document.createElement(f),e);}if(!d[f]){d[f]=Element.extend(document.createElement(f));}return Element.writeAttribute(d[f].cloneNode(false),e);};Object.extend(c.Element,a||{});if(a){c.Element.prototype=a.prototype;}})(this);Element.cache={};Element.idCounter=1;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=$(a);a.style.display="none";return a;},show:function(a){a=$(a);a.style.display="";return a;},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a;},update:(function(){var b=(function(){var e=document.createElement("select"),f=true;e.innerHTML='<option value="test">test</option>';if(e.options&&e.options[0]){f=e.options[0].nodeName.toUpperCase()!=="OPTION";}e=null;return f;})();var a=(function(){try{var f=document.createElement("table");if(f&&f.tBodies){f.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var h=typeof f.tBodies[0]=="undefined";f=null;return h;}}catch(g){return true;}})();var d=(function(){var f=document.createElement("script"),h=false;try{f.appendChild(document.createTextNode(""));h=!f.firstChild||f.firstChild&&f.firstChild.nodeType!==3;}catch(g){h=true;}f=null;return h;})();function c(f,g){f=$(f);if(g&&g.toElement){g=g.toElement();}if(Object.isElement(g)){return f.update().insert(g);}g=Object.toHTML(g);var e=f.tagName.toUpperCase();if(e==="SCRIPT"&&d){f.text=g;return f;}if(b||a){if(e in Element._insertionTranslations.tags){while(f.firstChild){f.removeChild(f.firstChild);}Element._getContentFromAnonymousElement(e,g.stripScripts()).each(function(h){f.appendChild(h);});}else{f.innerHTML=g.stripScripts();}}else{f.innerHTML=g.stripScripts();}g.evalScripts.bind(g).defer();return f;}return c;})(),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,e){c=$(c);if(Object.isString(e)||Object.isNumber(e)||Object.isElement(e)||(e&&(e.toElement||e.toHTML))){e={bottom:e};}var d,f,b,g;for(var a in e){d=e[a];a=a.toLowerCase();f=Element._insertionTranslations[a];if(d&&d.toElement){d=d.toElement();}if(Object.isElement(d)){f(c,d);continue;}d=Object.toHTML(d);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();g=Element._getContentFromAnonymousElement(b,d.stripScripts());if(a=="top"||a=="after"){g.reverse();}g.each(f.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(f){var e=f.first(),c=f.last(),d=(b[e]||"").toString();if(d){a+=" "+c+"="+d.inspect(true);}});return a+">";},recursivelyCollect:function(a,c,d){a=$(a);d=d||-1;var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a));}if(b.length==d){break;}}return b;},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode");},descendants:function(a){return Element.select(a,"*");},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling;}return $(a);},immediateDescendants:function(b){var a=[],c=$(b).firstChild;while(c){if(c.nodeType===1){a.push(Element.extend(c));}c=c.nextSibling;}return a;},previousSiblings:function(a,b){return Element.recursivelyCollect(a,"previousSibling");},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling");},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a));},match:function(b,a){b=$(b);if(Object.isString(a)){return Prototype.Selector.match(b,a);}return a.match(b);},up:function(b,d,a){b=$(b);if(arguments.length==1){return $(b.parentNode);}var c=Element.ancestors(b);return Object.isNumber(d)?c[d]:Prototype.Selector.find(c,d,a);},down:function(b,c,a){b=$(b);if(arguments.length==1){return Element.firstDescendant(b);}return Object.isNumber(c)?Element.descendants(b)[c]:Element.select(b,c)[a||0];},previous:function(b,c,a){b=$(b);if(Object.isNumber(c)){a=c,c=false;}if(!Object.isNumber(a)){a=0;}if(c){return Prototype.Selector.find(b.previousSiblings(),c,a);}else{return b.recursivelyCollect("previousSibling",a+1)[a];}},next:function(b,d,a){b=$(b);if(Object.isNumber(d)){a=d,d=false;}if(!Object.isNumber(a)){a=0;}if(d){return Prototype.Selector.find(b.nextSiblings(),d,a);}else{var c=Object.isNumber(a)?a+1:1;return b.recursivelyCollect("nextSibling",a+1)[a];}},select:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a);},adjacent:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a.parentNode).without(a);},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b){return b;}do{b="anonymous_element_"+Element.idCounter++;}while($(b));Element.writeAttribute(a,"id",b);return b;},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(e,c,f){e=$(e);var b={},d=Element._attributeTranslations.write;if(typeof c=="object"){b=c;}else{b[c]=Object.isUndefined(f)?true:f;}for(var a in b){c=d.names[a]||a;f=b[a];if(d.values[a]){c=d.values[a](e,f);}if(f===false||f===null){e.removeAttribute(c);}else{if(f===true){e.setAttribute(c,c);}else{e.setAttribute(c,f);}}}return e;},getHeight:function(a){return Element.getDimensions(a).height;},getWidth:function(a){return Element.getDimensions(a).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(!Element.hasClassName(a,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 Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,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(b,a){b=$(b),a=$(a);if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8;}if(a.contains){return a.contains(b)&&a!==b;}while(b=b.parentNode){if(b==a){return true;}}return false;},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);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||d=="auto"){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(c,d){function a(h,g){return(g===null&&";left;bottom;top;right".indexOf(h)?"auto":g);}c=$(c);var f=c.style,b;if(Object.isString(d)){c.style.cssText+=";"+d;return d.include("opacity")?c.setOpacity(d.match(/opacity:\s*(\d?\.?\d*)/)[1]):c;}for(var e in d){if(e=="opacity"){c.setOpacity(d[e]);}else{f[(e=="float"||e=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):e]=a(e,d[e]);}}return c;},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 g=Element.getStyle(c,"display");if(g!="none"&&g!=null){return{width:c.offsetWidth,height:c.offsetHeight};}var b=c.style,f=b.visibility,d=b.position,a=b.display;b.visibility="hidden";if(d!="fixed"){b.position="absolute";}b.display="block";var h=c.clientWidth,e=c.clientHeight;b.display=a;b.position=d;b.visibility=f;return{width:h,height:e};},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.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.toUpperCase()=="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(Element.getStyle(b,"position")=="absolute"){return b;}var d=Element.positionedOffset(b),f=d[1],e=d[0],c=b.clientWidth,a=b.clientHeight;b._originalLeft=e-parseFloat(b.style.left||0);b._originalTop=f-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=f+"px";b.style.left=e+"px";b.style.width=c+"px";b.style.height=a+"px";return b;},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative"){return a;}a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0),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);}if(Prototype.Browser.IE&&(a.tagName||"").toUpperCase()==="HTML"){return $(document.body);}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,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&&(b.tagName.toUpperCase()=="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 e=Element.viewportOffset(d),f=[0,0],c=null;b=$(b);if(Element.getStyle(b,"position")=="absolute"){c=Element.getOffsetParent(b);f=Element.viewportOffset(c);}if(c==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop;}if(a.setLeft){b.style.left=(e[0]-f[0]+a.offsetLeft)+"px";}if(a.setTop){b.style.top=(e[1]-f[1]+a.offsetTop)+"px";}if(a.setWidth){b.style.width=d.offsetWidth+"px";}if(a.setHeight){b.style.height=d.offsetHeight+"px";}return b;}};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 e=parseInt(d(b,c),10);if(e!==b["offset"+c.capitalize()]){return e+"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(e,function(f,g){var h=d(b,g);return h===null?f:f-parseInt(h,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);try{b.offsetParent;}catch(f){return $(document.body);}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);try{c.offsetParent;}catch(h){return Element._returnOffset(0,0);}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.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,a){try{a.offsetParent;}catch(c){return Element._returnOffset(0,0);}return b(a);});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,e){function f(g){return g.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(e==1||e===""){(d=f(d))?c.filter=d:c.removeAttribute("filter");return b;}else{if(e<0.00001){e=0;}}c.filter=f(d)+"alpha(opacity="+(e*100)+")";return b;};Element._attributeTranslations=(function(){var b="className",a="for",c=document.createElement("div");c.setAttribute(b,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x"){b="class";}}c=null;c=document.createElement("label");c.setAttribute(a,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x"){a="htmlFor";}}c=null;return{read:{names:{"class":b,className:b,"for":a,htmlFor:a},values:{_getAttr:function(d,e){return d.getAttribute(e);},_getAttr2:function(d,e){return d.getAttribute(e,2);},_getAttrNode:function(d,f){var e=d.getAttributeNode(f);return e?e.value:"";},_getEv:(function(){var d=document.createElement("div"),g;d.onclick=Prototype.emptyFunction;var e=d.getAttribute("onclick");if(String(e).indexOf("{")>-1){g=function(f,h){h=f.getAttribute(h);if(!h){return null;}h=h.toString();h=h.split("{")[1];h=h.split("}")[0];return h.strip();};}else{if(e===""){g=function(f,h){h=f.getAttribute(h);if(!h){return null;}return h.strip();};}}d=null;return g;})(),_flag:function(d,e){return $(d).hasAttribute(e)?e:null;},style:function(d){return d.style.cssText.toLowerCase();},title:function(d){return d.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 frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a;});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,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);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(e){var b=e.getElementsByTagName("*"),d=[];for(var c=0,f;f=b[c];c++){if(f.tagName!=="!"){d.push(f);}}return d;}Element.Methods.down=function(c,d,b){c=$(c);if(arguments.length==1){return c.firstDescendant();}return Object.isNumber(d)?a(c)[d]:Element.select(c,d)[b||0];};})();}}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.toUpperCase()=="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("outerHTML" in document.documentElement){Element.Methods.replace=function(c,e){c=$(c);if(e&&e.toElement){e=e.toElement();}if(Object.isElement(e)){c.parentNode.replaceChild(e,c);return c;}e=Object.toHTML(e);var d=c.parentNode,b=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var f=c.next(),a=Element._getContentFromAnonymousElement(b,e.stripScripts());d.removeChild(c);if(f){a.each(function(g){d.insertBefore(g,f);});}else{a.each(function(g){d.appendChild(g);});}}else{c.outerHTML=e.stripScripts();}e.evalScripts.bind(e).defer();return c;};}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a;};Element._getContentFromAnonymousElement=function(d,c){var e=new Element("div"),b=Element._insertionTranslations.tags[d];if(b){e.innerHTML=b[0]+c+b[1];for(var a=b[2];a--;){e=e.firstChild;}}else{e.innerHTML=c;}return $A(e.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(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD});})();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);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true;}a=null;})(document.createElement("div"));Element.extend=(function(){function c(g){if(typeof window.Element!="undefined"){var i=window.Element.prototype;if(i){var k="_"+(Math.random()+"").slice(2),h=document.createElement(g);i[k]="x";var j=(h[k]!=="x");delete i[k];h=null;return j;}}return false;}function b(h,g){for(var j in g){var i=g[j];if(Object.isFunction(i)&&!(j in h)){h[j]=i.methodize();}}}var d=c("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(d){return function(h){if(h&&typeof h._extendedByPrototype=="undefined"){var g=h.tagName;if(g&&(/^(?:object|applet|embed)$/i.test(g))){b(h,Element.Methods);b(h,Element.Methods.Simulated);b(h,Element.Methods.ByTag[g.toUpperCase()]);}}return h;};}return Prototype.K;}var a={},e=Element.Methods.ByTag;var f=Object.extend(function(i){if(!i||typeof i._extendedByPrototype!="undefined"||i.nodeType!=1||i==window){return i;}var g=Object.clone(a),h=i.tagName.toUpperCase();if(e[h]){Object.extend(g,e[h]);}b(i,g);i._extendedByPrototype=Prototype.emptyFunction;return i;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated);}}});f.refresh();return f;})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(a,b){return a.hasAttribute(b);};}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute;}Element.addMethods=function(c){var i=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(g);}else{g(b);}}function g(k){k=k.toUpperCase();if(!Element.Methods.ByTag[k]){Element.Methods.ByTag[k]={};}Object.extend(Element.Methods.ByTag[k],c);}function a(m,l,k){k=k||false;for(var o in m){var n=m[o];if(!Object.isFunction(n)){continue;}if(!k||!(o in l)){l[o]=n.methodize();}}}function e(n){var k;var m={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(m[n]){k="HTML"+m[n]+"Element";}if(window[k]){return window[k];}k="HTML"+n+"Element";if(window[k]){return window[k];}k="HTML"+n.capitalize()+"Element";if(window[k]){return window[k];}var l=document.createElement(n),o=l.__proto__||l.constructor.prototype;l=null;return o;}var h=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(i.ElementExtensions){a(Element.Methods,h);a(Element.Methods.Simulated,h,true);}if(i.SpecificElementExtensions){for(var j in Element.Methods.ByTag){var f=e(j);if(Object.isUndefined(f)){continue;}a(d[j],f.prototype);}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh();}Element.cache={};};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()};},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);}};(function(b){var g=Prototype.Browser,e=document,c,d={};function a(){if(g.WebKit&&!e.evaluate){return document;}if(g.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body;}return document.documentElement;}function f(h){if(!c){c=a();}d[h]="client"+h;b["get"+h]=function(){return c[d[h]];};return b["get"+h]();}b.getWidth=f.curry("Width");b.getHeight=f.curry("Height");})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(b){if(!(b=$(b))){return;}var a;if(b===window){a=0;}else{if(typeof b._prototypeUID==="undefined"){b._prototypeUID=[Element.Storage.UID++];}a=b._prototypeUID[0];}if(!Element.Storage[a]){Element.Storage[a]=$H();}return Element.Storage[a];},store:function(b,a,c){if(!(b=$(b))){return;}if(arguments.length===2){Element.getStorage(b).update(a);}else{Element.getStorage(b).set(a,c);}return b;},retrieve:function(c,b,a){if(!(c=$(c))){return;}var e=Element.getStorage(c),d=e.get(b);if(Object.isUndefined(d)){e.set(b,a);d=a;}return d;},clone:function(c,a){if(!(c=$(c))){return;}var e=c.cloneNode(a);e._prototypeUID=void 0;if(a){var d=Element.select(e,"*"),b=d.length;while(b--){d[b]._prototypeUID=void 0;}}return Element.extend(e);}});Prototype._original_property=window.Sizzle;
/*
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var q=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0;});var b=function(E,u,B,w){B=B||[];var e=u=u||document;if(u.nodeType!==1&&u.nodeType!==9){return[];}if(!E||typeof E!=="string"){return B;}var C=[],D,z,I,H,A,t,s=true,x=p(u),G=E;while((q.exec(""),D=q.exec(G))!==null){G=D[3];C.push(D[1]);if(D[2]){t=D[3];break;}}if(C.length>1&&k.exec(E)){if(C.length===2&&f.relative[C[0]]){z=g(C[0]+C[1],u);}else{z=f.relative[C[0]]?[u]:b(C.shift(),u);while(C.length){E=C.shift();if(f.relative[E]){E+=C.shift();}z=g(E,z);}}}else{if(!w&&C.length>1&&u.nodeType===9&&!x&&f.match.ID.test(C[0])&&!f.match.ID.test(C[C.length-1])){var J=b.find(C.shift(),u,x);u=J.expr?b.filter(J.expr,J.set)[0]:J.set[0];}if(u){var J=w?{expr:C.pop(),set:a(w)}:b.find(C.pop(),C.length===1&&(C[0]==="~"||C[0]==="+")&&u.parentNode?u.parentNode:u,x);z=J.expr?b.filter(J.expr,J.set):J.set;if(C.length>0){I=a(z);}else{s=false;}while(C.length){var v=C.pop(),y=v;if(!f.relative[v]){v="";}else{y=C.pop();}if(y==null){y=u;}f.relative[v](I,y,x);}}else{I=C=[];}}if(!I){I=z;}if(!I){throw"Syntax error, unrecognized expression: "+(v||E);}if(d.call(I)==="[object Array]"){if(!s){B.push.apply(B,I);}else{if(u&&u.nodeType===1){for(var F=0;I[F]!=null;F++){if(I[F]&&(I[F]===true||I[F].nodeType===1&&h(u,I[F]))){B.push(z[F]);}}}else{for(var F=0;I[F]!=null;F++){if(I[F]&&I[F].nodeType===1){B.push(z[F]);}}}}}else{a(I,B);}if(t){b(t,e,B,w);b.uniqueSort(B);}return B;};b.uniqueSort=function(s){if(c){o=i;s.sort(c);if(o){for(var e=1;e<s.length;e++){if(s[e]===s[e-1]){s.splice(e--,1);}}}}return s;};b.matches=function(e,s){return b(e,null,null,s);};b.find=function(y,e,z){var x,v;if(!y){return[];}for(var u=0,t=f.order.length;u<t;u++){var w=f.order[u],v;if((v=f.leftMatch[w].exec(y))){var s=v[1];v.splice(1,1);if(s.substr(s.length-1)!=="\\"){v[1]=(v[1]||"").replace(/\\/g,"");x=f.find[w](v,e,z);if(x!=null){y=y.replace(f.match[w],"");break;}}}}if(!x){x=e.getElementsByTagName("*");}return{set:x,expr:y};};b.filter=function(B,A,E,u){var t=B,G=[],y=A,w,e,x=A&&A[0]&&p(A[0]);while(B&&A.length){for(var z in f.filter){if((w=f.match[z].exec(B))!=null){var s=f.filter[z],F,D;e=false;if(y==G){G=[];}if(f.preFilter[z]){w=f.preFilter[z](w,y,E,G,u,x);if(!w){e=F=true;}else{if(w===true){continue;}}}if(w){for(var v=0;(D=y[v])!=null;v++){if(D){F=s(D,w,v,y);var C=u^!!F;if(E&&F!=null){if(C){e=true;}else{y[v]=false;}}else{if(C){G.push(D);e=true;}}}}}if(F!==undefined){if(!E){y=G;}B=B.replace(f.match[z],"");if(!e){return[];}break;}}}if(B==t){if(e==null){throw"Syntax error, unrecognized expression: "+B;}else{break;}}t=B;}return y;};var f=b.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\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href");}},relative:{"+":function(y,e,x){var v=typeof e==="string",z=v&&!/\W/.test(e),w=v&&!z;if(z&&!x){e=e.toUpperCase();}for(var u=0,t=y.length,s;u<t;u++){if((s=y[u])){while((s=s.previousSibling)&&s.nodeType!==1){}y[u]=w||s&&s.nodeName===e?s||false:s===e;}}if(w){b.filter(e,y,true);}},">":function(x,s,y){var v=typeof s==="string";if(v&&!/\W/.test(s)){s=y?s:s.toUpperCase();for(var t=0,e=x.length;t<e;t++){var w=x[t];if(w){var u=w.parentNode;x[t]=u.nodeName===s?u:false;}}}else{for(var t=0,e=x.length;t<e;t++){var w=x[t];if(w){x[t]=v?w.parentNode:w.parentNode===s;}}if(v){b.filter(s,x,true);}}},"":function(u,s,w){var t=j++,e=r;if(!/\W/.test(s)){var v=s=w?s:s.toUpperCase();e=n;}e("parentNode",s,t,u,v,w);},"~":function(u,s,w){var t=j++,e=r;if(typeof s==="string"&&!/\W/.test(s)){var v=s=w?s:s.toUpperCase();e=n;}e("previousSibling",s,t,u,v,w);}},find:{ID:function(s,t,u){if(typeof t.getElementById!=="undefined"&&!u){var e=t.getElementById(s[1]);return e?[e]:[];}},NAME:function(t,w,x){if(typeof w.getElementsByName!=="undefined"){var s=[],v=w.getElementsByName(t[1]);for(var u=0,e=v.length;u<e;u++){if(v[u].getAttribute("name")===t[1]){s.push(v[u]);}}return s.length===0?null:s;}},TAG:function(e,s){return s.getElementsByTagName(e[1]);}},preFilter:{CLASS:function(u,s,t,e,x,y){u=" "+u[1].replace(/\\/g,"")+" ";if(y){return u;}for(var v=0,w;(w=s[v])!=null;v++){if(w){if(x^(w.className&&(" "+w.className+" ").indexOf(u)>=0)){if(!t){e.push(w);}}else{if(t){s[v]=false;}}}}return false;},ID:function(e){return e[1].replace(/\\/g,"");},TAG:function(s,e){for(var t=0;e[t]===false;t++){}return e[t]&&p(e[t])?s[1]:s[1].toUpperCase();},CHILD:function(e){if(e[1]=="nth"){var s=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(s[1]+(s[2]||1))-0;e[3]=s[3]-0;}e[0]=j++;return e;},ATTR:function(v,s,t,e,w,x){var u=v[1].replace(/\\/g,"");if(!x&&f.attrMap[u]){v[1]=f.attrMap[u];}if(v[2]==="~="){v[4]=" "+v[4]+" ";}return v;},PSEUDO:function(v,s,t,e,w){if(v[1]==="not"){if((q.exec(v[3])||"").length>1||/^\w/.test(v[3])){v[3]=b(v[3],null,null,s);}else{var u=b.filter(v[3],s,t,true^w);if(!t){e.push.apply(e,u);}return false;}}else{if(f.match.POS.test(v[0])||f.match.CHILD.test(v[0])){return true;}}return v;},POS:function(e){e.unshift(true);return e;}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden";},disabled:function(e){return e.disabled===true;},checked:function(e){return e.checked===true;},selected:function(e){e.parentNode.selectedIndex;return e.selected===true;},parent:function(e){return !!e.firstChild;},empty:function(e){return !e.firstChild;},has:function(t,s,e){return !!b(e[3],t).length;},header:function(e){return/h\d/i.test(e.nodeName);},text:function(e){return"text"===e.type;},radio:function(e){return"radio"===e.type;},checkbox:function(e){return"checkbox"===e.type;},file:function(e){return"file"===e.type;},password:function(e){return"password"===e.type;},submit:function(e){return"submit"===e.type;},image:function(e){return"image"===e.type;},reset:function(e){return"reset"===e.type;},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON";},input:function(e){return/input|select|textarea|button/i.test(e.nodeName);}},setFilters:{first:function(s,e){return e===0;},last:function(t,s,e,u){return s===u.length-1;},even:function(s,e){return e%2===0;},odd:function(s,e){return e%2===1;},lt:function(t,s,e){return s<e[3]-0;},gt:function(t,s,e){return s>e[3]-0;},nth:function(t,s,e){return e[3]-0==s;},eq:function(t,s,e){return e[3]-0==s;}},filter:{PSEUDO:function(x,t,u,y){var s=t[1],v=f.filters[s];if(v){return v(x,u,t,y);}else{if(s==="contains"){return(x.textContent||x.innerText||"").indexOf(t[3])>=0;}else{if(s==="not"){var w=t[3];for(var u=0,e=w.length;u<e;u++){if(w[u]===x){return false;}}return true;}}}},CHILD:function(e,u){var x=u[1],s=e;switch(x){case"only":case"first":while((s=s.previousSibling)){if(s.nodeType===1){return false;}}if(x=="first"){return true;}s=e;case"last":while((s=s.nextSibling)){if(s.nodeType===1){return false;}}return true;case"nth":var t=u[2],A=u[3];if(t==1&&A==0){return true;}var w=u[0],z=e.parentNode;if(z&&(z.sizcache!==w||!e.nodeIndex)){var v=0;for(s=z.firstChild;s;s=s.nextSibling){if(s.nodeType===1){s.nodeIndex=++v;}}z.sizcache=w;}var y=e.nodeIndex-A;if(t==0){return y==0;}else{return(y%t==0&&y/t>=0);}}},ID:function(s,e){return s.nodeType===1&&s.getAttribute("id")===e;},TAG:function(s,e){return(e==="*"&&s.nodeType===1)||s.nodeName===e;},CLASS:function(s,e){return(" "+(s.className||s.getAttribute("class"))+" ").indexOf(e)>-1;},ATTR:function(w,u){var t=u[1],e=f.attrHandle[t]?f.attrHandle[t](w):w[t]!=null?w[t]:w.getAttribute(t),x=e+"",v=u[2],s=u[4];return e==null?v==="!=":v==="="?x===s:v==="*="?x.indexOf(s)>=0:v==="~="?(" "+x+" ").indexOf(s)>=0:!s?x&&e!==false:v==="!="?x!=s:v==="^="?x.indexOf(s)===0:v==="$="?x.substr(x.length-s.length)===s:v==="|="?x===s||x.substr(0,s.length+1)===s+"-":false;},POS:function(v,s,t,w){var e=s[2],u=f.setFilters[e];if(u){return u(v,t,s,w);}}}};var k=f.match.POS;for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+/(?![^\[]*\])(?![^\(]*\))/.source);f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source);}var a=function(s,e){s=Array.prototype.slice.call(s,0);if(e){e.push.apply(e,s);return e;}return s;};try{Array.prototype.slice.call(document.documentElement.childNodes,0);}catch(l){a=function(v,u){var s=u||[];if(d.call(v)==="[object Array]"){Array.prototype.push.apply(s,v);}else{if(typeof v.length==="number"){for(var t=0,e=v.length;t<e;t++){s.push(v[t]);}}else{for(var t=0;v[t];t++){s.push(v[t]);}}}return s;};}var c;if(document.documentElement.compareDocumentPosition){c=function(s,e){if(!s.compareDocumentPosition||!e.compareDocumentPosition){if(s==e){o=true;}return 0;}var t=s.compareDocumentPosition(e)&4?-1:s===e?0:1;if(t===0){o=true;}return t;};}else{if("sourceIndex" in document.documentElement){c=function(s,e){if(!s.sourceIndex||!e.sourceIndex){if(s==e){o=true;}return 0;}var t=s.sourceIndex-e.sourceIndex;if(t===0){o=true;}return t;};}else{if(document.createRange){c=function(u,s){if(!u.ownerDocument||!s.ownerDocument){if(u==s){o=true;}return 0;}var t=u.ownerDocument.createRange(),e=s.ownerDocument.createRange();t.setStart(u,0);t.setEnd(u,0);e.setStart(s,0);e.setEnd(s,0);var v=t.compareBoundaryPoints(Range.START_TO_END,e);if(v===0){o=true;}return v;};}}}(function(){var s=document.createElement("div"),t="script"+(new Date).getTime();s.innerHTML="<a name='"+t+"'/>";var e=document.documentElement;e.insertBefore(s,e.firstChild);if(!!document.getElementById(t)){f.find.ID=function(v,w,x){if(typeof w.getElementById!=="undefined"&&!x){var u=w.getElementById(v[1]);return u?u.id===v[1]||typeof u.getAttributeNode!=="undefined"&&u.getAttributeNode("id").nodeValue===v[1]?[u]:undefined:[];}};f.filter.ID=function(w,u){var v=typeof w.getAttributeNode!=="undefined"&&w.getAttributeNode("id");return w.nodeType===1&&v&&v.nodeValue===u;};}e.removeChild(s);e=s=null;})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(s,w){var v=w.getElementsByTagName(s[1]);if(s[1]==="*"){var u=[];for(var t=0;v[t];t++){if(v[t].nodeType===1){u.push(v[t]);}}v=u;}return v;};}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(s){return s.getAttribute("href",2);};}e=null;})();if(document.querySelectorAll){(function(){var e=b,t=document.createElement("div");t.innerHTML="<p class='TEST'></p>";if(t.querySelectorAll&&t.querySelectorAll(".TEST").length===0){return;}b=function(x,w,u,v){w=w||document;if(!v&&w.nodeType===9&&!p(w)){try{return a(w.querySelectorAll(x),u);}catch(y){}}return e(x,w,u,v);};for(var s in e){b[s]=e[s];}t=null;})();}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return;}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return;}f.order.splice(1,0,"CLASS");f.find.CLASS=function(s,t,u){if(typeof t.getElementsByClassName!=="undefined"&&!u){return t.getElementsByClassName(s[1]);}};e=null;})();}function n(s,x,w,B,y,A){var z=s=="previousSibling"&&!A;for(var u=0,t=B.length;u<t;u++){var e=B[u];if(e){if(z&&e.nodeType===1){e.sizcache=w;e.sizset=u;}e=e[s];var v=false;while(e){if(e.sizcache===w){v=B[e.sizset];break;}if(e.nodeType===1&&!A){e.sizcache=w;e.sizset=u;}if(e.nodeName===x){v=e;break;}e=e[s];}B[u]=v;}}}function r(s,x,w,B,y,A){var z=s=="previousSibling"&&!A;for(var u=0,t=B.length;u<t;u++){var e=B[u];if(e){if(z&&e.nodeType===1){e.sizcache=w;e.sizset=u;}e=e[s];var v=false;while(e){if(e.sizcache===w){v=B[e.sizset];break;}if(e.nodeType===1){if(!A){e.sizcache=w;e.sizset=u;}if(typeof x!=="string"){if(e===x){v=true;break;}}else{if(b.filter(x,[e]).length>0){v=e;break;}}}e=e[s];}B[u]=v;}}}var h=document.compareDocumentPosition?function(s,e){return s.compareDocumentPosition(e)&16;}:function(s,e){return s!==e&&(s.contains?s.contains(e):true);};var p=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML";};var g=function(e,y){var u=[],v="",w,t=y.nodeType?[y]:y;while((w=f.match.PSEUDO.exec(e))){v+=w[0];e=e.replace(f.match.PSEUDO,"");}e=f.relative[e]?e+"*":e;for(var x=0,s=t.length;x<s;x++){b(e,t[x],u);}return b.filter(v,u);};window.Sizzle=b;})();Prototype.Selector=(function(c){function d(g){for(var e=0,f=g.length;e<f;e++){Element.extend(g[e]);}return g;}function a(e,f){return d(c(e,f||document));}function b(f,e){return c.matches(e,[f]).length==1;}return{engine:c,select:a,match:b};})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;window.$$=function(){var a=$A(arguments).join(", ");return Prototype.Selector.select(a,document);};if(!Prototype.Selector.find){Prototype.Selector.find=function(f,g,c){if(Object.isUndefined(c)){c=0;}var b=Prototype.Selector.match,e=f.length,a=0,d;for(d=0;d<e;d++){if(b(f[d],g)&&c==a++){return Element.extend(f[d]);}}};}var Form={reset:function(a){a=$(a);a.reset();return a;},serializeElements:function(g,b){if(typeof b!="object"){b={hash:!!b};}else{if(Object.isUndefined(b.hash)){b.hash=true;}}var c,f,a=false,e=b.submit;var d=g.inject({},function(h,i){if(!i.disabled&&i.name){c=i.name;f=$(i).getValue();if(f!=null&&i.type!="file"&&(i.type!="submit"||(!a&&e!==false&&(!e||c==e)&&(a=true)))){if(c in h){if(!Object.isArray(h[c])){h[c]=[h[c]];}h[c].push(f);}else{h[c]=f;}}}return h;});return b.hash?d:Object.toQueryString(d);}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a);},getElements:function(e){var f=$(e).getElementsByTagName("*"),d,a=[],c=Form.Element.Serializers;for(var b=0;d=f[b];b++){a.push(d);}return a.inject([],function(g,h){if(c[h.tagName.toLowerCase()]){g.push(Element.extend(h));}return g;});},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend);}for(var e=0,h=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue;}h.push(Element.extend(b));}return h;},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)$/i.test(d.tagName);});},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)$/i.test(a.type)))){a.select();}}catch(b){}return a;},disable:function(a){a=$(a);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(c,f){if(Object.isUndefined(f)){return this[c.type=="select-one"?"selectOne":"selectMany"](c);}else{var b,d,g=!Object.isArray(f);for(var a=0,e=c.length;a<e;a++){b=c.options[a];d=this.optionValue(b);if(g){if(d==f){b.selected=true;return;}}else{b.selected=f.include(d);}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null;},selectMany:function(d){var a,e=d.length;if(!e){return null;}for(var c=0,a=[];c<e;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);}});(function(){var w={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:{}};var e=document.documentElement;var x="onmouseenter" in e&&"onmouseleave" in e;var p;if(Prototype.Browser.IE){var i={0:1,1:4,2:2};p=function(z,y){return z.button===i[y];};}else{if(Prototype.Browser.WebKit&&false){p=function(z,y){switch(y){case 0:return z.which==1&&!z.metaKey;case 1:return z.which==1&&z.metaKey;default:return false;}};}else{p=function(z,y){return z.which?(z.which===y+1):(z.button===y);};}}function s(y){return p(y,0);}function r(y){return p(y,1);}function l(y){return p(y,2);}function c(A){A=w.extend(A);var z=A.target,y=A.type,B=A.currentTarget;if(B&&B.tagName){if(y==="load"||y==="error"||(y==="click"&&B.tagName.toLowerCase()==="input"&&B.type==="radio")){z=B;}}if(z.nodeType==Node.TEXT_NODE){z=z.parentNode;}return Element.extend(z);}function n(z,A){var y=w.element(z);if(!A){return y;}while(y){if(Prototype.Selector.match(y,A)){return Element.extend(y);}y=y.parentNode;}}function q(y){return{x:b(y),y:a(y)};}function b(A){var z=document.documentElement,y=document.body||{scrollLeft:0};return A.pageX||(A.clientX+(z.scrollLeft||y.scrollLeft)-(z.clientLeft||0));}function a(A){var z=document.documentElement,y=document.body||{scrollTop:0};return A.pageY||(A.clientY+(z.scrollTop||y.scrollTop)-(z.clientTop||0));}function o(y){w.extend(y);y.preventDefault();y.stopPropagation();y.stopped=true;}w.Methods={isLeftClick:s,isMiddleClick:r,isRightClick:l,element:c,findElement:n,pointer:q,pointerX:b,pointerY:a,stop:o};var u=Object.keys(w.Methods).inject({},function(y,z){y[z]=w.Methods[z].methodize();return y;});if(Prototype.Browser.IE){function h(z){var y;switch(z.type){case"mouseover":y=z.fromElement;break;case"mouseout":y=z.toElement;break;default:return null;}return Element.extend(y);}Object.extend(u,{stopPropagation:function(){this.cancelBubble=true;},preventDefault:function(){this.returnValue=false;},inspect:function(){return"[object Event]";}});w.extend=function(z,y){if(!z){return false;}if(z._extendedByPrototype){return z;}z._extendedByPrototype=Prototype.emptyFunction;var A=w.pointer(z);Object.extend(z,{target:z.srcElement||y,relatedTarget:h(z),pageX:A.x,pageY:A.y});return Object.extend(z,u);};}else{w.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(w.prototype,u);w.extend=Prototype.K;}function m(C,B,D){var A=Element.retrieve(C,"prototype_event_registry");if(Object.isUndefined(A)){d.push(C);A=Element.retrieve(C,"prototype_event_registry",$H());}var y=A.get(B);if(Object.isUndefined(y)){y=[];A.set(B,y);}if(y.pluck("handler").include(D)){return false;}var z;if(B.include(":")){z=function(E){if(Object.isUndefined(E.eventName)){return false;}if(E.eventName!==B){return false;}w.extend(E,C);D.call(C,E);};}else{if(!x&&(B==="mouseenter"||B==="mouseleave")){if(B==="mouseenter"||B==="mouseleave"){z=function(F){w.extend(F,C);var E=F.relatedTarget;while(E&&E!==C){try{E=E.parentNode;}catch(G){E=C;}}if(E===C){return;}D.call(C,F);};}}else{z=function(E){w.extend(E,C);D.call(C,E);};}}z.handler=D;y.push(z);return z;}function g(){for(var y=0,z=d.length;y<z;y++){w.stopObserving(d[y]);d[y]=null;}}var d=[];if(Prototype.Browser.IE){window.attachEvent("onunload",g);}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false);}var k=Prototype.K,f={mouseenter:"mouseover",mouseleave:"mouseout"};if(!x){k=function(y){return(f[y]||y);};}function t(B,A,C){B=$(B);var z=m(B,A,C);if(!z){return B;}if(A.include(":")){if(B.addEventListener){B.addEventListener("dataavailable",z,false);}else{B.attachEvent("ondataavailable",z);B.attachEvent("onfilterchange",z);}}else{var y=k(A);if(B.addEventListener){B.addEventListener(y,z,false);}else{B.attachEvent("on"+y,z);}}return B;}function j(D,B,E){D=$(D);var A=Element.retrieve(D,"prototype_event_registry");if(!A){return D;}if(!B){A.each(function(G){var F=G.key;j(D,F);});return D;}var C=A.get(B);if(!C){return D;}if(!E){C.each(function(F){j(D,B,F.handler);});return D;}var z=C.find(function(F){return F.handler===E;});if(!z){return D;}if(B.include(":")){if(D.removeEventListener){D.removeEventListener("dataavailable",z,false);}else{D.detachEvent("ondataavailable",z);D.detachEvent("onfilterchange",z);}}else{var y=k(B);if(D.removeEventListener){D.removeEventListener(y,z,false);}else{D.detachEvent("on"+y,z);}}A.set(B,C.without(z));return D;}function v(B,A,z,y){B=$(B);if(Object.isUndefined(y)){y=true;}if(B==document&&document.createEvent&&!B.dispatchEvent){B=document.documentElement;}var C;if(document.createEvent){C=document.createEvent("HTMLEvents");C.initEvent("dataavailable",true,true);}else{C=document.createEventObject();C.eventType=y?"ondataavailable":"onfilterchange";}C.eventName=A;C.memo=z||{};if(document.createEvent){B.dispatchEvent(C);}else{B.fireEvent(C.eventType,C);}return w.extend(C);}Object.extend(w,w.Methods);Object.extend(w,{fire:v,observe:t,stopObserving:j});Element.addMethods({fire:v,observe:t,stopObserving:j});Object.extend(document,{fire:v.methodize(),observe:t.methodize(),stopObserving:j.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,w);}else{window.Event=w;}})();(function(){var d;function a(){if(document.loaded){return;}if(d){window.clearTimeout(d);}document.loaded=true;document.fire("dom:loaded");}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a();}}function b(){try{document.documentElement.doScroll("left");}catch(f){d=b.defer();return;}a();}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false);}else{document.observe("readystatechange",c);if(window==top){d=b.defer();}}Event.observe(window,"load",a);})();Element.addMethods();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,e){e=e.toString().strip();var d=/\s/.test(e)?$w(e).map(a).join(""):a(e);return d?document._getElementsByXPath(".//*"+d,c):[];}:function(e,f){f=f.toString().strip();var g=[],h=(/\s/.test(f)?$w(f):null);if(!h&&!f){return g;}var c=$(e).getElementsByTagName("*");f=" "+f+" ";for(var d=0,k,j;k=c[d];d++){if(k.className&&(j=" "+k.className+" ")&&(j.include(f)||(h&&h.all(function(i){return !i.toString().blank()&&j.include(" "+i+" ");})))){g.push(Element.extend(k));}}return g;};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);(function(){window.Selector=Class.create({initialize:function(a){this.expression=a.strip();},findElements:function(a){return Prototype.Selector.select(this.expression,a);},match:function(a){return Prototype.Selector.match(a,this.expression);},toString:function(){return this.expression;},inspect:function(){return"#<Selector: "+this.expression+">";}});Object.extend(Selector,{matchElements:Prototype.Selector.filter,findElement:function(f,g,b){b=b||0;var a=0,d;for(var c=0,e=f.length;c<e;c++){d=f[c];if(Prototype.Selector.match(d,g)&&b===a++){return Element.extend(d);}}},findChildElements:function(b,c){var a=c.toArray().join(", ");return Prototype.Selector.select(a,b||document);}});})();
/*
  yaffle (c)
  pjson.js
*/
(function(){function b(e){return(+e<0?-1:1)*Math.floor(Math.abs(+e||0));}var d=1;function c(h){var f=d,e,g;d=1;g=this.length>>>0;e=(arguments.length<2?(f>0?0:-1):b(arguments[1]));e=(e<0?Math.max(e+g,f-1):Math.min(e,g+f));for(;e>-1&&e<g&&!((e in this)&&this[e]===h);e+=f){}return(e>-1&&e<g?e:-1);}function a(e){d=-1;return c.apply(this,arguments);}Array.prototype.indexOf=c;Array.prototype.lastIndexOf=a;}());(function(){function f(n,m,o){for(var p in n){if(Object.prototype.hasOwnProperty.call(n,p)){o(p,m);}}return m;}function g(m,n){return f(n,m,function(o){m[o]=n[o];});}function l(m){return f(m,[],function(o,n){n.push(o);});}function j(m){return f(m,[],function(o,n){n.push(m[o]);});}Object.keys=l;Object.values=j;Object.extend=g;function c(m){return this.uniq().filter(function(n){return m.indexOf(n)!==-1;});}function h(m){var r,u=[],t=0,p,o,q,s;for(p=-1,q=arguments.length;p<q;p++){r=(p>=0?arguments[p]:this);if(Object.isArray(r)&&!("callee" in r)){for(o=0,s=r.length;o<s;o++,t++){if(o in r){u[t]=r[o];}}}else{u[t]=r;t++;}}return u;}function i(o,n){for(var m=0,p=this.length>>>0;m<p;m++){if(m in this){o.call(n,this[m],m,this);}}}function k(m){return this.inject([],function(p,o,n){if(0===n||(m?p.last()!==o:!p.include(o))){p.push(o);}return p;});}function a(){return Array.prototype.concat.apply([],this.map(function(m){return(Object.isArray(m)?m.flatten():m);}));}Array.prototype.intersect=c;Array.prototype.concat=h;Array.prototype.forEach=i;Array.prototype._each=i;Array.prototype.uniq=k;Array.prototype.flatten=a;function b(){var o=String(this),n=o.search(/\S/),m=/\s/,p=(n<0?0:o.length);while(m.test(o.charAt(--p))){}return o.substring(n,p+1);}function e(){return this.replace(/<\/?[^>]+>/gi,"");}function d(){return !(/\S/.test(this));}String.prototype.strip=b;String.prototype.trim=b;String.prototype.stripTags=e;String.prototype.blank=d;}());Date.prototype.toJSON=function(a){return(Object.isNumber(this)&&!isFinite(this)?null:this.toISOString());};Date.prototype.toISOString=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)+"."+this.getUTCMilliseconds().toPaddedString(3)+"Z";};Date.now=function(){return(new Date()).valueOf();};String.prototype.times=function(b){b=Math.floor(b);var a=(b>1?this.times(b/2):"");return a+(b%2===1?a+this:a);};delete String.prototype.toJSON;delete Array.prototype.toJSON;delete Number.prototype.toJSON;Object.keys=function(b){var d=[],c,a=0;for(c in b){if(Object.prototype.hasOwnProperty.call(b,c)){d[a]=c;a++;}}return d;};Object.toJSON=function(o){var g=arguments[1],b=arguments[2]||"",k={},m=[],n="",e=Object.prototype.toString,c,l,p,j,d,h;if(e.call(g)==="[object Array]"){c=[];for(j=0,d=g.length;j<d;j++){p=g[j];h=e.call(p);if(h==="[object Number]"||h==="[object String]"){p=String(p);if(!k.hasOwnProperty(" "+p)){k[" "+p]=true;c.push(p);}}}}switch(e.call(b)){case"[object Number]":n="          ".substr(0,b);break;case"[object String]":n=b.substr(0,10);break;}function a(q){var i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\",'"':'\\"'};q=String(q).replace(/[\x00-\x1f\\"]/g,function(r){if(!i.hasOwnProperty(r)){i[r]="\\u"+(65536+r.charCodeAt(0)).toString(16).substr(1);}return i[r];});return'"'+q+'"';}function f(v,q){var s=[],x=["{","}"],t,w,u,r;for(t=m.length-1;t>=0;t--){if(m[t]===v){throw new TypeError();}}m.push(v);if(e.call(v)==="[object Array]"){x=["[","]"];for(t=0,u=v.length;t<u;t++){w=l(t,v,q+n);s.push(typeof(w)==="undefined"?"null":w);}}else{r=c||Object.keys(v);for(t=0,u=r.length;t<u;t++){w=l(r[t],v,q+n);if(typeof(w)!=="undefined"){s.push(a(r[t])+(n?": ":":")+w);}}}m.pop();return x[0]+(s.length&&n?"\n"+q+n+s.join(",\n"+q+n)+"\n"+q:s.join(","))+x[1];}l=function(r,q,i){var s=q[r];if(s!==null&&(typeof(s)==="object"||typeof(s)==="function")&&typeof(s.toJSON)==="function"){s=s.toJSON(r);}if(typeof(g)==="function"){s=g.call(q,r,s);}if(s===null){return"null";}switch(e.call(s)){case"[object Boolean]":return String(s);case"[object String]":return a(s);case"[object Number]":return(isFinite(s)?String(s):"null");}if(typeof(s)==="object"){return f(s,i);}};return l("",{"":o},"");};(window.JSON=window.JSON||{}).stringify=Object.toJSON;var Hash=Class.create(Enumerable,(function(){function c(s,r){return Object.keys(s).inject({},function(t,u){t[r(u)]=s[u];return t;});}function f(r){this._object=(Object.isHash(r)?c(r._object,Prototype.K):c(r,Hash.escape));}function g(r){var s=this._object;Object.keys(s)._each(function(v){var u=s[v],t=Hash.unescape(v),w=[t,u];w.key=t;w.value=u;r(w);});}function n(r){r=Hash.escape(r);return Object.prototype.hasOwnProperty.call(this._object,r);}function k(r,s){r=Hash.escape(r);return(this._object[r]=s);}function d(r){if(this.has(r)){r=Hash.escape(r);return this._object[r];}}function p(r){var s;if(this.has(r)){r=Hash.escape(r);s=this._object[r];delete this._object[r];}return s;}function q(){return c(this._object,Hash.unescape);}function o(){return this.pluck("key");}function m(){return this.pluck("value");}function h(s){var r=this.detect(function(t){return t.value===s;});return r&&r.key;}function j(r){return this.clone().update(r);}function e(r){return new Hash(r).inject(this,function(s,t){s.set(t.key,t.value);return s;});}function b(r,s){if(Object.isUndefined(s)){return r;}return r+"="+encodeURIComponent(String.interpret(s));}function a(){return this.inject([],function(t,u){var s=encodeURIComponent(u.key),r=u.value;r=Object.isArray(r)?r:[Object.isFunction(r)?r():r];Array.prototype.push.apply(t,r.map(b.curry(s)));return t;}).join("&");}function l(){return"#<Hash:{"+this.map(function(r){return r.map(Object.inspect).join(": ");}).join(", ")+"}>";}function i(){return new Hash(this);}return{initialize:f,_each:g,has:n,set:k,get:d,unset:p,toObject:q,toTemplateReplacements:q,toJSON:q,keys:o,values:m,index:h,merge:j,update:e,toQueryString:a,inspect:l,clone:i};}()));Hash.from=$H;Hash.escape=function(a){return"*"+String(a);};Hash.unescape=function(a){return String(a).substr(1);};if(Array.isArray){Object.isArray=Array.isArray;}else{Array.isArray=Object.isArray;}(function(){try{window.offscreenBuffering=true;if(document.execCommand&&Prototype.Browser.IE){document.execCommand("BackgroundImageCache",false,true);}}catch(a){}}());Ajax.Request.prototype._complete=false;Ajax.Request.prototype.aborted=false;Ajax.Request.prototype.abort=function(){if(this._complete){return;}this.transport.onreadystatechange=Prototype.emptyFunction;this.transport.abort();this._complete=true;this.aborted=true;var a=new Ajax.Response(this);["Abort","Complete"].each(function(b){try{(this.options["on"+b]||Prototype.emptyFunction)(a,a.headerJSON);Ajax.Responders.dispatch("on"+b,this,a,a.headerJSON);}catch(c){this.dispatchException(c);}},this);};Prototype.globalEval=(function(){var GLOBAL_VARIABLE="__prototype_exec_test",TEST_SCRIPT="function "+GLOBAL_VARIABLE+"(){};",originalValue=window[GLOBAL_VARIABLE];function globalEval(script){window.eval(script);}function globalExecScript(script){window.execScript(script);}function scriptElementEval(script){var scriptElement=document.createElement("script"),head=document.getElementsByTagName("head")[0]||document.documentElement;scriptElement.type="text/javascript";scriptElement.appendChild(document.createTextNode(script));head.insertBefore(scriptElement,head.firstChild);head.removeChild(scriptElement);}window[GLOBAL_VARIABLE]=false;if(window.eval){globalEval(TEST_SCRIPT);if(window[GLOBAL_VARIABLE]){window[GLOBAL_VARIABLE]=originalValue;return globalEval;}}if(window.execScript){globalExecScript(TEST_SCRIPT);if(window[GLOBAL_VARIABLE]){window[GLOBAL_VARIABLE]=originalValue;return globalExecScript;}}return scriptElementEval;}());String.prototype.evalScripts=function(){return this.extractScripts().map(function(a){return Prototype.globalEval(a);});};if(typeof(window.opera)!=="object"){window.opera={postError:Prototype.K};}window.opera.postError=window.opera.postError||Prototype.K;Function.prototype.watch=function(b,a){var d=this,c=d();return window.setInterval(function(){var e=d();if(e!==c){a(e);c=e;}},b*1000);};Math.rand=function(b,a){if(arguments.length<2){a=b;b=0;}return b+Math.round(Math.random()*(a-b));};String.prototype.addSlashes=function(){return this.replace(/([\\'"])/g,"\\$1").replace(/\0/g,"\\0");};String.prototype.stripSlashes=function(){return this.replace(/\\0/g,"\u0000").replace(/\\([\\'"])/g,"$1");};var Cookie={defaultExpires:15552000,cut:function(a){document.cookie=a+"=; expires=Thu, 01-Jan-70 00:00:01 GMT";},get:function(b){var a=(new RegExp(RegExp.escape(b)+"=([^;]*)","m")).exec(document.cookie);return(a?window.unescape(a[1]||""):null);},set:function(b,c,a){document.cookie=b+"="+window.escape(c)+"; expires="+(new Date(Date.now()+(a||this.defaultExpires)*1000)).toGMTString()+"; path=/";return c;}};var storageCookie=(function(){var b,a;b=function(c,d){c=Hash.escape(c);if(window.localStorage){try{window.localStorage[c]=d;return true;}catch(f){}try{window.localStorage.removeItem(c);}catch(e){}}return false;};a=$H((Cookie.get("storageCookie")||"{}").evalJSON());return{set:function(c,d){c=String(c);d=String(d);a.set(c,d);if(!b(c,d)){Cookie.set("storageCookie",Object.toJSON(a));}return d;},get:function(d){var c=window.localStorage?window.localStorage[Hash.escape(d)]:null;return c===null?a.get(d):c;}};}());var Timeout=Class.create({initialize:function(){this.timer=null;this.count=0;},set:function(c,b,a){this.count++;this.clear(a);if(Object.isFunction(b)){b=b(this.count);}if(Object.isFunction(c)){this.timer=(function(){this.timer=null;c();}.bind(this).delay(b));}},clear:function(a){if(this.timer!==null){window.clearTimeout(this.timer);this.timer=null;}if(a){this.count=0;}},active:function(){return this.timer!==null;}});Ajax.PeriodicalRequest=Class.create({initialize:function(b,a){this.ajaxRequest=null;this.Timer=new Timeout();this.onTimeout=b;this.decayFunction=a||function(c){return Math.min(32,Math.pow(2,c));};},stop:function(a){if(this.ajaxRequest!==null){this.ajaxRequest.abort();this.ajaxRequest=null;}this.Timer.clear(a);},request:function(c,b,a){this.stop(this.Timer.active());this.haveNewContent=false;b=Object.clone(b);b.onSuccess=(b.onSuccess||Prototype.emptyFunction).wrap(function(d){this.haveNewContent=d.apply(this,$A(arguments).slice(1));}.bind(this));b.onComplete=(b.onComplete||Prototype.emptyFunction).wrap(function(d){this.ajaxRequest=null;this.Timer.set(this.onTimeout,this.decayFunction,d.apply(this,$A(arguments).slice(1))||this.haveNewContent);}.bind(this));if(a){return(this.ajaxRequest=new Ajax.Updater(a,c,b));}else{return(this.ajaxRequest=new Ajax.Request(c,b));}}});var jsload={loaded:{},stack:[],loading:"",checked:false,require:function(a,b){this.stack.push([a,$A(b)]);this.jsloaded();},basename:function(a){return a.parseURI().pathname.parsePath().basename;},isLoaded:function(a){return this.loaded.hasOwnProperty(" "+this.basename(a));},jsloaded:function(){var a,b;for(a=arguments.length-1;a>=0;a--){this.loaded[" "+this.basename(String(arguments[a]))]=1;}if(this.isLoaded(this.loading)){this.loading="";}b=this.isLoaded.bind(this);this.stack=this.stack.map(function(c){c[1]=c[1].reject(b);if(!c[1].length){window.setTimeout(c[0],1);return null;}return c;}).compact();if(this.checked&&!this.loading&&this.stack.length>0){this.loadjscssfile(this.stack.last()[1][0]);}},loadjscssfile:function(a){this.loading=this.basename(a);var c,b;if(a.parseURI().pathname.parsePath().extension===".css"){c=new Element("link",{type:"text/css",rel:"stylesheet",media:"all",href:a});this.jsloaded.bind(this,a).defer();}else{c=new Element("script",{type:"text/javascript",charset:"UTF-8",src:a});}b=function(){this.jsloaded(a);}.bind(this);c.onreadystatechange=function(){if(/loaded|complete/.test(c.readyState)){b();}};c.onload=b;(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(c);},checkscripts:function(){this.checked=true;this.jsloaded.apply(this,$$('link[rel="stylesheet"]').invoke("readAttribute","href").concat($$("script[src]").invoke("readAttribute","src")).compact());}};document.observe("dom:loaded",jsload.checkscripts.bind(jsload));if(typeof(jsload)!=="undefined"){jsload.jsloaded("prototype.js","protoaculous.js");}var Template=Class.create({initialize:function(j,f){var c=j.toString().split(f||Template.Pattern),a=c.length,m=/^([^.\[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/,d,b,g,l,h,e;for(d=1,b=1;d<a;d+=4){g=c[d]||"";if(g==="\\"){c[b-1]+=c[d+1];}else{c[b-1]+=g;l=[];h=c[d+2];e=m.exec(h);while(e){l.push(e[1].startsWith("[")?e[2].replace(/\\\\\]/g,"]"):e[1]);if(!e[3]){break;}h=h.substring("["===e[3]?e[1].length:e[0].length);e=m.exec(h);}if(l.length){c[b]=l;b+=2;c[b-1]=c[d+3];}else{c[b-1]+=c[d+3];}}}c.length=b;this.parts=c;},evaluate:function(e){if(Object.isFunction(e.toTemplateReplacements)){e=e.toTemplateReplacements();}var h=[this.parts[0]],a,c,d,b,f,g;for(f=1,g=this.parts.length;f<g;f+=2){a=this.parts[f];c=e;for(d=0,b=a.length;d<b&&c;d++){c=c[a[d]];}h.push(String.interpret(c));h.push(this.parts[f+1]);}return h.join("");}});Template.Pattern=/(^|.|\r|\n)(#\{([^\}]*)\})/;
/*
  (c)  yaffle  http://hostel6.ru
*/
Event.isShortcut=function(c,a){a=("+"+a).toUpperCase();var b=a.replace(/\+(CTRL|ALT|SHIFT)(?=\+)/g,"").substr(1)||{},e=c.keyCode,d="keydown";if(Prototype.Browser.Opera&&window.opera&&Object.isFunction(window.opera.version)&&(parseFloat(window.opera.version())<11)){d="keypress";e=c.which?String.fromCharCode(c.keyCode).toUpperCase().charCodeAt(0):(Event["KEY_"+b]?c.keyCode:0);}return((e===(Event["KEY_"+b]||b.charCodeAt(0)))&&(c.type===(d))&&(c.ctrlKey===(a.indexOf("+CTRL+")!==-1))&&(c.altKey===(a.indexOf("+ALT+")!==-1))&&(c.shiftKey===(a.indexOf("+SHIFT+")!==-1))&&("INPUT TEXTAREA SELECT OPTION BUTTON".indexOf(String(Event.element(c).tagName).toUpperCase())===-1));};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){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5;},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 e;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){e=b;}else{e=$(b).childNodes;}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;$A(e).each(function(g,f){new c(g,Object.extend(a,{delay:f*a.speed+d}));});},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c,a){b=$(b);c=(c||"appear").toLowerCase();return Effect[Effect.PAIRS[c][b.visible()?1:0]](b,Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},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(a){if(a&&a.transition===false){a.transition=Effect.Transitions.linear;}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});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;this.render=(function(){function b(d,c){if(d.options[c+"Internal"]){d.options[c+"Internal"](d);}if(d.options[c]){d.options[c](d);}}return function(c){if(this.state==="idle"){this.state="running";b(this,"beforeSetup");if(this.setup){this.setup();}b(this,"afterSetup");}if(this.state==="running"){c=(this.options.transition(c)*this.fromToDelta)+this.options.from;this.position=c;b(this,"beforeUpdate");if(this.update){this.update(c);}b(this,"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,f,e){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(g){c[d]=g;};this.start(Object.extend({from:f,to:e},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,e){var f={};if(this.options.scaleX){f.width=e.round()+"px";}if(this.options.scaleY){f.height=a.round()+"px";}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(e-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){f.top=this.originalTop-c+"px";}if(this.options.scaleX){f.left=this.originalLeft-b+"px";}}else{if(this.options.scaleY){f.top=-c+"px";}if(this.options.scaleX){f.left=-b+"px";}}}this.element.setStyle(f);}});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(c){var b=arguments[1]||{},a=document.viewport.getScrollOffsets(),d=$(c).cumulativeOffset();if(b.offset){d[1]+=b.offset;}return new Effect.Tween(null,a.top,d[1],b,function(e){scrollTo(a.left,e.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 e=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:e,y:0,duration:c,afterFinishInternal:function(f){new Effect.Move(f.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(g){new Effect.Move(g.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(i){new Effect.Move(i.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:-e,y:0,duration:c,afterFinishInternal:function(k){k.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 g=c.getDimensions();var h,f;var e,d;switch(b.direction){case"top-left":h=f=e=d=0;break;case"top-right":h=g.width;f=d=0;e=-g.width;break;case"bottom-left":h=e=0;f=g.height;d=-g.height;break;case"bottom-right":h=g.width;f=g.height;e=-g.width;d=-g.height;break;case"center":h=g.width/2;f=g.height/2;e=-g.width/2;d=-g.height/2;break;}return new Effect.Move(c,{x:h,y:f,duration:0.01,beforeSetup:function(i){i.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(i){new Effect.Parallel([new Effect.Opacity(i.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(i.element,{x:e,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(i.element,100,{scaleMode:{originalHeight:g.height,originalWidth:g.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(j){j.effects[0].element.setStyle({height:"0px"}).show();},afterFinishInternal:function(j){j.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 f=c.getDimensions();var e,d;switch(b.direction){case"top-left":e=d=0;break;case"top-right":e=f.width;d=0;break;case"bottom-left":e=0;d=f.height;break;case"bottom-right":e=f.width;d=f.height;break;case"center":e=f.width/2;d=f.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:e,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a);}},b));};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{},a=c.getInlineOpacity(),e=b.transition||Effect.Transitions.linear,d=function(f){return 1-e((-Math.cos((f*(b.pulses||5)*2)*Math.PI)/2)+0.5);};return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.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(e){d.element.style[e.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(g){var f=g[0],e=g[1],d=null;if(e.parseColor("#zzzzzz")!="#zzzzzz"){e=e.parseColor();d="color";}else{if(f=="opacity"){e=parseFloat(e);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1});}}else{if(Element.CSS_LENGTH.test(e)){var c=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(c[1]);d=(c.length==3)?c[2]:null;}}}var b=this.element.getStyle(f);return{style:f.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(e):e,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 e=[$(d)||$$(d)].flatten();return e.map(function(f){return new c(f,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,e){d[e]=a[e];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,e,b){c=$(c);var d=e.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);
/*
   http://prototype-window.xilinus.com/
 Copyright (c) 2006 Sébastien Gruhier (http://xilinus.com, http://itseb.com)
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
 
 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 VERSION 1.3
*/
var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var c;var b=0;if(arguments.length>0){if(typeof arguments[0]=="string"){c=arguments[0];b=1;}else{c=arguments[0]?arguments[0].id:null;}}if(!c){c="window_"+new Date().getTime();}if($(c)){alert("Window "+c+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor");}this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[b]||{});if(this.options.blurClassName){this.options.focusClassName=this.options.className;}if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined"){this.options.top=this._round(Math.random()*500,this.options.gridY);}if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined"){this.options.left=this._round(Math.random()*500,this.options.gridX);}if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear){this.options.showEffectOptions.to=this.options.opacity;}}if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear){this.options.showEffectOptions.to=this.options.opacity;}if(this.options.hideEffect==Effect.Fade){this.options.hideEffectOptions.from=this.options.opacity;}}if(this.options.hideEffect==Element.hide){this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose){this.destroy();}}.bind(this);}if(this.options.parent!=document.body){this.options.parent=$(this.options.parent);}this.element=this._createWindow(c);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var a=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(d){d.observe("mousedown",a.eventMouseDown);d.addClassName("top_draggable");});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(d){d.observe("mousedown",a.eventMouseDown);d.addClassName("bottom_draggable");});}if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown);}this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+"px"});this.useLeft=true;}else{this.element.setStyle({right:parseFloat(this.options.right)+"px"});this.useLeft=false;}if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+"px"});this.useTop=true;}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+"px"});this.useTop=false;}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex);}if(this.options.destroyOnClose){this.setDestroyOnClose(true);}this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height){this.setSize(this.options.width,this.options.height);}this.setTitle(this.options.title);Windows.register(this);},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var c=this.getContent();var a=null;for(var b=0;b<c.childNodes.length;b++){a=c.childNodes[b];if(a.nodeType==1){break;}a=null;}if(a){this._oldParent.appendChild(a);}this._oldParent=null;}if(this.sizer){Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown);}if(this.options.url){this.content.src=null;}if(this.iefix){Element.remove(this.iefix);}Element.remove(this.element);Windows.unregister(this);},setCloseCallback:function(a){this.options.closeCallback=a;},getContent:function(){return this.content;},setContent:function(h,g,b){var a=$(h);if(null==a){throw"Unable to find element '"+h+"' in DOM";}this._oldParent=a.parentNode;var f=null;var e=null;if(g){f=Element.getDimensions(a);}if(b){e=Position.cumulativeOffset(a);}var c=this.getContent();this.setHTMLContent("");c=this.getContent();c.appendChild(a);a.show();if(g){this.setSize(f.width,f.height);}if(b){this.setLocation(e[1]-this.heightN,e[0]-this.widthW);}},setHTMLContent:function(a){if(this.options.url){this.content.src=null;this.options.url=null;var b='<div id="'+this.getId()+'_content" class="'+this.options.className+'_content"> </div>';$(this.getId()+"_table_content").innerHTML=b;this.content=$(this.element.id+"_content");}this.getContent().innerHTML=a;},setAjaxContent:function(b,a,d,c){this.showFunction=d?"showCenter":"show";this.showModal=c||false;a=a||{};this.setHTMLContent("");this.onComplete=a.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this);}a.onComplete=this._onCompleteHandler;new Ajax.Request(b,a);a.onComplete=this.onComplete;},_setAjaxContent:function(a){Element.update(this.getContent(),a.responseText);if(this.onComplete){this.onComplete(a);}this.onComplete=null;this[this.showFunction](this.showModal);},setURL:function(a){if(this.options.url){this.content.src=null;}this.options.url=a;var b="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+a+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=b;this.content=$(this.element.id+"_content");},getURL:function(){return this.options.url?this.options.url:null;},refresh:function(){if(this.options.url){$(this.element.getAttribute("id")+"_content").src=this.options.url;}},setCookie:function(b,c,n,e,a){b=b||this.element.id;this.cookie=[b,c,n,e,a];var l=WindowUtilities.getCookie(b);if(l){var m=l.split(",");var j=m[0].split(":");var i=m[1].split(":");var k=parseFloat(m[2]),f=parseFloat(m[3]);var g=m[4];var d=m[5];this.setSize(k,f);if(g=="true"){this.doMinimize=true;}else{if(d=="true"){this.doMaximize=true;}}this.useLeft=j[0]=="l";this.useTop=i[0]=="t";this.element.setStyle(this.useLeft?{left:j[1]}:{right:j[1]});this.element.setStyle(this.useTop?{top:i[1]}:{bottom:i[1]});}},getId:function(){return this.element.id;},setDestroyOnClose:function(){this.options.destroyOnClose=true;},setConstraint:function(a,b){this.constraint=a;this.constraintPad=Object.extend(this.constraintPad,b||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left));}},_initDrag:function(b){if(Event.element(b)==this.sizer&&this.isMinimized()){return;}if(Event.element(b)!=this.sizer&&this.isMaximized()){return;}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize();}this.pointer=[this._round(Event.pointerX(b),this.options.gridX),this._round(Event.pointerY(b),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement();}else{this.currentDrag=this.element;}if(Event.element(b)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle("bottom"));this.rightOrg=parseFloat(this.element.getStyle("right"));this._notify("onStartResize");}else{this.doResize=false;var a=$(this.getId()+"_close");if(a&&Position.within(a,this.pointer[0],this.pointer[1])){this.currentDrag=null;return;}this.toFront();if(!this.options.draggable){return;}this._notify("onStartMove");}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__",this.overlayOpacity);document.body.ondrag=function(){return false;};document.body.onselectstart=function(){return false;};this.currentDrag.show();Event.stop(b);},_round:function(b,a){return a==1?b:b=Math.floor(b/a)*a;},_updateDrag:function(b){var a=[this._round(Event.pointerX(b),this.options.gridX),this._round(Event.pointerY(b),this.options.gridY)];var k=a[0]-this.pointer[0];var j=a[1]-this.pointer[1];if(this.doResize){var i=this.widthOrg+k;var d=this.heightOrg+j;k=this.width-this.widthOrg;j=this.height-this.heightOrg;if(this.useLeft){i=this._updateWidthConstraint(i);}else{this.currentDrag.setStyle({right:(this.rightOrg-k)+"px"});}if(this.useTop){d=this._updateHeightConstraint(d);}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-j)+"px"});}this.setSize(i,d);this._notify("onResize");}else{this.pointer=a;if(this.useLeft){var c=parseFloat(this.currentDrag.getStyle("left"))+k;var g=this._updateLeftConstraint(c);this.pointer[0]+=g-c;this.currentDrag.setStyle({left:g+"px"});}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-k+"px"});}if(this.useTop){var f=parseFloat(this.currentDrag.getStyle("top"))+j;var e=this._updateTopConstraint(f);this.pointer[1]+=e-f;this.currentDrag.setStyle({top:e+"px"});}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-j+"px"});}this._notify("onMove");}if(this.iefix){this._fixIEOverlapping();}this._removeStoreLocation();Event.stop(b);},_endDrag:function(a){WindowUtilities.enableScreen("__invisible__");if(this.doResize){this._notify("onEndResize");}else{this._notify("onEndMove");}Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(a);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null;},_updateLeftConstraint:function(b){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(b<this.constraintPad.left){b=this.constraintPad.left;}if(b+this.width+this.widthE+this.widthW>a-this.constraintPad.right){b=a-this.constraintPad.right-this.width-this.widthE-this.widthW;}}return b;},_updateTopConstraint:function(c){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var b=this.height+this.heightN+this.heightS;if(c<this.constraintPad.top){c=this.constraintPad.top;}if(c+b>a-this.constraintPad.bottom){c=a-this.constraintPad.bottom-b;}}return c;},_updateWidthConstraint:function(a){if(this.constraint&&this.useLeft&&this.useTop){var b=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var c=parseFloat(this.element.getStyle("left"));if(c+a+this.widthE+this.widthW>b-this.constraintPad.right){a=b-this.constraintPad.right-c-this.widthE-this.widthW;}}return a;},_updateHeightConstraint:function(b){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var c=parseFloat(this.element.getStyle("top"));if(c+b+this.heightN+this.heightS>a-this.constraintPad.bottom){b=a-this.constraintPad.bottom-c-this.heightN-this.heightS;}}return b;},_createWindow:function(a){var f=this.options.className;var d=document.createElement("div");d.setAttribute("id",a);d.className="dialog";var e;if(this.options.url){e='<iframe frameborder="0" name="'+a+'_content"  id="'+a+'_content" src="'+this.options.url+'"> </iframe>';}else{e='<div id="'+a+'_content" class="'+f+'_content"> </div>';}var g=this.options.closable?"<div class='"+f+"_close' id='"+a+"_close' onclick='Windows.close(\""+a+"\", event)'> </div>":"";var h=this.options.minimizable?"<div class='"+f+"_minimize' id='"+a+"_minimize' onclick='Windows.minimize(\""+a+"\", event)'> </div>":"";var i=this.options.maximizable?"<div class='"+f+"_maximize' id='"+a+"_maximize' onclick='Windows.maximize(\""+a+"\", event)'> </div>":"";var c=this.options.resizable?"class='"+f+"_sizer' id='"+a+"_sizer'":"class='"+f+"_se'";var b="../themes/default/blank.gif";d.innerHTML=g+h+i+"      <table id='"+a+"_row1' class=\"top table_window\">        <tr>          <td class='"+f+"_nw'></td>          <td class='"+f+"_n'><div id='"+a+"_top' class='"+f+"_title title_window'>"+this.options.title+"</div></td>          <td class='"+f+"_ne'></td>        </tr>      </table>      <table id='"+a+"_row2' class=\"mid table_window\">        <tr>          <td class='"+f+"_w'></td>            <td id='"+a+"_table_content' class='"+f+"_content' valign='top'>"+e+"</td>          <td class='"+f+"_e'></td>        </tr>      </table>        <table id='"+a+"_row3' class=\"bot table_window\">        <tr>          <td class='"+f+"_sw'></td>            <td class='"+f+"_s'><div id='"+a+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>            <td "+c+"></td>        </tr>      </table>    ";Element.hide(d);this.options.parent.insertBefore(d,this.options.parent.firstChild);Event.observe($(a+"_content"),"load",this.options.onload);return d;},changeClassName:function(a){var b=this.options.className;var c=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(d){this._toggleClassName($(c+d),b+d,a+d);}.bind(this));this._toggleClassName($(c+"_top"),b+"_title",a+"_title");$$("#"+c+" td").each(function(d){d.className=d.className.sub(b,a);});this.options.className=a;},_toggleClassName:function(c,b,a){if(c){c.removeClassName(b);c.addClassName(a);}},setLocation:function(c,b){c=this._updateTopConstraint(c);b=this._updateLeftConstraint(b);var a=this.currentDrag||this.element;a.setStyle({top:c+"px"});a.setStyle({left:b+"px"});this.useLeft=true;this.useTop=true;},getLocation:function(){var a={};if(this.useTop){a=Object.extend(a,{top:this.element.getStyle("top")});}else{a=Object.extend(a,{bottom:this.element.getStyle("bottom")});}if(this.useLeft){a=Object.extend(a,{left:this.element.getStyle("left")});}else{a=Object.extend(a,{right:this.element.getStyle("right")});}return a;},getSize:function(){return{width:this.width,height:this.height};},setSize:function(c,b,a){c=parseFloat(c);b=parseFloat(b);if(!this.minimized&&c<this.options.minWidth){c=this.options.minWidth;}if(!this.minimized&&b<this.options.minHeight){b=this.options.minHeight;}if(this.options.maxHeight&&b>this.options.maxHeight){b=this.options.maxHeight;}if(this.options.maxWidth&&c>this.options.maxWidth){c=this.options.maxWidth;}if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&a){new Effect.ResizeWindow(this,null,null,c,b,{duration:Window.resizeEffectDuration});}else{this.width=c;this.height=b;var f=this.currentDrag?this.currentDrag:this.element;f.setStyle({width:c+this.widthW+this.widthE+"px"});f.setStyle({height:b+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var d=$(this.element.id+"_content");d.setStyle({height:b+"px"});d.setStyle({width:c+"px"});}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true);},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true);},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex){this.setZIndex(Windows.maxZIndex+1);}if(this.iefix){this._fixIEOverlapping();}},getBounds:function(b){if(!this.width||!this.height||!this.visible){this.computeBounds();}var a=this.width;var c=this.height;if(!b){a+=this.widthW+this.widthE;c+=this.heightN+this.heightS;}var d=Object.extend(this.getLocation(),{width:a+"px",height:c+"px"});return d;},computeBounds:function(){if(!this.width||!this.height){var a=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=a+5;}else{this.height=a+5;}}this.setSize(this.width,this.height);if(this.centered){this._center(this.centerTop,this.centerLeft);}},show:function(b){this.visible=true;if(b){if(typeof this.overlayOpacity=="undefined"){var a=this;setTimeout(function(){a.show(b);},10);return;}Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this);}else{if(!this.element.style.zIndex){this.setZIndex(Windows.maxZIndex+1);}}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle});}this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions){this.options.showEffect(this.element,this.options.showEffectOptions);}else{this.options.showEffect(this.element);}this._checkIEOverlapping();WindowUtilities.focusedWindow=this;this._notify("onShow");},showCenter:function(a,c,b){this.centered=true;this.centerTop=c;this.centerLeft=b;this.show(a);},isVisible:function(){return this.visible;},_center:function(c,b){var d=WindowUtilities.getWindowScroll(this.options.parent);var a=WindowUtilities.getPageSize(this.options.parent);if(typeof c=="undefined"){c=(a.windowHeight-(this.height+this.heightN+this.heightS))/2;}c+=d.top;if(typeof b=="undefined"){b=(a.windowWidth-(this.width+this.widthW+this.widthE))/2;}b+=d.left;this.setLocation(c,b);this.toFront();},_recenter:function(b){if(this.centered){var a=WindowUtilities.getPageSize(this.options.parent);var c=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==a.windowWidth&&this.pageSize.windowHeight==a.windowHeight&&this.windowScroll.left==c.left&&this.windowScroll.top==c.top){return;}this.pageSize=a;this.windowScroll=c;if($("overlay_modal")){$("overlay_modal").setStyle({height:(a.pageHeight+"px")});}if(this.options.recenterAuto){this._center(this.centerTop,this.centerLeft);}}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow();}this.oldStyle=this.getContent().getStyle("overflow")||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide();}if(!this.doNotNotifyHide){this._notify("onHide");}},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this)){return;}if(this.options.destroyOnClose){var a=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var b=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){b();a();};}else{this.options.hideEffectOptions.afterFinish=function(){a();};}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose");}},minimize:function(){if(this.resizing){return;}var a=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var d=a.getDimensions().height;this.r2Height=d;var c=this.element.getHeight()-d;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-d,{duration:Window.resizeEffectDuration});}else{this.height-=d;this.element.setStyle({height:c+"px"});a.hide();}if(!this.useTop){var b=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(b+d)+"px"});}}else{this.minimized=false;var d=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+d,{duration:Window.resizeEffectDuration});}else{var c=this.element.getHeight()+d;this.height+=d;this.element.setStyle({height:c+"px"});a.show();}if(!this.useTop){var b=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(b-d)+"px"});}this.toFront();}this._notify("onMinimize");this._saveCookie();},maximize:function(){if(this.isMinimized()||this.resizing){return;}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize();}if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide();}}else{this._storeLocation();Windows.unsetOverflow(this);var g=WindowUtilities.getWindowScroll(this.options.parent);var b=WindowUtilities.getPageSize(this.options.parent);var f=g.left;var e=g.top;if(this.options.parent!=document.body){g={top:0,left:0,bottom:0,right:0};var d=this.options.parent.getDimensions();b.windowWidth=d.width;b.windowHeight=d.height;e=0;f=0;}if(this.constraint){b.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);b.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);f+=Math.max(0,this.constraintPad.left);e+=Math.max(0,this.constraintPad.top);}var c=b.windowWidth-this.widthW-this.widthE;var a=b.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,e,f,c,a,{duration:Window.resizeEffectDuration});}else{this.setSize(c,a);this.element.setStyle(this.useLeft?{left:f}:{right:f});this.element.setStyle(this.useTop?{top:e}:{bottom:e});}this.toFront();if(this.iefix){this._fixIEOverlapping();}}this._notify("onMaximize");this._saveCookie();},isMinimized:function(){return this.minimized;},isMaximized:function(){return(this.storedLocation!=null);},setOpacity:function(a){if(Element.setOpacity){Element.setOpacity(this.element,a);}},setZIndex:function(a){this.element.setStyle({zIndex:a});Windows.updateZindex(a,this);},setTitle:function(a){if(!a||a==""){a="&nbsp;";}Element.update(this.element.id+"_top",a);},getTitle:function(){return $(this.element.id+"_top").innerHTML;},setStatusBar:function(b){var a=$(this.getId()+"_bottom");if(typeof(b)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(b,this.bottombar.firstChild);}else{this.bottombar.appendChild(b);}}else{this.bottombar.innerHTML=b;}},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+"_iefix");}if(this.iefix){setTimeout(this._fixIEOverlapping.bind(this),50);}},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show();},_getWindowBorderSize:function(b){var c=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(c).height;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(c).height;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(c).width;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(c).width;c.parentNode.removeChild(c);var c=document.createElement("div");c.className="overlay_"+this.options.className;document.body.appendChild(c);var a=this;setTimeout(function(){a.overlayOpacity=($(c).getStyle("opacity"));c.parentNode.removeChild(c);},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height;}if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420){this.setSize(this.width,this.height);}if(this.doMaximize){this.maximize();}if(this.doMinimize){this.minimize();}},_createHiddenDiv:function(b){var a=document.body;var c=document.createElement("div");c.setAttribute("id",this.element.id+"_tmp");c.className=b;c.style.display="none";c.innerHTML="";a.insertBefore(c,a.firstChild);return c;},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle("top"),bottom:this.element.getStyle("bottom"),left:this.element.getStyle("left"),right:this.element.getStyle("right"),width:this.width,height:this.height};}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration});}else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height);}Windows.resetOverflow();this._removeStoreLocation();}},_removeStoreLocation:function(){this.storedLocation=null;},_saveCookie:function(){if(this.cookie){var a="";if(this.useLeft){a+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"));}else{a+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"));}if(this.useTop){a+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"));}else{a+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"));}a+=","+(this.storedLocation?this.storedLocation.width:this.width);a+=","+(this.storedLocation?this.storedLocation.height:this.height);a+=","+this.isMinimized();a+=","+this.isMaximized();WindowUtilities.setCookie(a,this.cookie);}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE){this._getWindowBorderSize();}var b=document.createElement("div");b.className="wired_frame "+this.options.className+"_wired_frame";b.style.position="absolute";this.options.parent.insertBefore(b,this.options.parent.firstChild);this.wiredElement=$(b);}if(this.useLeft){this.wiredElement.setStyle({left:this.element.getStyle("left")});}else{this.wiredElement.setStyle({right:this.element.getStyle("right")});}if(this.useTop){this.wiredElement.setStyle({top:this.element.getStyle("top")});}else{this.wiredElement.setStyle({bottom:this.element.getStyle("bottom")});}var a=this.element.getDimensions();this.wiredElement.setStyle({width:a.width+"px",height:a.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement;},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag){return;}if(this.currentDrag==this.element){this.currentDrag=null;}else{if(this.useLeft){this.element.setStyle({left:this.currentDrag.getStyle("left")});}else{this.element.setStyle({right:this.currentDrag.getStyle("right")});}if(this.useTop){this.element.setStyle({top:this.currentDrag.getStyle("top")});}else{this.element.setStyle({bottom:this.currentDrag.getStyle("bottom")});}this.currentDrag.hide();this.currentDrag=null;if(this.doResize){this.setSize(this.width,this.height);}}},_notify:function(a){if(this.options[a]){this.options[a](this);}else{Windows.notify(a,this);}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(a){this.removeObserver(a);this.observers.push(a);},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b==a;});},notify:function(a,b){this.observers.each(function(c){if(c[a]){c[a](a,b);}});},getWindow:function(a){return this.windows.detect(function(b){return b.getId()==a;});},getFocusedWindow:function(){return this.focusedWindow;},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null;},register:function(a){this.windows.push(a);},addModalWindow:function(a){if(this.modalWindows.length==0){WindowUtilities.disableScreen(a.options.className,"overlay_modal",a.overlayOpacity,a.getId(),a.options.parent);}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId());}else{this.modalWindows.last().element.hide();}WindowUtilities._showSelect(a.getId());}this.modalWindows.push(a);},removeModalWindow:function(a){this.modalWindows.pop();if(this.modalWindows.length==0){WindowUtilities.enableScreen();}else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId());}else{this.modalWindows.last().element.show();}}},register:function(a){this.windows.push(a);},unregister:function(a){this.windows=this.windows.reject(function(b){return b==a;});},closeAll:function(){this.windows.each(function(a){Windows.close(a.getId());});},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(a){if(a){a.close();}});},minimize:function(c,a){var b=this.getWindow(c);if(b&&b.visible){b.minimize();}Event.stop(a);},maximize:function(c,a){var b=this.getWindow(c);if(b&&b.visible){b.maximize();}Event.stop(a);},close:function(c,a){var b=this.getWindow(c);if(b){b.close();}if(a){Event.stop(a);}},blur:function(b){var a=this.getWindow(b);if(!a){return;}if(a.options.blurClassName){a.changeClassName(a.options.blurClassName);}if(this.focusedWindow==a){this.focusedWindow=null;}a._notify("onBlur");},focus:function(b){var a=this.getWindow(b);if(!a){return;}if(this.focusedWindow){this.blur(this.focusedWindow.getId());}if(a.options.focusClassName){a.changeClassName(a.options.focusClassName);}this.focusedWindow=a;a._notify("onFocus");},unsetOverflow:function(a){this.windows.each(function(b){b.oldOverflow=b.getContent().getStyle("overflow")||"auto";b.getContent().setStyle({overflow:"hidden"});});if(a&&a.oldOverflow){a.getContent().setStyle({overflow:a.oldOverflow});}},resetOverflow:function(){this.windows.each(function(a){if(a.oldOverflow){a.getContent().setStyle({overflow:a.oldOverflow});}});},updateZindex:function(a,b){if(a>this.maxZIndex){this.maxZIndex=a;if(this.focusedWindow){this.blur(this.focusedWindow.getId());}}this.focusedWindow=b;if(this.focusedWindow){this.focus(this.focusedWindow.getId());}}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(d,c){if(d&&typeof d!="string"){Dialog._runAjaxRequest(d,c,Dialog.confirm);return;}d=d||"";c=c||{};var f=c.okLabel?c.okLabel:"Ok";var a=c.cancelLabel?c.cancelLabel:"Cancel";c=Object.extend(c,c.windowParameters||{});c.windowParameters=c.windowParameters||{};c.className=c.className||"alert";var b="class ='"+(c.buttonClass?c.buttonClass+" ":"")+" ok_button'";var e="class ='"+(c.buttonClass?c.buttonClass+" ":"")+" cancel_button'";var d="      <div class='"+c.className+"_message'>"+d+"</div>        <div class='"+c.className+"_buttons'>          <input type='button' value='"+f+"' onclick='Dialog.okCallback()' "+b+"/>          <input type='button' value='"+a+"' onclick='Dialog.cancelCallback()' "+e+"/>        </div>    ";return this._openDialog(d,c);},alert:function(c,b){if(c&&typeof c!="string"){Dialog._runAjaxRequest(c,b,Dialog.alert);return;}c=c||"";b=b||{};var d=b.okLabel?b.okLabel:"Ok";b=Object.extend(b,b.windowParameters||{});b.windowParameters=b.windowParameters||{};b.className=b.className||"alert";var a="class ='"+(b.buttonClass?b.buttonClass+" ":"")+" ok_button'";var c="      <div class='"+b.className+"_message'>"+c+"</div>        <div class='"+b.className+"_buttons'>          <input type='button' value='"+d+"' onclick='Dialog.okCallback()' "+a+"/>        </div>";return this._openDialog(c,b);},info:function(b,a){if(b&&typeof b!="string"){Dialog._runAjaxRequest(b,a,Dialog.info);return;}b=b||"";a=a||{};a=Object.extend(a,a.windowParameters||{});a.windowParameters=a.windowParameters||{};a.className=a.className||"alert";var b="<div id='modal_dialog_message' class='"+a.className+"_message'>"+b+"</div>";if(a.showProgress){b+="<div id='modal_dialog_progress' class='"+a.className+"_progress'>  </div>";}a.ok=null;a.cancel=null;return this._openDialog(b,a);},setInfoMessage:function(a){$("modal_dialog_message").update(a);},closeInfo:function(){Windows.close(this.dialogId);},_openDialog:function(e,d){var c=d.className;if(!d.height&&!d.width){d.width=WindowUtilities.getPageSize(d.options.parent||document.body).pageWidth/2;}if(d.id){this.dialogId=d.id;}else{var b=new Date();this.dialogId="modal_dialog_"+b.getTime();d.id=this.dialogId;}if(!d.height||!d.width){var a=WindowUtilities._computeSize(e,this.dialogId,d.width,d.height,5,c);if(d.height){d.width=a+5;}else{d.height=a+5;}}d.effectOptions=d.effectOptions;d.resizable=d.resizable||false;d.minimizable=d.minimizable||false;d.maximizable=d.maximizable||false;d.draggable=d.draggable||false;d.closable=d.closable||false;var f=new Window(d);f.getContent().innerHTML=e;f.showCenter(true,d.top,d.left);f.setDestroyOnClose();f.cancelCallback=d.onCancel||d.cancel;f.okCallback=d.onOk||d.ok;return f;},_getAjaxContent:function(a){Dialog.callFunc(a.responseText,Dialog.parameters);},_runAjaxRequest:function(c,b,a){if(c.options==null){c.options={};}Dialog.onCompleteFunc=c.options.onComplete;Dialog.parameters=b;Dialog.callFunc=a;c.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(c.url,c.options);},okCallback:function(){var a=Windows.focusedWindow;if(!a.okCallback||a.okCallback(a)){$$("#"+a.getId()+" input").each(function(b){b.onclick=null;});a.close();}},cancelCallback:function(){var a=Windows.focusedWindow;$$("#"+a.getId()+" input").each(function(b){b.onclick=null;});a.close();if(a.cancelCallback){a.cancelCallback(a);}}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1]);}var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight;}else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight;}}}}return{top:T,left:L,width:W,height:H};},getPageSize:function(d){d=d||document.body;var c,g;var e,b;if(d!=document.body){c=d.getWidth();g=d.getHeight();b=d.scrollWidth;e=d.scrollHeight;}else{var f,a;if(window.innerHeight&&window.scrollMaxY){f=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY;}else{if(document.body.scrollHeight>document.body.offsetHeight){f=document.body.scrollWidth;a=document.body.scrollHeight;}else{f=document.body.offsetWidth;a=document.body.offsetHeight;}}if(self.innerHeight){c=self.innerWidth;g=self.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;g=document.documentElement.clientHeight;}else{if(document.body){c=document.body.clientWidth;g=document.body.clientHeight;}}}if(a<g){e=g;}else{e=a;}if(f<c){b=c;}else{b=f;}}return{pageWidth:b,pageHeight:e,windowWidth:c,windowHeight:g};},disableScreen:function(c,a,d,e,b){WindowUtilities.initLightbox(a,c,function(){this._disableScreen(c,a,d,e);}.bind(this),b||document.body);},_disableScreen:function(c,b,e,f){var d=$(b);var a=WindowUtilities.getPageSize(d.parentNode);if(f&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(f);}d.style.height=(a.pageHeight+"px");d.style.display="none";if(b=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){d.overlayOpacity=e;new Effect.Appear(d,Object.extend({from:0,to:e},Windows.overlayShowEffectOptions));}else{d.style.display="block";}},enableScreen:function(b){b=b||"overlay_modal";var a=$(b);if(a){if(b=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(a,Object.extend({from:a.overlayOpacity,to:0},Windows.overlayHideEffectOptions));}else{a.style.display="none";a.parentNode.removeChild(a);}if(b!="__invisible__"){WindowUtilities._showSelect();}}},_hideSelect:function(a){if(Prototype.Browser.IE){a=a==null?"":"#"+a+" ";$$(a+"select").each(function(b){if(!WindowUtilities.isDefined(b.oldVisibility)){b.oldVisibility=b.style.visibility?b.style.visibility:"visible";b.style.visibility="hidden";}});}},_showSelect:function(a){if(Prototype.Browser.IE){a=a==null?"":"#"+a+" ";$$(a+"select").each(function(b){if(WindowUtilities.isDefined(b.oldVisibility)){try{b.style.visibility=b.oldVisibility;}catch(c){b.style.visibility="visible";}b.oldVisibility=null;}else{if(b.style.visibility){b.style.visibility="visible";}}});}},isDefined:function(a){return typeof(a)!="undefined"&&a!=null;},initLightbox:function(e,c,a,b){if($(e)){Element.setStyle(e,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;a();}else{var d=document.createElement("div");d.setAttribute("id",e);d.className="overlay_"+c;d.style.display="none";d.style.position="absolute";d.style.top="0";d.style.left="0";d.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;d.style.width="100%";b.insertBefore(d,b.firstChild);if(Prototype.Browser.WebKit&&e=="overlay_modal"){setTimeout(function(){a();},10);}else{a();}}},setCookie:function(b,a){document.cookie=a[0]+"="+escape(b)+((a[1])?"; expires="+a[1].toGMTString():"")+((a[2])?"; path="+a[2]:"")+((a[3])?"; domain="+a[3]:"")+((a[4])?"; secure":"");},getCookie:function(c){var b=document.cookie;var e=c+"=";var d=b.indexOf("; "+e);if(d==-1){d=b.indexOf(e);if(d!=0){return null;}}else{d+=2;}var a=document.cookie.indexOf(";",d);if(a==-1){a=b.length;}return unescape(b.substring(d+e.length,a));},_computeSize:function(e,a,b,g,d,f){var i=document.body;var c=document.createElement("div");c.setAttribute("id",a);c.className=f+"_content";if(g){c.style.height=g+"px";}else{c.style.width=b+"px";}c.style.position="absolute";c.style.top="0";c.style.left="0";c.style.display="none";c.innerHTML=e;i.insertBefore(c,i.firstChild);var h;if(g){h=$(c).getDimensions().width+d;}else{h=$(c).getDimensions().height+d;}i.removeChild(c);return h;}}
/*
 * @description		prototype.js based hover menu
 * @author        	Peter Slagter; peter [at] procurios [dot] nl; http://twitter.com/pesla or http://techblog.procurios.nl/k/618/news/view/34556/14863/ProtoFish-advanced-hover-menu-based-on-Prototype.html
 * @date          	17/06/09
 * @requires      	prototype.js 1.6
*/
;var ProtoFish=Class.create({initialize:function(c,b,a){this.id=c;this.timeout=b||0.4;this.cssClass=a||"hover";this.queue=[];if($(c)&&$(c).down()){this.listItems=$(c).select("li");this.initObservers();}},showUL:function(d){d.addClassName(this.cssClass);var c=d.down("ul"),b=d.down("a");if(c){c.addClassName("visible");}if(b){b.addClassName("hover");}},removeHover:function(d){d.removeClassName(this.cssClass);var c=d.down("ul"),b=d.down("a");if(c){c.removeClassName("visible");}if(b){b.removeClassName("hover");}},initObservers:function(){this.listItems.each(function(a){a.observe("mouseover",function(c,b){this.enterMenu(b);this.showUL(b);}.bindAsEventListener(this,a));a.observe("mouseout",function(c,b){this.queue.push([this.leaveMenu.delay(this.timeout,this),b]);}.bindAsEventListener(this,a));a.observe("click",function(c,b){this.queue.push([null,b]);this.leaveMenu(this);b.down("a").blur();}.bindAsEventListener(this,a));a.down().observe("focus",function(c,b){this.showUL(b);}.bindAsEventListener(this,a));a.down().observe("blur",function(d,c){if(!c.down("li")){this.removeHover(c);while(c.up("li")&&!c.next("li")){var b=c.up("li");this.removeHover(b);c=b;}}}.bindAsEventListener(this,a));}.bind(this));},enterMenu:function(){while(this.queue.length){window.clearTimeout(this.queue[0][0]);this.leaveMenu(this);}},leaveMenu:function(b){if(b.queue.length){var a=b.queue.shift()[1];b.removeHover(a);}}});
/*
    virtSusu core.js
    http://hostel6.ru/index.php?area=1&p=news&newsid=185
    yaffle, drdim
*/
function createCanvas(a,c){var b=document.createElement("canvas");b.width=a;b.height=c;if(typeof(window.G_vmlCanvasManager)==="object"){b=window.G_vmlCanvasManager.initElement(b);}b.style.width=a+"px";b.style.height=c+"px";return b;}function createCanvasFromImage(d,b,f,c,g){var e=createCanvas(2*b,f),a=e.getContext("2d");a.drawImage(d,0,0,c,g,0,0,b,f);a.drawImage(d,0,0,c,g,b,0,b,f);return e;}function splitImage(C,m,z,e,q,n,g,A){var l,f=[],s,c,B,o,x,v,u,d,y,p,a,t,b,r;l=createCanvasFromImage(C,m,z,e,q);C=l;e=m;q=z;for(v=0;v<2;v++){d=0;y=0;f[v]=[];for(x=0;x<n;x++){s=(!x?e-Math.floor(e/n)*(n-1):Math.floor(e/n));c=Math.round(s*m/e);p=0;a=0;f[v][x]=[];for(u=0;u<g;u++){B=(!u?q-Math.floor(q/g)*(g-1):Math.floor(q/g));o=Math.round(B*z/q);b=createCanvas(c,o);t=b.getContext("2d");t.drawImage(C,d,p,s,B,0,0,c,o);b.style.position="absolute";b.style.top=(a)+"px";b.style.left=(y+v*m)+"px";f[v][x][u]=b;p+=B;a+=o;}d+=s;y+=c;}}r=new Element("div");r.setStyle({display:"block",position:"relative",height:"100%",width:"100%",left:"0",top:"0"});for(v=0;v<2;v++){for(x=0;x<n;x++){for(u=0;u<g;u++){r.insert(f[v][x][u]);}}}$(A).update("").insert(r);}var virtSusu={config:{menuTest:false,dataUrl:"data/",XMLCoordsCoef:1,loadConfig:false,defLocation:null,effectsDuration:0.25,baseImageWidth:900,baseImageHeight:520,rotate360Time:5,brakingAcc:-1200,useScaling:false&&!Prototype.Browser.IE,useIMGTag:true,useCanvas:false&&!Prototype.Browser.IE,useEffects:true,lang:{ru:{wikiTitle:"Википедия",exitTitle:"Переход",noteTitle:"Информация",altForIMGTag:"Проект Виртуальный ЮУрГУ - Панорамная фотография",msg2:"\nВозможно в браузере отключен показ изображений.",msg1:"Ошибка при загрузке"}},wikiTitle:"Wikipedia",exitTitle:"Moving",noteTitle:"Information",altForIMGTag:"Virt SUSU - Panorama",msg2:"\nMay be pictures switched off in your browser settings.",msg1:"Error while loading"},canRotate:false,timeoutId:null,speed:1,direction:0,imageWidth:0,imageHeight:0,sImageWidth:0,sImageHeight:0,sCoef:1,maxSpeed:0,panorama:function(){return false;},setImageWidth:function(b,a,c,d){if(this.config.useScaling){this.imageWidth=(a>0?Math.round(this.config.baseImageHeight*b/a):0);this.imageHeight=this.config.baseImageHeight;}else{this.imageWidth=b;this.imageHeight=a;}this.maxSpeed=this.imageWidth/this.config.rotate360Time;this.sCoef=d;this.sImageWidth=Math.round(this.imageWidth*this.sCoef);this.sImageHeight=Math.round(this.imageHeight*this.sCoef);this.panorama=function(){return c&&this.imageWidth>this.config.baseImageWidth;}.bind(this);this.setCanRotate(this.canRotate);},canRotateLeft:function(){return this.canRotate&&(this.panorama()?true:$("slider").scrollLeft>0);},canRotateRight:function(){return this.canRotate&&(this.panorama()?true:($("slider").scrollLeft+$("slider").offsetWidth<this.sImageWidth));},setCanRotate:function(a){this.canRotate=a&&this.imageWidth;if(!this.canRotate){this.stop();}$("lb").setOpacity(this.canRotateLeft()?1:0.15);$("rb").setOpacity(this.canRotateRight()?1:0.15);this.setDragging(this.dragging);},setLbRb:function(){var a=0,b=0;if(this.canRotate){a=$("slider").scrollLeft/this.sCoef;b=2/3*this.config.baseImageWidth;}["lb","rb"].each(function(c,d){$(c).writeAttribute("href",this.makeLocation(this.currentLocation.id,Math.round(a+b*(d?1:-1)),""));}.bind(this));},rotate:function(b,a){if(!this.canRotate){return;}var c=document.getElementById("slider");if(this.panorama()){c.scrollLeft=(c.scrollLeft+Math.round(b)%this.sImageWidth+this.sImageWidth)%this.sImageWidth;}else{c.scrollLeft=Math.min(Math.max(0,c.scrollLeft+Math.round(b)),this.sImageWidth-c.offsetWidth);}c.scrollTop=Math.min(Math.max(0,c.scrollTop+Math.round(a)),this.sImageHeight-c.offsetHeight);this.setCanRotate(this.canRotate);},rotateTo:function(f){if(!this.canRotate){return;}var d=(f%this.imageWidth+this.imageWidth)%this.imageWidth,a=$("slider"),c=a.scrollLeft/this.sCoef,b=(c-d+this.imageWidth)%this.imageWidth,e=(d-c+this.imageWidth)%this.imageWidth;this.start((b<e?Math.PI:0),"rotateTo",false);this.speed=Math.sqrt(Math.abs(2*this.config.brakingAcc*Math.min(b,e)));this.brake("rotateTo");},braking:false,move:function(){var b=Date.now(),d=(b-this.lastTime)/1000,c=this.speed,a;this.lastTime=b;this.timeoutId=window.setTimeout(this.moveBinded,15);if(this.braking){this.speed+=this.config.brakingAcc*d;if(this.speed<0.01){this.stop();return;}}else{if(!this.constSpeed){this.speed=Math.min(this.speed+600*d,this.maxSpeed);}}a=(c+this.speed)*d/2*this.sCoef;this.rotate(a*Math.cos(this.direction),a*Math.sin(this.direction));},by:null,constSpeed:false,start:function(c,b,a){a=a||false;if(!this.canRotate){return;}this.stop();this.by=b;this.speed=0;this.constSpeed=a;this.direction=c;this.braking=false;this.moveBinded=this.move.bind(this);this.lastTime=Date.now();this.timeoutId=window.setTimeout(this.moveBinded,15);},brake:function(a){if(this.by===a){this.braking=true;}},stop:function(){if(this.timeoutId!==null){window.clearTimeout(this.timeoutId);this.timeoutId=null;this.by=null;}},updateScrollId:null,updateScroll:function(b){b=Math.round(this.sCoef*b);var a=$("slider");a.scrollLeft=b;this.setLbRb();if(Math.abs(a.scrollLeft-b)<2){window.clearInterval(this.updateScrollId);this.updateScrollId=null;if(this.config.useEffects){$("sliderMain").appear({duration:this.config.effectsDuration,from:0.01,to:1,queue:{position:"end",scope:"sliderMainFadeAppear"}});}else{$("sliderMain").setOpacity(1);}}},dragging:false,setDragging:function(a){this.dragging=a;$("slider").className="drag"+(this.canRotate?(this.dragging+1):"0");},currentLocation:null,movingTo:null,ajax:null,image:null,endTimeoutId:null,photoPath:"",soundPath:"",currentExits:[],locationsEquals:function(b,a){return b.id===a.id&&(+b.pos)===(+a.pos)&&b.info===a.info;},parseLocation:function(b){var a=b.replace(/%23/g,"#").split(";");return{id:a[0]||this.config.defLocation.id,pos:(+a[1])||0,info:(a[2]||"")};},getLocation:function(){return this.parseLocation(window.location.hash.substr(1));},setLocation:function(a){this.currentLocation=a;if(!this.locationsEquals(this.getLocation(),a)){this.setHash(this.makeLocation(a.id,a.pos,a.info));}},makeLocation:function(c,b,a){b=(+b)||0;return"#"+((c||"")+(b||a?(";"+(b||"0")+(a?";"+(this.local?a:(""+a).replace(/[\/\\]index\.html$/,"/")):"")):"")).replace(/\\/g,"/").replace(/#/g,"%23");},setHash:function(a){a=a+"";if(window.location.hash!==a){window.location.hash=a;}},locationOnChange:function(){var a=this.getLocation();if((this.currentLocation===null||!this.locationsEquals(this.currentLocation,a))&&(this.movingTo===null||!this.locationsEquals(this.movingTo,a))){this.goToLocation(a);}},onLoadingFailure:function(a,c){var b=this.config.msg1+' "'+a+'".'+(c||"");if(Object.isFunction(window.onerror)){window.onerror(b,window.location.href,1);}window.alert(b);},local:window.location.protocol==="file:",getXML:function(b,c){if(!Prototype.Browser.IE||!this.local){return new Ajax.Request(b,{method:"get",onSuccess:function(d){if(!d.responseXML||!d.responseXML.documentElement||d.responseXML.documentElement.nodeName==="parsererror"){if(d.responseXML){this.onLoadingFailure(b,"("+(d.status||0)+" xml)");}return;}c(d.responseXML);}.bind(this),onFailure:function(d){this.onLoadingFailure(b,"("+(d.status||"")+")");}.bind(this)});}else{var a=Try.these(function(){return new window.ActiveXObject("Microsoft.XMLDOM");},function(){return document.implementation.createDocument("","",null);});if(!Object.isUndefined(a)){a.async=false;a.load(b);if(!a.documentElement||a.documentElement.nodeName==="parsererror"){this.onLoadingFailure(b,"");}else{c(a);}}else{this.onLoadingFailure(b,"");}}return null;},iframeWin:null,closeText:function(a){if(this.iframeWin!==null){if(a){var b=this.getLocation();b.info="";this.setLocation(b);}else{this.iframeWin.destroy();}this.iframeWin=null;}},showTextFrom:function(a){this.closeText(false);if(!(/^\w+:\/\//.test(a))){a=this.config.dataUrl+a;}var b=new Window({zIndex:15,url:a,showEffectOptions:{duration:0.5},hideEffectOptions:{duration:0.3},className:"mac_os_x",onClose:this.closeText.bind(this,true),title:this.config.noteTitle,width:800,height:460,resizable:false,minimizable:false,maximizable:false,draggable:false,destroyOnClose:true,recenterAuto:false,parent:"window"});b.showCenter(false,2);this.iframeWin=b;},parseXML:function(d){var x=this.panorama(),o=(new Element("div")),n=[],r=d.getElementsByTagName("location")[0],f=(r.getElementsByTagName("exits")[0]||{getElementsByTagName:function(){return[];}}).getElementsByTagName("exit"),l=(r.getElementsByTagName("notes")[0]||{getElementsByTagName:function(){return[];}}).getElementsByTagName("note"),w,v,m,j,a,c,b=this.config.XMLCoordsCoef*100/this.imageWidth/(x?2:1),k=this.config.XMLCoordsCoef*100/this.imageHeight,p=Math.ceil(52*100/this.imageWidth/(x?2:1)),z=Math.ceil(52*100/this.imageHeight),e=(this.config.defLocation.id===this.movingTo.id?" noBG":""),q="block exit"+e,u="block note"+e,y="block wiki"+e,t=Math.round(this.config.baseImageWidth/2);function s(g){var A=g.getAttribute("x1")*b,i=g.getAttribute("x2")*b,C=g.getAttribute("y1")*k,B=g.getAttribute("y2")*k,D;D=(Math.max(p,Math.round(i-A))-i+A)/2;A-=D;i+=D;D=(Math.max(z,Math.round(B-C))-B+C)/2;C-=D;B+=D;return{centerX:Math.round((i+A)/2/b),centerY:Math.round((B+C)/2/k),nleft:(A+50).toFixed(3)+"%",style:{left:A.toFixed(3)+"%",top:C.toFixed(3)+"%",width:(i-A).toFixed(0)+"%",height:(B-C).toFixed(0)+"%"}};}function h(i,g,A){A=A+"<span></span>";o.insert((new Element("a",g)).setStyle(i.style).update(A));if(x){i.style.left=i.nleft;o.insert((new Element("a",g)).setStyle(i.style).update(A));}}for(v=f.length-1;v>=0;v--){a=f[v].getAttribute("text")||"";m=s(f[v].getElementsByTagName("area")[0]);w=f[v].getElementsByTagName("goto")[0];j=this.makeLocation(w.getAttribute("id"),w.getAttribute("pos"),"");n[v]={loc:j,x:m.centerX,y:m.centerY};h(m,{href:j,title:this.config.exitTitle,"class":q+(w.getAttribute("direction")==="-1"?"Down":"")},a);}for(v=l.length-1;v>=0;v--){a=l[v].getAttribute("text")||"";m=s(l[v].getElementsByTagName("area")[0]);w=l[v].getElementsByTagName("text")[0];c=l[v].getAttribute("type")||"note";j=this.makeLocation(this.movingTo.id,(x?(m.centerX-t):0),(c!=="wiki"?this.movingTo.id+"/":"")+w.getAttribute("from"));h(m,{href:j,title:this.config[(c!=="wiki"?"noteTitle":"wikiTitle")],"class":(c!=="wiki"?u:y)},a);}return{ce:n,div:o};},canvasContainer:null,lastW:-1,lastH:-1,createCanvases:function(a){if(this.image&&this.image.width&&this.image.height&&this.canvasContainer&&(this.lastW!==this.sImageWidth||this.lastH!==this.sImageHeight||a)){this.lastW=this.sImageWidth;this.lastH=this.sImageHeight;splitImage(this.image,this.sImageWidth,this.sImageHeight,this.image.width,this.image.height,16,1,this.canvasContainer);}},goToLocationEnd:function(b){var d=(this.config.useIMGTag||this.config.useScaling?'<img src="#{src}" width="#{width}" height="100%" alt="#{alt}" border="0" style="font-size:32px;border:0;margin:0;padding:0;display:block;position:absolute;left:#{left};top:0;" />':'<div style="background:transparent url(#{src}) scroll no-repeat 0 0;position:absolute;left:#{left};top:0;width:#{width};height:100%;"></div>'),c=this.panorama(),a=this.parseXML(b,this.movingTo,c),e=a.div;this.currentExits=a.ce;e.setStyle({display:"block",position:"relative",height:"100%",width:"100%",left:"0",top:"0"});if(this.config.useCanvas){this.canvasContainer=new Element("div");this.canvasContainer.setStyle({display:"block",position:"relative",height:"100%",width:"100%",left:"0",top:"0"});e.insert({top:this.canvasContainer});this.createCanvases(true);}else{if(c){e.insert({top:d.interpolate({src:this.photoPath,alt:this.config.altForIMGTag,left:"0",width:"50%"})});e.insert({top:d.interpolate({src:this.photoPath,alt:this.config.altForIMGTag,left:"50%",width:"50%"})});}else{e.insert({top:d.interpolate({src:this.photoPath,alt:this.config.altForIMGTag,left:"0",width:"100%"})});}}$("sliderMain").setStyle({height:(this.sImageHeight)+"px",width:((c?2:1)*this.sImageWidth)+"px"}).update("").insert(e);this.updateScrollId=window.setInterval(this.updateScroll.bind(this,(c?(this.movingTo.pos%this.imageWidth+this.imageWidth)%this.imageWidth:0)),5);this.setLocation(this.movingTo);if(this.movingTo.info){this.showTextFrom(this.movingTo.info);}this.movingTo=null;this.setCanRotate(true);document.fire("virtSusu:locationChanged");},fadeEffectFinished:true,fadeEffectAfterFinish:Prototype.emptyFunction,goToLocationContinue2:function(b,a,d,c){this.endTimeoutId=null;this.setImageWidth(a,d,c,this.sCoef);if(this.fadeEffectFinished){this.goToLocationEnd(b);}else{this.fadeEffectAfterFinish=this.goToLocationEnd.bind(this,b);}},goToLocationContinue:function(c){this.ajax=null;var f=c.getElementsByTagName("location")[0],b=f.getElementsByTagName("photo")[0],a=(+b.getAttribute("width"))||0,e=(+b.getAttribute("height"))||0,d=(b.getAttribute("panorama")||"true").strip().toLowerCase()==="true";this.photoPath=this.config.dataUrl+this.movingTo.id+"/"+b.getAttribute("from");this.soundPath=(f.getElementsByTagName("sound")[0]||{getAttribute:Prototype.emptyFunction}).getAttribute("from")||"";if(this.soundPath){this.soundPath=this.config.dataUrl+this.movingTo.id+"/"+this.soundPath;}if(a&&e&&!this.config.useCanvas){this.endTimeoutId=window.setTimeout(this.goToLocationContinue2.bind(this,c,a,e,d),1);return;}this.image=new Image();this.image.onload=function(){if(!this.image.width||!this.image.complete||(("naturalWidth" in this.image)&&!this.image.naturalWidth)){this.onLoadingFailure(this.photoPath,this.config.msg2);return;}a=this.image.width+0;e=this.image.height+0;if(!this.config.useCanvas){this.image=null;}this.endTimeoutId=window.setTimeout(this.goToLocationContinue2.bind(this,c,a,e,d),1);}.bind(this);this.image.onerror=this.onLoadingFailure.bind(this,this.photoPath,"");this.image.src=this.photoPath;},goToLocation:function(a){if(this.movingTo===null&&this.currentLocation!==null){if(a.id===this.currentLocation.id){this.setLocation(a);this.rotateTo(a.pos);if(a.info){this.showTextFrom(a.info);}else{this.closeText(false);}return;}}if(this.movingTo!==null){if(this.ajax!==null){this.ajax.abort();this.ajax=null;}if(this.image!==null){this.image.onload=Prototype.emptyFunction;this.image.onerror=Prototype.emptyFunction;this.image.onabort=Prototype.emptyFunction;this.image=null;}if(this.updateScrollId!==null){window.clearInterval(this.updateScrollId);this.updateScrollId=null;}if(this.endTimeoutId!==null){window.clearTimeout(this.endTimeoutId);this.endTimeoutId=null;}}this.setCanRotate(false);this.closeText(false);if(this.config.useEffects){this.fadeEffectAfterFinish=Prototype.emptyFunction;Effect.Queues.get("sliderMainFadeAppear").invoke("cancel");$("sliderMain").fade({duration:this.config.effectsDuration,to:0.01,queue:{position:"end",scope:"sliderMainFadeAppear"},afterFinish:function(){this.fadeEffectFinished=true;this.fadeEffectAfterFinish();this.fadeEffectAfterFinish=Prototype.emptyFunction;}.bind(this)});this.fadeEffectFinished=false;}else{$("sliderMain").setOpacity(0.01);}this.movingTo=a;this.ajax=this.getXML(this.config.dataUrl+a.id+"/index.xml",this.goToLocationContinue.bind(this));},loadConfig:function(){var a=function(b){this.config.defLocation=this.parseLocation(b?b.getElementsByTagName("config")[0].getElementsByTagName("firstlocation")[0].getAttribute("from"):"start");this.initializeContinue();}.bind(this);if(this.config.loadConfig){this.getXML(this.config.dataUrl+"config.xml",a);}else{a(0);}},nearestExit:function(){var a=$("slider"),e={x:((a.scrollLeft+a.getWidth()/2)%this.sImageWidth)/this.sCoef,y:(a.scrollTop+a.getHeight()/2)/this.sCoef},h=null,g=0,b=this.imageWidth,f=function(j,c){var i=(c.y-j.y),k=Math.abs(j.x-c.x);k=Math.min(b-k,k);return Math.sqrt(k*k+i*i);},d;for(d=this.currentExits.length-1;d>=0;d--){if(h===null||f(e,this.currentExits[d])<g){h=this.currentExits[d];g=f(e,h);}}return h;},initializeContinue:function(){if($("alpha")){$("alpha").observe("click",function(o){Event.stop(o);this.config.useScaling=true;this.setSliderDimensions();var n=this.currentLocation;this.currentLocation=null;this.goToLocation(n);}.bindAsEventListener(this));}["rb","lb"].each(function(o,p){var n=$(o);n.observe("click",this.setLbRb.bind(this));n.observe("mouseout",this.brake.bind(this,o));n.observe("mouseover",this.start.bind(this,Math.PI*p,o,false));}.bind(this));var i=null,b,k,c,j=function(o,n){return Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y));},d=null,e="",a,h,m="Right Down Left Up D S A W 6 2 4 8".toUpperCase().split(" "),g;g=function(n){m.each(function(p,q){if(Event.isShortcut(n,p)){if(this.by!=="key "+n.keyCode){this.start(q*Math.PI/2,"key "+n.keyCode,false);}Event.stop(n);}if(n.type==="keyup"&&(n.keyCode===Event["KEY_"+p]||n.keyCode===p.charCodeAt(0))){this.brake("key "+n.keyCode);}}.bind(this));if(Event.isShortcut(n,"ESC")||Event.isShortcut(n,"Down")){Event.stop(n);window.history.back();}if(Event.isShortcut(n,"HOME")){Event.stop(n);this.setHash(this.makeLocation(this.config.defLocation.id,this.config.defLocation.pos,this.config.defLocation.info));}if(Event.isShortcut(n,"G")||Event.isShortcut(n,"M")||Event.isShortcut(n,"5")||Event.isShortcut(n,"Up")){Event.stop(n);var o=this.nearestExit();if(o!==null){this.setHash(o.loc);}}}.bindAsEventListener(this);document.observe("keydown",g).observe("keypress",g).observe("keyup",g);h=function(n){return false;};$("slider").observe("mousedown",function(n){if(!this.canRotate){return;}if(Event.isLeftClick(n)){this.setDragging(1);Event.stop(n);i=Event.pointer(n);this.stop();b=i;c=Date.now();k=b;}if(Event.isMiddleClick(n)&&!h(n)){Event.stop(n);}}.bindAsEventListener(this));function f(o){this.setDragging(0);if(i!==null){this.start(Math.atan2(b.y-k.y,b.x-k.x),"mouseup",false);this.speed=600*j(k,b)/(Date.now()-c+1);this.brake("mouseup");i=null;}var n=Event.isMiddleClick(o);if(n){Event.stop(o);}if(n&&d===null){this.setDragging(2);d=Event.pointer(o);}else{this.brake("middleClick");d=null;}}$("slider").observe("mouseup",f.bindAsEventListener(this)).observe("mouseleave",f.bindAsEventListener(this));document.observe("mousemove",function(p){var n,q,o;if(i!==null){Event.stop(p);n=Event.pointer(p);this.rotate(i.x-n.x,i.y-n.y);i=n;k=i;}if(d!==null){Event.stop(p);n={x:Event.pointerX(p),y:Event.pointerY(p)};q=Math.atan2(n.y-d.y,n.x-d.x);if(this.by==="middleClick"){this.direction=q;}else{this.start(q,"middleClick",true);}o=j({x:0,y:0},{x:this.config.baseImageWidth*this.sCoef,y:this.config.baseImageHeight*this.sCoef});this.speed=this.maxSpeed/o*2*j(n,d);}}.bindAsEventListener(this));a=function(p,n){var q=(p.detail||(-(p.wheelDelta||0)/40))/3,o=!!(p.wheelDeltaX||(typeof(p.HORIZONTAL_AXIS)!=="undefined"&&typeof(p.axis)!=="undefined"&&p.axis===p.HORIZONTAL_AXIS));if((e===n||!e)&&q&&o){e=n;Event.stop(p);this.start((q<0?Math.PI:0),"mousewheel",false);this.speed=Math.abs(this.config.brakingAcc*q);this.brake("mousewheel");}};$("slider").observe("DOMMouseScroll",a.bindAsEventListener(this,"DOMMouseScroll"));$("slider").observe("mousewheel",a.bindAsEventListener(this,"mousewheel"));this.setSliderDimensions();document.fire("virtSusu:initialize");var l=this.locationOnChange.bind(this);window.onhashchange=l;(function(){return window.location.hash;}.watch(0.12,l));document.observe("click",function(){window.setTimeout(l,1);});this.locationOnChange();},initialize:function(){this.setCanRotate(false);this.initLang("ru");this.prepareMenu();this.loadConfig();},siteMap:null,menuLinks:[],prepareMenu:function(){this.menuLinks=[];var c=0,a=(function(p,n,f){var d=0,r,o,t,e,g=p.length,k,h,q,m=true,s;for(k=0;k<g;k++){t=p[k];if(t.tagName===f){r=(t.getAttribute("ShortText")||t.getAttribute("Text")||"");o=t.childNodes;s=m;m=/^_+$/.test(r);if(m){continue;}if(s){n.push([]);}d=Math.max(d,r.length);e={text:r,url:this.makeLocation(t.getAttribute("Location"),t.getAttribute("Pos"),t.getAttribute("Html"))};if(o&&o.length){e.submenu={itemdata:a(o,[],"MenuItem"),id:"menuID"+(c++)};}this.menuLinks.push(e.url);n[n.length-1].push(e);}}q=Math.round(Math.max(131,d*7.2));for(k=n.length-1;k>=0;k--){for(h=n[k].length-1;h>=0;h--){n[k][h].size=q;}}return n;}.bind(this)),b=function(e,n){var r="",q=['<li class="',1," ",3," ",5,'"><a href="',7,'" class="',9,'">',11,"</a>",13,"</li>"],o=Math.min(e[0][0].size,Math.max((4-n)*200,200)),h,f,g,p,k;for(h=0,f=e.length;h<f;h++){k=e[h];for(g=0,p=k.length;g<p;g++){q[1]=(n?"":"top");q[3]=(n&&h===f-1&&g===p-1?"last":"");q[5]=(n&&!g?"first":"");q[7]=k[g].url;q[9]=(n&&k[g].submenu?"sub":"");q[11]=k[g].text;q[13]=(k[g].submenu?b(e[h][g].submenu.itemdata,n+1):"");r+=q.join("");}}return"<ul"+(!n?' id="menuUL"':' style="width:'+o+'px;"')+">"+r+"</ul>";};this.getXML(this.config.dataUrl+"menu.xml",function(e){var d=a(e.getElementsByTagName("root")[0].childNodes,[],"TopLevelMenu");$("menu").update(b(d,0));(function(){var f=(new ProtoFish("menuUL",0.4,"hover")),g;if(this.config.menuTest){g=$("menu").select("li");f.showUL(g[10]);f.showUL(g[98]);f.showUL(g[100]);}}.bind(this).defer());}.bind(this));},initLang:function(a){Object.extend(this.config,this.config.lang[a]||{});},onResizePrev:null,setSliderDimensions:function(){if(!this.config.useScaling){return;}if(this.onResizePrev===null){this.onResizePrev=window.onresize||1;window.onresize=function(){this.setSliderDimensions();if(Object.isFunction(this.onResizePrev)){return this.onResizePrev.apply(window,arguments);}}.bind(this);}var f=2,h=document.viewport.getDimensions(),a=h.width-f,e=h.height-178,c=Math.max(Math.min(Math.min(a/this.config.baseImageWidth,e/this.config.baseImageHeight),2),1),b=Math.round(c*this.config.baseImageHeight)+"px",g=Math.round(c*this.config.baseImageWidth);[$("lb"),$("rb")].invoke("setStyle",{height:b});$("headerTop").setStyle({margin:"0"});$("footerTop").setStyle({margin:"0"});$("alpha").hide();$("soundButton").setStyle({left:"2px"});$("vkontakte").setStyle({marginLeft:"-44px"});$("slider").setStyle({width:g+"px",height:"100%"});$("topDiv").setStyle({width:(f+g)+"px"});$("window").setStyle({height:b});this.setImageWidth(this.imageWidth,this.imageHeight,this.panorama(),c);$("sliderMain").setStyle({height:(this.sImageHeight)+"px",width:((this.panorama()?2:1)*this.sImageWidth)+"px"});if(this.config.useCanvas){this.createCanvases(false);}}};document.observe("dom:loaded",virtSusu.initialize.bind(virtSusu));(function(){var b="soundButton",i=["soundOn","soundOff"],a=[],h=-1,d=false,f;f=(function(){var k={},j,l;try{j=typeof(Audio)!=="undefined"?new Audio(""):{};l=j.canPlayType||function(){return"";};k[".mp3"]="no".indexOf(l.call(j,"audio/mpeg"))===-1;k[".ogg"]="no".indexOf(l.call(j,"audio/ogg"))===-1;j=null;}catch(m){}return function(n){var o=n.parseURI().pathname.parsePath().extension;return o&&(o in k)&&k[o];};}());function c(l){this.src=l;var j=null;function k(){if(!j){j=new Audio(l);}return j;}this.ended=function(){return !!j&&j.ended;};this.paused=function(){return !j||j.paused;};this.play=function(){k().play();};this.pause=function(){if(j){j.pause();}};}function g(){var j=$(b);j.className=i[d?0:1];if(h===-1||a[h].ended()){j.hide();}else{j.writeAttribute("href",a[h].src);j.show();}}function e(){var k=virtSusu.soundPath,j;k=[k.replace(/\.mp3($|\?|#)/,".ogg"),k.replace(/\.ogg($|\?|#)/,".mp3")].find(function(l){return f(l);})||"";if(k){k=encodeURI(absolutizeURI(window.location.href,k));for(j=a.length-1;j>=0&&a[j].src!==k;j--){}if(j===-1){j=a.length;a[j]=(new c(k));}h=j;}a.each(function(m,l){if((l!==h||!d)&&!m.paused()&&!m.ended()){m.pause();}});if(d&&h!==-1&&a[h].paused()&&!a[h].ended()){a[h].play();}g();}document.observe("virtSusu:locationChanged",e);document.observe("virtSusu:initialize",function(){$(b).hide().observe("click",function(j){Event.stop(j);d=!d;e();});});}());