var Prototype={Version:"1.6.0",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A;
}};
if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false;
}if(Prototype.Browser.WebKit){Prototype.BrowserFeatures.XPath=false;
}var Class={create:function(){var E=null,D=$A(arguments);
if(Object.isFunction(D[0])){E=D.shift();
}function A(){this.initialize.apply(this,arguments);
}Object.extend(A,Class.Methods);
A.superclass=E;
A.subclasses=[];
if(E){var B=function(){};
B.prototype=E.prototype;
A.prototype=new B;
E.subclasses.push(A);
}for(var C=0;
C<D.length;
C++){A.addMethods(D[C]);
}if(!A.prototype.initialize){A.prototype.initialize=Prototype.emptyFunction;
}A.prototype.constructor=A;
return A;
}};
Class.Methods={addMethods:function(G){var C=this.superclass&&this.superclass.prototype;
var B=Object.keys(G);
if(!Object.keys({toString:true}).length){B.push("toString","valueOf");
}for(var A=0,D=B.length;
A<D;
A++){var F=B[A],E=G[F];
if(C&&Object.isFunction(E)&&E.argumentNames().first()=="$super"){var H=E,E=Object.extend((function(I){return function(){return C[I].apply(this,arguments);
};
})(F).wrap(H),{valueOf:function(){return H;
},toString:function(){return H.toString();
}});
}this.prototype[F]=E;
}return this;
}};
var Abstract={};
Object.extend=function(A,C){for(var B in C){A[B]=C[B];
}return A;
};
Object.extend(Object,{inspect:function(A){try{if(A===undefined){return"undefined";
}if(A===null){return"null";
}return A.inspect?A.inspect():A.toString();
}catch(B){if(B instanceof RangeError){return"...";
}throw B;
}},toJSON:function(A){var C=typeof A;
switch(C){case"undefined":case"function":case"unknown":return ;
case"boolean":return A.toString();
}if(A===null){return"null";
}if(A.toJSON){return A.toJSON();
}if(Object.isElement(A)){return ;
}var B=[];
for(var E in A){var D=Object.toJSON(A[E]);
if(D!==undefined){B.push(E.toJSON()+": "+D);
}}return"{"+B.join(", ")+"}";
},toQueryString:function(A){return $H(A).toQueryString();
},toHTML:function(A){return A&&A.toHTML?A.toHTML():String.interpret(A);
},keys:function(A){var B=[];
for(var C in A){B.push(C);
}return B;
},values:function(B){var A=[];
for(var C in B){A.push(B[C]);
}return A;
},clone:function(A){return Object.extend({},A);
},isElement:function(A){return A&&A.nodeType==1;
},isArray:function(A){return A&&A.constructor===Array;
},isHash:function(A){return A instanceof Hash;
},isFunction:function(A){return typeof A=="function";
},isString:function(A){return typeof A=="string";
},isNumber:function(A){return typeof A=="number";
},isUndefined:function(A){return typeof A=="undefined";
}});
Object.extend(Function.prototype,{argumentNames:function(){var A=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
return A.length==1&&!A[0]?[]:A;
},bind:function(){if(arguments.length<2&&arguments[0]===undefined){return this;
}var A=this,C=$A(arguments),B=C.shift();
return function(){return A.apply(B,C.concat($A(arguments)));
};
},bindAsEventListener:function(){var A=this,C=$A(arguments),B=C.shift();
return function(D){return A.apply(B,[D||window.event].concat(C));
};
},curry:function(){if(!arguments.length){return this;
}var A=this,B=$A(arguments);
return function(){return A.apply(this,B.concat($A(arguments)));
};
},delay:function(){var A=this,B=$A(arguments),C=B.shift()*1000;
return window.setTimeout(function(){return A.apply(A,B);
},C);
},wrap:function(B){var A=this;
return function(){return B.apply(this,[A.bind(this)].concat($A(arguments)));
};
},methodize:function(){if(this._methodized){return this._methodized;
}var A=this;
return this._methodized=function(){return A.apply(null,[this].concat($A(arguments)));
};
}});
Function.prototype.defer=Function.prototype.delay.curry(0.01);
Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"';
};
var Try={these:function(){var C;
for(var B=0,D=arguments.length;
B<D;
B++){var A=arguments[B];
try{C=A();
break;
}catch(E){}}return C;
}};
RegExp.prototype.match=RegExp.prototype.test;
RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1");
};
var PeriodicalExecuter=Class.create({initialize:function(B,A){this.callback=B;
this.frequency=A;
this.currentlyExecuting=false;
this.registerCallback();
},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},execute:function(){this.callback(this);
},stop:function(){if(!this.timer){return ;
}clearInterval(this.timer);
this.timer=null;
},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;
this.execute();
}finally{this.currentlyExecuting=false;
}}}});
Object.extend(String,{interpret:function(A){return A==null?"":String(A);
},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(E,C){var A="",D=this,B;
C=arguments.callee.prepareReplacement(C);
while(D.length>0){if(B=D.match(E)){A+=D.slice(0,B.index);
A+=String.interpret(C(B));
D=D.slice(B.index+B[0].length);
}else{A+=D,D="";
}}return A;
},sub:function(C,A,B){A=this.gsub.prepareReplacement(A);
B=B===undefined?1:B;
return this.gsub(C,function(D){if(--B<0){return D[0];
}return A(D);
});
},scan:function(B,A){this.gsub(B,A);
return String(this);
},truncate:function(B,A){B=B||30;
A=A===undefined?"...":A;
return this.length>B?this.slice(0,B-A.length)+A:String(this);
},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"");
},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"");
},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
},extractScripts:function(){var B=new RegExp(Prototype.ScriptFragment,"img");
var A=new RegExp(Prototype.ScriptFragment,"im");
return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1];
});
},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script);
});
},escapeHTML:function(){var A=arguments.callee;
A.text.data=this;
return A.div.innerHTML;
},unescapeHTML:function(){var A=new Element("div");
A.innerHTML=this.stripTags();
return A.childNodes[0]?(A.childNodes.length>1?$A(A.childNodes).inject("",function(B,C){return B+C.nodeValue;
}):A.childNodes[0].nodeValue):"";
},toQueryParams:function(B){var A=this.strip().match(/([^?#]*)(#.*)?$/);
if(!A){return{};
}return A[1].split(B||"&").inject({},function(E,F){if((F=F.split("="))[0]){var C=decodeURIComponent(F.shift());
var D=F.length>1?F.join("="):F[0];
if(D!=undefined){D=decodeURIComponent(D);
}if(C in E){if(!Object.isArray(E[C])){E[C]=[E[C]];
}E[C].push(D);
}else{E[C]=D;
}}return E;
});
},toArray:function(){return this.split("");
},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);
},times:function(A){return A<1?"":new Array(A+1).join(this);
},camelize:function(){var D=this.split("-"),A=D.length;
if(A==1){return D[0];
}var C=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];
for(var B=1;
B<A;
B++){C+=D[B].charAt(0).toUpperCase()+D[B].substring(1);
}return C;
},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();
},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase();
},dasherize:function(){return this.gsub(/_/,"-");
},inspect:function(B){var A=this.gsub(/[\x00-\x1f\\]/,function(C){var D=String.specialChar[C[0]];
return D?D:"\\u00"+C[0].charCodeAt().toPaddedString(2,16);
});
if(B){return'"'+A.replace(/"/g,'\\"')+'"';
}return"'"+A.replace(/'/g,"\\'")+"'";
},toJSON:function(){return this.inspect(true);
},unfilterJSON:function(A){return this.sub(A||Prototype.JSONFilter,"#{1}");
},isJSON:function(){var A=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");
return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(A);
},evalJSON:function(sanitize){var json=this.unfilterJSON();
try{if(!sanitize||json.isJSON()){return eval("("+json+")");
}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect());
},include:function(A){return this.indexOf(A)>-1;
},startsWith:function(A){return this.indexOf(A)===0;
},endsWith:function(A){var B=this.length-A.length;
return B>=0&&this.lastIndexOf(A)===B;
},empty:function(){return this=="";
},blank:function(){return/^\s*$/.test(this);
},interpolate:function(A,B){return new Template(this,B).evaluate(A);
}});
if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">");
}});
}String.prototype.gsub.prepareReplacement=function(B){if(Object.isFunction(B)){return B;
}var A=new Template(B);
return function(C){return A.evaluate(C);
};
};
String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});
with(String.prototype.escapeHTML){div.appendChild(text);
}var Template=Class.create({initialize:function(A,B){this.template=A.toString();
this.pattern=B||Template.Pattern;
},evaluate:function(A){if(Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements();
}return this.template.gsub(this.pattern,function(D){if(A==null){return"";
}var F=D[1]||"";
if(F=="\\"){return D[2];
}var B=A,G=D[3];
var E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/,D=E.exec(G);
if(D==null){return F;
}while(D!=null){var C=D[1].startsWith("[")?D[2].gsub("\\\\]","]"):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);
}.bind(this));
}});
Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={};
var Enumerable={each:function(C,B){var A=0;
C=C.bind(B);
try{this._each(function(E){C(E,A++);
});
}catch(D){if(D!=$break){throw D;
}}return this;
},eachSlice:function(D,C,B){C=C?C.bind(B):Prototype.K;
var A=-D,E=[],F=this.toArray();
while((A+=D)<F.length){E.push(F.slice(A,A+D));
}return E.collect(C,B);
},all:function(C,B){C=C?C.bind(B):Prototype.K;
var A=true;
this.each(function(E,D){A=A&&!!C(E,D);
if(!A){throw $break;
}});
return A;
},any:function(C,B){C=C?C.bind(B):Prototype.K;
var A=false;
this.each(function(E,D){if(A=!!C(E,D)){throw $break;
}});
return A;
},collect:function(C,B){C=C?C.bind(B):Prototype.K;
var A=[];
this.each(function(E,D){A.push(C(E,D));
});
return A;
},detect:function(C,B){C=C.bind(B);
var A;
this.each(function(E,D){if(C(E,D)){A=E;
throw $break;
}});
return A;
},findAll:function(C,B){C=C.bind(B);
var A=[];
this.each(function(E,D){if(C(E,D)){A.push(E);
}});
return A;
},grep:function(D,C,B){C=C?C.bind(B):Prototype.K;
var A=[];
if(Object.isString(D)){D=new RegExp(D);
}this.each(function(F,E){if(D.match(F)){A.push(C(F,E));
}});
return A;
},include:function(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true;
}}var B=false;
this.each(function(C){if(C==A){B=true;
throw $break;
}});
return B;
},inGroupsOf:function(B,A){A=A===undefined?null:A;
return this.eachSlice(B,function(C){while(C.length<B){C.push(A);
}return C;
});
},inject:function(A,C,B){C=C.bind(B);
this.each(function(E,D){A=C(A,E,D);
});
return A;
},invoke:function(B){var A=$A(arguments).slice(1);
return this.map(function(C){return C[B].apply(C,A);
});
},max:function(C,B){C=C?C.bind(B):Prototype.K;
var A;
this.each(function(E,D){E=C(E,D);
if(A==undefined||E>=A){A=E;
}});
return A;
},min:function(C,B){C=C?C.bind(B):Prototype.K;
var A;
this.each(function(E,D){E=C(E,D);
if(A==undefined||E<A){A=E;
}});
return A;
},partition:function(D,B){D=D?D.bind(B):Prototype.K;
var C=[],A=[];
this.each(function(F,E){(D(F,E)?C:A).push(F);
});
return[C,A];
},pluck:function(B){var A=[];
this.each(function(C){A.push(C[B]);
});
return A;
},reject:function(C,B){C=C.bind(B);
var A=[];
this.each(function(E,D){if(!C(E,D)){A.push(E);
}});
return A;
},sortBy:function(B,A){B=B.bind(A);
return this.map(function(D,C){return{value:D,criteria:B(D,C)};
}).sort(function(F,E){var D=F.criteria,C=E.criteria;
return D<C?-1:D>C?1:0;
}).pluck("value");
},toArray:function(){return this.map();
},zip:function(){var B=Prototype.K,A=$A(arguments);
if(Object.isFunction(A.last())){B=A.pop();
}var C=[this].concat(A).map($A);
return this.map(function(E,D){return B(C.pluck(D));
});
},size:function(){return this.toArray().length;
},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">";
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});
function $A(C){if(!C){return[];
}if(C.toArray){return C.toArray();
}var B=C.length,A=new Array(B);
while(B--){A[B]=C[B];
}return A;
}if(Prototype.Browser.WebKit){function $A(C){if(!C){return[];
}if(!(Object.isFunction(C)&&C=="[object NodeList]")&&C.toArray){return C.toArray();
}var B=C.length,A=new Array(B);
while(B--){A[B]=C[B];
}return A;
}}Array.from=$A;
Object.extend(Array.prototype,Enumerable);
if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse;
}Object.extend(Array.prototype,{_each:function(B){for(var A=0,C=this.length;
A<C;
A++){B(this[A]);
}},clear:function(){this.length=0;
return this;
},first:function(){return this[0];
},last:function(){return this[this.length-1];
},compact:function(){return this.select(function(A){return A!=null;
});
},flatten:function(){return this.inject([],function(B,A){return B.concat(Object.isArray(A)?A.flatten():[A]);
});
},without:function(){var A=$A(arguments);
return this.select(function(B){return !A.include(B);
});
},reverse:function(A){return(A!==false?this:this.toArray())._reverse();
},reduce:function(){return this.length>1?this:this[0];
},uniq:function(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C);
}return D;
});
},intersect:function(A){return this.uniq().findAll(function(B){return A.detect(function(C){return B===C;
});
});
},clone:function(){return[].concat(this);
},size:function(){return this.length;
},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]";
},toJSON:function(){var A=[];
this.each(function(B){var C=Object.toJSON(B);
if(C!==undefined){A.push(C);
}});
return"["+A.join(", ")+"]";
}});
if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach;
}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,A){A||(A=0);
var B=this.length;
if(A<0){A=B+A;
}for(;
A<B;
A++){if(this[A]===C){return A;
}}return -1;
};
}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(B,A){A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;
var C=this.slice(0,A).reverse().indexOf(B);
return(C<0)?C:A-C-1;
};
}Array.prototype.toArray=Array.prototype.clone;
function $w(A){if(!Object.isString(A)){return[];
}A=A.strip();
return A?A.split(/\s+/):[];
}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var E=[];
for(var B=0,C=this.length;
B<C;
B++){E.push(this[B]);
}for(var B=0,C=arguments.length;
B<C;
B++){if(Object.isArray(arguments[B])){for(var A=0,D=arguments[B].length;
A<D;
A++){E.push(arguments[B][A]);
}}else{E.push(arguments[B]);
}}return E;
};
}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);
},succ:function(){return this+1;
},times:function(A){$R(0,this,true).each(A);
return this;
},toPaddedString:function(C,B){var A=this.toString(B||10);
return"0".times(C-A.length)+A;
},toJSON:function(){return isFinite(this)?this.toString():"null";
}});
$w("abs round ceil floor").each(function(A){Number.prototype[A]=Math[A].methodize();
});
function $H(A){return new Hash(A);
}var Hash=Class.create(Enumerable,(function(){if(function(){var C=0,E=function(F){this.key=F;
};
E.prototype.key="foo";
for(var D in new E("bar")){C++;
}return C>1;
}()){function B(E){var C=[];
for(var D in this._object){var F=this._object[D];
if(C.include(D)){continue;
}C.push(D);
var G=[D,F];
G.key=D;
G.value=F;
E(G);
}}}else{function B(D){for(var C in this._object){var E=this._object[C],F=[C,E];
F.key=C;
F.value=E;
D(F);
}}}function A(C,D){if(Object.isUndefined(D)){return C;
}return C+"="+encodeURIComponent(String.interpret(D));
}return{initialize:function(C){this._object=Object.isHash(C)?C.toObject():Object.clone(C);
},_each:B,set:function(C,D){return this._object[C]=D;
},get:function(C){return this._object[C];
},unset:function(C){var D=this._object[C];
delete this._object[C];
return D;
},toObject:function(){return Object.clone(this._object);
},keys:function(){return this.pluck("key");
},values:function(){return this.pluck("value");
},index:function(D){var C=this.detect(function(E){return E.value===D;
});
return C&&C.key;
},merge:function(C){return this.clone().update(C);
},update:function(C){return new Hash(C).inject(this,function(D,E){D.set(E.key,E.value);
return D;
});
},toQueryString:function(){return this.map(function(E){var D=encodeURIComponent(E.key),C=E.value;
if(C&&typeof C=="object"){if(Object.isArray(C)){return C.map(A.curry(D)).join("&");
}}return A(D,C);
}).join("&");
},inspect:function(){return"#<Hash:{"+this.map(function(C){return C.map(Object.inspect).join(": ");
}).join(", ")+"}>";
},toJSON:function(){return Object.toJSON(this.toObject());
},clone:function(){return new Hash(this);
}};
})());
Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;
Hash.from=$H;
var ObjectRange=Class.create(Enumerable,{initialize:function(C,A,B){this.start=C;
this.end=A;
this.exclusive=B;
},_each:function(A){var B=this.start;
while(this.include(B)){A(B);
B=B.succ();
}},include:function(A){if(A<this.start){return false;
}if(this.exclusive){return A<this.end;
}return A<=this.end;
}});
var $R=function(C,A,B){return new ObjectRange(C,A,B);
};
var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest();
},function(){return new ActiveXObject("Msxml2.XMLHTTP");
},function(){return new ActiveXObject("Microsoft.XMLHTTP");
})||false;
},activeRequestCount:0};
Ajax.Responders={responders:[],_each:function(A){this.responders._each(A);
},register:function(A){if(!this.include(A)){this.responders.push(A);
}},unregister:function(A){this.responders=this.responders.without(A);
},dispatch:function(D,B,C,A){this.each(function(E){if(Object.isFunction(E[D])){try{E[D].apply(E,[B,C,A]);
}catch(F){}}});
}};
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();
}}});
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 E=B.getHeader("Content-type");
if(this.options.evalJS=="force"||(this.options.evalJS&&E&&E.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;
}},getHeader:function(A){try{return this.transport.getResponseHeader(A);
}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=B===undefined?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);
}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"))){return null;
}try{return this.transport.responseText.evalJSON(A.sanitizeJSON);
}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=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);
}}if(this.success()){if(this.onComplete){this.onComplete.bind(this).defer();
}}}});
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(){var A=this.Element;
this.Element=function(D,C){C=C||{};
D=D.toLowerCase();
var B=Element.cache;
if(Prototype.Browser.IE&&C.name){D="<"+D+' name="'+C.name+'">';
delete C.name;
return Element.writeAttribute(document.createElement(D),C);
}if(!B[D]){B[D]=Element.extend(document.createElement(D));
}return Element.writeAttribute(B[D].cloneNode(false),C);
};
Object.extend(this.Element,A||{});
}).call(window);
Element.cache={};
Element.Methods={visible:function(A){return $(A).style.display!="none";
},toggle:function(A){A=$(A);
Element[Element.visible(A)?"hide":"show"](A);
return A;
},hide:function(A){$(A).style.display="none";
return A;
},show:function(A){$(A).style.display="";
return A;
},remove:function(A){A=$(A);
A.parentNode.removeChild(A);
return A;
},update:function(A,B){A=$(A);
if(B&&B.toElement){B=B.toElement();
}if(Object.isElement(B)){return A.update().insert(B);
}B=Object.toHTML(B);
A.innerHTML=B.stripScripts();
B.evalScripts.bind(B).defer();
return A;
},replace:function(B,C){B=$(B);
if(C&&C.toElement){C=C.toElement();
}else{if(!Object.isElement(C)){C=Object.toHTML(C);
var A=B.ownerDocument.createRange();
A.selectNode(B);
C.evalScripts.bind(C).defer();
C=A.createContextualFragment(C.stripScripts());
}}B.parentNode.replaceChild(C,B);
return B;
},insert:function(C,E){C=$(C);
if(Object.isString(E)||Object.isNumber(E)||Object.isElement(E)||(E&&(E.toElement||E.toHTML))){E={bottom:E};
}var D,B,A;
for(position in E){D=E[position];
position=position.toLowerCase();
B=Element._insertionTranslations[position];
if(D&&D.toElement){D=D.toElement();
}if(Object.isElement(D)){B.insert(C,D);
continue;
}D=Object.toHTML(D);
A=C.ownerDocument.createRange();
B.initializeRange(C,A);
B.insert(C,A.createContextualFragment(D.stripScripts()));
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();
var D=(B[E]||"").toString();
if(D){A+=" "+C+"="+D.inspect(true);
}});
return A+">";
},recursivelyCollect:function(A,C){A=$(A);
var B=[];
while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A));
}}return B;
},ancestors:function(A){return $(A).recursivelyCollect("parentNode");
},descendants:function(A){return $A($(A).getElementsByTagName("*")).each(Element.extend);
},firstDescendant:function(A){A=$(A).firstChild;
while(A&&A.nodeType!=1){A=A.nextSibling;
}return $(A);
},immediateDescendants:function(A){if(!(A=$(A).firstChild)){return[];
}while(A&&A.nodeType!=1){A=A.nextSibling;
}if(A){return[A].concat($(A).nextSiblings());
}return[];
},previousSiblings:function(A){return $(A).recursivelyCollect("previousSibling");
},nextSiblings:function(A){return $(A).recursivelyCollect("nextSibling");
},siblings:function(A){A=$(A);
return A.previousSiblings().reverse().concat(A.nextSiblings());
},match:function(B,A){if(Object.isString(A)){A=new Selector(A);
}return A.match($(B));
},up:function(B,D,A){B=$(B);
if(arguments.length==1){return $(B.parentNode);
}var C=B.ancestors();
return D?Selector.findElement(C,D,A):C[A||0];
},down:function(B,C,A){B=$(B);
if(arguments.length==1){return B.firstDescendant();
}var D=B.descendants();
return C?Selector.findElement(D,C,A):D[A||0];
},previous:function(B,D,A){B=$(B);
if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B));
}var C=B.previousSiblings();
return D?Selector.findElement(C,D,A):C[A||0];
},next:function(C,D,B){C=$(C);
if(arguments.length==1){return $(Selector.handlers.nextElementSibling(C));
}var A=C.nextSiblings();
return D?Selector.findElement(A,D,B):A[B||0];
},select:function(){var A=$A(arguments),B=$(A.shift());
return Selector.findChildElements(B,A);
},adjacent:function(){var A=$A(arguments),B=$(A.shift());
return Selector.findChildElements(B.parentNode,A).without(B);
},identify:function(B){B=$(B);
var C=B.readAttribute("id"),A=arguments.callee;
if(C){return C;
}do{C="anonymous_element_"+A.counter++;
}while($(C));
B.writeAttribute("id",C);
return C;
},readAttribute:function(C,A){C=$(C);
if(Prototype.Browser.IE){var B=Element._attributeTranslations.read;
if(B.values[A]){return B.values[A](C,A);
}if(B.names[A]){A=B.names[A];
}if(A.include(":")){return(!C.attributes||!C.attributes[A])?null:C.attributes[A].value;
}}return C.getAttribute(A);
},writeAttribute:function(E,C,F){E=$(E);
var B={},D=Element._attributeTranslations.write;
if(typeof C=="object"){B=C;
}else{B[C]=F===undefined?true:F;
}for(var A in B){var 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 $(A).getDimensions().height;
},getWidth:function(A){return $(A).getDimensions().width;
},classNames:function(A){return new Element.ClassNames(A);
},hasClassName:function(A,B){if(!(A=$(A))){return ;
}var C=A.className;
return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)));
},addClassName:function(A,B){if(!(A=$(A))){return ;
}if(!A.hasClassName(B)){A.className+=(A.className?" ":"")+B;
}return A;
},removeClassName:function(A,B){if(!(A=$(A))){return ;
}A.className=A.className.replace(new RegExp("(^|\\s+)"+B+"(\\s+|$)")," ").strip();
return A;
},toggleClassName:function(A,B){if(!(A=$(A))){return ;
}return A[A.hasClassName(B)?"removeClassName":"addClassName"](B);
},cleanWhitespace:function(B){B=$(B);
var C=B.firstChild;
while(C){var A=C.nextSibling;
if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C);
}C=A;
}return B;
},empty:function(A){return $(A).innerHTML.blank();
},descendantOf:function(D,C){D=$(D),C=$(C);
if(D.compareDocumentPosition){return(D.compareDocumentPosition(C)&8)===8;
}if(D.sourceIndex&&!Prototype.Browser.Opera){var E=D.sourceIndex,B=C.sourceIndex,A=C.nextSibling;
if(!A){do{C=C.parentNode;
}while(!(A=C.nextSibling)&&C.parentNode);
}if(A){return(E>B&&E<A.sourceIndex);
}}while(D=D.parentNode){if(D==C){return true;
}}return false;
},scrollTo:function(A){A=$(A);
var B=A.cumulativeOffset();
window.scrollTo(B[0],B[1]);
return A;
},getStyle:function(B,C){B=$(B);
C=C=="float"?"cssFloat":C.camelize();
var D=B.style[C];
if(!D){var A=document.defaultView.getComputedStyle(B,null);
D=A?A[C]:null;
}if(C=="opacity"){return D?parseFloat(D):1;
}return D=="auto"?null:D;
},getOpacity:function(A){return $(A).getStyle("opacity");
},setStyle:function(B,C){B=$(B);
var E=B.style,A;
if(Object.isString(C)){B.style.cssText+=";"+C;
return C.include("opacity")?B.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):B;
}for(var D in C){if(D=="opacity"){B.setOpacity(C[D]);
}else{E[(D=="float"||D=="cssFloat")?(E.styleFloat===undefined?"cssFloat":"styleFloat"):D]=C[D];
}}return B;
},setOpacity:function(A,B){A=$(A);
A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;
return A;
},getDimensions:function(C){C=$(C);
var G=$(C).getStyle("display");
if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight};
}var B=C.style;
var F=B.visibility;
var D=B.position;
var A=B.display;
B.visibility="hidden";
B.position="absolute";
B.display="block";
var H=C.clientWidth;
var 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(window.opera){A.style.top=0;
A.style.left=0;
}}return A;
},undoPositioned:function(A){A=$(A);
if(A._madePositioned){A._madePositioned=undefined;
A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right="";
}return A;
},makeClipping:function(A){A=$(A);
if(A._overflow){return A;
}A._overflow=Element.getStyle(A,"overflow")||"auto";
if(A._overflow!=="hidden"){A.style.overflow="hidden";
}return A;
},undoClipping:function(A){A=$(A);
if(!A._overflow){return A;
}A.style.overflow=A._overflow=="auto"?"":A._overflow;
A._overflow=null;
return A;
},cumulativeOffset:function(B){var A=0,C=0;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
B=B.offsetParent;
}while(B);
return Element._returnOffset(C,A);
},positionedOffset:function(B){var A=0,D=0;
do{A+=B.offsetTop||0;
D+=B.offsetLeft||0;
B=B.offsetParent;
if(B){if(B.tagName=="BODY"){break;
}var C=Element.getStyle(B,"position");
if(C=="relative"||C=="absolute"){break;
}}}while(B);
return Element._returnOffset(D,A);
},absolutize:function(B){B=$(B);
if(B.getStyle("position")=="absolute"){return ;
}var D=B.positionedOffset();
var F=D[1];
var E=D[0];
var C=B.clientWidth;
var 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(A.getStyle("position")=="relative"){return ;
}A.style.position="relative";
var C=parseFloat(A.style.top||0)-(A._originalTop||0);
var B=parseFloat(A.style.left||0)-(A._originalLeft||0);
A.style.top=C+"px";
A.style.left=B+"px";
A.style.height=A._originalHeight;
A.style.width=A._originalWidth;
return A;
},cumulativeScrollOffset:function(B){var A=0,C=0;
do{A+=B.scrollTop||0;
C+=B.scrollLeft||0;
B=B.parentNode;
}while(B);
return Element._returnOffset(C,A);
},getOffsetParent:function(A){if(A.offsetParent){return $(A.offsetParent);
}if(A==document.body){return $(A);
}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return $(A);
}}return $(document.body);
},viewportOffset:function(D){var A=0,C=0;
var B=D;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
if(B.offsetParent==document.body&&Element.getStyle(B,"position")=="absolute"){break;
}}while(B=B.offsetParent);
B=D;
do{if(!Prototype.Browser.Opera||B.tagName=="BODY"){A-=B.scrollTop||0;
C-=B.scrollLeft||0;
}}while(B=B.parentNode);
return Element._returnOffset(C,A);
},clonePosition:function(B,D){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
D=$(D);
var E=D.viewportOffset();
B=$(B);
var F=[0,0];
var C=null;
if(Element.getStyle(B,"position")=="absolute"){C=B.getOffsetParent();
F=C.viewportOffset();
}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;
}};
Element.Methods.identify.counter=1;
Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});
Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};
if(!document.createRange||Prototype.Browser.Opera){Element.Methods.insert=function(E,G){E=$(E);
if(Object.isString(G)||Object.isNumber(G)||Object.isElement(G)||(G&&(G.toElement||G.toHTML))){G={bottom:G};
}var D=Element._insertionTranslations,F,B,H,C;
for(B in G){F=G[B];
B=B.toLowerCase();
H=D[B];
if(F&&F.toElement){F=F.toElement();
}if(Object.isElement(F)){H.insert(E,F);
continue;
}F=Object.toHTML(F);
C=((B=="before"||B=="after")?E.parentNode:E).tagName.toUpperCase();
if(D.tags[C]){var A=Element._getContentFromAnonymousElement(C,F.stripScripts());
if(B=="top"||B=="after"){A.reverse();
}A.each(H.insert.curry(E));
}else{E.insertAdjacentHTML(H.adjacency,F.stripScripts());
}F.evalScripts.bind(F).defer();
}return E;
};
}if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;
Element.Methods.getStyle=function(A,B){switch(B){case"left":case"top":case"right":case"bottom":if(Element._getStyle(A,"position")=="static"){return null;
}default:return Element._getStyle(A,B);
}};
Element.Methods._readAttribute=Element.Methods.readAttribute;
Element.Methods.readAttribute=function(A,B){if(B=="title"){return A.title;
}return Element._readAttribute(A,B);
};
}else{if(Prototype.Browser.IE){$w("positionedOffset getOffsetParent viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(D,C){C=$(C);
var B=C.getStyle("position");
if(B!="static"){return D(C);
}C.setStyle({position:"relative"});
var E=D(C);
C.setStyle({position:B});
return E;
});
});
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={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(A,B){return A.getAttribute(B,2);
},_getAttrNode:function(A,C){var B=A.getAttributeNode(C);
return B?B.value:"";
},_getEv:function(A,B){var B=A.getAttribute(B);
return B?B.toString().slice(23,-2):null;
},_flag:function(A,B){return $(A).hasAttribute(B)?B:null;
},style:function(A){return A.style.cssText.toLowerCase();
},title:function(A){return A.title;
}}}};
Element._attributeTranslations.write={names:Object.clone(Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B;
},style:function(A,B){A.style.cssText=B?B:"";
}}};
Element._attributeTranslations.has={};
$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;
Element._attributeTranslations.has[A.toLowerCase()]=A;
});
(function(A){Object.extend(A,{href:A._getAttr,src:A._getAttr,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv});
})(Element._attributeTranslations.read.values);
}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);
A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;
return A;
};
}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);
A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;
if(B==1){if(A.tagName=="IMG"&&A.width){A.width++;
A.width--;
}else{try{var D=document.createTextNode(" ");
A.appendChild(D);
A.removeChild(D);
}catch(C){}}}return A;
};
Element.Methods.cumulativeOffset=function(B){var A=0,C=0;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break;
}}B=B.offsetParent;
}while(B);
return Element._returnOffset(C,A);
};
}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(B,C){B=$(B);
if(C&&C.toElement){C=C.toElement();
}if(Object.isElement(C)){return B.update().insert(C);
}C=Object.toHTML(C);
var A=B.tagName.toUpperCase();
if(A in Element._insertionTranslations.tags){$A(B.childNodes).each(function(D){B.removeChild(D);
});
Element._getContentFromAnonymousElement(A,C.stripScripts()).each(function(D){B.appendChild(D);
});
}else{B.innerHTML=C.stripScripts();
}C.evalScripts.bind(C).defer();
return B;
};
}if(document.createElement("div").outerHTML){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();
var 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(C,B){var D=new Element("div"),A=Element._insertionTranslations.tags[C];
D.innerHTML=A[0]+B+A[1];
A[2].times(function(){D=D.firstChild;
});
return $A(D.childNodes);
};
Element._insertionTranslations={before:{adjacency:"beforeBegin",insert:function(A,B){A.parentNode.insertBefore(B,A);
},initializeRange:function(B,A){A.setStartBefore(B);
}},top:{adjacency:"afterBegin",insert:function(A,B){A.insertBefore(B,A.firstChild);
},initializeRange:function(B,A){A.selectNodeContents(B);
A.collapse(true);
}},bottom:{adjacency:"beforeEnd",insert:function(A,B){A.appendChild(B);
}},after:{adjacency:"afterEnd",insert:function(A,B){A.parentNode.insertBefore(B,A.nextSibling);
},initializeRange:function(B,A){A.setStartAfter(B);
}},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(){this.bottom.initializeRange=this.top.initializeRange;
Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD});
}).call(Element._insertionTranslations);
Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;
var B=$(A).getAttributeNode(C);
return B&&B.specified;
}};
Element.Methods.ByTag={};
Object.extend(Element,Element.Methods);
if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};
window.HTMLElement.prototype=document.createElement("div").__proto__;
Prototype.BrowserFeatures.ElementExtensions=true;
}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K;
}var A={},B=Element.Methods.ByTag;
var C=Object.extend(function(F){if(!F||F._extendedByPrototype||F.nodeType!=1||F==window){return F;
}var D=Object.clone(A),E=F.tagName,H,G;
if(B[E]){Object.extend(D,B[E]);
}for(H in D){G=D[H];
if(Object.isFunction(G)&&!(H in F)){F[H]=G.methodize();
}}F._extendedByPrototype=Prototype.emptyFunction;
return F;
},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(A,Element.Methods);
Object.extend(A,Element.Methods.Simulated);
}}});
C.refresh();
return C;
})();
Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B);
}return Element.Methods.Simulated.hasAttribute(A,B);
};
Element.addMethods=function(C){var 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(H);
}else{H(B);
}}function H(F){F=F.toUpperCase();
if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={};
}Object.extend(Element.Methods.ByTag[F],C);
}function A(L,K,F){F=F||false;
for(var N in L){var M=L[N];
if(!Object.isFunction(M)){continue;
}if(!F||!(N in K)){K[N]=M.methodize();
}}}function E(L){var F;
var K={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(K[L]){F="HTML"+K[L]+"Element";
}if(window[F]){return window[F];
}F="HTML"+L+"Element";
if(window[F]){return window[F];
}F="HTML"+L.capitalize()+"Element";
if(window[F]){return window[F];
}window[F]={};
window[F].prototype=document.createElement(L).__proto__;
return window[F];
}if(I.ElementExtensions){A(Element.Methods,HTMLElement.prototype);
A(Element.Methods.Simulated,HTMLElement.prototype,true);
}if(I.SpecificElementExtensions){for(var J in Element.Methods.ByTag){var G=E(J);
if(Object.isUndefined(G)){continue;
}A(D[J],G.prototype);
}}Object.extend(Element,Element.Methods);
delete Element.ByTag;
if(Element.extend.refresh){Element.extend.refresh();
}Element.cache={};
};
document.viewport={getDimensions:function(){var A={};
$w("width height").each(function(C){var B=C.capitalize();
A[C]=self["inner"+B]||(document.documentElement["client"+B]||document.body["client"+B]);
});
return A;
},getWidth:function(){return this.getDimensions().width;
},getHeight:function(){return this.getDimensions().height;
},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);
}};
var Selector=Class.create({initialize:function(A){this.expression=A.strip();
this.compileMatcher();
},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!(/(\[[\w-]*?:|:checked)/).test(this.expression)){return this.compileXPathMatcher();
}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;
if(Selector._cache[e]){this.matcher=Selector._cache[e];
return ;
}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];
while(e&&le!=e&&(/\S/).test(e)){le=e;
for(var i in ps){p=ps[i];
if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));
e=e.replace(m[0],"");
break;
}}}this.matcher.push("return h.unique(n);\n}");
eval(this.matcher.join("\n"));
Selector._cache[this.expression]=this.matcher;
},compileXPathMatcher:function(){var E=this.expression,F=Selector.patterns,B=Selector.xpath,D,A;
if(Selector._cache[E]){this.xpath=Selector._cache[E];
return ;
}this.matcher=[".//*"];
while(E&&D!=E&&(/\S/).test(E)){D=E;
for(var C in F){if(A=E.match(F[C])){this.matcher.push(Object.isFunction(B[C])?B[C](A):new Template(B[C]).evaluate(A));
E=E.replace(A[0],"");
break;
}}}this.xpath=this.matcher.join("");
Selector._cache[this.expression]=this.xpath;
},findElements:function(A){A=A||document;
if(this.xpath){return document._getElementsByXPath(this.xpath,A);
}return this.matcher(A);
},match:function(H){this.tokens=[];
var L=this.expression,A=Selector.patterns,E=Selector.assertions;
var B,D,F;
while(L&&B!==L&&(/\S/).test(L)){B=L;
for(var I in A){D=A[I];
if(F=L.match(D)){if(E[I]){this.tokens.push([I,Object.clone(F)]);
L=L.replace(F[0],"");
}else{return this.findElements(document).include(H);
}}}}var K=true,C,J;
for(var I=0,G;
G=this.tokens[I];
I++){C=G[0],J=G[1];
if(!Selector.assertions[C](H,J)){K=false;
break;
}}return K;
},toString:function(){return this.expression;
},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";
}});
Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return"";
}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']";
},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(A){A[3]=A[5]||A[6];
return new Template(Selector.xpath.operators[A[2]]).evaluate(A);
},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];
if(!B){return"";
}if(Object.isFunction(B)){return B(A);
}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A);
},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(B){var H=B[6],G=Selector.patterns,A=Selector.xpath,E,B,C;
var F=[];
while(H&&E!=H&&(/\S/).test(H)){E=H;
for(var D in G){if(B=H.match(G[D])){C=Object.isFunction(A[D])?A[D](B):new Template(A[D]).evaluate(B);
F.push("("+C.substring(1,C.length-1)+")");
H=H.replace(B[0],"");
break;
}}}return"[not("+F.join(" and ")+")]";
},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A);
},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A);
},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A);
},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A);
},"first-of-type":function(A){A[6]="1";
return Selector.xpath.pseudos["nth-of-type"](A);
},"last-of-type":function(A){A[6]="1";
return Selector.xpath.pseudos["nth-last-of-type"](A);
},"only-of-type":function(A){var B=Selector.xpath.pseudos;
return B["first-of-type"](A)+B["last-of-type"](A);
},nth:function(E,C){var F,G=C[6],B;
if(G=="even"){G="2n+0";
}if(G=="odd"){G="2n+1";
}if(F=G.match(/^(\d+)$/)){return"["+E+"= "+F[1]+"]";
}if(F=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1;
}var D=F[1]?Number(F[1]):1;
var A=F[2]?Number(F[2]):0;
B="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";
return new Template(B).evaluate({fragment:E,a:D,b:A});
}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);   c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c);        c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}"); c = false;',attr:function(A){A[3]=(A[5]||A[6]);
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(A);
},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"');
}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A);
},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase();
},className:function(A,B){return Element.hasClassName(A,B[1]);
},id:function(A,B){return A.id===B[1];
},attrPresence:function(A,B){return Element.hasAttribute(A,B[1]);
},attr:function(B,C){var A=Element.readAttribute(B,C[1]);
return Selector.operators[C[2]](A,C[3]);
}},handlers:{concat:function(B,A){for(var C=0,D;
D=A[C];
C++){B.push(D);
}return B;
},mark:function(A){for(var B=0,C;
C=A[B];
B++){C._counted=true;
}return A;
},unmark:function(A){for(var B=0,C;
C=A[B];
B++){C._counted=undefined;
}return A;
},index:function(A,D,G){A._counted=true;
if(D){for(var B=A.childNodes,E=B.length-1,C=1;
E>=0;
E--){var F=B[E];
if(F.nodeType==1&&(!G||F._counted)){F.nodeIndex=C++;
}}}else{for(var E=0,C=1,B=A.childNodes;
F=B[E];
E++){if(F.nodeType==1&&(!G||F._counted)){F.nodeIndex=C++;
}}}},unique:function(B){if(B.length==0){return B;
}var D=[],E;
for(var C=0,A=B.length;
C<A;
C++){if(!(E=B[C])._counted){E._counted=true;
D.push(Element.extend(E));
}}return Selector.handlers.unmark(D);
},descendant:function(A){var D=Selector.handlers;
for(var C=0,B=[],E;
E=A[C];
C++){D.concat(B,E.getElementsByTagName("*"));
}return B;
},child:function(A){var F=Selector.handlers;
for(var E=0,D=[],G;
G=A[E];
E++){for(var B=0,C=[],H;
H=G.childNodes[B];
B++){if(H.nodeType==1&&H.tagName!="!"){D.push(H);
}}}return D;
},adjacent:function(A){for(var C=0,B=[],E;
E=A[C];
C++){var D=this.nextElementSibling(E);
if(D){B.push(D);
}}return B;
},laterSibling:function(A){var D=Selector.handlers;
for(var C=0,B=[],E;
E=A[C];
C++){D.concat(B,Element.nextSiblings(E));
}return B;
},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A;
}}return null;
},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A;
}}return null;
},tagName:function(B,A,E,H){E=E.toUpperCase();
var D=[],F=Selector.handlers;
if(B){if(H){if(H=="descendant"){for(var C=0,G;
G=B[C];
C++){F.concat(D,G.getElementsByTagName(E));
}return D;
}else{B=this[H](B);
}if(E=="*"){return B;
}}for(var C=0,G;
G=B[C];
C++){if(G.tagName.toUpperCase()==E){D.push(G);
}}return D;
}else{return A.getElementsByTagName(E);
}},id:function(B,A,H,F){var G=$(H),D=Selector.handlers;
if(!G){return[];
}if(!B&&A==document){return[G];
}if(B){if(F){if(F=="child"){for(var C=0,E;
E=B[C];
C++){if(G.parentNode==E){return[G];
}}}else{if(F=="descendant"){for(var C=0,E;
E=B[C];
C++){if(Element.descendantOf(G,E)){return[G];
}}}else{if(F=="adjacent"){for(var C=0,E;
E=B[C];
C++){if(Selector.handlers.previousElementSibling(G)==E){return[G];
}}}else{B=D[F](B);
}}}}for(var C=0,E;
E=B[C];
C++){if(E==G){return[G];
}}return[];
}return(G&&Element.descendantOf(G,A))?[G]:[];
},className:function(B,A,C,D){if(B&&D){B=this[D](B);
}return Selector.handlers.byClassName(B,A,C);
},byClassName:function(C,B,F){if(!C){C=Selector.handlers.descendant([B]);
}var H=" "+F+" ";
for(var E=0,D=[],G,A;
G=C[E];
E++){A=G.className;
if(A.length==0){continue;
}if(A==F||(" "+A+" ").include(H)){D.push(G);
}}return D;
},attrPresence:function(C,B,A){if(!C){C=B.getElementsByTagName("*");
}var E=[];
for(var D=0,F;
F=C[D];
D++){if(Element.hasAttribute(F,A)){E.push(F);
}}return E;
},attr:function(A,H,G,I,B){if(!A){A=H.getElementsByTagName("*");
}var J=Selector.operators[B],D=[];
for(var E=0,C;
C=A[E];
E++){var F=Element.readAttribute(C,G);
if(F===null){continue;
}if(J(F,I)){D.push(C);
}}return D;
},pseudo:function(B,C,E,A,D){if(B&&D){B=this[D](B);
}if(!B){B=A.getElementsByTagName("*");
}return Selector.pseudos[C](B,E,A);
}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(Selector.handlers.previousElementSibling(E)){continue;
}C.push(E);
}return C;
},"last-child":function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(Selector.handlers.nextElementSibling(E)){continue;
}C.push(E);
}return C;
},"only-child":function(B,G,A){var E=Selector.handlers;
for(var D=0,C=[],F;
F=B[D];
D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F);
}}return C;
},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A);
},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true);
},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true);
},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true);
},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true);
},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true);
},"only-of-type":function(B,D,A){var C=Selector.pseudos;
return C["last-of-type"](C["first-of-type"](B,D,A),D,A);
},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[];
}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E);
}return D;
});
},nth:function(A,L,N,K,C){if(A.length==0){return[];
}if(L=="even"){L="2n+0";
}if(L=="odd"){L="2n+1";
}var J=Selector.handlers,I=[],B=[],E;
J.mark(A);
for(var H=0,D;
D=A[H];
H++){if(!D.parentNode._counted){J.index(D.parentNode,K,C);
B.push(D.parentNode);
}}if(L.match(/^\d+$/)){L=Number(L);
for(var H=0,D;
D=A[H];
H++){if(D.nodeIndex==L){I.push(D);
}}}else{if(E=L.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1;
}var O=E[1]?Number(E[1]):1;
var M=E[2]?Number(E[2]):0;
var P=Selector.pseudos.getIndices(O,M,A.length);
for(var H=0,D,F=P.length;
D=A[H];
H++){for(var G=0;
G<F;
G++){if(D.nodeIndex==P[G]){I.push(D);
}}}}}J.unmark(A);
J.unmark(B);
return I;
},empty:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.tagName=="!"||(E.firstChild&&!E.innerHTML.match(/^\s*$/))){continue;
}C.push(E);
}return C;
},not:function(A,D,I){var G=Selector.handlers,J,C;
var H=new Selector(D).findElements(I);
G.mark(H);
for(var F=0,E=[],B;
B=A[F];
F++){if(!B._counted){E.push(B);
}}G.unmark(H);
return E;
},enabled:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(!E.disabled){C.push(E);
}}return C;
},disabled:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.disabled){C.push(E);
}}return C;
},checked:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.checked){C.push(E);
}}return C;
}},operators:{"=":function(B,A){return B==A;
},"!=":function(B,A){return B!=A;
},"^=":function(B,A){return B.startsWith(A);
},"$=":function(B,A){return B.endsWith(A);
},"*=":function(B,A){return B.include(A);
},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ");
},"|=":function(B,A){return("-"+B.toUpperCase()+"-").include("-"+A.toUpperCase()+"-");
}},matchElements:function(F,G){var E=new Selector(G).findElements(),D=Selector.handlers;
D.mark(E);
for(var C=0,B=[],A;
A=F[C];
C++){if(A._counted){B.push(A);
}}D.unmark(E);
return B;
},findElement:function(B,C,A){if(Object.isNumber(C)){A=C;
C=false;
}return Selector.matchElements(B,C||"*")[A||0];
},findChildElements:function(E,G){var H=G.join(","),G=[];
H.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(I){G.push(I[1].strip());
});
var D=[],F=Selector.handlers;
for(var C=0,B=G.length,A;
C<B;
C++){A=new Selector(G[C].strip());
F.concat(D,A.findElements(E));
}return(B>1)?F.unique(D):D;
}});
function $$(){return Selector.findChildElements(document,$A(arguments));
}var Form={reset:function(A){$(A).reset();
return A;
},serializeElements:function(G,B){if(typeof B!="object"){B={hash:!!B};
}else{if(B.hash===undefined){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!="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(A){return $A($(A).getElementsByTagName("*")).inject([],function(B,C){if(Form.Element.Serializers[C.tagName.toLowerCase()]){B.push(Element.extend(C));
}return B;
});
},getInputs:function(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"].include(D.tagName.toLowerCase());
});
},focusFirstElement:function(A){A=$(A);
A.findFirstElement().activate();
return A;
},request:function(B,A){B=$(B),A=Object.clone(A||{});
var D=A.parameters,C=B.readAttribute("action")||"";
if(C.blank()){C=window.location.href;
}A.parameters=B.serialize(true);
if(D){if(Object.isString(D)){D=D.toQueryParams();
}Object.extend(A.parameters,D);
}if(B.hasAttribute("method")&&!A.method){A.method=B.method;
}return new Ajax.Request(C,A);
}};
Form.Element={focus:function(A){$(A).focus();
return A;
},select:function(A){$(A).select();
return A;
}};
Form.Element.Methods={serialize:function(A){A=$(A);
if(!A.disabled&&A.name){var B=A.getValue();
if(B!=undefined){var C={};
C[A.name]=B;
return Object.toQueryString(C);
}}return"";
},getValue:function(A){A=$(A);
var B=A.tagName.toLowerCase();
return Form.Element.Serializers[B](A);
},setValue:function(A,B){A=$(A);
var C=A.tagName.toLowerCase();
Form.Element.Serializers[C](A,B);
return A;
},clear:function(A){$(A).value="";
return A;
},present:function(A){return $(A).value!="";
},activate:function(A){A=$(A);
try{A.focus();
if(A.select&&(A.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(A.type))){A.select();
}}catch(B){}return A;
},disable:function(A){A=$(A);
A.blur();
A.disabled=true;
return A;
},enable:function(A){A=$(A);
A.disabled=false;
return A;
}};
var Field=Form.Element;
var $F=Form.Element.Methods.getValue;
Form.Element.Serializers={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);
default:return Form.Element.Serializers.textarea(A,B);
}},inputSelector:function(A,B){if(B===undefined){return A.checked?A.value:null;
}else{A.checked=!!B;
}},textarea:function(A,B){if(B===undefined){return A.value;
}else{A.value=B;
}},select:function(D,A){if(A===undefined){return this[D.type=="select-one"?"selectOne":"selectMany"](D);
}else{var C,F,G=!Object.isArray(A);
for(var B=0,E=D.length;
B<E;
B++){C=D.options[B];
F=this.optionValue(C);
if(G){if(F==A){C.selected=true;
return ;
}}else{C.selected=A.include(F);
}}}},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);
}});
if(!window.Event){var Event={};
}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(B){var A;
switch(B.type){case"mouseover":A=B.fromElement;
break;
case"mouseout":A=B.toElement;
break;
default:return null;
}return Element.extend(A);
}});
Event.Methods=(function(){var A;
if(Prototype.Browser.IE){var B={0:1,1:4,2:2};
A=function(D,C){return D.button==B[C];
};
}else{if(Prototype.Browser.WebKit){A=function(D,C){switch(C){case 0:return D.which==1&&!D.metaKey;
case 1:return D.which==1&&D.metaKey;
default:return false;
}};
}else{A=function(D,C){return D.which?(D.which===C+1):(D.button===C);
};
}}return{isLeftClick:function(C){return A(C,0);
},isMiddleClick:function(C){return A(C,1);
},isRightClick:function(C){return A(C,2);
},element:function(D){var C=Event.extend(D).target;
return Element.extend(C.nodeType==Node.TEXT_NODE?C.parentNode:C);
},findElement:function(D,E){var C=Event.element(D);
return C.match(E)?C:C.up(E);
},pointer:function(C){return{x:C.pageX||(C.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:C.pageY||(C.clientY+(document.documentElement.scrollTop||document.body.scrollTop))};
},pointerX:function(C){return Event.pointer(C).x;
},pointerY:function(C){return Event.pointer(C).y;
},stop:function(C){Event.extend(C);
C.preventDefault();
C.stopPropagation();
C.stopped=true;
}};
})();
Event.extend=(function(){var A=Object.keys(Event.Methods).inject({},function(B,C){B[C]=Event.Methods[C].methodize();
return B;
});
if(Prototype.Browser.IE){Object.extend(A,{stopPropagation:function(){this.cancelBubble=true;
},preventDefault:function(){this.returnValue=false;
},inspect:function(){return"[object Event]";
}});
return function(B){if(!B){return false;
}if(B._extendedByPrototype){return B;
}B._extendedByPrototype=Prototype.emptyFunction;
var C=Event.pointer(B);
Object.extend(B,{target:B.srcElement,relatedTarget:Event.relatedTarget(B),pageX:C.x,pageY:C.y});
return Object.extend(B,A);
};
}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;
Object.extend(Event.prototype,A);
return Prototype.K;
}})();
Object.extend(Event,(function(){var B=Event.cache;
function C(J){if(J._eventID){return J._eventID;
}arguments.callee.id=arguments.callee.id||1;
return J._eventID=++arguments.callee.id;
}function G(J){if(J&&J.include(":")){return"dataavailable";
}return J;
}function A(J){return B[J]=B[J]||{};
}function F(L,J){var K=A(L);
return K[J]=K[J]||[];
}function H(K,J,L){var O=C(K);
var N=F(O,J);
if(N.pluck("handler").include(L)){return false;
}var M=function(P){if(!Event||!Event.extend||(P.eventName&&P.eventName!=J)){return false;
}Event.extend(P);
L.call(K,P);
};
M.handler=L;
N.push(M);
return M;
}function I(M,J,K){var L=F(M,J);
return L.find(function(N){return N.handler==K;
});
}function D(M,J,K){var L=A(M);
if(!L[J]){return false;
}L[J]=L[J].without(I(M,J,K));
}function E(){for(var K in B){for(var J in B[K]){B[K][J]=null;
}}}if(window.attachEvent){window.attachEvent("onunload",E);
}return{observe:function(L,J,M){L=$(L);
var K=G(J);
var N=H(L,J,M);
if(!N){return L;
}if(L.addEventListener){L.addEventListener(K,N,false);
}else{L.attachEvent("on"+K,N);
}return L;
},stopObserving:function(L,J,M){L=$(L);
var O=C(L),K=G(J);
if(!M&&J){F(O,J).each(function(P){L.stopObserving(J,P.handler);
});
return L;
}else{if(!J){Object.keys(A(O)).each(function(P){L.stopObserving(P);
});
return L;
}}var N=I(O,J,M);
if(!N){return L;
}if(L.removeEventListener){L.removeEventListener(K,N,false);
}else{L.detachEvent("on"+K,N);
}D(O,J,M);
return L;
},fire:function(L,K,J){L=$(L);
if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement;
}if(document.createEvent){var M=document.createEvent("HTMLEvents");
M.initEvent("dataavailable",true,true);
}else{var M=document.createEventObject();
M.eventType="ondataavailable";
}M.eventName=K;
M.memo=J||{};
if(document.createEvent){L.dispatchEvent(M);
}else{L.fireEvent(M.eventType,M);
}return M;
}};
})());
Object.extend(Event,Event.Methods);
Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});
Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});
(function(){var C,B=false;
function A(){if(B){return ;
}if(C){window.clearInterval(C);
}document.fire("dom:loaded");
B=true;
}if(document.addEventListener){if(Prototype.Browser.WebKit){C=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){A();
}},0);
Event.observe(window,"load",A);
}else{document.addEventListener("DOMContentLoaded",A,false);
}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;
A();
}};
}})();
Hash.toQueryString=Object.toQueryString;
var Toggle={display:Element.toggle};
Element.Methods.childOf=Element.Methods.descendantOf;
var Insertion={Before:function(A,B){return Element.insert(A,{before:B});
},Top:function(A,B){return Element.insert(A,{top:B});
},Bottom:function(A,B){return Element.insert(A,{bottom:B});
},After:function(A,B){return Element.insert(A,{after:B});
}};
var $continue=new Error('"throw $continue" is deprecated, use "return" instead');
var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;
},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C);
}this.xcomp=A;
this.ycomp=C;
this.offset=Element.cumulativeOffset(B);
return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth);
},withinIncludingScrolloffsets:function(B,A,D){var C=Element.cumulativeScrollOffset(B);
this.xcomp=A+C[0]-this.deltaX;
this.ycomp=D+C[1]-this.deltaY;
this.offset=Element.cumulativeOffset(B);
return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth);
},overlap:function(B,A){if(!B){return 0;
}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight;
}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth;
}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(A){Position.prepare();
return Element.absolutize(A);
},relativize:function(A){Position.prepare();
return Element.relativize(A);
},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(B,C,A){A=A||{};
return Element.clonePosition(C,B,A);
}};
if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]";
}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(C,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,J,I;
J=C[D];
D++){if(J.className&&(I=" "+J.className+" ")&&(I.include(F)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ");
})))){G.push(Element.extend(J));
}}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);
Element.addMethods();

function logError(A){alert(A);
}
function doConfirm(A,B){if(confirm(A)){B();
}}
function updateHrefUniversal(C,B,I,R){try{var Q=document.getElementById(C);
var M=Q.href;
M=M.split("?");
var P;
if(M.length>1){P=M[1];
P=P.split("&");
}else{P=new Array();
}M=M[0];
var E=false;
var H=P.length;
for(var L=H-1;
L>=0;
L--){var F=P[L];
F=F.split("=");
var G=F[0];
var D=F[1];
if(G==B){if(I){F=B+"="+I;
P[L]=F;
I=null;
}else{var O=P.splice(0,L);
var N=P.splice(L+1,P.length-L-1);
P=O.concat(N);
}E=true;
}else{if(R){var A=false;
for(var K=0;
K<R.length;
K++){if(R[K]==G){A=true;
break;
}}if(!A){var O=P.splice(0,L);
var N=P.splice(L+1,P.length-L-1);
P=O.concat(N);
}}}}if(!E&&I){P[P.length]=B+"="+I;
}if(P.length&&P.length>0){M=M+"?"+P.join("&");
}Q.href=M;
}catch(J){alert("Error: "+J);
}}function updateWindowHrefUniversal(F,C){try{var A=window.location.href;
A=A.split("?");
var D;
if(A.length>1){D=A[1];
D=D.split("&");
}else{D=new Array();
}A=A[0];
var L=false;
for(var E=0;
E<D.length;
E++){var K=D[E];
K=K.split("=");
var B=K[0];
var J=K[1];
if(B==F){if(C!=null){K=F+"="+C;
D[E]=K;
}else{var I=D.splice(0,E);
var H=D.splice(E+1,D.length-E-1);
D=I.concat(H);
}L=true;
break;
}}if(!L&&C!=""){D[D.length]=F+"="+C;
}if(D.length&&D.length>0){A=A+"?"+D.join("&");
}window.location.href=A;
}catch(G){alert("Error: "+G);
}}function getRequestParamValue(E){try{var A=window.location.href;
A=A.split("?");
var C;
if(A.length>1){C=A[1];
C=C.split("&");
}else{C=new Array();
}A=A[0];
var I=false;
for(var D=0;
D<C.length;
D++){var H=C[D];
H=H.split("=");
var B=H[0];
var G=H[1];
if(B==E){return G;
}}return"";
}catch(F){alert("Error: "+F);
}}
function createEntryActionCallback(A){var B=A.id;
return function(C){ajaxService.getHtmlById("entry?showSource="+A.showSource+"&showOwnerOnly="+A.showOwnerOnly,B,{callback:createReplaceCallback("entry:"+B,C)});
};
}function createReplaceCallback(B,A){return function(C){DWRUtil.setValue(B,C);
};
}function deferEntry(B,A){entryService.deferEntryById(B,{callback:function(D){var C=document.getElementById("deferred:"+B);
if(D){C.src=A+"images/deferred.png";
}else{C.src=A+"design/img/rec/el/disc.gif";
}}});
return false;
}function markEntry(B,A){entryService.markEntryById(B,{callback:function(D){var C=document.getElementById("marked:"+B);
if(D){C.src=A+"design/img/rec/el/heart.gif";
}else{C.src=A+"images/white-heart.png";
}}});
return false;
}function punishUser(B){try{var D=B.id;
var A=document.getElementById("days:"+D);
communityService.punishUserByEntryId({id:D,days:A.value},createEntryActionCallback(B));
return false;
}catch(C){alert("error punish user: "+C);
}}function saveTags(B){try{var D=B.id;
var A=document.getElementById("entryTags:"+D);
entryService.editEntryTagsById(D,A.value,createEntryActionCallback(B));
return false;
}catch(C){alert("error save tags: "+C);
}}function showDetails(A){var C=document.getElementById("show-details");
var D=document.getElementById("hide-details");
var B=document.getElementById("show-param");
if(A){C.style.display="none";
D.style.display="";
B.value="true";
if(document.getElementById("mce_editor_1")==null){tinyMCE.addMCEControl(document.getElementById("details"),"details");
}}else{C.style.display="";
D.style.display="none";
B.value="false";
}}function updateDetails(){var B=document.getElementById("show-param");
var A=B.value;
if(A==null||A.length==0){showDetails(false);
}}function Entries(){function J(O,N){try{var L=document.getElementById("entryTags:"+O);
if(typeof N=="undefined"){entryService.updateEntryTagsById(O,L.value,{callback:function(){if($("blogTags")!=null){blogTagsController.getTags(blogInfo.code,{callback:function(Q){var P=Q.html;
var R=$("blogTags");
R.replace(P);
}});
}D(O);
}});
}else{entryService.updateEntryTagsById(O,L.value,N);
}return false;
}catch(M){alert("error save entry tags: "+M);
}}function H(N){try{var L=document.getElementById("days:"+N);
communityService.punishUserByEntryId({id:N,days:L.value},{callback:function(){D(N);
}});
return false;
}catch(M){alert("error entry punish user: "+M);
}}function B(M){variants=document.getElementsByName("a:"+M);
for(var L=0;
L<variants.length;
L++){if(variants[L].checked){var N=variants[L].value;
createUserAnswerController.create(M,N,{callback:function(O){if(O!=null){Element.replace("polling:"+M,O.html);
}else{alert("Error in polling. Please, contact developers.");
}}});
return ;
}}}function I(M){try{communityService.removePunishUserByEntryId(M,{callback:function(){D(M);
}});
return false;
}catch(L){alert("error remove punishment: "+L);
}}function G(L){var M=L.id;
return function(N){ajaxService.getHtmlById("entry?showSource="+L.showSource+"&showOwnerOnly="+L.showOwnerOnly,M,{callback:createReplaceCallback("entry:"+M,N)});
};
}function D(O,L){var N=L==null?O:L;
DWREngine.beginBatch();
try{var M={id:N,blogType:blogInfo.type,blogId:blogInfo.code};
entryController.getEntry(M,{callback:function(Q){var P=Q.html;
var R=$("entry:"+O);
R.replace(P);
}});
}finally{DWREngine.endBatch();
}}function A(){window.location.reload();
}function F(O,L,N){try{if(L=="editEntry"){return true;
}else{if(L=="deleteEntry"){doConfirm(N,function(){entryService.deleteEntryById(O,{callback:function(){A();
}});
});
}else{if(L=="publishDraft"){document.getElementById("cmenu:"+O).style.visibility="hidden";
show("publish-draft:"+O);
}else{if(L=="punishUser"){document.getElementById("cmenu:"+O).style.visibility="hidden";
show("punish-user:"+O);
}else{if(L=="removePunishmentUser"){document.getElementById("cmenu:"+O).style.visibility="hidden";
this.removePunishmentUser(O);
}else{if(L=="editTags"){document.getElementById("cmenu:"+O).style.visibility="hidden";
show("entry-edit-tags:"+O);
}else{if(L=="lockUser"){communityService.removeUserByEntryId(O,{callback:function(){D(O);
}});
}else{if(L=="unlockUser"){communityService.restoreUserByEntryId(O,{callback:function(){D(O);
}});
}else{if(L=="lockEntry"){entryService.lockEntryById(O,{callback:function(P){D(O,P);
}});
}else{if(L=="unlockEntry"){entryService.unlockEntryById(O,{callback:function(P){D(O,P);
}});
}else{if(L=="freezeEntry"){entryService.freezeEntryById(O,{callback:function(){D(O);
}});
}else{if(L=="unfreezeEntry"){entryService.unfreezeEntryById(O,{callback:function(){D(O);
}});
}else{if(L=="toggleMegaMark"){entryService.toggleMegaMark(O,{callback:function(){D(O);
}});
}}}}}}}}}}}}}}catch(M){alert(M);
}return false;
}function K(M){var L={callback:function(N){var P="entryMegaMark:"+M;
var O=$(P);
if(O){O.checked=N;
}}};
entryService.toggleMegaMark(M,L);
}function E(O){var N=$("entryBodyOrig:"+O);
var L=$("entryBody:"+O);
if(Element.empty(N)&&!Element.hasClassName(N,"cut-loading")){Element.addClassName(N,"cut-loading");
Element.removeClassName(L,"mega-entryBody-brief");
Element.addClassName(L,"mega-entryBody-original");
var M={callback:function(P){Element.removeClassName(N,"cut-loading");
Element.update(N,P);
}};
megaEntryController.getEntry(O,M);
}else{if(Element.empty(N)&&Element.hasClassName(N,"cut-loading")){Element.removeClassName(L,"mega-entryBody-brief");
Element.addClassName(L,"mega-entryBody-original");
}else{Element.removeClassName(N,"cut-loading");
Element.removeClassName(L,"mega-entryBody-brief");
Element.addClassName(L,"mega-entryBody-original");
}}}function C(N){var L=$("entryBody:"+N);
var M=$("entryBodyOrig:"+N);
Element.removeClassName(L,"mega-entryBody-original");
Element.addClassName(L,"mega-entryBody-brief");
}this.doEntryAction=F;
this.punishUser=H;
this.removePunishmentUser=I;
this.saveTags=J;
this.toggleMegaMark=K;
this.openMegaEntry=E;
this.closeMegaEntry=C;
this.doAnswer=B;
}function deferEntryById(B,A){entryService.deferEntryById(B,{callback:function(F){if(!A){var D=document.getElementById("deferred:"+B+":");
D.className=F?"g-state-on":"g-state-off";
}else{var E=document.getElementById("deferred:"+B+":top");
if(E!=null){E.className=F?"g-state-on":"g-state-off";
}var C=document.getElementById("deferred:"+B+":bottom");
if(C!=null){C.className=F?"g-state-on":"g-state-off";
}}}});
return false;
}function markEntryById(B,A){entryService.markEntryById(B,{callback:function(F){if(!A){var C=document.getElementById("marked:"+B+":");
C.className=F?"g-state-on":"g-state-off";
}else{var E=document.getElementById("marked:"+B+":top");
if(E!=null){E.className=F?"g-state-on":"g-state-off";
}var D=document.getElementById("marked:"+B+":bottom");
if(D!=null){D.className=F?"g-state-on":"g-state-off";
}}}});
return false;
}function setRatingEntryById(B,A){ratingController.setRatingEntryById(B,A,{callback:function(E){var F=document.getElementById("rating:"+B);
F.style.display="none";
var C=document.getElementById("ratingResult:"+B);
if(E.status=="ERROR"){C.replace("error");
}else{var D=E.html;
Element.replace(F,D);
}}});
return false;
}function sendPostComment(B,A){notificationService.toggleEntryPostCommentNotification(B,{callback:function(E){if(!A){var F=document.getElementById("sendPostComment:"+B+":");
F.className=E?"g-state-on":"g-state-off";
}else{var D=document.getElementById("sendPostComment:"+B+":top");
if(D!=null){D.className=E?"g-state-on":"g-state-off";
}var C=document.getElementById("sendPostComment:"+B+":bottom");
if(C!=null){C.className=E?"g-state-on":"g-state-off";
}}}});
return false;
}function cancelEditTags(B,A){$("entry-edit-tags:"+B).style.display="none";
$("entryTags:"+B).value=A;
}
function comment(){try{var C="replyForm";
C=$(C);
if(C==null){alert("replyForm is not found");
}var A=Form.serialize("replyForm");
}catch(B){alert(B);
}}function submit(G,F,B){var E=null;
if(G!=null){E=document.forms[G];
}else{E=document.forms[0];
}if(F!=null&&B!=null&&F.length==B.length){for(var D=0;
D<F.length;
D++){var C=F[D];
var H=C+"_id";
var A=document.getElementById(H);
if(A==null){A=document.createElement("input");
A.type="hidden";
A.id=H;
E.appendChild(A);
}A.name=C;
A.value=B[D];
}}E.submit();
return false;
}function updateCheckboxName(E){var B=document.getElementById(E);
var A=B.name;
if(A.indexOf("_")!=0){A="_"+A;
}var D="_"+E;
var C=document.getElementById(D);
if(C==null){C=document.createElement("input");
C.type="text";
C.id=D;
C.name=A;
B.form.appendChild(C);
}if(B.checked==true){C.value=null;
}else{C.value="off";
}}function show(A){$(A).style.display="block";
}function cancelAction(B,A){show("entry-actions:"+B);
$(A).style.display="none";
}function hideReplyForm(){var D=$("replyForm.restored");
if(D){try{if(D.innerHTML!="false"){D.innerHTML="false";
var B=document.getElementById("hiddenReply");
replyForm.save();
var A=getReplyForm();
B.appendChild(A);
}}catch(C){alert("hideReply: "+C+", "+B);
}}}function ReplyForm(P,B,O){var Q="replyForm";
var I=null;
var H;
var S=null;
I=new EditorSupport(B);
var A=false;
function J(k,a){try{var V=A;
A=true;
try{hidePreviewComment();
}catch(g){}var W=$(Q);
var Y="replyCell:"+k;
var l=$(Y);
for(var b=0;
b<l.childNodes.length;
b++){var X=l.childNodes[0];
if(X.id!=W.id){l.removeChild(X);
}}if(l.childNodes.length>1){alert("Invalid state: too many nodes.");
return ;
}var U=$("commentTarget");
if(U==null||U.length==0){alert("Invalid state! Hidden form element is not found.");
return ;
}U.value=k;
var c=$("hideComment:checkbox");
if(c!=null){var j=$("hideComment:"+k).innerHTML;
var f=$("hideComment:"+k+":value").innerHTML;
c.disabled=(j!="true");
c.checked=(f=="true");
var h=$("hideComment:label");
var Z=$("hideComment:"+k+":label").innerHTML;
h.innerHTML=Z;
}if(l.childNodes.length==0){if(!V){if(O=="true"){if(autoSave&&!a){setTimeout("replyForm.appendReplyForm('"+Y+"');setTimeout(autoSave.restore, 150)",100);
}}}setTimeout("replyForm.appendReplyForm('"+Y+"')",100);
}}catch(g){alert("Open form error: "+g);
}}function R(W){H=I.getMode();
I.showTextEditor();
var V=$(Q);
var U=$(W);
V.style.display="none";
U.appendChild(V);
V.style.display="";
K(H);
}function T(){A=true;
I.showTextEditor();
}function G(){A=true;
I.showRichEditor();
}function N(){if(!H){H=I.getMode();
}T();
}function K(){A=true;
I.showEditor(H);
H=null;
}function C(){return I.getMode();
}function L(U){I.setMode(U);
}function D(U){if(U){return I.getHTML(U);
}else{return I.getHTML();
}}function M(U){return I.setHTML(U);
}function F(U){S=U;
}function E(){return A;
}this.getHTML=D;
this.setHTML=M;
this.showReply=J;
this.showTextEditor=T;
this.showRichEditor=G;
this.appendReplyForm=R;
this.save=N;
this.restore=K;
this.getMode=C;
this.setOnShow=F;
this.isShown=E;
}function switchOnOff(B,A){try{$(B).className="active";
$(A).className="";
}catch(C){alert(C);
}}function displayEditorButtons(A){if(A){$("e-b").removeClassName("g-display-none");
$("e-b").addClassName("g-display-block");
return ;
}$("e-b").addClassName("g-display-none");
$("e-b").removeClassName("g-display-block");
}function updateHref(H,F){try{var H=document.getElementById(H);
var A=H.href;
A=A.split("?");
var C;
if(A.length>1){C=A[1];
C=C.split("&");
}else{C=new Array();
}A=A[0];
var L=false;
for(var D=0;
D<C.length;
D++){var K=C[D];
K=K.split("=");
var B=K[0];
var J=K[1];
if(B=="pages.top"){if(F>0){K="pages.top="+F;
C[D]=K;
}else{var I=C.splice(0,D);
var G=C.splice(D+1,C.length-D-1);
C=I.concat(G);
}L=true;
break;
}}if(!L&&F>0){C[C.length]="pages.top="+F;
}if(C.length&&C.length>0){A=A+"?"+C.join("&");
}H.href=A;
}catch(E){alert("Error: "+E);
}}function updateLocked(C,B){var A=document.getElementById("locked:"+C);
if(B){A.style.display="inline";
}else{A.style.display="none";
}}function getCommentTarget(B){var A=Form.getInputs(B,"hidden","commentTarget");
if(A==null||A.length==0){alert("Invalid state! Hidden form element is not found.");
return null;
}return A[0];
}function getReplyForm(){return $("replyForm");
}function showReply(A){$("replyForm.restored").innerHTML="true";
replyForm.showReply(A);
replyForm.restore();
setPosition(A);
}function absPosition(B){var A=y=0;
while(B){A+=B.offsetLeft;
y+=B.offsetTop;
B=B.offsetParent;
}return{x:A,y:y};
}function setPosition(A){d=document.getElementById("replyCell:"+A);
if(d){if(d.style.marginLeft>=0){d.style.width="100%";
d.style.position="relative";
mOffset=absPosition(d).x-absPosition(document.getElementById("main-content-area")).x;
d.style.width=d.clientWidth+mOffset;
d.style.marginLeft="-"+mOffset+"px";
}}}function restoreReplyForm(A){try{var D=getReplyForm();
if($("replyForm.restored").innerHTML!="true"){var C=$("target:"+A+":freezed");
var B=C.innerHTML;
if(B!="true"){if(!replyForm){alert("Error restoreReplyForm: restoreReplyForm must present in current context!!!");
return ;
}replyForm.showReply(A);
replyForm.restore();
}$("replyForm.restored").innerHTML="true";
}}catch(E){alert("restoreReply: "+E);
}}function fireEntryService(A,F,C){try{hideReplyForm();
var B=function(G){Element.replace("entry:null",G);
};
var E=function(){showCommentsController.getEntryWithComments(ENTRY_PARAMS,{callback:B});
};
if(typeof C=="undefined"){A(F,E);
}else{A(F,C,E);
}}catch(D){alert("entryService: "+D);
}}function doEditTags(B){var A=document.getElementById("entryTags:"+B);
fireEntryService(entryService.updateEntryTagsById,B,A.value);
return false;
}function editTags(A){document.getElementById("cmenu:"+A).style.visibility="hidden";
show("entry-edit-tags:"+A);
return false;
}function freezeEntry(A){fireEntryService(entryService.freezeEntryById,A);
return false;
}function unfreezeEntry(A){fireEntryService(entryService.unfreezeEntryById,A);
return false;
}function lockEntry(A){fireEntryService(entryService.lockEntryById,A);
return false;
}function unlockEntry(A){fireEntryService(entryService.unlockEntryById,A);
return false;
}function deleteEntry(B,A){doConfirm(A,function(){try{callback=function(D){if(D.status=="OK"){Element.update("entry:null",D.html);
}else{alert(D.html);
}};
deleteEntryController.deleteEntry(B,callback);
}catch(C){alert("entryService: "+C);
}});
return false;
}function reload(){window.location.reload();
}function publishDraft(B,A){doConfirm(A,function(){try{callback=function(D){if(D.status=="OK"){Element.update("entry:null",D.html);
}else{alert(D.html);
}};
entryService.publishDraftById(B,{callback:function(){reload();
}});
}catch(C){alert("entryService: "+C);
}});
return false;
}function getHtmlByName(F,B,A,E,D){try{return function(){var G=D==null?A:D;
Element.addClassName(G,"thread-loading");
ajaxService.getHtmlById(B,F,function(H){if(!H){alert("ajaxCallback: no data to paste");
}Element.removeClassName(G,"cut-loading");
Element.replace(A,H);
if(E){E();
}});
};
}catch(C){alert("e="+C);
}}function Comments(){function I(J,O,N){try{hideReplyForm();
var L;
if(O!="null"&&O!=null){L=getHtmlByName(O,"comment",""+O,null,N);
}else{var K=function(P){Element.replace("entry:null",P);
};
L=function(){showCommentsController.getEntryWithComments(ENTRY_PARAMS,{callback:K});
};
}J(N,L);
}catch(M){alert("commentService: "+M);
}}function G(K,J){I(commentService.freezeById,K,J);
return false;
}function H(K,J){I(commentService.unfreezeById,K,J);
return false;
}function B(K,J){I(commentService.lockById,K,J);
return false;
}function C(K,J){I(commentService.unlockById,K,J);
return false;
}function D(K,J){if(confirm(global_messages["text.warningCommentHide"])){I(commentService.hideById,K,J);
}return false;
}function A(L,K,J){doConfirm(J,function(){I(commentService.deleteById,L,K);
var M=parseInt($("commentsCount").innerHTML);
Element.update("commentsCount",M-1);
});
return false;
}function F(L,K,J){commentController.getComment(K,function(O){if(O.status=="OK"){var N=$("comment");
N.title.value=O.bean.title;
replyForm.setHTML(O.bean.body);
N.currentId.value=O.bean.id;
$(""+K).style.display="none";
showReply(J);
N.hidden.checked=O.bean.hidden;
N.hidden.disabled=!O.bean.canHideComment;
setTimeout(function(){document.getElementById("comment_title").focus();
},1500);
}else{var M=$("comment-editing:"+K).style.display="none";
}});
}function E(L,J){try{hideReplyForm();
getHtmlByName(J,"comment",J,function(){showLines(J);
},J)();
return false;
}catch(K){alert("showComment: "+K);
return true;
}}this.editComment=F;
this.hideComment=D;
this.fireCommentService=I;
this.freezeComment=G;
this.unfreezeComment=H;
this.lockComment=B;
this.unlockComment=C;
this.deleteComment=A;
this.showComment=E;
}function showLines(H){try{var D="["+H+"]";
var B=Element.getElementsBySelector(null,".line-dotted2");
if(B){var A=B.length;
for(var C=0;
C<A;
C++){var E=B[C];
var G=E.id;
if(G.indexOf(D)>=0){E.style.display="";
}}}}catch(F){alert("showLines error: "+F);
}}function showTextEditor(){replyForm.showTextEditor();
switchOnOff("htmlLI","richLI");
displayEditorButtons(false);
return false;
}function showRichEditor(){replyForm.showRichEditor();
switchOnOff("richLI","htmlLI");
displayEditorButtons(true);
return false;
}function getEditorHTML(){return replyForm.getHTML();
}
function Preview(A){var C=null;
var E=null;
function G(I,H){I.style.cursor="wait";
C=I;
clearTimeout(E);
$("previewImage").onload=function(J){E=setTimeout(function(){if(C!=null){D();
var N=$("previewImageDiv");
var L=$(I).offsetWidth;
N.style.position="absolute";
var K=YAHOO.util.Dom.getX(I);
var M=YAHOO.util.Dom.getY(I);
YAHOO.util.Dom.setStyle(N,"left",K+L+1+"px");
YAHOO.util.Dom.setStyle(N,"top",M+"px");
YAHOO.util.Dom.setStyle($("previewImageDiv"),"visibility","visible");
C.style.cursor="default";
}},150);
};
$("previewImage").src=H;
}function F(){YAHOO.util.Dom.setStyle($("previewImage"),"width","");
YAHOO.util.Dom.setStyle($("previewImage"),"height","");
}function B(H){C=null;
YAHOO.util.Dom.setStyle($("previewImageDiv"),"visibility","hidden");
YAHOO.util.Dom.setStyle($("previewImageDiv"),"top","-10000px");
YAHOO.util.Dom.setStyle($("previewImageDiv"),"left","-10000px");
F();
}function D(){var I=$("previewImage");
var K=200;
F();
var H=I.width;
var J=I.getHeight();
if(Math.max(H,J)>K){if(H>J){YAHOO.util.Dom.setStyle(I,"width",K+"px");
}else{YAHOO.util.Dom.setStyle(I,"height",K+"px");
}}}this.setPreviewSize=D;
this.showImagePreview=G;
this.hideImagePreview=B;
}function GetImageDimensions(C,B,D){var A=document.createElement("IMG");
A.style.position="absolute";
A.style.top="-10000px";
A.style.left="-10000px";
document.body.appendChild(A);
A.onload=function(G){var F=A.width;
var E=A.height;
D({w:F,h:E});
document.body.removeChild(A);
};
A.src=C;
}
function AutoPreview(){var B="autoPreviewWindow";
var E="autoPreviewWindowContent";
var D="autoPreviewImage";
var A="autoPreviewSave";
function C(I){function H(K,J){if(K<500){$(B).style.width=(K+50)+"px";
$(E).style.width=(K+48-14*2)+"px";
}else{$(B).style.width="790px";
$(E).style.width="760px";
}if(J<500){$(E).style.height=(J+2)+"px";
}else{$(E).style.height="550px";
}}return{on:function(K){var J=I.src.indexOf("/S500X");
var L=I.src;
if(J!=-1){src0=L.substring(0,J);
src1=L.substring(J+"/S500X".length);
L=src0+src1;
}$(D).src=L;
$(A).href=L.replace(/pictures/,"savePictures");
H(I.width,I.height);
popupWindow(B,false);
}};
}function F(H){H.style.cursor="pointer";
Element.observe(H,"click",new C(H).on);
}function G(){if($(B)==null){return ;
}var H=Element.getElementsBySelector(null,".auto-preview");
for(var I=0;
I<H.length;
I++){F(H[I]);
}$(B).style.left="-10000px";
$(B).style.top="-10000px";
}this.start=G;
}
if(!ru){var ru={};
}if(!ru.headhunter){ru.headhunter={};
}if(!ru.headhunter.liveoffice){ru.headhunter.liveoffice={};
}
function ru_headhunter_liveoffice_Commons(){function C(D,E){if(!E){ru.headhunter.liveoffice.Commons.hideAndClearInnerHTML(D);
}else{setTimeout("ru.headhunter.liveoffice.Commons.hideAndClearInnerHTML('"+D+"');",E);
}}function A(D){document.getElementById(D).innerHTML="";
B(D);
}function B(D){var E=document.getElementById(D);
if(E.style.display=="none"){E.style.display="";
}else{E.style.display="none";
}return false;
}this.hideAndClearInnerHTMLByTimeout=C;
this.hideAndClearInnerHTML=A;
this.showHideElement=B;
}ru.headhunter.liveoffice.Commons=new ru_headhunter_liveoffice_Commons();
function disableEnableElement(A,B){if(A.checked){B.disabled=false;
}else{B.disabled=true;
}}function hideElement(B){var A=document.getElementById(B);
A.style.display="none";
}function showElement(B){var A=document.getElementById(B);
A.style.display="block";
}function disableElement(B){var A=document.getElementById(B);
A.disabled=true;
}function enableElement(B){var A=document.getElementById(B);
A.disabled=false;
}function showHideElements(A,C){if(A){for(var B=0;
B<A.length;
B++){var D=document.getElementById(A[B]);
D.style.display="";
}}if(C){for(var B=0;
B<C.length;
B++){var D=document.getElementById(C[B]);
D.style.display="none";
}}return false;
}function confirmDelete(){var A=prompt(global_messages["text.typeDelete"],"");
if(A&&A.toLowerCase()==global_messages["action.delete"].toLowerCase()){return true;
}else{return false;
}}
var newUniverCount=0;
var newSchoolCount=0;
var newExternalSiteCount=0;
function getDeletedFlag(B,C){var A=document.getElementById(C+"Deleted:"+B);
return A;
}function addUniversity(A){addEducation(A,"university",newUniverCount);
newUniverCount++;
}function addSchool(A){addEducation(A,"school",newSchoolCount);
newSchoolCount++;
}function addExternalSite(A){addSite(A,"externalSites",newExternalSiteCount);
newExternalSiteCount++;
}function addSite(E,B,F){var G=document.getElementById(B+"Div");
var D=$(B+":0").innerHTML;
var C=E+F;
D=D.replace(/:0/gm,":"+C);
D=D.replace(/\[0\]/gm,"["+C+"]");
var H=document.createElement("div");
H.id=B+":"+C;
H.innerHTML=D;
G.appendChild(H);
var A=getDeletedFlag(C,B);
A.value="false";
}function addEducation(E,C,F){var G=document.getElementById(C+"Div");
var D=document.getElementById(C+":0").innerHTML;
var B=E+F;
D=D.replace(/:0/gm,":"+B);
D=D.replace(/\[0\]/gm,"["+B+"]");
var H=document.createElement("div");
H.className="education";
H.id=C+":"+B;
H.innerHTML=D;
G.appendChild(H);
var A=getDeletedFlag(B,C);
A.value="false";
}function confirmRemovePortrait(B){showHideElements(["confirm-delete:"+B],["control-delete:"+B]);
var A=document.getElementById("portraitId");
if(A==null){alert("error confirm remove portrait");
}else{A.value=B;
}}function callBacka(E){var F=E.oldAvatarId;
var C=E.newAvatarId;
if(F==C){return ;
}var B=document.getElementById("portrait-div:"+F);
if(B!=null){B.style.background="#CCCCCC";
}var D=document.getElementById("portrait-div:"+C);
if(D!=null){D.style.background="#CCDDCC";
}var A=document.getElementById("img-def");
if(A!=null){A.src=A.src+"&nocache";
}}function blockLink(B,J,A){alert("@Deprecated");
if(A==null||A==""){return false;
}var D=document.getElementById(J);
var G=new Array(null,null,null);
var I=document.getElementById("link:"+A);
G[0]=I;
var H=document.getElementById("delete:"+A);
G[1]=H;
var E=document.getElementById("cancel:"+A);
G[2]=E;
try{for(var C=0;
C<G.length;
C++){if(window.event.srcElement==G[C]){return false;
}}}catch(F){for(var C=0;
C<G.length;
C++){if(B.originalTarget==G[C]){return false;
}}}imageService.setDefaultAvatar(callBacka,A);
}function removeEducation(B,D){var E=B.indexOf(":");
var C=B.substring(E+1,B.length);
var F=document.getElementById(B);
F.style.display="none";
var A=getDeletedFlag(C,D);
A.value="true";
}function removeExternalSite(B){var D=B.indexOf(":");
var C=B.substring(D+1,B.length);
var E=document.getElementById(B);
E.style.display="none";
var A=getDeletedFlag(C,"externalSites");
A.value="true";
}
function Groups(){function N(R){if(R!=R+0){throw"A number is expected here.";
}}function O(R){N(R);
return"group:"+R;
}function A(R){if(R.status=="OK"){var S=document.getElementById("foundSearch");
S.innerHTML=R.html;
S.style.display="block";
}else{alert("Failed: "+R.html);
}}function E(S,U){try{N(S);
var T=O(S);
var V=$(T);
V.innerHTML=U;
}catch(R){alert("Failed: "+R);
}}function Q(){var R=document.getElementById("searchByName");
var S=document.getElementById("lastName");
var T=document.getElementById("firstName");
searchUsersController.getUsers({lastName:S.value,firstName:T.value},A);
}function G(U){try{var c=document.getElementsByTagName("select");
for(var X=0;
X<c.length;
X++){var d=c[X];
var T=d.id;
var Z=null;
if(T=="addUserTargetGroup"){Z=U;
}else{var Y="targetGroup:";
if(T!=null&&T.indexOf(Y)==0){var V=Y.length;
var S=parseInt(T.substr(V),10);
Z=new Array();
for(var W=0;
W<U.length;
W++){if(U[W].id!=S){Z[Z.length]=U[W];
}}}}if(Z!=null){DWRUtil.removeAllOptions(T);
DWRUtil.addOptions(T,Z,"id","title");
}}var b=document.getElementsByTagName("div");
for(var X=0;
X<b.length;
X++){var R=b[X];
var S=R.id;
var Y="group:";
if(S!=null&&S.indexOf(Y)==0){var V=Y.length;
S=parseInt(S.substr(V),10);
if(U.find(function(f,e){return f.id==S;
})!=null){R.style.display="";
}else{R.style.display="none";
}}}var d=$("addUserTargetGroup");
if(d!=null){if(U.length==0){d.disabled=true;
$("add").disabled=true;
}else{d.disabled=false;
$("add").disabled=false;
}}}catch(a){alert("doUpdateTargetGroups: "+a);
}}function L(){try{memberGroupController.getUserGroups({callback:function(T){if(T.status=="OK"){var S=T.bean;
if(S!=null&&S.length>=0){G(S);
}else{throw"Illegal reply from server";
}}else{throw"Error: "+T.error;
}}});
}catch(R){alert("updateTargetGroups: "+R);
}}function F(){try{var X="users";
var S=$(X);
if(S==null){alert("There are no users selected");
}var R=new Array();
var U=Form.getInputs(X,"checkbox","userIds");
for(var V=0;
V<U.length;
V++){if(U[V].checked==true){R[R.length]=U[V].value;
}}var Z=$F("addUserTargetGroup");
Z=parseInt(Z,10);
var T=this;
var W=function(){T.showGroup(Z,true);
};
memberGroupService.addUsersToGroupById(Z,R,W);
}catch(Y){alert(Y);
}}function K(T,R){try{memberGroupController.getGroup(T,R,{callback:function(U){if(U.status=="OK"){E(T,U.html);
}else{throw U.error;
}}});
}catch(S){alert(S);
}return false;
}function M(U){N(U);
var W=new Array();
var V="user:"+U;
var S=Form.getInputs(O(U),"checkbox",V);
for(var T=0;
T<S.length;
T++){var R=S[T];
if(R.checked==true){W[W.length]=R.value;
}}return W;
}function B(T){try{var U=M(T);
if(U.length==0){K(T,true);
return ;
}var S=parseInt($F("targetGroup:"+T),10);
memberGroupService.moveUsersById(T,S,U,{callback:function(){K(T,true);
K(S,true);
}});
}catch(R){alert(R);
}}function P(S){try{var T=M(S);
if(T.length==0){K(S,true);
return ;
}memberGroupService.removeUsersFromGroupById(S,T,{callback:function(){K(S,true);
}});
}catch(R){alert(R);
}}function I(S){try{N(S);
memberGroupController.deleteGroupById(S,{callback:function(T){if(T.status=="OK"){L();
return ;
}if(confirm(T.bean)){memberGroupController.deleteGroupByIdAndUpdateEntries(S,J);
}else{K(S,true);
}}});
}catch(R){alert(R);
}return false;
}function J(R){if(R.status!="OK"){alert("Internal Server Error");
return ;
}L();
}function H(S){try{N(S);
var U="name:"+S;
var T=$F(U);
memberGroupService.renameGroupById(S,T,{callback:function(){K(S,true);
L();
}});
}catch(R){alert("renameGroup: "+R);
}return false;
}function C(W){try{if(W.status=="OK"){var d=W.bean;
var c=d.title;
var S=O(d.id);
var R=$(S);
if(R==null){var V=$("groups");
var U=V.childNodes;
var R=document.createElement("div");
var Z=null;
for(var X=0;
X<U.length;
X++){var T=U[X];
var Y=$(T.id+".title");
if(Y!=null){var a=Y.value;
if(c<a){Z=T;
break;
}}}if(Z==null){V.appendChild(R);
}else{V.insertBefore(R,Z);
}R.id=S;
R.className="item";
}else{R.style.display="";
}R.innerHTML=W.html;
L(W.groups);
}else{throw"Failed: "+W;
}}catch(b){alert("createNewGroup: "+b);
}}function D(R){try{var T=$F("newGroupName");
memberGroupController.createGroup(T,{callback:function(V){var U=document.getElementById(R);
U.innerHTML=V.html;
ru.headhunter.liveoffice.Commons.showHideElement(R);
ru.headhunter.liveoffice.Commons.hideAndClearInnerHTMLByTimeout(R,5000);
if(V.status=="OK"){memberGroupController.getGroupByTitle(T,C);
}}});
}catch(S){alert(S);
}}this.addUsers=F;
this.moveUsers=B;
this.removeUsers=P;
this.showGroup=K;
this.deleteGroup=I;
this.createNewGroup=D;
this.renameGroup=H;
this.getUsers=Q;
}var groups=new Groups();
function oldaddUsers(){try{var G=$("users");
if(G==null){alert("There are no users selected");
}var E=new Array();
var B=Form.getInputs("users","checkbox","userIds");
for(var C=0;
C<B.length;
C++){if(B[C].checked==true){E[E.length]=B[C].value;
}}var F=$F("addUserTargetGroup");
F=parseInt(F,10);
var D=function(){memberGroupController.getGroup(F,true,function(H){refreshGroup(F,H.text);
});
};
memberGroupService.addUsersToGroupById(F,E,D);
}catch(A){alert(A);
}}function confirmAction(D,E){try{var C=$(D+":"+E);
var B=$("toolbar:"+E);
B.style.display="none";
C.style.display="";
}catch(A){alert(A);
}return false;
}function oldpasteSearchResult(A){if(A.status==true){found=$("found");
found.innerHTML=A.text;
}else{alert("Failed: "+A.error);
}}function oldgetMceCommandInsert(){return"&#34;mceInsertContent&#34;";
}function oldmakeUrlToUserPassport(B,C){var A='<a href="">';
A+=B;
A+="</a>";
return" <a class='user' href='/liveoffice/"+B+"/passport/inLiveOffice' >"+C+"</a>";
}function oldpasteSearchResultTinyMCE(B){found=document.getElementById("found");
found.innerHTML="";
if(B.list.length>0){for(var A=0;
A<B.list.length;
A++){var C=B.list[A].personName;
found.innerHTML+='<img src="/liveoffice/images/user-icon.gif" /><a href="" onclick="tinyMCE.execCommand('+getMceCommandInsert()+",true, &#34; "+makeUrlToUserPassport(B.list[A].name,B.list[A].personName)+' &#34; ); showSearchUserDiv(); return false;" >'+B.list[A].personName+" ,"+B.list[A].name+"</a> <br />";
}}else{found.innerHTML="Sorry... User not found";
}}function setupSearch(E){try{var C=document.getElementById("searchById");
var A=document.getElementById("searchByName");
var H=document.getElementById("liveOfficeId");
var D=document.getElementById("lastName");
var F=document.getElementById("firstName");
var B=document.getElementById("secondName");
if(E){H.disabled=false;
D.disabled=true;
F.disabled=true;
if(B!=null){B.disabled=true;
}C.checked=true;
A.checked=false;
}else{H.disabled=true;
D.disabled=false;
F.disabled=false;
if(B!=null){B.disabled=false;
}C.checked=false;
A.checked=true;
}}catch(G){alert("error setup search: "+G);
}}function pasteReplyIntoTabContent(E){try{var H=$("tab-content");
var D=$(E);
var G=D.parentNode;
var A=G.childNodes;
for(var C=0;
C<A.length;
C++){var F=A[C];
if(F.id==E){F.className="active";
}else{F.className="";
}}}catch(B){alert("Failed: "+B);
}}function openSearchTab(){pasteReplyIntoTabContent("searchTab");
setupDisplay("","none");
}function openReadersTab(B,A){pasteReplyIntoTabContent("readersTab");
setupDisplay("none","");
}function setupDisplay(B,A){document.getElementById("groupsSearch").style.display=B;
document.getElementById("groupsReaders").style.display=A;
}function oldcreateNewGroup(){try{var B=$F("newGroupName");
if(B==null||B.length==null||B.length==0){throw"A new group name input is not found";
}groupFormAction.createGroup(B,{callback:function(H){try{if(H.status==true){var M=H.group;
var L=M.title;
var D=getGroupDivId(M.id);
var C=$(D);
if(C==null){var G=$("groups");
var F=G.childNodes;
var C=document.createElement("div");
var J=null;
var N="";
for(var I=0;
I<F.length;
I++){var E=F[I];
if(D<E.id){J=E;
break;
}N=N+E.id;
}if(J==null){G.appendChild(C);
}else{G.insertBefore(C,J);
}C.id=D;
C.className="item";
}else{C.style.display="";
}C.innerHTML=H.text;
updateTargetGroups(H.groups);
}else{throw"Failed: "+H;
}}catch(K){alert(K);
}}});
}catch(A){alert(A);
}}function oldfindGroupUsers(D){assertNumber(D);
var F=new Array();
var E="user:"+D;
var B=Form.getInputs(getGroupDivId(D),"checkbox",E);
for(var C=0;
C<B.length;
C++){var A=B[C];
if(A.checked==true){F[F.length]=A.value;
}}return F;
}function oldgetGroupDivId(A){assertNumber(A);
return"group:"+A;
}function oldmoveUsers(C){try{var D=findGroupUsers(C);
if(D.length==0){return ;
}var B=parseInt($F("targetGroup:"+C),10);
groupFormAction.moveUsers(C,B,D,{callback:function(E){if(E.status==true){if(E.text.length==null||E.text.length!=2){alert("Invalid reply");
}refreshGroup(C,E.text[0]);
refreshGroup(B,E.text[1]);
}else{alert(E.error);
}}});
}catch(A){alert(A);
}}function oldrefreshGroup(B,D){try{assertNumber(B);
var C=getGroupDivId(B);
var E=$(C);
E.innerHTML=D;
}catch(A){alert("Failed: "+A);
}}function oldremoveGroup(B){try{assertNumber(B);
groupFormAction.removeGroup(B,{callback:function(D){try{if(D.status==true){updateTargetGroups(D.groups);
}else{throw D.error;
}}catch(C){alert("Failed: "+C);
}}});
}catch(A){alert(A);
}return false;
}function oldremoveUsers(B){try{var C=findGroupUsers(B);
if(C.length==0){return ;
}groupFormAction.removeUsers(B,C,{callback:function(D){if(D.status==true){refreshGroup(B,D.text);
}else{alert(D.error);
}}});
}catch(A){alert(A);
}}function oldrenameGroup(C){try{var B=$F("name:"+C);
groupFormAction.renameGroup(C,B,{callback:function(D){if(D.status==true){refreshGroup(C,D.text);
updateTargetGroups(D.groups);
}else{throw D.error;
}}});
}catch(A){alert("Failed: "+A);
}}function oldshowGroup(C,A){try{groupFormAction.showGroup(C,A,{callback:function(D){if(D.status==true){refreshGroup(C,D.text);
}else{throw D.error;
}}});
}catch(B){alert(B);
}return false;
}function oldupdateTargetGroups(B){try{if(B==null){groupFormAction.findGroups({callback:function(J){if(J.status==true){var I=J.text;
if(I!=null&&I.length>=0){updateTargetGroups(I);
}else{throw"Illegal reply from server";
}}else{throw"Error: "+J.error;
}}});
return ;
}var E=document.getElementsByTagName("select");
for(var D=0;
D<E.length;
D++){var A=E[D];
if(A.name=="targetGroup"){DWRUtil.removeAllOptions(A.id);
DWRUtil.addOptions(A.id,B,"id","title");
}}var F=document.getElementsByTagName("div");
for(var D=0;
D<F.length;
D++){var H=F[D];
var G=H.id;
if(G!=null&&G.indexOf("group:")==0){G=parseInt(G.substr(6),10);
if(B.find(function(J,I){return J.id==G;
})!=null){H.style.display="";
}else{H.style.display="none";
}}}}catch(C){alert(C);
}}function invers(B){var A=$(B);
A.checked=!A.checked;
}
function clearAllRadioAccess(){var C=["cALL","cREGISTERED","cGROUP"];
for(var B=0;
B<C.length;
B++){var A=$(C[B]);
if(A!=null){A.disabled=false;
}}}function checkRadio(F,A){clearAllRadioAccess();
var C=false;
for(var D=0;
D<A.length;
D++){var B=$(A[D]);
if(B!=null){B.disabled=true;
if(B.checked){B.checked=false;
var E=$(F);
if(E!=null){E.checked=true;
}}}}}
var autoSave=null;
var DELAY_AS=20000;
function AutoSaveEntry(H){var C=null;
function K(O){Element.addClassName(O,"autosave");
}function B(O){autoSave.clearTimer();
var P="autosaveDone";
Element.removeClassName(P,"autosave");
setTimeout(function(){K(P);
},3000);
}function M(P){var O=Form.getInputs("new-post","radio",P);
for(var Q=0;
Q<O.length;
Q++){if(O[Q].checked==true){return O[Q].value;
}}return null;
}function D(P,R){var O=Form.getInputs("new-post","radio",P);
for(var Q=0;
Q<O.length;
Q++){if(O[Q].value==R){O[Q].checked=true;
return ;
}}}function N(P){var O=document.getElementsByName(P);
if(O.length==1){return $F(O[0]);
}return null;
}function G(O,T){var Q=document.getElementsByName(O);
if(Q.length==1){var R=Q[0];
var S=R.options;
for(var P=0;
P<S.length;
P++){if(S[P].value==T){S[P].selected=true;
return ;
}}}}function A(){var Q="new-post";
var O=$(Q);
var P=new Object();
P.title=$("title").value;
P.body=replyForm.getHTML();
P.tags=$("tags").value;
ajaxController.saveEntryData(P,{callback:B});
L();
}function J(){if(C==null){C=setTimeout(function(){A();
},DELAY_AS);
}}function F(O){if(confirm(H)){$("title").value=O.title;
replyForm.setHTML(O.body);
$("tags").value=O.tags;
}else{E();
}}function E(){ajaxController.deleteSavedEntryData();
}function I(){ajaxController.getSavedEntryData({callback:F});
}function L(){if(C!=null){clearTimeout(C);
C=null;
}}this.save=J;
this.clearTimer=L;
this.restore=I;
this.clear=E;
this.getTimer=function(){return C!=null;
};
}function AutoSaveComment(G){var B=null;
var C="comment_title";
function I(L){Element.addClassName(L,"autosave");
}function D(L){autoSave.clearTimer();
var M="autosaveDone";
Element.removeClassName(M,"autosave");
setTimeout(function(){I(M);
},3000);
}function A(){var N="new-post";
var L=$(N);
var M=new Object();
M.title=$(C).value;
M.body=replyForm.getHTML();
ajaxController.saveCommentData(M,{callback:D});
}function J(){if(B==null){B=setTimeout(A,DELAY_AS);
}}function F(L){if(confirm(G)){$(C).value=L.title;
replyForm.setHTML(L.body);
}else{E();
}}function H(){ajaxController.getSavedCommentData({callback:F});
}function E(){ajaxController.deleteSavedCommentData();
}function K(){if(B!=null){clearTimeout(B);
B=null;
}}this.clearTimer=K;
this.save=J;
this.restore=H;
this.clear=E;
this.getTimer=function(){return B!=null;
};
}function initialize(B,F,K,J,G,S,L,I,D,P,R,N,H,M,C,Q,O,E){paramUserId=H;
paramEntryId=M;
tinyMCE.init({theme:"advanced",plugins:"-headhunter,media,spellchecker",theme_advanced_buttons1:"",theme_advanced_buttons2:"",theme_advanced_buttons3:"",convert_urls:false,apply_source_formatting:false,force_p_newlines:false,force_br_newlines:true,forced_root_block:"",force_br_newlines:false,theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",mode:"exact",editor_css:B,content_css:F,language:K,handle_event_callback:saveData});
function A(){replyForm=new ReplyForm(null,"body");
replyForm.showRichEditor();
if(N>1){avatarSupport=new GetAvatarSupport(J,G,S,L);
}illustrationSupport=new IllustrationSupport(P,J);
if(E){if(M==""){autoSave=new AutoSaveEntry(O);
if(Q=="true"){setTimeout(autoSave.restore,2000);
}}}}PREVIEW_URL=D;
editorActionBarSupport=new EditorActionBarSupport(P,"body");
Event.observe(window,"load",A);
}function showSelectTags(){Element.toggleClassName("tags-select","tags-opened");
}function insertTags(){try{var E=$("tags");
var D=E.value;
if(D.length!=0&&D[D.length-2]!=","){D+=", ";
}var A=$("selectTags");
for(var B=0;
B<A.options.length;
B++){D+=A.options[B].selected?A.options[B].text+", ":"";
}if(D.length!=0){D=D.substr(0,D.length-2);
}E.value=D;
showSelectTags();
}catch(C){}}function createSubmit(A){if(A=="_eventId_deleteAsync"){entryService.deleteEntryById(entryid,function(){document.getElementById("new-post").submit();
});
}else{var B=document.getElementById("new-post");
hidden=document.getElementById("eventId");
hidden.name=A;
hidden.value="true";
B.submit();
}}function saveData(){if(autoSave!=null){if(!autoSave.getTimer()){autoSave.save();
}}return true;
}function PollModel(E,A,C,K,D,I,M){this.upUrl=E;
this.downUrl=A;
this.delUrl=C;
this.voidUrl=K;
this.upHint=D;
this.downHint=I;
this.delHint=M;
this.counter=0;
this.answers=new Array();
Answer=function(X,W,U,V,T,S){this.id=X;
this.text=W;
this.canup=U;
this.candown=V;
this.editable=T;
this.order=S;
this.deletable=T;
};
this.getFirst=function L(S){for(var T=0;
T<this.answers.length;
T++){if(this.answers[T]!=null){return T;
}}};
this.getLiveCount=function O(){var T=0;
for(var S=0;
S<this.answers.length;
S++){if(this.answers[S]!=null){T++;
}}return T;
};
this.getLast=function P(S){for(var T=this.answers.length-1;
T>=0;
T--){if(this.answers[T]!=null){return T;
}}};
this.verify=function B(){var S=this.getLast();
var V=this.getFirst();
var U=this.getLiveCount();
for(var T=0;
T<this.answers.length;
T++){if(this.answers[T]!=null){this.answers[T].canup=true;
this.answers[T].candown=true;
if(V==T){this.answers[T].canup=false;
}else{if(S==T){this.answers[T].candown=false;
}}if(this.answers[T].editable){if(U>2){this.answers[T].deletable=true;
}else{this.answers[T].deletable=false;
}}else{this.answers[T].deletable=false;
}}}};
this.flush=function J(){for(var S=0;
S<this.answers.length;
S++){if(this.answers[S]!=null&&this.answers[S].editable){domEl=document.getElementById("answers["+this.answers[S].order+"].text");
if(domEl){this.answers[S].text=domEl.value;
}}}};
this.down=function G(S){this.flush();
for(var U=S+1;
U<this.answers.length;
U++){if(this.answers[U]!=null){var T=this.answers[U];
this.answers[U]=this.answers[S];
this.answers[S]=T;
this.answers[S].order=S;
this.answers[U].order=U;
break;
}}this.verify();
this.render();
};
this.up=function F(S){this.flush();
for(var U=S-1;
U>=0;
U--){if(this.answers[U]!=null){var T=this.answers[U];
this.answers[U]=this.answers[S];
this.answers[S]=T;
this.answers[S].order=S;
this.answers[U].order=U;
break;
}}this.verify();
this.render();
};
this.remove=function Q(T){this.flush();
var S=this.answers[T];
if(S!=null&&(S.editable&&S.deletable)){this.answers[T]=null;
}this.verify();
this.render();
};
this.render=function R(){var U=$("entry-poll-answers");
var W="";
var S=this.answers.length;
if(this.answers.length>0){for(var V=0;
V<S;
V++){var T=this.answers[V];
if(T==null){continue;
}W+='<table><tr><td class="label">'+(T.first?'<label for="tags">${answerVariants}:</label>':"")+'</td><td class="input">'+(T.editable?'<input id ="answers['+T.order+'].text" type="text" class="text" value="'+T.text+'" name="answers['+T.order+'].text"/>':'<input id ="answers['+T.order+'].text" type="text" disabled="disabled" class="text" value="'+T.text+'" name="answers['+T.order+'].text"/><input type="hidden" class="text" value="'+T.text+'" name="answers['+T.order+'].text"/>')+'</td><td nowrap="" class="entry-poll-nav">'+(T.candown?'<span class="g-clickable" onclick="QA.down('+T.order+')"><img alt="'+this.downHint+'" src="'+this.downUrl+'"/></span>':'<img alt="" src="'+this.voidUrl+'"/>')+(T.canup?'<span class="g-clickable" onclick="QA.up('+T.order+')"><img alt="'+this.upHint+'" src="'+this.upUrl+'"/></span>':'<img alt="" src="'+this.voidUrl+'"/>')+(T.deletable?'<div class="entry-poll-slash"></div><span onclick="QA.remove('+T.order+')" class="g-clickable"><img alt="'+this.delHint+'" src="'+this.delUrl+'"/></span>':'<img alt="" src="'+this.voidUrl+'"/>')+'<input type="hidden" name="answers['+T.order+'].id" value="'+T.id+'"/></td></tr></tbale>';
}}U.innerHTML=W;
};
this.addEmptyAnswer=function N(){this.flush();
var S=this.createAnswer("","",true,true,true);
this.add(S);
this.verify();
this.render();
};
this.add=function H(S){this.answers.push(S);
return this;
};
this.createAnswer=function(X,W,U,V,T,S){return new Answer(X,W,U,V,T,this.counter++);
};
}
function getActiveChild(F,J){var I=document.getElementById(F);
var C=I.getElementsByTagName("DIV");
for(var E=0;
E<C.length;
E++){var B=C.item(E);
if(B.getAttribute("name")==J&&B.className=="active"){var K=new Object();
var G=B.getElementsByTagName("SPAN");
for(var D=0;
D<G.length;
D++){var H=G.item(D);
var A=H.getAttribute("name");
if(A){K[A]=DWRUtil.getValue(H);
}}return K;
}}return null;
}
function EditorSupport(L,F){var G=this;
var D;
function C(){return L;
}function E(){K("text");
}function J(){K("rich");
}function H(){return D;
}function K(M){if(!M){M="rich";
}if(M=="rich"){if(G.editorId){return ;
}tinymce.EditorManager.execCommand("mceAddEditor",false,G.textAreaId);
G.editorId=C();
}else{if(M=="text"){if(tinymce.EditorManager.get(C())!=null){tinymce.EditorManager.execCommand("mceRemoveControl",false,C());
}G.editorId=null;
}else{alert("unknown mode: "+M);
return ;
}}D=M;
}function B(){return tinymce.EditorManager.get(C());
}function A(M){var O="";
if(H()=="rich"){var N=B();
O=N.getContent();
}else{O=$(L).value;
}return O;
}function I(M){if(H()=="rich"){B().setContent(M);
}else{$(L).value=M;
}}this.getHTML=A;
this.setHTML=I;
this.editorId=undefined;
this.textAreaId=L;
this.showTextEditor=E;
this.showRichEditor=J;
this.getMode=H;
this.showEditor=K;
}
function EditorActionBarSupport(Bc,BV){var c=this;
var g=false;
var Bh=false;
var w=false;
var Ag=false;
var A0=false;
var z=false;
var V=false;
var j=false;
var t=false;
var AB=false;
var T=false;
var Ar=false;
var A2=false;
var BJ=false;
var BQ=false;
var BG=false;
var BD=false;
var Bi=false;
var Bg=false;
var Aa="boldCommand";
var Av="italicCommand";
var AH="underlineCommand";
var a="alignLeftCommand";
var J="alignRightCommand";
var b="alignCenterCommand";
var Au="alignFullCommand";
var AI="listBulletsCommand";
var P="listNumeringCommand";
var l="cutCommand";
var Ax="linkCommand";
var B="pictureCommand";
var Y="videoCommand";
var h="clearFormatCommand";
var An="spellCommand";
var AM="quoteCommand";
var Bd="searchUserCommand";
var At="searchCommunityCommand";
var Bj="editor-popup-user";
var Ah="editor-popup-community";
var N="editor-popup-url";
var Ao="editor-popup-picture";
var BA="editor-popup-video";
var Ak="lastname";
var Af="communityTitle";
var K="urlInput";
var k="src";
var I="uploadOption";
var U="videoCode";
var n="illustrationNumber";
var x="illustrationId";
var Ap="illustrationType";
var BW=null;
function Bk(){var Bo=$(Aa);
Bo.src=Bc+"css/images/editor/bold_on.gif";
}function r(){var Bo=$(Aa);
if(!g){Bo.src=Bc+"css/images/editor/bold.gif";
}}function AZ(Bo){return Bo.indexOf("_on.")==Bo.indexOf("_active.");
}function AD(Bp){var Bo=$(Aa);
if(Bp&&AZ(Bo.src)){g=true;
Bo.src=Bc+"css/images/editor/bold_on.gif";
}else{g=false;
Bo.src=Bc+"css/images/editor/bold.gif";
}}function X(){var Bo=$(An);
Bo.src=Bc+"css/images/editor/spell_on.gif";
}function Ai(){var Bo=$(An);
if(!BD){Bo.src=Bc+"css/images/editor/spell.gif";
}}function Al(){var Bo=$(h);
Bo.src=Bc+"css/images/editor/eraser_on.gif";
}function d(){var Bo=$(h);
if(!Bg){Bo.src=Bc+"css/images/editor/eraser.gif";
}}function L(){var Bo=$(AM);
Bo.src=Bc+"css/images/editor/quote_on.gif";
}function AX(){var Bo=$(AM);
if(!Bi){Bo.src=Bc+"css/images/editor/quote.gif";
}}function v(){var Bo=$(Av);
Bo.src=Bc+"css/images/editor/italic_on.gif";
}function AF(){var Bo=$(Av);
if(!Bh){Bo.src=Bc+"css/images/editor/italic.gif";
}}function p(Bp){var Bo=$(Av);
if(Bp&&AZ(Bo.src)){Bh=true;
Bo.src=Bc+"css/images/editor/italic_on.gif";
}else{Bh=false;
Bo.src=Bc+"css/images/editor/italic.gif";
}}function A3(){var Bo=$(AH);
Bo.src=Bc+"css/images/editor/underlined_on.gif";
}function Am(){var Bo=$(AH);
if(!w){Bo.src=Bc+"css/images/editor/underlined.gif";
}}function AV(Bp){var Bo=$(AH);
if(Bp&&AZ(Bo.src)){w=true;
Bo.src=Bc+"css/images/editor/underlined_on.gif";
}else{w=false;
Bo.src=Bc+"css/images/editor/underlined.gif";
}}function BB(){var Bo=$(a);
Bo.src=Bc+"css/images/editor/align_left_on.gif";
}function Ay(){var Bo=$(a);
if(!Ag){Bo.src=Bc+"css/images/editor/align_left.gif";
}}function As(Bp){var Bo=$(a);
if(Bp&&AZ(Bo.src)){Ag=true;
Bo.src=Bc+"css/images/editor/align_left_on.gif";
}else{Ag=false;
Bo.src=Bc+"css/images/editor/align_left.gif";
}}function Z(){var Bo=$(J);
Bo.src=Bc+"css/images/editor/align_right_on.gif";
}function W(){var Bo=$(J);
if(!A0){Bo.src=Bc+"css/images/editor/align_right.gif";
}}function AL(Bp){var Bo=$(J);
if(Bp&&AZ(Bo.src)){A0=true;
Bo.src=Bc+"css/images/editor/align_right_on.gif";
}else{A0=false;
Bo.src=Bc+"css/images/editor/align_right.gif";
}}function BY(){var Bo=$(b);
Bo.src=Bc+"css/images/editor/align_center_on.gif";
}function AT(){var Bo=$(b);
if(!z){Bo.src=Bc+"css/images/editor/align_center.gif";
}}function BS(Bp){var Bo=$(b);
if(Bp&&AZ(Bo.src)){Bo.src=Bc+"css/images/editor/align_center_on.gif";
}else{Bo.src=Bc+"css/images/editor/align_center.gif";
}}function AS(){var Bo=$(AI);
Bo.src=Bc+"css/images/editor/list_bullets_on.gif";
}function R(){var Bo=$(AI);
if(!j){Bo.src=Bc+"css/images/editor/list_bullets.gif";
}}function AQ(Bp){var Bo=$(AI);
if(Bp&&AZ(Bo.src)){Bo.src=Bc+"css/images/editor/list_bullets_on.gif";
}else{Bo.src=Bc+"css/images/editor/list_bullets.gif";
}}function A6(){var Bo=$(P);
Bo.src=Bc+"css/images/editor/list_numering_on.gif";
}function f(){var Bo=$(P);
if(!t){Bo.src=Bc+"css/images/editor/list_numering.gif";
}}function A8(Bp){var Bo=$(P);
if(Bp&&AZ(Bo.src)){Bo.src=Bc+"css/images/editor/list_numering_on.gif";
}else{Bo.src=Bc+"css/images/editor/list_numering.gif";
}}function Ae(){var Bo=$(l);
Bo.src=Bc+"css/images/editor/cut_on.gif";
}function A7(){var Bo=$(l);
if(!Ar){Bo.src=Bc+"css/images/editor/cut.gif";
}}function u(Bp){var Bo=$(l);
if(Bo&&AZ(Bo.src)){if(Bp&&!Ar){Bo.src=Bc+"css/images/editor/cut_on.gif";
}else{Bo.src=Bc+"css/images/editor/cut.gif";
}}}function BP(){var Bo=$(Au);
Bo.src=Bc+"css/images/editor/align_justify_on.gif";
}function BC(){var Bo=$(Au);
if(!V){Bo.src=Bc+"css/images/editor/align_justify.gif";
}}function A5(Bp){var Bo=$(Au);
if(Bp&&AZ(Bo.src)){Bo.src=Bc+"css/images/editor/align_justify_on.gif";
}else{Bo.src=Bc+"css/images/editor/align_justify.gif";
}}function F(){if(!A2){var Bo=$(Ax);
Bo.src=Bc+"css/images/editor/url_on.gif";
}}function y(){if(!A2){var Bo=$(Ax);
Bo.src=Bc+"css/images/editor/url.gif";
}}function Ad(Bp){var Bo=$(Ax);
if(Bp){Bo.src=Bc+"css/images/editor/url_active.gif";
}else{Bo.src=Bc+"css/images/editor/url.gif";
}}function AP(){q();
BR();
AY();
BU();
AA();
if(!A2){A2=true;
Ad(true);
$(N).style.visibility="visible";
$(K).value="";
$(K).focus();
}else{D();
}}function D(){if(A2){$(N).style.visibility="hidden";
y();
A2=false;
Ad(false);
Q();
}}function s(){D();
var Bo=$(K).value;
if(Bo.indexOf("http://")!=0&&Bo.indexOf("https://")!=0){Bo="http://"+Bo;
}Q();
html=instance.selection.getContent();
if(html==""){tinymce.EditorManager.execInstanceCommand(o(),"mceInsertContent",true,'<span><a href="'+Bo+'">'+Bo+"</a></span>");
return ;
}tinymce.EditorManager.execCommand("mceReplaceContent",true,'<span><a href="'+Bo+'">'+html+"</a></span>");
}function BO(){if(!BQ){var Bo=$(Y);
Bo.src=Bc+"css/images/editor/video_on.gif";
}}function m(){if(!BQ){var Bo=$(Y);
Bo.src=Bc+"css/images/editor/video.gif";
}}function Bm(Bp){var Bo=$(Y);
if(Bp){Bo.src=Bc+"css/images/editor/video_active.gif";
}else{Bo.src=Bc+"css/images/editor/video.gif";
}}function AE(){q();
BR();
AY();
BU();
D();
if(!BQ){BQ=true;
Bm(true);
$(BA).style.visibility="visible";
}else{AA();
}}function AA(Bo){if(BQ){$(BA).style.visibility="hidden";
m();
BQ=false;
Bm(false);
if(!Bo){Q();
}}}function BZ(){AA(true);
var Bo=tinymce.EditorManager.activeEditor.getContent();
var Bp=Bo.substring(0,BI.start);
var Bq=Bo.substring(BI.end,Bo.length);
tinymce.EditorManager.activeEditor.setContent(Bp+$(U).value+Bq);
Q();
}function BT(){if(!BJ){var Bo=$(B);
Bo.src=Bc+"css/images/editor/image_on.gif";
}}function E(){if(!BJ){var Bo=$(B);
Bo.src=Bc+"css/images/editor/image.gif";
}}function AR(Bp){var Bo=$(B);
if(Bp){Bo.src=Bc+"css/images/editor/image_active.gif";
}else{Bo.src=Bc+"css/images/editor/image.gif";
}}function i(){$("uploadnew").checked=true;
}function Be(Bp){var Bo=window.frames.pictureUploadFrame;
if(Bo==null){return null;
}return Bo.document.getElementById(Bp);
}function Ac(){q();
BR();
AY();
D();
AA();
if(!BJ){BJ=true;
AR(true);
var Bo=Be("newImageFile");
if(Bo!=null){Bo.onclick=i;
}$(Ao).style.visibility="visible";
}else{BU();
}}function BU(){if(BJ){$(Ao).style.visibility="hidden";
E();
BJ=false;
AR(false);
Q();
}}function A4(Bo){alert(Bo);
Aq(true);
}function S(Bo){imageService.getIllustration(Bo,function(Bp){var Bq=illustrationSupport.getPictureSrc(Bp.storageId,Bp.imageType);
G(Bq);
Aq(true);
});
return false;
}function Aq(Bo){$("okButton").style.display=Bo?"block":"none";
$("ajaxIndicator").style.display=Bo?"none":"block";
}function Az(){tinymce.EditorManager.activeEditor.editorCommands.RemoveFormat();
}function Bn(){var Bq=$("linkpic");
var Bs=$("gallerypic");
var Bt=$("uploadnew");
var Bp=$("src");
var Bo=Be("newImageFile");
var Br=$("illustrationId");
var Bu="";
if(Bq.checked){if(Bp.value.length>0){Bu=M();
if($(I).checked){A1(Bu);
return ;
}}else{alert(NO_PICTURE_URL);
}}else{if(Bs.checked){if(Br.value>0){Bu=Bf();
}else{alert(PICTURE_NOT_FOUND);
}}else{if(Bt.checked){if(AK(Bo.value)){BK();
}else{alert(NO_PICTURE_FILE);
}}}}if(Bu!=""){G(Bu);
}}function G(Bp){BU();
var Bo="";
if($("alt").value!=""){Bo='alt="'+$("alt").value+'"';
}var Bq=$("align").options[$("align").selectedIndex].value;
if(Bq!=""){Bq='align="'+Bq+'"';
}GetImageDimensions(Bp,c,function(Bu){var Bt=0;
var Br=0;
if(Bu.w<=500&&Bu.h<=500){Bt=Bu.w;
Br=Bu.h;
}else{if(Bu.w>Bu.h){Bt=500;
Br=Math.floor(Bt/((Bu.w+0.0001)/Bu.h));
}else{if(Bu.w<Bu.h){Br=500;
Bt=Math.floor(Br/((Bu.h+0.0001)/Bu.w));
}else{Br=500;
Bt=500;
}}}var Bs='<img src="'+Bp+'" '+Bo+Bq+' width="'+Bt+'" height="'+Br+'"/>';
if(Bp.indexOf("/")!=0){Bs='<a href="'+Bp+'" target="_blank">'+Bs+"</a>";
}tinymce.EditorManager.execInstanceCommand(c.getEditor(),"mceInsertContent",true,Bs);
});
}function M(){var Bo=$(k).value;
if(Bo.indexOf("http://")!=0){Bo="http://"+Bo;
}return Bo;
}function A1(Bo){uploadImageController.saveImageByUrl(Bo,function(Bp){if(Bp.errorCode==null){G(Bp.url);
}else{alert(Bp.errorText);
}});
}function BK(){Aq(false);
var Bo=Be("avatarForm");
Bo.submit();
}function AK(Bo){var Bq=Bo.lastIndexOf(".");
var Bp=Bo.substring(Bq,Bo.length).toLowerCase();
return(Bp==".jpg"||Bp==".jpeg"||Bp==".png"||Bp==".gif");
}function Bf(){var Bq=$(x).value;
var Bo=$(Ap).value;
var Bp=illustrationSupport.getPictureSrc(Bq,Bo);
return Bp;
}function BH(){if(!AB){var Bo=$(Bd);
Bo.src=Bc+"css/images/editor/id_user_on.gif";
}}function BE(){if(!AB){var Bo=$(Bd);
Bo.src=Bc+"css/images/editor/id_user.gif";
}}function Bl(Bp){var Bo=$(Bd);
if(Bp){Bo.src=Bc+"css/images/editor/id_user_active.gif";
}else{Bo.src=Bc+"css/images/editor/id_user.gif";
}}function AY(){if(AB){$(Bj).style.visibility="hidden";
BE();
AB=false;
Bl(false);
Aw().hideUserResult();
Q();
}}function H(){q();
BR();
BU();
D();
AA();
if(!AB){AB=true;
Bl(true);
$(Bj).style.visibility="visible";
}else{AY();
}}this.catchSelection=function(){try{if(window.getSelection()!=""&&window.getSelection()!=null){return window.getSelection().toString();
}else{return"";
}}catch(Bp){try{if(document.selection!=""&&document.selection!=null){var Bo=document.selection.createRange();
return Bo.text.toString();
}return"";
}catch(Bp){return"";
}}};
function A9(){BM(this.catchSelection());
}function BM(Bp){if(Bp==""){alert(global_messages["text.selectTextBeforeQuote"]);
return ;
}var Bq=tinymce.EditorManager.get(o());
var Bo=Bq.getContent();
Bq.setContent(Bo+'<div class="quote-text">'+Bp+"</div> <div> <br/> </div>");
}function O(Bu,Bs){if(!replyForm.isShown()){replyForm.showReply(Bu);
setTimeout(function(){editorActionBarSupport.doQuoteAuth(Bu,Bs);
},1000);
return ;
}var Bp=this.catchSelection();
var Bt=$("userName:"+Bu).innerHTML;
if(Bp==""){var Br=$("body:"+Bu);
if(Br!=null){Bp=Br.innerHTML;
}}if(Bp==""){alert(global_messages["text.selectTextBeforeQuote"]);
return ;
}var Bq=tinymce.EditorManager.get(o());
var Bo=Bq.getContent();
Bq.setContent(Bo+'<div class="quote-text"><strong>'+Bt+"</strong> "+global_messages["msg.hasWritten."+Bs]+"<br/>"+Bp+"</div> <div> <br/> </div>");
}function AU(Bp){var Bo=$(At);
if(Bp){Bo.src=Bc+"css/images/editor/id_community_active.gif";
}else{Bo.src=Bc+"css/images/editor/id_community.gif";
}}function BF(){if(!T){var Bo=$(At);
Bo.src=Bc+"css/images/editor/id_community_on.gif";
}}function AJ(){if(!T){var Bo=$(At);
Bo.src=Bc+"css/images/editor/id_community.gif";
}}function BR(){if(T){$(Ah).style.visibility="hidden";
AJ();
AU(false);
T=false;
Aw().hideCommunityResult();
Q();
}}function Bb(){return tinymce.EditorManager.getInstanceById(o());
}var BI=null;
function q(){instance=Bb();
BI=instance.selection.getBookmark(true);
}function Q(){instance=Bb();
instance.selection.moveToBookmark(BI);
BI=null;
}function Aj(){q();
AY();
BU();
D();
AA();
if(!T){T=true;
AU(true);
$(Ah).style.visibility="visible";
$(Af).focus();
}else{BR();
}}var AC=null;
function AG(Bo){if(AC){Element.removeClassName(AC,"active");
}Element.addClassName(Bo,"active");
AC=Bo;
}function AN(){tinymce.EditorManager.execInstanceCommand(o(),"mceSpellCheck");
}function AW(){return{searchUsers:function(){},searchCommunities:function(){},pasteUserResult:function(){},pasteCommunityResult:function(){}};
}function Aw(){if(!BW){if(EditorActionBarSearchSupport){BW=new EditorActionBarSearchSupport(Bc);
return BW;
}else{return AW();
}}return BW;
}function AO(Bo){Aw().searchUsers(Bo);
}function Ba(){AY();
Aw().pasteUserResult(o());
}function C(){BR();
Aw().pasteCommunityResult(o());
}function e(Bo){Aw().searchCommunities(Bo);
}function BX(){tinymce.EditorManager.execCommand("mceFocus",false,o());
tinymce.EditorManager.execCommand("selectall",false,o());
instance=tinymce.EditorManager.getInstanceById(o());
selection=instance.selection;
if(tinymce.isIE){rng=selection.getRng();
rng.collapse(false);
rng.select();
}else{sel=selection.getSel();
sel.collapseToEnd();
}}function BN(){instance=tinymce.EditorManager.getInstanceById(o());
html=instance.selection.getContent();
if(html==""||html==null){tinymce.EditorManager.execCommand("mceInsertContent",true,' <div class="live-cut"><p><br/></p></div> ');
}else{tinymce.EditorManager.execCommand("mceReplaceContent",true,' <div class="live-cut">'+html+"</div> ");
}}function Ab(Bp,Bo){if(tinymce.isIE){Ab(Bo);
}}var BL=null;
function Ab(Bo){var Bq=null;
if(!BL){Bq=$("pad-grey");
if(!Bq){return ;
}BL=Bq.getElementsByTagName("SELECT");
}if(BL){for(var Bp=0;
Bp<BL.length;
Bp++){BL[Bp].style.visibility=Bo?"visible":"hidden";
}}}function A(Bo){tinymce.EditorManager.execInstanceCommand(editorActionBarSupport.getEditor(),"FormatBlock",false,Bo);
}function o(){return tinymce.EditorManager.get(BV).id;
}this.activateBold=AD;
this.activateItalic=p;
this.activateUnderline=AV;
this.activateAlignLeft=As;
this.activateAlignRight=AL;
this.activateAlignCenter=BS;
this.activateAlignFull=A5;
this.activateListBullets=AQ;
this.activateListNumering=A8;
this.activateCut=u;
this.activateVideo=AE;
this.activatePicture=Ac;
this.hiBold=Bk;
this.hiItalic=v;
this.hiUnderline=A3;
this.hiAlignLeft=BB;
this.hiAlignRight=Z;
this.hiAlignCenter=BY;
this.hiAlignFull=BP;
this.hiListBullets=AS;
this.hiListNumering=A6;
this.hiCut=Ae;
this.hiLink=F;
this.hiPicture=BT;
this.hiVideo=BO;
this.hiSpell=X;
this.hiQuote=L;
this.hiClearFormat=Al;
this.loSpell=Ai;
this.loBold=r;
this.loItalic=AF;
this.loUnderline=Am;
this.loAlignLeft=Ay;
this.loAlignRight=W;
this.loAlignCenter=AT;
this.loAlignFull=BC;
this.loListBullets=R;
this.loListNumering=f;
this.loCut=A7;
this.loLink=y;
this.loPicture=E;
this.loVideo=m;
this.loQuote=AX;
this.loClearFormat=d;
this.hiSearchUser=BH;
this.hiSearchCommunity=BF;
this.loSearchUser=BE;
this.loSearchCommunity=AJ;
this.activateSearchUser=H;
this.activateSearchCommunity=Aj;
this.activateLink=AP;
this.hideLink=D;
this.hidePicture=BU;
this.hideVideo=AA;
this.hideSearchUser=AY;
this.hideSearchCommunity=BR;
this.hiRow=AG;
this.searchUsers=AO;
this.searchCommunities=e;
this.moveCursorToEnd=BX;
this.pasteUserResult=Ba;
this.pasteCommunityResult=C;
this.pasteLink=s;
this.pastePicture=Bn;
this.pasteVideo=BZ;
this.pasteUploaded=S;
this.breakUpload=A4;
this.getEditor=o;
this.cut=BN;
this.setFormat=A;
this.spell=AN;
this.doQuote=A9;
this.doQuoteAuth=O;
this.clearFormat=Az;
}
function EditorActionBarSearchSupport(P){var I="userNotFound";
var E="communityNotFound";
function O(W){var X=W.bean;
if(X&&X>5){$("users").addClassName("scroll");
}else{$("users").removeClassName("scroll");
}Element.update("users",W.html);
F("user",X);
}function F(X,Y){var W=$(X+"SearchResult");
if(W){if(Y>0){W.className="result";
}else{W.className="empty-result";
}}}function L(W){var X=W.bean;
if(X&&X>5){$("communities").addClassName("scroll");
}else{$("communities").removeClassName("scroll");
}Element.update("communities",W.html);
F("community",X);
}function G(W){title=$("communityTitle");
titleValue=title.value;
if(N(titleValue)){alert(W);
return ;
}searchCommunitiesEditorController.editorSearch({title:title.value},{callback:L});
}function N(X){var W=/[\S]/;
return X.match(W)==null;
}function D(Y){var Z={};
var X=$("searchByUsername");
var W=$("searchByOrganization");
if(X.checked==true){last=$("lastname").value!="Фамилия"?$("lastname").value:"";
first=$("firstname").value!="Имя"?$("firstname").value:"";
second=$("secondname").value!="Отчество"?$("secondname").value:"";
Z={lastName:last,firstName:first,secondName:second,organization:"",searchType:"SEARCH_BY_NAME"};
if(N(Z.lastName)&&N(Z.firstName)&&N(Z.secondName)){alert(Y);
return ;
}}else{if(W.checked==true){org=$("organization").value!="Организация"?$("organization").value:"";
Z={lastName:"",firstName:"",secondName:"",organization:org,searchType:"SEARCH_BY_ORGANIZATION"};
if(N(Z.organization)){alert(Y);
return ;
}}}searchUsersEditorController.editorSearch(Z,{callback:O});
}var C=null;
var V=null;
function S(W){if(W.attributes.name.value=="userCode"){C=DWRUtil.getValue(W);
}else{if(W.attributes.name.value=="userName"){V=DWRUtil.getValue(W);
}}}function T(W){if(W.id!=I&&Element.hasClassName(W,"active")){codeAndName=W.getElementsByTagName("SPAN");
$A(codeAndName).each(S);
}}function H(W){if(W.attributes.name.value=="communityCode"){C=DWRUtil.getValue(W);
}else{if(W.attributes.name.value=="communityTitle"){V=DWRUtil.getValue(W);
}}}function U(W){if(W.id!=E&&Element.hasClassName(W,"active")){codeAndName=W.getElementsByTagName("SPAN");
$A(codeAndName).each(H);
}}function K(Y,X){var W='"'+P+Y+'/passport"';
return'&#160;<a class="user" href='+W+'><img style="vertical-align:middle;" src="'+resourcesUrl+'/css/images/icon_user_small.gif"/></a><a href='+W+">"+X+"</a>&#160;";
}function B(Y,X){var W="'"+P+Y+"/passport'";
return'&#160;<a class="user" href='+W+'><img style="vertical-align:middle;" src="'+resourcesUrl+'/css/images/icon_community_small.gif"/></a><a href='+W+">"+X+"</a>&#160;";
}function A(W){var X=$("users").getElementsByTagName("DIV");
$A(X).each(T);
if(V&&C){tinyMCE.execInstanceCommand(W,"mceInsertContent",true,K(C,V));
}V=null;
C=null;
J("user");
}function J(X){var W=$(X+"SearchResult");
if(W){W.className="hidden";
}}function R(W){var X=$("communities").getElementsByTagName("DIV");
$A(X).each(U);
if(V&&C){tinyMCE.execInstanceCommand(W,"mceInsertContent",true,B(C,V),true);
}V=null;
C=null;
J("community");
}function M(){$("users").removeClassName("scroll");
J("user");
}function Q(){$("communities").removeClassName("scroll");
J("community");
}this.searchUsers=D;
this.searchCommunities=G;
this.pasteUserResult=A;
this.pasteCommunityResult=R;
this.hideUserResult=M;
this.hideCommunityResult=Q;
}
function GetAvatarSupport(C,J,F,I){function K(L){if(L==null){return ;
}$(I).value=L;
G(L);
}function B(L){return function(Q){var P="chooseAvatarInput";
var O="chooseAvatarImg";
var N=$(P);
var M=$(O);
if(Q!=null){N.value=Q.number;
M.src="/avatar/medium/"+Q.storageId+"."+Q.imageType;
M.style.visibility="visible";
}else{M.style.visibility="hidden";
}};
}function A(){if(isNaN($(I).value)){$(I).value="";
trySetDefaults("");
}}function E(M){var L="chooseAvatarInput";
imageService.getAvatar($(L).value,B(M));
}function H(M){var L="chooseAvatarInput";
imageService.getNextAvatar($(L).value,B(M));
}function D(M){var L="chooseAvatarInput";
imageService.getPrevAvatar($(L).value,B(M));
}function G(L){if(L&&L!=null){$("imgPortrait").src=J+"?n="+L+"&c="+C;
}else{$("imgPortrait").src=F;
}}this.applyChanges=K;
this.changeImg=E;
this.getNextAvatar=H;
this.getPrevAvatar=D;
}
function IllustrationSupport(E,H){var M="illustrationNumber";
var A="illustrationId";
var N="illustrationType";
var D="illustrationImage";
var C="illustrationDescription";
var I="css/images/picture_not_found.gif";
function G(){return function(T){var P=$(M);
var R=$(A);
var S=$(N);
var O=$(D);
if(T!=null){P.value=T.number;
R.value=T.storageId;
S.value=T.imageType;
var Q=T.description==null?"":T.description;
Element.update(C,Q);
O.src=B(T.storageId,T.imageType);
}else{R.value=-1;
O.src=E+I;
}};
}function B(P,O){return E+"gallery/big/"+P+"."+O;
}function L(P,O){return"/pictures/"+P+"."+O;
}function J(){imageService.getNextIllustration($(M).value,G());
}function F(){imageService.getPrevIllustration($(M).value,G());
}function K(){imageService.getIllustration($(M).value,G());
}this.changeImg=K;
this.getNext=J;
this.getPrev=F;
this.getPictureSrc=L;
}
function JoinToCommunitySupport(){var B=null;
function D(E){try{if(B==null){B=new Object();
joinCommunityController.join(E,A);
}}catch(F){alert(F);
}}function C(E){try{if(B==null){B=new Object();
joinCommunityController.retire(E,A);
}}catch(F){alert(F);
}}function A(E){if(E.bean=="JOIN_OK"||E.bean=="RETIRE_OK"){window.location.reload();
}var F=$("menu:feeds");
if(F!=null){F.innerHTML=E.html;
}B=null;
}this.join=D;
this.retire=C;
}
function getCommentAvatar(){try{var A="chooseAvatarInput";
return $(A).value;
}catch(B){return null;
}}function commentCallback(A){$("commentPreview").innerHTML=A.html;
$("commentPreview").style.display="block";
}function hidePreviewComment(){$("commentPreview").style.display="none";
}function commentPreview(){try{if(tinyMCE&&tinyMCE.triggerSave){tinyMCE.triggerSave();
}}catch(D){}var A=$("comment_title").value;
var C=$("body").value;
var B=$("commentanonimously").checked;
try{commentPreviewController.getPreview(C,A,B,getCommentAvatar(),{callback:commentCallback});
}catch(D){}}
function getEntryPreviewDate(){try{var A=$("pubdate").value.split(".");
var C=new Date(A[2],A[1]-1,A[0]);
var B=new Date();
C.setHours(B.getHours());
C.setMinutes(B.getMinutes());
if(C.getHours()!=B.getHours()){throw"invalid date format";
}return C;
}catch(D){return new Date();
}}function getEntryAvatar(){try{var A="chooseAvatarInput";
return $(A).value;
}catch(B){return null;
}}function getValue(C){var A=document.getElementsByName(C);
for(var B=0;
B<A.length;
B++){if(A[B].checked){return A[B].value;
}}}function entryPreview(D,G){try{if(tinyMCE&&tinyMCE.triggerSave){tinyMCE.triggerSave();
}}catch(F){}var C=$("title").value;
var E=$("body").value;
var B=$("tags").value;
var A=getValue("reader");
try{entryPreviewController.getPreview(D,E,C,B,getEntryAvatar(),A,getEntryPreviewDate(),entryPreviewCallback);
}catch(F){}}function entryPreviewCallback(A){$("previewEntryBody").innerHTML=A.html;
$("previewEntry").style.display="block";
}
function communityAnswerPreview(B,A){try{if(tinyMCE&&tinyMCE.triggerSave){tinyMCE.triggerSave();
}}catch(D){}var C=$("body").value;
try{communityAnswerPreviewController.getPreview(B,C,A,entryPreviewCallback);
}catch(D){}}function entryPreviewCallback(A){$("previewEntryBody").innerHTML=A.html;
$("previewEntry").style.display="block";
}
function Popup(C,A){var E=false;
function B(){return E;
}function D(G){if(!E){E=true;
document.images[G].src=C;
document.getElementById(A).style.visibility="visible";
}else{F();
}}function F(){if(E){E=false;
document.getElementById(A).style.visibility="hidden";
}}this.close=F;
this.click=D;
this.isActive=B;
}function popupWindow(A,B){var C=document.getElementById(A);
if(C){if(!B){C.style.top=Math.floor(document.body.clientHeight/2-C.clientHeight/2-30+document.body.scrollTop);
C.style.left=Math.floor(document.body.clientWidth/2-C.clientWidth/2+document.body.scrollLeft);
}else{C.style.top="-10000px";
C.style.left="-10000px";
}C.style.visibility=B?"hidden":"visible";
}}
function SearchCommunitySupport(){var E="communityNotFound";
function A(K,J){var H="communities:"+K;
var G="community";
var I=getActiveChild(H,G);
if(I){J(I);
}B();
}function B(){var G=$("communitySearchResult");
if(G){G.className="hidden";
}}function C(H){var G=/[\S]/;
return H.match(G)==null;
}function D(G,H){var I=$("title:"+G);
if(C(I.value)){alert(H);
B();
return ;
}var J={title:I.value};
searchCommunitiesEditorController.feedsSearch(J,{callback:function(K){F(K,G);
}});
}function F(I,H){var J=I.bean;
$("communities:"+H).style.display="none";
if(J>5){$("communities:"+H).addClassName("scroll");
}else{$("communities:"+H).removeClassName("scroll");
}Element.update("communities:"+H,I.html);
var G=$("communitySearchResult");
if(G){if(J>0){G.className="result";
}else{G.className="empty-result";
}}$("communities:"+H).style.display="block";
}this.pasteCommunity=A;
this.searchCommunities=D;
}
function SearchUserSupport(){function C(G){var F=/[\S]/;
return G.match(F)==null;
}function E(J,I){var G="users:"+J;
var F="user";
var H=getActiveChild(G,F);
if(H){I(H);
}B();
}function B(){var F=$("userSearchResult");
if(F){F.className="hidden";
}}function D(G,J){var I="users:"+J;
var H=G.bean;
$(I).style.display="none";
if(H>5){$(I).addClassName("scroll");
}else{$(I).removeClassName("scroll");
}Element.update(I,G.html);
var F=$("userSearchResult");
if(F){if(H>0){F.className="result";
}else{F.className="empty-result";
}}$(I).style.display="block";
}function A(J,H){var I={};
var G=$("byName:"+J);
var F=$("byOrg:"+J);
if(G.checked==true){I.lastName=$("lastname:"+J).value;
I.firstName=$("firstname:"+J).value;
I.secondName=$("secondname:"+J).value;
if(C(I.lastName)&&C(I.firstName)&&C(I.secondName)){alert(H);
B();
return ;
}I.searchType="SEARCH_BY_NAME";
}else{if(F.checked==true){I.organization=$("org:"+J).value;
if(C(I.organization)){alert(H);
B();
return ;
}I.searchType="SEARCH_BY_ORGANIZATION";
}else{return ;
}}searchUsersEditorController.feedsSearch(I,{callback:function(K){D(K,J);
}});
}this.paste=E;
this.search=A;
}
var INV_DELAY=15000;
function sendInvCallback(C,D,B,A){Element.update("userResult",C.html);
setTimeout(function(){Element.update("userResult","");
},INV_DELAY);
$(B).style.display="";
$(A).style.display="none";
}function sendColleagues(){var A=new Array();
var B=Form.getInputs("colleagues","checkbox","email");
for(var C=0;
C<B.length;
C++){if(B[C].checked){A.push(B[C].value);
}}if(A.length==0){return ;
}$("btnColl").style.display="none";
$("coll-active").style.display="";
inviteController.inviteColleagues(A,{callback:function(D){sendInvCallback(D,"colleaguesResult","btnColl","coll-active");
}});
}function sendUserInvite(){var B=$("lastName").value;
var D=$("firstName").value;
var A=$("email").value;
var C=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!C.test(A)){$("email-error").style.display="";
setTimeout(function(){$("email-error").style.display="none";
},INV_DELAY);
return ;
}$("btnUser").style.display="none";
$("user-active").style.display="";
inviteController.inviteUser(B,D,A,{callback:function(E){sendInvCallback(E,"userResult","btnUser","user-active");
}});
}function sendInvCommunityCallback(B,A){$("invitationStatus").innerHTML=B.html;
$("invitationStatus").style.display="";
if(B.status=="OK"){$("lastName").value="";
$("firstName").value="";
$("email").value="";
}setTimeout(function(){$("invitationStatus").style.display="none";
},INV_DELAY);
invite2CommunityController.getFriendsForm(A,updateFriends);
}function updateFriends(A){if($("inviteeCounter")){$("inviteeCounter").innerHTML=A.bean;
}if($("invitedMembers")){Element.update("invitedMembers",A.html);
}}function sendUserInviteToCommunity(A){var G=Element.getElementsBySelector($("mailUsers"),".newUserCom");
if(G.length>0){var F=new Array();
for(var D=0;
D<G.length;
D++){var C=Element.getElementsBySelector(G[D],".email")[0].value;
if(C!=""){var B=Element.getElementsBySelector(G[D],".name")[0].value;
var E={lastName:"",firstName:B,email:C,communityCode:A};
F.push(E);
}}if(F.length>0){$("inviteEmailBtn").style.display="none";
$("ciInviteIndicator2").style.display="block";
}else{return ;
}inviteController.inviteUsersToCommunity(F,new invitationHandler().callback);
}}function invitationHandler(){return{callback:function(E){var G=document.getElementById("mailUsers");
var B=Element.getElementsBySelector(G,".newUserCom");
var J=E.bean;
for(var F=0;
F<B.length;
F++){var C=B[F];
var H=C.getElementsBySelector(".email")[0].value;
var A=C.getElementsBySelector(".name")[0].value;
var K=false;
for(var D=0;
D<J.length;
D++){var I=J[D];
if(I.email==H&&I.firstName==A){K=true;
break;
}}if(!K){G.removeChild(C);
}}Element.update("mailUsersInviteResults",E.html);
addEmptyFields();
$("inviteEmailBtn").style.display="block";
$("ciInviteIndicator2").style.display="none";
}};
}function activateInvite(C){var B=$("inviteIndicator1");
var A=$("inviteIndicator2");
var D=(C==true)?"visible":"hidden";
B.style.visibility=D;
A.style.visibility=D;
}function addEmptyFields(){var A;
try{A=Element.getElementsBySelector(null,".newUserCom");
}catch(C){}if(A==null){A=new Array();
}for(var B=A.length;
B<6;
B++){addInviteeField();
}}function invitePpls(G){var D=Element.getElementsBySelector(null,".newUser");
if(D.length>0){var F=new Array();
for(var E=0;
E<D.length;
E++){var C=Element.getElementsBySelector(D[E],".check")[0];
if(C&&C.checked){var B=Element.getElementsBySelector(D[E],".email")[0].value;
var A=Element.getElementsBySelector(D[E],".name")[0].value;
F.push({name:A,email:B});
}}if(F.length>0){activateInvite(true);
DWREngine.beginBatch();
for(var E=0;
E<F.length;
E++){if(E==F.length-1){inviteController.inviteUser("",F[E].name,F[E].email,{callback:function(H){activateInvite(false);
window.location.assign(G);
}});
}else{inviteController.inviteUser("",F[E].name,F[E].email);
}}DWREngine.endBatch();
}}}function navigationFormNext(){var B=$("navigationForm");
var A=document.createElement("input");
A.type="hidden";
B.appendChild(A);
A.name="_eventId_next";
A.value="true";
B.submit();
}function addInviteeField(){var D=document.getElementById("formCount");
var E=parseInt(D.value)+1;
D.value=E;
var F=document.getElementById("mailUsers");
var C=document.createElement("div");
C.className="newUserCom";
C.id="ciLineDiv:"+E;
C.style.marginRight="1em";
C.style.paddingBottom="3px";
F.appendChild(C);
C.innerHTML='<input type="hidden" id="numail:'+E+'" class="email"/><input type="hidden" id="nuname:'+E+'" class="name"/><div style="padding:2px;float:left;width:49%;">  <input id="email:'+E+'" class="text" style="width: 100%" onkeydown="addInviteeField()" onchange="document.getElementById(\'numail:'+E+'\').value = this.value;"/></div><div style="padding:2px;float:left;width:48%;">  <input id="name:'+E+'" class="text" style="width: 100%" onkeydown="addInviteeField()" onchange="document.getElementById(\'nuname:'+E+'\').value = this.value;"/></div><div style="clear: left"><jsp:text/></div>';
var A=document.getElementById("email:"+(E-1));
if(A!=null){A.onkeydown=null;
}var B=document.getElementById("name:"+(E-1));
if(B!=null){B.onkeydown=null;
}return E;
}function addPplsToInvite(){var C=document.getElementById("notSelectedError");
C.style.visibility="hidden";
var J=Element.getElementsBySelector($("usersFromBook"),".newUser");
if(J.length>0){var I=new Array();
for(var E=0;
E<J.length;
E++){var G=Element.getElementsBySelector(J[E],".check")[0];
if(G&&G.checked){var K=Element.getElementsBySelector(J[E],".email")[0].value;
var A=Element.getElementsBySelector(J[E],".name")[0].value;
I.push({name:A,email:K});
}}if(I.length>0){$("communityInviteBtn").style.display="none";
$("ciInviteIndicator").style.display="block";
parent.removeEmptyFields();
for(var E=0;
E<I.length;
E++){var D=parent.addInviteeField();
var L=parent.document.getElementById("email:"+D);
var H=parent.document.getElementById("name:"+D);
var F=parent.document.getElementById("numail:"+D);
var B=parent.document.getElementById("nuname:"+D);
L.value=I[E].email;
F.value=I[E].email;
H.value=I[E].name;
B.value=I[E].name;
}parent.addInviteeField();
parent.addEmptyFields();
parent.popAddressBookImport(true);
}else{C.style.visibility="visible";
}}}function removeEmptyFields(){var F=$("mailUsers");
var A=true;
while(A){A=false;
var D=F.getElementsByClassName("newUserCom");
if(D.length>0){for(var E=D.length-1;
E>=0;
E--){var C=D[E].getElementsByClassName("email")[0].value;
var B=D[E].getElementsByClassName("name")[0].value;
if(C==""&&B==""){A=true;
F.removeChild(D[E]);
}}}}}
var lastMessagesType="UNREAD";
var checkAsReadCallback=function(C,B){if(B.status=="OK"){var A=$("read:"+C);
$("msg-icon:"+C).title="";
A.removeClassName("unread");
A.addClassName("read");
updateCounters(B.bean.all,B.bean.important,B.bean.unread);
}};
var checkAsRead=function(D){try{var B=$("read:"+D);
if(!B){return ;
}if(B.hasClassName("unread")){var A=function(E){checkAsReadCallback(D,E);
setVisibleIndicator(false);
};
setVisibleIndicator(true);
messageController.read(D,{callback:A,errorHandler:function(E){}});
}}catch(C){alert("Error: "+C);
}};
var vote=function(D,A){var B=A?"":prompt(global_messages["text.causeRefuse"]);
if(B==null){return ;
}setVisibleIndicator(true);
try{if(B.length==0){B=null;
}messageController.vote(D,A,B,{callback:function(E){showMessages(lastMessagesType);
setVisibleIndicator(false);
},errorHandler:function(){alert("Server error");
setVisibleIndicator(false);
}});
}catch(C){alert("Error: "+C);
}};
function setVisibleIndicator(B){var A=$("msgLoadIndicator");
A.style.visibility=(B==true)?"visible":"hidden";
}function showMessages(C){lastMessagesType=C;
setVisibleIndicator(true);
var A=$("messagesContent");
var D="importantHint";
var B=document.getElementById(D);
if(C=="IMPORTANT"){A.addClassName("onlyImportant");
A.removeClassName("onlyUnread");
B.style.display="block";
messageController.getImportantMessagesView({callback:updateMessages});
}else{if(C=="UNREAD"){A.addClassName("onlyUnread");
A.removeClassName("onlyImportant");
B.style.display="none";
messageController.getUnreadMessagesView({callback:updateMessages});
}else{if(C=="ALL"){A.removeClassName("onlyImportant");
A.removeClassName("onlyUnread");
B.style.display="none";
messageController.getAllMessagesView({callback:updateMessages});
}}}}function updateMessages(A){Element.replace("msgDataXX",A.html);
updateCounters(A.bean.all,A.bean.important,A.bean.unread);
setVisibleIndicator(false);
setOnClicks();
}function updateCounters(C,B,A){var D=$("unreadMessagesCounter");
D.innerHTML=A+" ";
$("all-messages-tab").innerHTML=C;
$("important-messages-tab").innerHTML=B;
$("unread-messages-tab").innerHTML=A;
}function deleteMessage(B){setVisibleIndicator(true);
try{messageController.deleteMessageById(B,lastMessagesType,{callback:updateMessages});
}catch(A){alert("Error: "+A);
}}function getVisibleMessageIds(){var C=new Array();
var D=Element.getElementsBySelector("msgDataXX",".msgid");
if(D.length>0){for(var B=0;
B<D.length;
B++){var A=D[B].innerHTML;
C.push(A);
}}return C;
}function deleteVisibleMessages(){var A=getVisibleMessageIds();
if(A.length>0){setVisibleIndicator(true);
messageController.deleteMessagesById(A,lastMessagesType,{callback:updateMessages});
}}function checkVisibleMessagesAsRead(){var A=getVisibleMessageIds();
if(A.length>0){setVisibleIndicator(true);
messageController.checkMessagesAsReadById(A,lastMessagesType,{callback:updateMessages});
}}function deleteReadMessages(){var B=Element.getElementsBySelector("msgDataXX",".read");
if(B.length>0){var F=new Array();
for(var E=0;
E<B.length;
E++){var A=Element.getElementsBySelector(B[E],".msgid");
if(A.length>0){for(var D=0;
D<A.length;
D++){var C=A[D].innerHTML;
F.push(C);
}}}if(F.length>0){setVisibleIndicator(true);
messageController.deleteMessagesById(F,lastMessagesType,{callback:updateMessages});
}}}function OnClickHandler(A){return{call:function(){checkAsRead(A);
}};
}function setOnClicksByMessageClass(I){var A=Element.getElementsBySelector("messagesContent","."+I);
for(var G=0;
G<A.length;
G++){var E=A[G];
var C=Element.getElementsBySelector(E,".unread");
if(C.length>0){var D=Element.getElementsBySelector(E,".msgid")[0].innerHTML;
var B=E.getElementsByTagName("A");
for(var F=0;
F<B.length;
F++){var H=B[F];
if(H.href.indexOf("/read/")<0){YAHOO.util.Event.addListener(H,"click",new OnClickHandler(D).call);
}}}}}function setOnClicks(){setOnClicksByMessageClass("message");
setOnClicksByMessageClass("important");
}
function refreshMemberList(B,C){var A=B.selectedIndex;
var E=B.options[A];
var D=E.value;
if(D==""){alert("Debuging refreshMemberList, value is empty");
return ;
}var G="community";
if(D=="ALL"){G="community";
}else{if(D=="BOSS"){G="community/admins";
}else{if(D=="BANISHED"){G="community/banished";
}else{if(D=="PUNISHED"){G="community/punished";
}else{if(D=="NOVICE"){G="community/awaiting";
}else{alert("Unexpected option: "+D);
}}}}}var F=C+"/"+G;
window.location.href=window.location.protocol+"//"+window.location.host+F;
}function updateMemberActions(C,E){var A={blogCode:C,userCode:E};
try{var D=function(K){var F=document.getElementById("action:"+E);
var J=F.options;
J.length=1;
for(var I=0;
I<K.length;
I++){var L=K[I];
var H=actions[K[I]];
var G=new Option(H,L);
J.add(G);
}F.disabled=J.length==1;
};
memberService.getMemberActionsById(A,D);
}catch(B){alert(B);
}}function doUpdateMembersWrapper(D,E,C){var B={blogCode:D,userCode:E};
var A={blogCode:D,userCode:C};
DWREngine.beginBatch();
memberService.getMemberKindById(B,function(F){doUpdateMembers(D,E,F);
});
if(C&&C!=null){memberService.getMemberKindById(A,function(F){doUpdateMembers(D,C,F);
});
}DWREngine.endBatch();
}function doUpdateMembers(C,D,B){var A=document.getElementById("member:"+D);
if(A){A.innerHTML=(B!=null)?kinds[B]:kinds.notMember;
updateMemberActions(C,D);
}}function setMemberBanish(D,C){var A=document.getElementById("member:"+D);
var B=document.getElementById("action:"+D);
if(A!=null&&C!=null){A.innerHTML=C?kinds.BANISHED:"";
B.value=null;
B.disabled=true;
}}function updateMember(F,G,B){var A={blogCode:F,userCode:G};
var E=document.getElementById("action:"+G).value;
switch(E){case"BANISH":memberService.banishMember(A,function(H){setMemberBanish(G,H);
});
break;
case"GRANT_ADMIN":if(confirm(GRANT_ADMIN_CONFIRM)){var C=window.location.href;
C=C.substring(0,C.lastIndexOf("/"));
memberService.grantAdminRole(A,function(){window.location.replace(C);
});
}break;
case"GRANT_MEMBER":memberService.grantMemberRole(A,function(){doUpdateMembersWrapper(F,G,B);
});
break;
case"GRANT_MODERATOR":memberService.grantModeratorRole(A,function(){doUpdateMembersWrapper(F,G,B);
});
break;
case"PUNISH":memberService.punishMember(A,function(){doUpdateMembersWrapper(F,G,B);
});
break;
case"REFUSE":var D=prompt(global_messages["text.causeRefuse"]);
if(D==null){return ;
}memberService.refuseMember(A,D,function(){doUpdateMembersWrapper(F,G,B);
});
break;
case"REMOVE_PUNISHMENT":memberService.removePunishment(A,function(){doUpdateMembersWrapper(F,G,B);
});
break;
case"RESTORE":memberService.restoreMember(A,function(H){setMemberBanish(G,H);
});
break;
case"REVOKE_ADMIN":if(G==B){alert(REVOKE_ADMIN_ERROR);
doUpdateMembersWrapper(F,G,B);
}else{memberService.revokeAdminRole(A,function(){doUpdateMembersWrapper(F,G,B);
});
}break;
case"REVOKE_MODERATOR":if(G==B){if(confirm(REVOKE_MODERATOR_CONFIRM)){var C=window.location.href;
C=C.substring(0,C.lastIndexOf("/"));
memberService.revokeModeratorRole(A,function(){window.location.replace(C);
});
}}else{memberService.revokeModeratorRole(A,function(){doUpdateMembersWrapper(F,G,B);
});
}break;
case"null":break;
default:alert("Unexpected action: "+E);
}}function redirectToCommunity(B,A){if(B.options[B.selectedIndex].value==""){return ;
}var H=window.location.pathname;
var D=H.split("/");
if(D.length<2){return ;
}var G="entries";
var E=B.options[B.selectedIndex].value;
if(A!=""){for(var C=0;
C<D.length;
C++){if(D[C]==A){D[C]=E;
H=D.join("/");
window.location.href=window.location.pathname=H;
break;
}}}else{if(D.indexOf(G)>0){var I=new Array();
for(C=0;
C<D.length;
C++){I.push(D[C]);
if(D[C]==G){I.push(E);
}}window.location.href=I.join("/");
}else{var I=new Array();
I.push(B.options[B.selectedIndex].value);
I.push(D[D.length-1]);
var F=I.join("/");
if(F.indexOf("moderation")>0){F=F.replace("/moderation","");
}window.location.href=F;
}}}
var Inv={title:null,url:null,closeUrl:null,name:"Inv",winProp:{className:"alphacube",zIndex:150,minWidth:300,minHeight:300,width:780,height:530,opacity:100,resizable:0,maximizable:0,minimizable:0},init:function(){Windows.addObserver({onClose:this.onClose.bind(this)});
},onCloseDone:function(){},onClose:function(B,A){if(this.name==A.getId()){new Ajax.Request(this.closeUrl,{method:"post",onComplete:this.onCloseDone.bind(this)});
}},open:function(A){if(!Windows.getWindow(this.name)){pos={url:this.url,title:this.title};
var B=new Window(this.name,Object.extend(this.winProp,pos));
B.setDestroyOnClose();
B.showCenter();
}return false;
},close:function(){Windows.close(this.name);
}};

function deleteImage(A){imageController.deleteImage(A,{callback:function(B){window.location.reload(true);
},errorHandler:function(C,B){}});
return false;
}
function updateSpecs(E,A,G){var F=function(J){Element.update($(G),J.html);
var H=document.getElementById(A);
var I=J.bean;
if(I&&I>0){H.className="choose-one";
}else{H.className="choose";
}};
var D=document.getElementById(E);
var C=D.selectedIndex;
var B=D.options[C].value;
specializationController.getSpecsByProvAreaId(B,{callback:F});
}function sendLoBlog(F,C){DWREngine.beginBatch();
try{var A=Form.getInputs(F,"checkbox","check");
for(var D=0;
D<A.length;
D++){var B=A[D];
if(B.checked){var E=B.value;
subscriptionController.getNamedBlog(E,{callback:function(G){createSubscriptionCallback(G,C);
}});
}}}finally{DWREngine.endBatch({timeout:3000,callback:function(){$("lc-active").style.display="none";
}});
}return ;
}function addSuggestedSubscription(E){DWREngine.beginBatch();
var A=Form.getInputs(E,"checkbox","check");
try{for(var C=0;
C<A.length;
C++){var B=A[C];
if(B.checked){var D=B.value;
subscriptionController.getNamedBlog(D,{callback:function(F){}});
}}}finally{DWREngine.endBatch({timeout:3000,callback:function(){$("lc-active").style.display="none";
}});
}return ;
}function sendLjBlog(B,C){var A=document.getElementById(B).value;
$("lj-button").style.display="none";
$("lj-active").style.display="";
subscriptionController.getLjBlog(A,{callback:function(D){$("lj-button").style.display="";
$("lj-active").style.display="none";
createSubscriptionCallback(D,C);
}});
}function createRssBlog(B,D,E){var C=document.getElementById(D).value;
var A=document.getElementById(B).value;
$("rss-button").style.display="none";
$("rss-active").style.display="";
subscriptionController.getRssBlog(A,C,{callback:function(F){$("rss-button").style.display="";
$("rss-active").style.display="none";
createSubscriptionCallback(F,E);
}});
}function sendSearchBlog(B,G,D,F){var E=document.getElementById(G).value;
var C=document.getElementById(D).value;
var A=document.getElementById(B).value;
$("search-button").style.display="none";
$("search-active").style.display="";
subscriptionController.getSearchBlog(A,E,C,{callback:function(H){$("search-button").style.display="";
$("search-active").style.display="none";
createSubscriptionCallback(H,"errorSearchBlog");
}});
}function sendHhBlog(H,D,B,S,T,I,L,R,G){var N=document.getElementById(H).value;
var J=document.getElementById(D).value;
var Q=document.getElementById(B).value;
var E=document.getElementById(S).value;
var P=document.getElementsByName(T);
var F=document.getElementById(I).checked;
var C=document.getElementById(L).checked;
var A=document.getElementById(R).value;
var K=new Array();
var M=0;
for(var O=0;
O<P.length;
O++){if(P[O].checked==true){K[M]=P[O].value;
M=M+1;
}}$("hh-button").style.display="none";
$("hh-active").style.display="";
subscriptionController.getVacancyBlog(N,A,J,Q,E,K,F,C,{callback:function(U){$("hh-button").style.display="";
$("hh-active").style.display="none";
createSubscriptionCallback(U,G);
}});
}function createSubscriptionCallback(C,B){try{hide();
if(C.status!="OK"){printError(B,C.html);
return ;
}var F=$(B);
F.style.display="none";
var A=$("sources");
printSubscription(A,C.bean.id,C.html,C.bean.kind);
var D=$("lenta");
if(Element.hasClassName(D,"lenta-empty")){Element.removeClassName(D,"lenta-empty");
Element.addClassName(D,"lenta");
}}catch(E){alert("ERROR: "+E);
}}function renameSub(){var B=document.getElementById("listSubscription");
if(B.selectedIndex==-1){return ;
}var A=document.getElementById("renameObject");
subscriptionController.renameSubscription(B.value,A.value,{callback:function(C){renameCallback(C,"errorRename");
}});
}function renameCallback(C,D){var A=document.getElementById("renameObject");
A.value="";
var B=document.getElementById("listSubscription");
if(C.status=="OK"){hide();
printSubscription(B,C.bean.id,C.html,C.bean.kind);
}else{printError(D,C.html);
}}function deleteSubscrById(A){subscriptionController.deleteSubscription(A,{callback:function(B){deleteCallback(A);
}});
}function deleteSubscription(C){var B=document.getElementsByName(C);
var F=B.length;
for(var D=0;
D<F;
D++){var A=B[D];
var E=A.value;
if(A.checked){deleteSubscrById(E);
}}}function deleteCallback(B){var C=$("sourceDiv:"+B);
C.style.display="none";
var A=document.getElementById("source:"+B);
A.checked=true;
Element.remove(C);
if(Element.getElementsBySelector($("sources"),".subscriptionItem").length==0){Element.removeClassName($("lenta"),"lenta");
Element.addClassName($("lenta"),"lenta-empty");
}}function hide(){}function clearError(B){var A=document.getElementById(B);
A.style.display="none";
A.innerHTML="";
}function printError(C,B){var A=document.getElementById(C);
A.style.display="block";
A.innerHTML=B;
setTimeout("clearError('"+C+"')",5000);
}function printSubscription(A,H,E,C){var D=document.getElementById("sourceDiv:"+H);
if(D){return ;
}var G=document.createElement("DIV");
Element.update(G,E);
var B=A.getElementsByTagName("DIV");
var F=B[0];
A.insertBefore(G,F);
}function saveSubscriptions(){var M=$("sources");
var A=M.getElementsBySelector('input[type="checkbox"]');
DWREngine.beginBatch();
var B=new Array();
for(var K=0;
K<A.size();
K++){var D=A[K].id;
var E=D.indexOf("source:");
if(E==0){var C=D.length;
var G=D.substring("source:".length,C);
B.push(G);
}}var J=new Array();
for(var K=0;
K<B.length;
K++){var D=B[K];
var N=document.getElementById("cc:"+D);
var I=document.getElementById("ce:"+D);
if(N==null||I==null){continue;
}var H=N.checked;
var F=I.checked;
var L={id:D,communities:F,comments:H};
J.push(L);
}subscriptionController.updateSubscriptionFlags(J);
DWREngine.endBatch();
}function getSubscriptionId(A){return A.substring(3,A.length-1);
}
function Subscription(){var C=null;
var F=function(){return function(I){C=null;
$("menu:feeds").innerHTML=I.html;
};
};
var E=function(I){if(C==null){C=new Object();
userSubscriptionController.subscribeUser(I,true,F());
}return false;
};
var D=function(I){if(C==null){C=new Object();
userSubscriptionController.unsubscribeUser(I,F());
}return false;
};
var A=function(I){if(C==null){C=new Object();
userSubscriptionController.subscribeUserComments(I,F());
}};
var H=function(I){if(C==null){C=new Object();
userSubscriptionController.unsubscribeUserComments(I,F());
}};
var G=function(I){if(C==null){C=new Object();
communitySubscriptionController.subscribeCommunity(I,F());
}return false;
};
var B=function(I){if(C==null){C=new Object();
communitySubscriptionController.unsubscribeCommunity(I,F());
}return false;
};
this.subscribeUser=E;
this.unsubscribeUser=D;
this.subscribeUserComments=A;
this.unsubscribeUserComments=H;
this.subscribeCommunity=G;
this.unsubscribeCommunity=B;
}
var BookmarksConstructor=function(){this.userId=null;
this.cancelEdit=null;
this.updated=function(){bookmarkController.getTagsWithCounts(this.userId,function(D){if(D!=null&&typeof D=="object"){alert(DWRUtil.toDescriptiveString(D,2));
}else{if(document.getElementById("userTags")!=null){DWRUtil.setValue("userTags",DWRUtil.toDescriptiveString(D,1));
}}});
};
var B=function(E,D){if(D!=null&&typeof D=="object"){alert(DWRUtil.toDescriptiveString(D,2));
}else{$("bookmark.entryBody.text:"+E).innerHTML=D;
showHideElements(["bookmark.close:"+E,"bookmark.entryBody:"+E],["bookmark.open:"+E]);
}};
var A=function(F,D,E){if(D!=null&&typeof D=="object"){alert(DWRUtil.toDescriptiveString(D,2));
}else{}};
var C=function(G,F){if(F!=null&&typeof F=="object"){alert(DWRUtil.toDescriptiveString(F,2));
}else{var E=false;
var D=document.getElementById("bookmark.entryBody:"+G);
Element.replace("bookmark:"+G,F);
}};
this.edit=function(H,G){var E=$("bookmark.edit.form.title:"+H).value;
var D=$("bookmark.edit.form.tags:"+H).value;
var F=function(I){C(H,I);
if($("bookmarkTags")!=null){bookmarkTagsController.getTags(G,{callback:function(K){var J=K.html;
var L=$("bookmarkTags");
L.replace(J);
}});
}};
bookmarkController.editBookmark(this.userId,H,E,D,F);
this.cancelEdit(H);
};
this.deleteBookmark=function(F,D){var E=function(G){if(G!=null){showHideElements(["bookmark.delete:"+F],["bookmark:"+F]);
Element.update("bookmarksCounter",G);
}else{showHideElements(["bookmark.delete:"+F],["bookmark.delete.confirm:"+F]);
}};
bookmarkController.deleteBookmark(F,E);
return false;
};
this.cancelEdit=function(D){showHideElements(["bookmark.edit:"+D],["bookmark.edit.form:"+D]);
};
this.beginEdit=function(D){showHideElements(["bookmark.edit.form:"+D,"bookmark.delete:"+D],["bookmark.edit:"+D,"bookmark.delete.confirm:"+D]);
};
this.openBookmark=function(E){var D=function(F){B(E,F);
};
bookmarkController.getEntryBodyForBookmark(E,D);
};
};

EntriesCalendar=function(F,D){this.calendar=null;
var G=this;
var B={};
var J=F;
function M(){G.calendar=new YAHOO.widget.Calendar("calendar","calendarDiv");
G.calendar.cfg.setProperty("MONTHS_LONG",[global_messages["text.MONTHS_LONG.0"],global_messages["text.MONTHS_LONG.1"],global_messages["text.MONTHS_LONG.2"],global_messages["text.MONTHS_LONG.3"],global_messages["text.MONTHS_LONG.4"],global_messages["text.MONTHS_LONG.5"],global_messages["text.MONTHS_LONG.6"],global_messages["text.MONTHS_LONG.7"],global_messages["text.MONTHS_LONG.8"],global_messages["text.MONTHS_LONG.9"],global_messages["text.MONTHS_LONG.10"],global_messages["text.MONTHS_LONG.11"],]);
G.calendar.cfg.setProperty("START_WEEKDAY",1);
G.calendar.cfg.setProperty("WEEKDAYS_SHORT",[global_messages["text.WEEKDAYS_SHORT.6"],global_messages["text.WEEKDAYS_SHORT.0"],global_messages["text.WEEKDAYS_SHORT.1"],global_messages["text.WEEKDAYS_SHORT.2"],global_messages["text.WEEKDAYS_SHORT.3"],global_messages["text.WEEKDAYS_SHORT.4"],global_messages["text.WEEKDAYS_SHORT.5"]]);
if(F=="megaSelected"){J="mega/best";
}else{if(F=="megaAll"){J="mega";
}else{if(F=="megaHot"){J="mega/hot";
}else{if(F=="megaPolls"){J="mega/polls";
}else{if(F=="megaRated"){J="mega/rated";
}else{J=F;
}}}}}if(D!=""){var O=D.split("/");
if(O.length>1){var P=1;
if(O.length==3){P=O[2];
}var S=O[1];
var R=O[0];
if(!isNaN(S)&&!isNaN(P)&&!isNaN(R)){var Q=S+"/"+P+"/"+R;
G.calendar.cfg.setProperty("pagedate",S+"/"+R);
G.calendar.select(Q);
}}}G.calendar.changePageEvent.subscribe(E,G.calendar,true);
G.calendar.render();
E();
}this.cleanRenderer=function(P,O){YAHOO.util.Dom.removeClass(O,this.Style.CSS_CELL_SELECTABLE);
O.innerHTML=P.getDate();
return YAHOO.widget.Calendar.STOP_RENDER;
};
function E(){var O=G.calendar.preMonthDays;
var P=G.calendar.cellDates[O];
L();
entryController.getEntryCountsByDate(P[0],P[1]-1,P[2],F,{callback:N});
}function L(){var O=G.calendar.cellDates;
var R=O.length-G.calendar.postMonthDays;
var Q=G.calendar.preMonthDays;
while(Q<R){var P=O[Q][1]+"/"+O[Q][2]+"/"+O[Q][0];
K(P,G.cleanRenderer);
Q++;
}}function N(Q){if(Q.status=="OK"){var S=Q.bean;
var R=0;
for(var P=0;
P<S.length;
P++){var O=(S[P].month+1)+"/"+S[P].date+"/"+S[P].year;
B[O]=S[P].count;
R+=S[P].count;
G.reset();
K(O,G.renderer);
}G.calendar.buildMonthLabel=I(R);
}else{}G.calendar.render();
}function I(O){return function(){var R=G.calendar.cfg.getProperty("pagedate");
var S=R.getFullYear();
var T=R.getMonth();
var Q=G.calendar.cfg.getProperty("MONTHS_LONG")[T];
var P=Q+" "+S;
if(O!=null&&O!=0){var U=global_messages["text.entryCountsByMonth"]+" "+O;
return"<a title='"+U+"' href='/"+J+"/"+S+"/"+(T+1)+"/'>"+P+"</a>";
}return P;
};
}function A(O){pDate=[];
if(O instanceof Date){}else{if(typeof O=="string"){pDate=O.split("/");
}else{if(O instanceof Array){pDate[0]=O[0];
pDate[1]=O[1];
pDate[2]=O[2];
}}}if((pDate[0]+"").length>2){return{month:pDate[1],day:pDate[2],year:pDate[0]};
}else{return{month:pDate[0],day:pDate[1],year:pDate[2]};
}}function K(P,S){var R=G.calendar.renderStack.length;
for(var Q=0;
Q<R;
Q++){rendererData=G.calendar.renderStack[Q];
var O=rendererData[1];
newDate=A(P);
if(newDate.day==O[2]&&newDate.month==O[1]&&newDate.year==O[0]){rendererData[2]=G.renderer;
}}G.calendar.addRenderer(P,S);
}this.renderer=function(T,O){YAHOO.util.Dom.addClass(O,this.Style.CSS_CELL_SELECTABLE);
var P=T.getFullYear()+"/"+(T.getMonth()+1)+"/"+T.getDate();
var Q=(T.getMonth()+1)+"/"+T.getDate()+"/"+T.getFullYear();
var S="";
var R=B[Q];
if(R!=null&&R!=""){S=global_messages["text.entryCountsByDate"]+" "+R;
}O.innerHTML="<a title='"+S+"' href='/"+J+"/"+P+"'>"+T.getDate()+"</a>";
return YAHOO.widget.Calendar.STOP_RENDER;
};
this.render=function C(){G.calendar.render();
};
this.reset=function H(){G.calendar.resetRenderers();
};
M();
};

function ReaderSupport(){var H=null;
var I=0;
var G=300;
var R=null;
var K="unreadEntriesCounter";
var P="menuItemUnreadEntriesCounter";
function M(){window.onscroll=readerSupport.scrollHandler;
readerSupport.scrollHandler();
}function S(U){var T=-G;
if(U.offsetParent){T=U.offsetTop;
while(U=U.offsetParent){T+=U.offsetTop;
}}return T;
}function F(){var T=navigator.userAgent.toLowerCase();
if(T.indexOf("msie")>-1){return document.body.offsetHeight;
}else{return window.innerHeight;
}}function C(V,U){var T=$(V);
if(T!=null){Element.update(T,U);
}}function B(T){if(T!=null){Element.removeClassName(T,"unread");
Element.addClassName(T,"read");
}}function J(){H=setTimeout("readerSupport.checkPosition()",500);
}function N(){var T=R;
R=document.body.scrollTop;
if(R==T){L();
}if(H!=null){window.clearTimeout(H);
H=null;
}}function D(){R=document.body.scrollTop;
if(H==null){J();
}}function L(){var T=Element.getElementsBySelector(document,".unread");
for(var U=0;
U<T.length;
U++){var V=T[U];
if(O(V)){Q(V);
}}}function O(V){var Y=document.body.scrollTop;
var T=Y+F()-40;
var W=S(V);
var X=Element.getElementsBySelector(V,".blog-item-body")[0];
var U=S(X)+X.scrollHeight;
return W<T&&U>Y;
}function E(T){if(T.startsWith("entry:")){return T.substring(6);
}return"C"+T;
}function Q(T){var U=E(T.id);
showEntryController.createReadMark(U,function(V){if(V){C(K,V+" ");
C(P,V);
B(T);
}});
}function A(){if(H!=null){clearTimeout(H);
}hitRegisterer.registerEntryReadMark(function(){var T=Element.getElementsBySelector(document,".unread");
for(var U=0;
U<T.length;
U++){B(T[U]);
}Element.update(K,"0");
Element.update(P,"0");
});
}this.scrollHandler=D;
this.init=M;
this.checkPosition=N;
this.markAllAsRead=A;
}
var tour_keepClassName;
function tour_hi(A){tour_keepClassName=A.className;
A.className+=" tour-pick-over";
}function tour_lo(A){A.className=tour_keepClassName;
}
function Button(F,G,B,A){function C(){if(!A.isActive()){document.images[F].src=G;
}}function D(){if(!A.isActive()){document.images[F].src=B;
}}function E(){A.click(F);
}function H(){A.close();
D();
}this.hi=C;
this.lo=D;
this.click=E;
this.close=H;
}
function ButtonGroup(){var B=arguments;
function A(C){if(B){if(C<0||C>=B.length){alert("Invalid index: "+C);
return ;
}var E=B[C];
for(var D=0;
D<B.length;
D++){if(D!=C){B[D].close();
}}E.click();
}else{alert("There is no any button");
}}this.open=A;
}
function ActionCounter(D){var B=0;
this.targetElement=D;
var C=this;
var A=function(){var E=Element.getElementsBySelector(C.targetElement,".activity")[0];
if(B<=0){Element.removeClassName(E,"activity-true");
Element.addClassName(E,"activity-false");
}else{Element.removeClassName(E,"activity-false");
Element.addClassName(E,"activity-true");
}};
return{begin:function(){B++;
A();
},end:function(){B<0?B=0:B--;
A();
}};
}
CalendarWidget=function(T,M,D,N,H,A,P){this.calendar=null;
this.notes={};
var X={};
var S=this;
var R=new ActionCounter($(T));
function B(b,a,c){var Z=a[0][0];
var Y=I(Z);
global_messages["msg.sometext"];
S.showNote(Y.month+"/"+Y.day+"/"+Y.year);
}this.setInternalCalendarProperty=function(Y,Z){S.calendar.cfg.setProperty(Y,Z);
};
function C(){S.calendar=new YAHOO.widget.Calendar("calendar",M);
S.calendar.selectEvent.subscribe(B,S.calendar,true);
S.calendar.changePageEvent.subscribe(O,S.calendar,true);
}function E(Z){R.end();
if(Z.length==0){return ;
}for(var Y=0;
Y<Z.length;
Y++){var a=Z[Y];
S.addNote((a.month+1)+"/"+a.date+"/"+a.year,a.text);
}S.render();
}function O(){S.cancelNote();
var Y=new Date();
page=(Y.getMonth()+1)+"/"+Y.getFullYear();
if(!X[page]){R.begin();
noteController.getNotes(Y.getFullYear(),Y.getMonth(),Y.getDate(),{callback:E});
X[page]=true;
}}this.renderer=function(g,Z){YAHOO.util.Dom.addClass(Z,this.Style.CSS_CELL_SELECTABLE);
YAHOO.util.Dom.addClass(Z,"calendar-high");
var a=(g.getMonth()+1)+"/"+g.getDate()+"/"+g.getFullYear();
Z.innerHTML="<a href=\"javascript:widget.showNote('"+a+"')\" >"+g.getDate()+"</a>";
var f=null;
try{var Y=S.calendar.cfg.getProperty("selected")[0];
f=Y[0]+"/"+Y[1]+"/"+Y[2];
}catch(d){}var c=g.getFullYear()+"/"+(g.getMonth()+1)+"/"+g.getDate();
var b=S.notes[(g.getMonth()+1)+"/"+g.getDate()+"/"+g.getFullYear()]!=null;
if(c==f&&b){YAHOO.util.Dom.addClass(Z,this.Style.CSS_CELL_SELECTED);
}return YAHOO.widget.Calendar.STOP_RENDER;
};
this.showNote=function(Z){$(H).value=Z;
if(this.notes[Z]){$(N).value=this.notes[Z];
}else{$(N).value="";
}$(D).style.visibility="visible";
var Y=S.calendar.cfg.getProperty("selected")[0];
S.updateWeekNotes(Y[0],Y[1]-1,Y[2]);
};
this.selectNote=function(Y,b,a){var Z=(parseInt(b)+1)+"/"+Y+"/"+a;
S.calendar.select(Z);
S.calendar.cfg.setProperty("pagedate",(parseInt(b)+1)+"/"+a);
S.render();
return false;
};
this.cancelNote=function(){};
var U=function(Z,Y){};
function Q(Z){var b=S.calendar.renderStack.length;
for(var a=0;
a<b;
a++){rendererData=S.calendar.renderStack[a];
var Y=rendererData[1];
newDate=I(Z);
if(newDate.day==Y[2]&&newDate.month==Y[1]&&newDate.year==Y[0]){rendererData[2]=S.renderer;
}}S.calendar.addRenderer(Z,S.renderer);
}function I(Y){pDate=[];
if(Y instanceof Date){}else{if(typeof Y=="string"){pDate=Y.split("/");
}else{if(Y instanceof Array){pDate[0]=Y[0];
pDate[1]=Y[1];
pDate[2]=Y[2];
}}}if((pDate[0]+"").length>2){return{month:pDate[1],day:pDate[2],year:pDate[0]};
}else{return{month:pDate[0],day:pDate[1],year:pDate[2]};
}}function F(Z){var b=S.calendar.renderStack.length;
for(var a=0;
a<b;
a++){rendererData=S.calendar.renderStack[a];
var Y=rendererData[1];
newDate=I(Z);
if(newDate.day==Y[2]&&newDate.month==Y[1]&&newDate.year==Y[0]){rendererData[2]=U;
}}}function K(Y,Z){S.notes[Y]=Z;
}function L(Y){S.notes[Y]=null;
}this.addNote=function(Y,Z){if(Z){this.reset();
}Q(Y);
K(Y,Z);
this.cancelNote();
};
this.createNote=function(Z,a){if(a==""){this.removeNote(Z);
}else{this.addNote(Z,a);
this.render();
var Y=I(Z);
R.begin();
noteController.createNote(Y.year,Y.month-1,Y.day,a,{callback:function(){R.end();
S.updateWeekNotes();
}});
}};
this.removeNote=function(Z){if(this.notes[Z]==null){this.cancelNote();
return ;
}this.reset();
F(Z);
L(Z);
this.render();
this.cancelNote();
var Y=I(Z);
R.begin();
noteController.deleteNote(Y.year,Y.month-1,Y.day,{callback:function(){R.end();
S.updateWeekNotes();
}});
$(N).value="";
};
function G(a,Y,b){function Z(c){S.selectNote(a,Y,b);
}this.onClick=Z;
}function J(a,Y,b){function Z(c){S.removeNote((parseInt(Y)+1)+"/"+a+"/"+b);
}this.onClick=Z;
}this._updateLinks=function(){var Z=Element.getElementsBySelector($("widget-calendar"),".note-day");
var Y=Z.length;
if(Y==0){return ;
}for(var b=0;
b<Y;
b++){var e=Z[b].getElementsByTagName("input")[0].value;
var a=$("noteDay["+e+"]").innerHTML;
var d=$("noteMonth["+e+"]").innerHTML;
var c=$("noteYear["+e+"]").innerHTML;
Element.observe("remove-note["+e+"]","click",function(){doConfirm(P,new J(a,d,c).onClick);
});
}};
this._updateWeekNotes=function(Y){R.end();
Element.update("current-week-notes",Y.html);
setTimeout(function(){S._updateLinks();
},500);
};
this.updateWeekNotes=function(){R.begin();
var Z=S.calendar.cfg.getProperty("selected")[0];
var c;
var Y;
var b;
if(Z==null){var a=new Date();
c=a.getFullYear();
Y=a.getMonth();
b=a.getDate();
}else{c=Z[0];
Y=Z[1]-1;
b=Z[2];
}noteController.getWeekNotes(c,Y,b,{callback:this._updateWeekNotes});
};
this.render=function W(){S.calendar.render();
};
this.reset=function V(){S.calendar.resetRenderers();
};
this.selectToday=function(){var Y=new Date();
S.selectNote(Y.getDate(),Y.getMonth(),Y.getFullYear());
};
C();
O();
this.selectToday();
};

function showHideOptions(H,E,G){var F=$(H);
if(G==false){G=!F.checked;
}for(var C=0;
C<E.length;
C++){var D=E[C];
if(D!=null&&D.length!=0){var B;
var A;
if(E.length==1){B=$(D);
A=$(D+"-label");
}else{B=$(D[0]);
A=$(D[0]+"-label");
}if(B!=null){if(G||!F.checked){B.disabled=true;
Element.addClassName(A,"label-disabled");
}else{B.disabled=false;
Element.removeClassName(A,"label-disabled");
}}if(E.length>1&&D.length>1){showHideOptions(D[0],D[1],G);
}}}}
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(G,F,B){var A=$(G);
if(null==A){throw"Unable to find element '"+G+"' in DOM";
}this._oldParent=A.parentNode;
var E=null;
var D=null;
if(F){E=Element.getDimensions(A);
}if(B){D=Position.cumulativeOffset(A);
}var C=this.getContent();
this.setHTMLContent("");
C=this.getContent();
C.appendChild(A);
A.show();
if(F){this.setSize(E.width,E.height);
}if(B){this.setLocation(D[1]-this.heightN,D[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,M,E,A){B=B||this.element.id;
this.cookie=[B,C,M,E,A];
var K=WindowUtilities.getCookie(B);
if(K){var L=K.split(",");
var I=L[0].split(":");
var H=L[1].split(":");
var J=parseFloat(L[2]),F=parseFloat(L[3]);
var G=L[4];
var D=L[5];
this.setSize(J,F);
if(G=="true"){this.doMinimize=true;
}else{if(D=="true"){this.doMaximize=true;
}}this.useLeft=I[0]=="l";
this.useTop=H[0]=="t";
this.element.setStyle(this.useLeft?{left:I[1]}:{right:I[1]});
this.element.setStyle(this.useTop?{top:H[1]}:{bottom:H[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 J=A[0]-this.pointer[0];
var I=A[1]-this.pointer[1];
if(this.doResize){var H=this.widthOrg+J;
var D=this.heightOrg+I;
J=this.width-this.widthOrg;
I=this.height-this.heightOrg;
if(this.useLeft){H=this._updateWidthConstraint(H);
}else{this.currentDrag.setStyle({right:(this.rightOrg-J)+"px"});
}if(this.useTop){D=this._updateHeightConstraint(D);
}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-I)+"px"});
}this.setSize(H,D);
this._notify("onResize");
}else{this.pointer=A;
if(this.useLeft){var C=parseFloat(this.currentDrag.getStyle("left"))+J;
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"))-J+"px"});
}if(this.useTop){var F=parseFloat(this.currentDrag.getStyle("top"))+I;
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"))-I+"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 E=this.currentDrag?this.currentDrag:this.element;
E.setStyle({width:C+this.widthW+this.widthE+"px"});
E.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;
}};

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){}};
Array.prototype.call=function(){var A=arguments;
this.each(function(B){B.apply(this,A);
});
};
var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},tagifyText:function(A){if(typeof Builder=="undefined"){throw ("Effect.tagifyText requires including script.aculo.us' builder.js library");
}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(Builder.node("span",{style:B},D==" "?String.fromCharCode(160):D),C);
});
Element.remove(C);
}});
},multiple:function(B,C){var E;
if(((typeof B=="object")||(typeof B=="function"))&&(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){B=$(B);
C=(C||"appear").toLowerCase();
var A=Object.extend({queue:{position:"end",scope:(B.id||"global"),limit:1}},arguments[2]||{});
Effect[B.visible()?Effect.PAIRS[C][1]:Effect.PAIRS[C][0]](B,A);
}};
var Effect2=Effect;
Effect.Transitions={linear:Prototype.K,sinoidal:function(A){return(-Math.cos(A*Math.PI)/2)+0.5;
},reverse:function(A){return 1-A;
},flicker:function(A){var A=((-Math.cos(A*Math.PI)/4)+0.75)+Math.random()/4;
return(A>1?1:A);
},wobble:function(A){return(-Math.cos(A*Math.PI*(9*A))/2)+0.5;
},pulse:function(B,A){A=A||5;
return(Math.round((B%(1/A))*A)==0?((B*A*2)-Math.floor(B*A*2)):1-((B*A*2)-Math.floor(B*A*2)));
},none:function(A){return 0;
},full:function(A){return 1;
}};
Effect.ScopedQueue=Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype,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=(typeof B.options.queue=="string")?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(typeof A!="string"){return A;
}if(!this.instances[A]){this.instances[A]=new Effect.ScopedQueue();
}return this.instances[A];
}};
Effect.Queue=Effect.Queues.get("global");
Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"};
Effect.Base=function(){};
Effect.Base.prototype={position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+"Internal"]?"this.options."+eventName+"Internal(this);":"")+(options[eventName]?"this.options."+eventName+"(this);":""));
}if(options.transition===false){options.transition=Effect.Transitions.linear;
}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});
this.currentFrame=0;
this.state="idle";
this.startOn=this.options.delay*1000;
this.finishOn=this.startOn+(this.options.duration*1000);
this.fromToDelta=this.options.to-this.options.from;
this.totalTime=this.finishOn-this.startOn;
this.totalFrames=this.options.fps*this.options.duration;
eval('this.render = function(pos){ if(this.state=="idle"){this.state="running";'+codeForEvent(options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(options,"afterSetup")+'};if(this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(options,"afterUpdate")+"}}");
this.event("beforeStart");
if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"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=Math.round(B*this.totalFrames);
if(A>this.currentFrame){this.render(B);
this.currentFrame=A;
}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"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(typeof this[property]!="function"){A[property]=this[property];
}}return"#<Effect:"+A.inspect()+",options:"+$H(this.options).inspect()+">";
}};
Effect.Parallel=Class.create();
Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{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.Event=Class.create();
Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize:function(){var A=Object.extend({duration:0},arguments[0]||{});
this.start(A);
},update:Prototype.emptyFunction});
Effect.Opacity=Class.create();
Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{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();
Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{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:Math.round(this.options.x*A+this.originalLeft)+"px",top:Math.round(this.options.y*A+this.originalTop)+"px"});
}});
Effect.MoveBy=function(B,A,C){return new Effect.Move(B,Object.extend({x:C,y:A},arguments[3]||{}));
};
Effect.Scale=Class.create();
Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{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,D){var E={};
if(this.options.scaleX){E.width=Math.round(D)+"px";
}if(this.options.scaleY){E.height=Math.round(A)+"px";
}if(this.options.scaleFromCenter){var C=(A-this.dims[0])/2;
var B=(D-this.dims[1])/2;
if(this.elementPositioning=="absolute"){if(this.options.scaleY){E.top=this.originalTop-C+"px";
}if(this.options.scaleX){E.left=this.originalLeft-B+"px";
}}else{if(this.options.scaleY){E.top=-C+"px";
}if(this.options.scaleX){E.left=-B+"px";
}}}this.element.setStyle(E);
}});
Effect.Highlight=Class.create();
Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{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+(Math.round(this._base[D]+(this._delta[D]*A)).toColorPart());
}.bind(this))});
},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));
}});
Effect.ScrollTo=Class.create();
Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(A){this.element=$(A);
this.start(arguments[1]||{});
},setup:function(){Position.prepare();
var B=Position.cumulativeOffset(this.element);
if(this.options.offset){B[1]+=this.options.offset;
}var A=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);
this.scrollStart=Position.deltaY;
this.delta=(B[1]>A?A:B[1])-this.scrollStart;
},update:function(A){Position.prepare();
window.scrollTo(Position.deltaX,this.scrollStart+(A*this.delta));
}});
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(B){B=$(B);
var A={top:B.getStyle("top"),left:B.getStyle("left")};
return new Effect.Move(B,{x:20,y:0,duration:0.05,afterFinishInternal:function(C){new Effect.Move(C.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(D){new Effect.Move(D.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(E){new Effect.Move(E.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(F){new Effect.Move(F.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(G){new Effect.Move(G.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(H){H.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(B){B=$(B).cleanWhitespace();
var A=B.down().getStyle("bottom");
return new Effect.Scale(B,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(C){C.element.makePositioned();
C.element.down().makePositioned();
if(window.opera){C.element.setStyle({top:""});
}C.element.makeClipping().show();
},afterUpdateInternal:function(C){C.element.down().setStyle({bottom:(C.dims[0]-C.element.clientHeight)+"px"});
},afterFinishInternal:function(C){C.element.hide().undoClipping().undoPositioned().setStyle({bottom:A});
C.element.down().undoPositioned();
}},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]||{};
var A=C.getInlineOpacity();
var E=B.transition||Effect.Transitions.sinoidal;
var D=function(F){return E(1-Effect.Transitions.pulse(F,B.pulses));
};
D.bind(E);
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();
Object.extend(Object.extend(Effect.Morph.prototype,Effect.Base.prototype),{initialize:function(C){this.element=$(C);
if(!this.element){throw (Effect._elementDoesNotExistError);
}var B=Object.extend({style:{}},arguments[1]||{});
if(typeof B.style=="string"){if(B.style.indexOf(":")==-1){var D="",A="."+B.style;
$A(document.styleSheets).reverse().each(function(E){if(E.cssRules){cssRules=E.cssRules;
}else{if(E.rules){cssRules=E.rules;
}}$A(cssRules).reverse().each(function(F){if(A==F.selectorText){D=F.style.cssText;
throw $break;
}});
if(D){throw $break;
}});
this.style=D.parseStyle();
B.afterFinishInternal=function(E){E.element.addClassName(E.options.style);
E.transforms.each(function(F){if(F.style!="opacity"){E.element.style[F.style]="";
}});
};
}else{this.style=B.style.parseStyle();
}}else{this.style=$H(B.style);
}this.start(B);
},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+Math.round(((B.targetValue-B.originalValue)*A)*1000)/1000+B.unit;
}this.element.setStyle(D,true);
}});
Effect.Transform=Class.create();
Object.extend(Effect.Transform.prototype,{initialize:function(A){this.tracks=[];
this.options=arguments[1]||{};
this.addTracks(A);
},addTracks:function(A){A.each(function(B){var C=$H(B).values().first();
this.tracks.push($H({ids:$H(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 B=[$(A.ids)||$$(A.ids)].flatten();
return B.map(function(C){return new A.effect(C,Object.extend({sync:true},A.options));
});
}).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.prototype.parseStyle=function(){var B=document.createElement("div");
B.innerHTML='<div style="'+this+'"></div>';
var C=B.childNodes[0].style,A=$H();
Element.CSS_PROPERTIES.each(function(D){if(C[D]){A[D]=C[D];
}});
if(Prototype.Browser.IE&&this.indexOf("opacity")>-1){A.opacity=this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
}return A;
};
Element.morph=function(A,B){new Effect.Morph(A,Object.extend({style:B},arguments[2]||{}));
return A;
};
["getInlineOpacity","forceRerendering","setContentZoom","collectTextNodes","collectTextNodesIgnoreClass","morph"].each(function(A){Element.Methods[A]=Element[A];
});
Element.Methods.visualEffect=function(B,C,A){s=C.dasherize().camelize();
effect_class=s.charAt(0).toUpperCase()+s.substring(1);
new Effect[effect_class](B,A);
return $(B);
};
Element.addMethods();

TooltipManager={options:{cssClassName:"tooltip",delayOver:200,delayOut:1000,shiftX:10,shiftY:10,className:"alphacube",width:200,height:null,draggable:false,minimizable:false,maximizable:false,showEffect:Element.show,hideEffect:Element.hide},ajaxInfo:null,elements:null,showTimer:null,hideTimer:null,init:function(A,B,C){TooltipManager.options=Object.extend(TooltipManager.options,C||{});
A=TooltipManager.options.cssClassName||"tooltip";
TooltipManager.ajaxInfo=B;
TooltipManager.elements=$$("."+A);
TooltipManager.elements.each(function(D){D=$(D);
var E=TooltipManager._getInfo(D);
if(E.ajax){D.ajaxId=E.id;
D.ajaxInfo=B;
}else{D.tooltipElement=$(E.id);
}D.observe("mouseover",TooltipManager._mouseOver);
D.observe("mouseout",TooltipManager._mouseOut);
});
Windows.addObserver(this);
},addHTML:function(A,B){A=$(A);
B=$(B);
A.tooltipElement=B;
A.observe("mouseover",TooltipManager._mouseOver);
A.observe("mouseout",TooltipManager._mouseOut);
},addAjax:function(B,A){B=$(B);
B.ajaxInfo=A;
B.observe("mouseover",TooltipManager._mouseOver);
B.observe("mouseout",TooltipManager._mouseOut);
},addURL:function(C,B,D,A){C=$(C);
C.url=B;
C.frameWidth=D;
C.frameHeight=A;
C.observe("mouseover",TooltipManager._mouseOver);
C.observe("mouseout",TooltipManager._mouseOut);
},close:function(){if(TooltipManager.tooltipWindow){TooltipManager.tooltipWindow.hide();
}},preloadImages:function(B,A,C){if(!C){C=".gif";
}$A(A).each(function(D){var E=new Image();
E.src=B+"/"+D+C;
});
},_showTooltip:function(C){if(this.element==C){return ;
}while(C&&(!C.tooltipElement&&!C.ajaxInfo&&!C.url)){C=C.parentNode;
}this.element=C;
TooltipManager.showTimer=null;
if(TooltipManager.hideTimer){clearTimeout(TooltipManager.hideTimer);
}var A=Position.cumulativeOffset(C);
var E=C.getDimensions();
if(!this.tooltipWindow){this.tooltipWindow=new Window("__tooltip__",TooltipManager.options);
}this.tooltipWindow.hide();
this.tooltipWindow.setLocation(A[1]+E.height+TooltipManager.options.shiftY,A[0]+TooltipManager.options.shiftX);
Event.observe(this.tooltipWindow.element,"mouseover",function(F){TooltipManager._tooltipOver(F,C);
});
Event.observe(this.tooltipWindow.element,"mouseout",function(F){TooltipManager._tooltipOut(F,C);
});
this.tooltipWindow.height=TooltipManager.options.height;
this.tooltipWindow.width=TooltipManager.options.width;
if(C.ajaxInfo){var D=C.ajaxInfo.options.parameters;
var B=D;
if(C.ajaxId){if(D){D+="&id="+C.ajaxId;
}else{D="id="+C.ajaxId;
}}C.ajaxInfo.options.parameters=D||"";
this.tooltipWindow.setHTMLContent("");
this.tooltipWindow.setAjaxContent(C.ajaxInfo.url,C.ajaxInfo.options);
C.ajaxInfo.options.parameters=B;
}else{if(C.url){this.tooltipWindow.setURL(C.url);
this.tooltipWindow.setSize(C.frameWidth,C.frameHeight);
this.tooltipWindow.height=C.frameHeight;
this.tooltipWindow.width=C.frameWidth;
}else{this.tooltipWindow.setHTMLContent(C.tooltipElement.innerHTML);
}}if(!C.ajaxInfo){this.tooltipWindow.show();
this.tooltipWindow.toFront();
}},_hideTooltip:function(A){if(this.tooltipWindow){this.tooltipWindow.hide();
this.element=null;
}},_mouseOver:function(B){var A=Event.element(B);
if(TooltipManager.showTimer){clearTimeout(TooltipManager.showTimer);
}TooltipManager.showTimer=setTimeout(function(){TooltipManager._showTooltip(A);
},TooltipManager.options.delayOver);
},_mouseOut:function(B){var A=Event.element(B);
if(TooltipManager.showTimer){clearTimeout(TooltipManager.showTimer);
TooltipManager.showTimer=null;
return ;
}if(TooltipManager.tooltipWindow){TooltipManager.hideTimer=setTimeout(function(){TooltipManager._hideTooltip(A);
},TooltipManager.options.delayOut);
}},_tooltipOver:function(B,A){if(TooltipManager.hideTimer){clearTimeout(TooltipManager.hideTimer);
TooltipManager.hideTimer=null;
}},_tooltipOut:function(B,A){if(TooltipManager.hideTimer==null){TooltipManager.hideTimer=setTimeout(function(){TooltipManager._hideTooltip(A);
},TooltipManager.options.delayOut);
}},_getInfo:function(A){var C=A.className.split(" ").detect(function(D){return D.indexOf("html_")==0;
});
var B=true;
if(C){B=false;
}else{C=A.className.split(" ").detect(function(D){return D.indexOf("ajax_")==0;
});
}C=C.substr(C.indexOf("_")+1,C.length);
return C?{ajax:B,id:C}:null;
},onBeforeShow:function(B,E){var D=parseFloat(E.getLocation().top);
var C=E.element.getDimensions();
if(D+C.height>TooltipManager._getScrollTop()+TooltipManager._getPageHeight()){var A=Position.cumulativeOffset(this.element);
var D=A[1]-TooltipManager.options.shiftY-C.height;
E.setLocation(D,A[0]+TooltipManager.options.shiftX);
}},_getPageWidth:function(){return window.innerWidth||document.documentElement.clientWidth||0;
},_getPageHeight:function(){return window.innerHeight||document.documentElement.clientHeight||0;
},_getScrollTop:function(){return document.documentElement.scrollTop||window.pageYOffset||0;
},_getScrollLeft:function(){return document.documentElement.scrollLeft||window.pageXOffset||0;
}};

Effect.ResizeWindow=Class.create();
Object.extend(Object.extend(Effect.ResizeWindow.prototype,Effect.Base.prototype),{initialize:function(G,F,E,D,A){this.window=G;
this.window.resizing=true;
var C=G.getSize();
this.initWidth=parseFloat(C.width);
this.initHeight=parseFloat(C.height);
var B=G.getLocation();
this.initTop=parseFloat(B.top);
this.initLeft=parseFloat(B.left);
this.width=D!=null?parseFloat(D):this.initWidth;
this.height=A!=null?parseFloat(A):this.initHeight;
this.top=F!=null?parseFloat(F):this.initTop;
this.left=E!=null?parseFloat(E):this.initLeft;
this.dx=this.left-this.initLeft;
this.dy=this.top-this.initTop;
this.dw=this.width-this.initWidth;
this.dh=this.height-this.initHeight;
this.r2=$(this.window.getId()+"_row2");
this.content=$(this.window.getId()+"_content");
this.contentOverflow=this.content.getStyle("overflow")||"auto";
this.content.setStyle({overflow:"hidden"});
if(this.window.options.wiredDrag){this.window.currentDrag=G._createWiredElement();
this.window.currentDrag.show();
this.window.element.hide();
}this.start(arguments[5]);
},update:function(B){var C=Math.floor(this.initWidth+this.dw*B);
var A=Math.floor(this.initHeight+this.dh*B);
var E=Math.floor(this.initTop+this.dy*B);
var D=Math.floor(this.initLeft+this.dx*B);
if(window.ie){if(Math.floor(A)==0){this.r2.hide();
}else{if(Math.floor(A)>1){this.r2.show();
}}}this.r2.setStyle({height:A});
this.window.setSize(C,A);
this.window.setLocation(E,D);
},finish:function(A){if(this.window.options.wiredDrag){this.window._hideWiredElement();
this.window.element.show();
}this.window.setSize(this.width,this.height);
this.window.setLocation(this.top,this.left);
this.r2.setStyle({height:null});
this.content.setStyle({overflow:this.contentOverflow});
this.window.resizing=false;
}});
Effect.ModalSlideDown=function(B){var C=WindowUtilities.getWindowScroll();
var A=B.getStyle("height");
B.setStyle({top:-(parseFloat(A)-C.top)+"px"});
B.show();
return new Effect.Move(B,Object.extend({x:0,y:parseFloat(A)},arguments[1]||{}));
};
Effect.ModalSlideUp=function(B){var A=B.getStyle("height");
return new Effect.Move(B,Object.extend({x:0,y:-parseFloat(A)},arguments[1]||{}));
};
PopupEffect=Class.create();
PopupEffect.prototype={initialize:function(A){this.html=$(A);
this.options=Object.extend({className:"popup_effect",duration:0.4},arguments[1]||{});
},show:function(D,B){var A=Position.cumulativeOffset(this.html);
var C=this.html.getDimensions();
var F=D.win.getBounds();
this.window=D.win;
if(!this.div){this.div=document.createElement("div");
this.div.className=this.options.className;
this.div.style.height=C.height+"px";
this.div.style.width=C.width+"px";
this.div.style.top=A[1]+"px";
this.div.style.left=A[0]+"px";
this.div.style.position="absolute";
document.body.appendChild(this.div);
}if(this.options.fromOpacity){this.div.setStyle({opacity:this.options.fromOpacity});
}this.div.show();
var E="top:"+F.top+";left:"+F.left+";width:"+F.width+";height:"+F.height;
if(this.options.toOpacity){E+=";opacity:"+this.options.toOpacity;
}new Effect.Morph(this.div,{style:E,duration:this.options.duration,afterFinish:this._showWindow.bind(this)});
},hide:function(D,B){var A=Position.cumulativeOffset(this.html);
var C=this.html.getDimensions();
this.window.visible=true;
var F=this.window.getBounds();
this.window.visible=false;
this.window.element.hide();
this.div.style.height=F.height;
this.div.style.width=F.width;
this.div.style.top=F.top;
this.div.style.left=F.left;
if(this.options.toOpacity){this.div.setStyle({opacity:this.options.toOpacity});
}this.div.show();
var E="top:"+A[1]+"px;left:"+A[0]+"px;width:"+C.width+"px;height:"+C.height+"px";
if(this.options.fromOpacity){E+=";opacity:"+this.options.fromOpacity;
}new Effect.Morph(this.div,{style:E,duration:this.options.duration,afterFinish:this._hideDiv.bind(this)});
},_showWindow:function(){this.div.hide();
this.window.element.show();
},_hideDiv:function(){this.div.hide();
}};

WindowStore={doSetCookie:false,cookieName:"__window_store__",expired:null,init:function(D,B){WindowStore.cookieName=D||WindowStore.cookieName;
if(!B){var A=new Date();
A.setYear(A.getYear()+1903);
WindowStore.expired=A;
}else{WindowStore.expired=B;
}Windows.windows.each(function(E){E.setCookie(E.getId(),WindowStore.expired);
});
var C={onShow:function(E,F){WindowStore._saveCookie();
},onClose:function(E,F){WindowStore._saveCookie();
},onHide:function(E,F){WindowStore._saveCookie();
}};
Windows.addObserver(C);
WindowStore._restoreWindows();
WindowStore._saveCookie();
},show:function(win){eval("var cookie = "+WindowUtilities.getCookie(WindowStore.cookieName));
if(cookie!=null){if(cookie[win.getId()]){win.show();
}}else{win.show();
}},_saveCookie:function(){if(!doSetCookie){return ;
}var A="{";
Windows.windows.each(function(B){if(A!="{"){A+=",";
}A+=B.getId()+": "+B.isVisible();
});
A+="}";
WindowUtilities.setCookie(A,[WindowStore.cookieName,WindowStore.expired]);
},_restoreWindows:function(){eval("var cookie = "+WindowUtilities.getCookie(WindowStore.cookieName));
if(cookie!=null){doSetCookie=false;
Windows.windows.each(function(win){if(cookie[win.getId()]){win.show();
}});
}doSetCookie=true;
}};
WindowCloseKey={keyCode:Event.KEY_ESC,init:function(A){if(A){WindowCloseKey.keyCode=A;
}Event.observe(document,"keydown",this._closeCurrentWindow.bindAsEventListener(this));
},_closeCurrentWindow:function(B){var D=B||window.event;
var A=D.which||D.keyCode;
var C=top.Windows.focusedWindow;
if(A==WindowCloseKey.keyCode&&C){if(C.cancelCallback){top.Dialog.cancelCallback();
}else{if(C.okCallback){top.Dialog.okCallback();
}else{top.Windows.close(top.Windows.focusedWindow.getId());
}}}}};

var cheersOn=new Image();
cheersOn.src=global_messages["page.contextPath"]+"/css/images/lapka_new_cheers_on.gif";
var jeersOn=new Image();
jeersOn.src=global_messages["page.contextPath"]+"/css/images/lapka_new_jeers_on.gif";
var storeRatingSrc;
function hiRating(B,A){rating_img=B.getElementsByTagName("img")[0];
storeRatingSrc=rating_img.src;
rating_img.src=A?cheersOn.src:jeersOn.src;
}function loRating(A){A.getElementsByTagName("img")[0].src=storeRatingSrc;
}
