var Prototype={Version:"1.6.0.3",Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,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,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&
document.createElement("div").__proto__!==document.createElement("form").__proto__},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;
var Class={create:function(){function a(){this.initialize.apply(this,arguments)}var b=null,c=$A(arguments);if(Object.isFunction(c[0]))b=c.shift();Object.extend(a,Class.Methods);a.superclass=b;a.subclasses=[];if(b){var d=function(){};d.prototype=b.prototype;a.prototype=new d;b.subclasses.push(a)}for(b=0;b<c.length;b++)a.addMethods(c[b]);if(!a.prototype.initialize)a.prototype.initialize=Prototype.emptyFunction;return a.prototype.constructor=a}};
Class.Methods={addMethods:function(a){var b=this.superclass&&this.superclass.prototype,c=Object.keys(a);Object.keys({toString:true}).length||c.push("toString","valueOf");for(var d=0,e=c.length;d<e;d++){var f=c[d],j=a[f];if(b&&Object.isFunction(j)&&j.argumentNames().first()=="$super"){var h=j;j=function(g){return function(){return b[g].apply(this,arguments)}}(f).wrap(h);j.valueOf=h.valueOf.bind(h);j.toString=h.toString.bind(h)}this.prototype[f]=j}return this}};var Abstract={};
Object.extend=function(a,b){for(var c in b)a[c]=b[c];return a};
Object.extend(Object,{inspect:function(a){try{if(Object.isUndefined(a))return"undefined";if(a===null)return"null";return a.inspect?a.inspect():String(a)}catch(b){if(b instanceof RangeError)return"...";throw b;}},toJSON:function(a){switch(typeof a){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)){var b=[];for(var c in a){var d=Object.toJSON(a[c]);Object.isUndefined(d)||b.push(c.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(a){var b=[];for(var c in a)b.push(a[c]);return b},clone:function(a){return Object.extend({},a)},isElement:function(a){return!!(a&&a.nodeType==1)},isArray:function(a){return a!=null&&typeof a=="object"&&"splice"in a&&"join"in a},isHash:function(a){return a instanceof
Hash},isFunction:function(a){return typeof a=="function"},isString:function(a){return typeof a=="string"},isNumber:function(a){return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}});
Object.extend(Function.prototype,{argumentNames:function(){var a=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,"").split(",");return a.length==1&&!a[0]?[]:a},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var a=this,b=$A(arguments),c=b.shift();return function(){return a.apply(c,b.concat($A(arguments)))}},bindAsEventListener:function(){var a=this,b=$A(arguments),c=b.shift();return function(d){return a.apply(c,[d||window.event].concat(b))}},
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()*1E3;return window.setTimeout(function(){return a.apply(a,b)},c)},defer:function(){return this.delay.apply(this,[0.01].concat($A(arguments)))},wrap:function(a){var b=this;return function(){return a.apply(this,[b.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)))}}});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(){for(var a,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a}};
RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};
var PeriodicalExecuter=Class.create({initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},execute:function(){this.callback(this)},stop:function(){if(this.timer){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:{"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(a,b){var c="",d=this,e;for(b=arguments.callee.prepareReplacement(b);d.length>0;)if(e=d.match(a)){c+=d.slice(0,e.index);c+=String.interpret(b(e));d=d.slice(e.index+e[0].length)}else{c+=d;d=""}return c},sub:function(a,b,c){b=this.gsub.prepareReplacement(b);c=Object.isUndefined(c)?1:c;return this.gsub(a,function(d){if(--c<0)return d[0];return b(d)})},scan:function(a,b){this.gsub(a,b);return String(this)},truncate:function(a,b){a=a||30;b=Object.isUndefined(b)?
"...":b;return this.length>a?this.slice(0,a-b.length)+b: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 a=new RegExp(Prototype.ScriptFragment,"img"),b=new RegExp(Prototype.ScriptFragment,"im");return(this.match(a)||[]).map(function(c){return(c.match(b)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(a){return eval(a)})},
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(a){var b=this.strip().match(/([^?#]*)(#.*)?$/);if(!b)return{};return b[1].split(a||"&").inject({},function(c,d){if((d=d.split("="))[0]){var e=decodeURIComponent(d.shift());d=d.length>
1?d.join("="):d[0];if(d!=undefined)d=decodeURIComponent(d);if(e in c){Object.isArray(c[e])||(c[e]=[c[e]]);c[e].push(d)}else c[e]=d}return c})},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 a=this.split("-"),b=a.length;if(b==1)return a[0];for(var c=this.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):
a[0],d=1;d<b;d++)c+=a[d].charAt(0).toUpperCase()+a[d].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(a){var b=this.gsub(/[\x00-\x1f\\]/,function(c){var d=String.specialChar[c[0]];return d?d:"\\u00"+c[0].charCodeAt().toPaddedString(2,
16)});if(a)return'"'+b.replace(/"/g,'\\"')+'"';return"'"+b.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){var a=this;if(a.blank())return false;a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(a)},evalJSON:function(a){var b=this.unfilterJSON();try{if(!a||b.isJSON())return eval("("+b+")")}catch(c){}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.stripTags().replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}});String.prototype.gsub.prepareReplacement=function(a){if(Object.isFunction(a))return a;var b=new Template(a);return function(c){return b.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.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(b){if(a==null)return"";var c=b[1]||"";if(c=="\\")return b[2];var d=a,e=b[3],f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;b=f.exec(e);if(b==null)return c;for(;b!=null;){var j=b[1].startsWith("[")?b[2].gsub("\\\\]","]"):b[1];d=d[j];if(null==d||""==
b[3])break;e=e.substring("["==b[3]?b[1].length:b[0].length);b=f.exec(e)}return c+String.interpret(d)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={},Enumerable={each:function(a,b){var c=0;try{this._each(function(e){a.call(b,e,c++)})}catch(d){if(d!=$break)throw d;}return this},eachSlice:function(a,b,c){var d=-a,e=[],f=this.toArray();if(a<1)return f;for(;(d+=a)<f.length;)e.push(f.slice(d,d+a));return e.collect(b,c)},all:function(a,b){a=a||Prototype.K;var c=true;this.each(function(d,e){c=c&&!!a.call(b,d,e);if(!c)throw $break;});return c},any:function(a,b){a=a||Prototype.K;var c=false;this.each(function(d,e){if(c=!!a.call(b,d,e))throw $break;
});return c},collect:function(a,b){a=a||Prototype.K;var c=[];this.each(function(d,e){c.push(a.call(b,d,e))});return c},detect:function(a,b){var c;this.each(function(d,e){if(a.call(b,d,e)){c=d;throw $break;}});return c},findAll:function(a,b){var c=[];this.each(function(d,e){a.call(b,d,e)&&c.push(d)});return c},grep:function(a,b,c){b=b||Prototype.K;var d=[];if(Object.isString(a))a=new RegExp(a);this.each(function(e,f){a.match(e)&&d.push(b.call(c,e,f))});return d},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(a,b){b=Object.isUndefined(b)?null:b;return this.eachSlice(a,function(c){for(;c.length<a;)c.push(b);return c})},inject:function(a,b,c){this.each(function(d,e){a=b.call(c,a,d,e)});return a},invoke:function(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})},max:function(a,b){a=a||Prototype.K;var c;this.each(function(d,e){d=a.call(b,d,e);if(c==null||d>=c)c=
d});return c},min:function(a,b){a=a||Prototype.K;var c;this.each(function(d,e){d=a.call(b,d,e);if(c==null||d<c)c=d});return c},partition:function(a,b){a=a||Prototype.K;var c=[],d=[];this.each(function(e,f){(a.call(b,e,f)?c:d).push(e)});return[c,d]},pluck:function(a){var b=[];this.each(function(c){b.push(c[a])});return b},reject:function(a,b){var c=[];this.each(function(d,e){a.call(b,d,e)||c.push(d)});return c},sortBy:function(a,b){return this.map(function(c,d){return{value:c,criteria:a.call(b,c,d)}}).sort(function(c,
d){c=c.criteria;d=d.criteria;return c<d?-1:c>d?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var a=Prototype.K,b=$A(arguments);if(Object.isFunction(b.last()))a=b.pop();var c=[this].concat(b).map($A);return this.map(function(d,e){return a(c.pluck(e))})},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(a){if(!a)return[];if(a.toArray)return a.toArray();for(var b=a.length||0,c=new Array(b);b--;)c[b]=a[b];return c}
if(Prototype.Browser.WebKit)$A=function(a){if(!a)return[];if(!(typeof a==="function"&&typeof a.length==="number"&&typeof a.item==="function")&&a.toArray)return a.toArray();for(var b=a.length||0,c=new Array(b);b--;)c[b]=a[b];return c};Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;
Object.extend(Array.prototype,{_each:function(a){for(var b=0,c=this.length;b<c;b++)a(this[b])},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(a,b){return a.concat(Object.isArray(b)?b.flatten():[b])})},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(b,c,d){if(0==d||(a?b.last()!=c:!b.include(c)))b.push(c);return b})},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){b=
Object.toJSON(b);Object.isUndefined(b)||a.push(b)});return"["+a.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach))Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,b){b||(b=0);var c=this.length;if(b<0)b=c+b;for(;b<c;b++)if(this[b]===a)return b;return-1};
if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(a,b){b=isNaN(b)?this.length:(b<0?this.length+b:b)+1;a=this.slice(0,b).reverse().indexOf(a);return a<0?a:b-a-1};Array.prototype.toArray=Array.prototype.clone;function $w(a){if(!Object.isString(a))return[];return(a=a.strip())?a.split(/\s+/):[]}
if(Prototype.Browser.Opera)Array.prototype.concat=function(){for(var a=[],b=0,c=this.length;b<c;b++)a.push(this[b]);b=0;for(c=arguments.length;b<c;b++)if(Object.isArray(arguments[b]))for(var d=0,e=arguments[b].length;d<e;d++)a.push(arguments[b][d]);else a.push(arguments[b]);return a};
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(a,b){$R(0,this,true).each(a,b);return this},toPaddedString:function(a,b){b=this.toString(b||10);return"0".times(a-b.length)+b},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(a){Number.prototype[a]=Math[a].methodize()});function $H(a){return new Hash(a)}
var Hash=Class.create(Enumerable,function(){function a(b,c){if(Object.isUndefined(c))return b;return b+"="+encodeURIComponent(String.interpret(c))}return{initialize:function(b){this._object=Object.isHash(b)?b.toObject():Object.clone(b)},_each:function(b){for(var c in this._object){var d=this._object[c],e=[c,d];e.key=c;e.value=d;b(e)}},set:function(b,c){return this._object[b]=c},get:function(b){if(this._object[b]!==Object.prototype[b])return this._object[b]},unset:function(b){var c=this._object[b];
delete this._object[b];return c},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(b){var c=this.detect(function(d){return d.value===b});return c&&c.key},merge:function(b){return this.clone().update(b)},update:function(b){return(new Hash(b)).inject(this,function(c,d){c.set(d.key,d.value);return c})},toQueryString:function(){return this.inject([],function(b,c){var d=encodeURIComponent(c.key);
if((c=c.value)&&typeof c=="object"){if(Object.isArray(c))return b.concat(c.map(a.curry(d)))}else b.push(a(d,c));return b}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(b){return b.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}}());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;
var ObjectRange=Class.create(Enumerable,{initialize:function(a,b,c){this.start=a;this.end=b;this.exclusive=c},_each:function(a){for(var b=this.start;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}}),$R=function(a,b,c){return new ObjectRange(a,b,c)},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){this.include(a)||this.responders.push(a)},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,b,c,d){this.each(function(e){if(Object.isFunction(e[a]))try{e[a].apply(e,[b,c,d])}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();else if(Object.isHash(this.options.parameters))this.options.parameters=this.options.parameters.toObject()}});
Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,c){$super(c);this.transport=Ajax.getTransport();this.request(b)},request:function(a){this.url=a;this.method=this.options.method;a=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){a._method=this.method;this.method="post"}this.parameters=a;if(a=Object.toQueryString(a))if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+a;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))a+=
"&_=";try{var b=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(b);Ajax.Responders.dispatch("onCreate",this,b);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);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||a:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&
this.onStateChange()}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;a>1&&!(a==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var a={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){a["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)a.Connection="close"}if(typeof this.options.requestHeaders=="object"){var b=this.options.requestHeaders;if(Object.isFunction(b.push))for(var c=0,d=b.length;c<d;c+=2)a[b[c]]=b[c+1];else $H(b).each(function(f){a[f.key]=f.value})}for(var e in a)this.transport.setRequestHeader(e,a[e])},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){a=Ajax.Request.Events[a];var b=new Ajax.Response(this);if(a=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(c){this.dispatchException(c)}var d=b.getHeader("Content-type");if(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&d&&d.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))this.evalResponse()}try{(this.options["on"+
a]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+a,this,b,b.headerJSON)}catch(e){this.dispatchException(e)}if(a=="Complete")this.transport.onreadystatechange=Prototype.emptyFunction},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return!a||a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""})},getHeader:function(a){try{return this.transport.getResponseHeader(a)||
null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(a){this.dispatchException(a)}},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(a){this.request=a;a=this.transport=a.transport;var b=this.readyState=a.readyState;if(b>2&&!Prototype.Browser.IE||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(a.responseText);this.headerJSON=this._getHeaderJSON()}if(b==4){a=a.responseXML;this.responseXML=Object.isUndefined(a)?null:a;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,
getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a)return null;a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||
!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json")||this.responseText.blank())return null;try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});
Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,b,c,d){this.container={success:b.success||b,failure:b.failure||(b.success?null:b)};d=Object.clone(d);var e=d.onComplete;d.onComplete=function(f,j){this.updateContent(f.responseText);Object.isFunction(e)&&e(f,j)}.bind(this);$super(c,d)},updateContent:function(a){var b=this.container[this.success()?"success":"failure"],c=this.options;c.evalScripts||(a=a.stripScripts());if(b=$(b))if(c.insertion)if(Object.isString(c.insertion)){var d=
{};d[c.insertion]=a;b.insert(d)}else c.insertion(b,a);else b.update(a)}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,c,d){$super(d);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=b;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 $(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push($(arguments[b]));return c}if(Object.isString(a))a=document.getElementById(a);return Element.extend(a)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(a,b){var c=[];a=document.evaluate(a,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);b=0;for(var d=a.snapshotLength;b<d;b++)c.push(Element.extend(a.snapshotItem(b)));return c};if(!window.Node)var Node={};
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(b,c){c=c||{};b=b.toLowerCase();var d=Element.cache;if(Prototype.Browser.IE&&c.name){b="<"+b+' name="'+c.name+'">';delete c.name;return Element.writeAttribute(document.createElement(b),c)}d[b]||(d[b]=Element.extend(document.createElement(b)));return Element.writeAttribute(d[b].cloneNode(false),c)};Object.extend(this.Element,a||{});if(a)this.Element.prototype=a.prototype}).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=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(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(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();else if(!Object.isElement(b)){b=Object.toHTML(b);var c=a.ownerDocument.createRange();c.selectNode(a);b.evalScripts.bind(b).defer();b=c.createContextualFragment(b.stripScripts())}a.parentNode.replaceChild(b,a);return a},insert:function(a,b){a=$(a);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||b&&(b.toElement||b.toHTML))b={bottom:b};var c,d,e;for(var f in b){c=b[f];f=f.toLowerCase();d=Element._insertionTranslations[f];
if(c&&c.toElement)c=c.toElement();if(Object.isElement(c))d(a,c);else{c=Object.toHTML(c);e=(f=="before"||f=="after"?a.parentNode:a).tagName.toUpperCase();e=Element._getContentFromAnonymousElement(e,c.stripScripts());if(f=="top"||f=="after")e.reverse();e.each(d.curry(a));c.evalScripts.bind(c).defer()}}return a},wrap:function(a,b,c){a=$(a);if(Object.isElement(b))$(b).writeAttribute(c||{});else b=Object.isString(b)?new Element(b,c):new Element("div",b);a.parentNode&&a.parentNode.replaceChild(b,a);b.appendChild(a);
return b},inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(c){var d=c.first();c=c.last();if(d=(a[d]||"").toString())b+=" "+c+"="+d.inspect(true)});return b+">"},recursivelyCollect:function(a,b){a=$(a);for(var c=[];a=a[b];)a.nodeType==1&&c.push(Element.extend(a));return c},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $(a).select("*")},firstDescendant:function(a){for(a=$(a).firstChild;a&&
a.nodeType!=1;)a=a.nextSibling;return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild))return[];for(;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(a,b){if(Object.isString(b))b=new Selector(b);
return b.match($(a))},up:function(a,b,c){a=$(a);if(arguments.length==1)return $(a.parentNode);var d=a.ancestors();return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},down:function(a,b,c){a=$(a);if(arguments.length==1)return a.firstDescendant();return Object.isNumber(b)?a.descendants()[b]:Element.select(a,b)[c||0]},previous:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(a));var d=a.previousSiblings();return Object.isNumber(b)?d[b]:Selector.findElement(d,
b,c)},next:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(a));var d=a.nextSiblings();return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},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(a){a=$(a);var b=a.readAttribute("id"),c=arguments.callee;if(b)return b;do b="anonymous_element_"+
c.counter++;while($(b));a.writeAttribute("id",b);return b},readAttribute:function(a,b){a=$(a);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[b])return c.values[b](a,b);if(c.names[b])b=c.names[b];if(b.include(":"))return!a.attributes||!a.attributes[b]?null:a.attributes[b].value}return a.getAttribute(b)},writeAttribute:function(a,b,c){a=$(a);var d={},e=Element._attributeTranslations.write;if(typeof b=="object")d=b;else d[b]=Object.isUndefined(c)?true:c;for(var f in d){b=
e.names[f]||f;c=d[f];if(e.values[f])b=e.values[f](a,c);if(c===false||c===null)a.removeAttribute(b);else c===true?a.setAttribute(b,b):a.setAttribute(b,c)}return a},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)){a=a.className;return a.length>0&&(a==b||(new RegExp("(^|\\s)"+b+"(\\s|$)")).test(a))}},addClassName:function(a,b){if(a=$(a)){a.hasClassName(b)||
(a.className+=(a.className?" ":"")+b);return a}},removeClassName:function(a,b){if(a=$(a)){a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a}},toggleClassName:function(a,b){if(a=$(a))return a[a.hasClassName(b)?"removeClassName":"addClassName"](b)},cleanWhitespace:function(a){a=$(a);for(var b=a.firstChild;b;){var c=b.nextSibling;b.nodeType==3&&!/\S/.test(b.nodeValue)&&a.removeChild(b);b=c}return a},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(a,
b){a=$(a);b=$(b);if(a.compareDocumentPosition)return(a.compareDocumentPosition(b)&8)===8;if(b.contains)return b.contains(a)&&b!==a;for(;a=a.parentNode;)if(a==b)return true;return false},scrollTo:function(a){a=$(a);var b=a.cumulativeOffset();window.scrollTo(b[0],b[1]);return a},getStyle:function(a,b){a=$(a);b=b=="float"?"cssFloat":b.camelize();var c=a.style[b];if(!c||c=="auto")c=(a=document.defaultView.getComputedStyle(a,null))?a[b]:null;if(b=="opacity")return c?parseFloat(c):1;return c=="auto"?null:
c},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,b){a=$(a);var c=a.style;if(Object.isString(b)){a.style.cssText+=";"+b;return b.include("opacity")?a.setOpacity(b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(var d in b)if(d=="opacity")a.setOpacity(b[d]);else c[d=="float"||d=="cssFloat"?Object.isUndefined(c.styleFloat)?"cssFloat":"styleFloat":d]=b[d];return a},setOpacity:function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;return a},getDimensions:function(a){a=
$(a);var b=a.getStyle("display");if(b!="none"&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};b=a.style;var c=b.visibility,d=b.position,e=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var f=a.clientWidth;a=a.clientHeight;b.display=e;b.position=d;b.visibility=c;return{width:f,height:a}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=
0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow)return a;a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden")a.style.overflow="hidden";return a},undoClipping:function(a){a=$(a);if(!a._overflow)return a;a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},
cumulativeOffset:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return Element._returnOffset(c,b)},positionedOffset:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a=a.offsetParent){if(a.tagName.toUpperCase()=="BODY")break;if(Element.getStyle(a,"position")!=="static")break}}while(a);return Element._returnOffset(c,b)},absolutize:function(a){a=$(a);if(a.getStyle("position")=="absolute")return a;var b=a.positionedOffset(),c=b[1];b=b[0];var d=
a.clientWidth,e=a.clientHeight;a._originalLeft=b-parseFloat(a.style.left||0);a._originalTop=c-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=a.style.height;a.style.position="absolute";a.style.top=c+"px";a.style.left=b+"px";a.style.width=d+"px";a.style.height=e+"px";return a},relativize:function(a){a=$(a);if(a.getStyle("position")=="relative")return a;a.style.position="relative";var b=parseFloat(a.style.top||0)-(a._originalTop||0),c=parseFloat(a.style.left||0)-(a._originalLeft||
0);a.style.top=b+"px";a.style.left=c+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(a){var b=0,c=0;do{b+=a.scrollTop||0;c+=a.scrollLeft||0;a=a.parentNode}while(a);return Element._returnOffset(c,b)},getOffsetParent:function(a){if(a.offsetParent)return $(a.offsetParent);if(a==document.body)return $(a);for(;(a=a.parentNode)&&a!=document.body;)if(Element.getStyle(a,"position")!="static")return $(a);return $(document.body)},viewportOffset:function(a){var b=
0,c=0,d=a;do{b+=d.offsetTop||0;c+=d.offsetLeft||0;if(d.offsetParent==document.body&&Element.getStyle(d,"position")=="absolute")break}while(d=d.offsetParent);d=a;do if(!Prototype.Browser.Opera||d.tagName&&d.tagName.toUpperCase()=="BODY"){b-=d.scrollTop||0;c-=d.scrollLeft||0}while(d=d.parentNode);return Element._returnOffset(c,b)},clonePosition:function(a,b,c){c=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},c||{});b=$(b);var d=b.viewportOffset();a=$(a);
var e=[0,0],f=null;if(Element.getStyle(a,"position")=="absolute"){f=a.getOffsetParent();e=f.viewportOffset()}if(f==document.body){e[0]-=document.body.offsetLeft;e[1]-=document.body.offsetTop}if(c.setLeft)a.style.left=d[0]-e[0]+c.offsetLeft+"px";if(c.setTop)a.style.top=d[1]-e[1]+c.offsetTop+"px";if(c.setWidth)a.style.width=b.offsetWidth+"px";if(c.setHeight)a.style.height=b.offsetHeight+"px";return a}};Element.Methods.identify.counter=1;
Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};
if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(a,b,c){switch(c){case "left":case "top":case "right":case "bottom":if(a(b,"position")==="static")return null;case "height":case "width":if(!Element.visible(b))return null;var d=parseInt(a(b,c),10);if(d!==b["offset"+c.capitalize()])return d+"px";return(c==="height"?["border-top-width","padding-top","padding-bottom","border-bottom-width"]:["border-left-width","padding-left","padding-right","border-right-width"]).inject(d,
function(e,f){f=a(b,f);return f===null?e:e-parseInt(f,10)})+"px";default:return a(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(a,b,c){if(c==="title")return b.title;return a(b,c)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(a,b){b=$(b);var c=b.getStyle("position");if(c!=="static")return a(b);b.setStyle({position:"relative"});a=a(b);b.setStyle({position:c});return a});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=
Element.Methods[a].wrap(function(b,c){c=$(c);var d=c.getStyle("position");if(d!=="static")return b(c);var e=c.getOffsetParent();e&&e.getStyle("position")==="fixed"&&e.setStyle({zoom:1});c.setStyle({position:"relative"});b=b(c);c.setStyle({position:d});return b})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(a,b){return a(b)});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(a,b){function c(f){return f.replace(/alpha\([^\)]*\)/gi,"")}a=$(a);var d=a.currentStyle;if(d&&!d.hasLayout||!d&&a.style.zoom=="normal")a.style.zoom=1;d=a.getStyle("filter");var e=a.style;
if(b==1||b===""){(d=c(d))?(e.filter=d):e.removeAttribute("filter");return a}else if(b<1.0E-5)b=0;e.filter=c(d)+"alpha(opacity="+b*100+")";return a};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_getAttrNode:function(a,b){return(a=a.getAttributeNode(b))?a.value:""},_getEv:function(a,b){return(b=a.getAttribute(b))?b.toString().slice(23,-2):null},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},
title:function(a){return a.title}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").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<1.0E-5?0:b;return a};else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;if(b==1)if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else try{var c=document.createTextNode(" ");
a.appendChild(c);a.removeChild(c)}catch(d){}return a};Element.Methods.cumulativeOffset=function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a.offsetParent==document.body)if(Element.getStyle(a,"position")=="absolute")break;a=a.offsetParent}while(a);return Element._returnOffset(c,b)}}
if(Prototype.Browser.IE||Prototype.Browser.Opera)Element.Methods.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);var c=a.tagName.toUpperCase();if(c in Element._insertionTranslations.tags){$A(a.childNodes).each(function(d){a.removeChild(d)});Element._getContentFromAnonymousElement(c,b.stripScripts()).each(function(d){a.appendChild(d)})}else a.innerHTML=b.stripScripts();b.evalScripts.bind(b).defer();return a};
if("outerHTML"in document.createElement("div"))Element.Methods.replace=function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b)){a.parentNode.replaceChild(b,a);return a}b=Object.toHTML(b);var c=a.parentNode,d=c.tagName.toUpperCase();if(Element._insertionTranslations.tags[d]){var e=a.next();d=Element._getContentFromAnonymousElement(d,b.stripScripts());c.removeChild(a);e?d.each(function(f){c.insertBefore(f,e)}):d.each(function(f){c.appendChild(f)})}else a.outerHTML=b.stripScripts();
b.evalScripts.bind(b).defer();return a};Element._returnOffset=function(a,b){var c=[a,b];c.left=a;c.top=b;return c};Element._getContentFromAnonymousElement=function(a,b){var c=new Element("div");if(a=Element._insertionTranslations.tags[a]){c.innerHTML=a[0]+b+a[1];a[2].times(function(){c=c.firstChild})}else c.innerHTML=b;return $A(c.childNodes)};
Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};
(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(a,b){b=Element._attributeTranslations.has[b]||b;a=$(a).getAttributeNode(b);return!!(a&&a.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,c=Object.extend(function(d){if(!d||d._extendedByPrototype||d.nodeType!=1||d==window)return d;var e=Object.clone(a),f=d.tagName.toUpperCase(),j;b[f]&&Object.extend(e,b[f]);for(j in e){f=e[j];if(Object.isFunction(f)&&!(j in d))d[j]=f.methodize()}d._extendedByPrototype=Prototype.emptyFunction;return d},{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(a){function b(g){g=g.toUpperCase();Element.Methods.ByTag[g]||(Element.Methods.ByTag[g]={});Object.extend(Element.Methods.ByTag[g],a)}function c(g,k,l){l=l||false;for(var p in g){var m=g[p];if(Object.isFunction(m))if(!l||!(p in k))k[p]=m.methodize()}}function d(g){var k,l={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(l[g])k="HTML"+l[g]+"Element";if(window[k])return window[k];k="HTML"+g+"Element";if(window[k])return window[k];k="HTML"+g.capitalize()+"Element";if(window[k])return window[k];window[k]={};window[k].prototype=document.createElement(g).__proto__;
return window[k]}var e=Prototype.BrowserFeatures,f=Element.Methods.ByTag;if(!a){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 j=a;a=arguments[1]}if(j)Object.isArray(j)?j.each(b):b(j);else Object.extend(Element.Methods,a||{});if(e.ElementExtensions){c(Element.Methods,
HTMLElement.prototype);c(Element.Methods.Simulated,HTMLElement.prototype,true)}if(e.SpecificElementExtensions)for(var h in Element.Methods.ByTag){e=d(h);Object.isUndefined(e)||c(f[h],e.prototype)}Object.extend(Element,Element.Methods);delete Element.ByTag;Element.extend.refresh&&Element.extend.refresh();Element.cache={}};
document.viewport={getDimensions:function(){var a={},b=Prototype.Browser;$w("width height").each(function(c){var d=c.capitalize();a[c]=b.WebKit&&!document.evaluate?self["inner"+d]:b.Opera&&parseFloat(window.opera.version())<9.5?document.body["client"+d]:document.documentElement["client"+d]});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();if(this.shouldUseSelectorsAPI())this.mode="selectorsAPI";else if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var a=this.expression;if(Prototype.Browser.WebKit&&(a.include("-of-type")||a.include(":empty")))return false;if(/(\[[\w-]*?:|:checked)/.test(a))return false;return true},
shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(!Selector._div)Selector._div=new Element("div");try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var a=this.expression,b=Selector.patterns,c=Selector.criteria,d,e;if(Selector._cache[a])this.matcher=Selector._cache[a];else{for(this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];a&&d!=a&&/\S/.test(a);){d=
a;for(var f in b){e=b[f];if(e=a.match(e)){this.matcher.push(Object.isFunction(c[f])?c[f](e):(new Template(c[f])).evaluate(e));a=a.replace(e[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher}},compileXPathMatcher:function(){var a=this.expression,b=Selector.patterns,c=Selector.xpath,d,e;if(Selector._cache[a])this.xpath=Selector._cache[a];else{for(this.matcher=[".//*"];a&&d!=a&&/\S/.test(a);){d=a;for(var f in b)if(e=
a.match(b[f])){this.matcher.push(Object.isFunction(c[f])?c[f](e):(new Template(c[f])).evaluate(e));a=a.replace(e[0],"");break}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath}},findElements:function(a){a=a||document;var b=this.expression;switch(this.mode){case "selectorsAPI":if(a!==document){var c=a.id;b="#"+$(a).identify()+" "+b}b=$A(a.querySelectorAll(b)).map(Element.extend);a.id=c;return b;case "xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},
match:function(a){this.tokens=[];for(var b=this.expression,c=Selector.patterns,d=Selector.assertions,e,f;b&&e!==b&&/\S/.test(b);){e=b;for(var j in c){f=c[j];if(f=b.match(f))if(d[j]){this.tokens.push([j,Object.clone(f)]);b=b.replace(f[0],"")}else return this.findElements(document).include(a)}}b=true;for(j=0;d=this.tokens[j];j++){c=d[0];d=d[1];if(!Selector.assertions[c](a,d)){b=false;break}}return b},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+
">"}});
Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*")return"";return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return(new Template("[@#{1}]")).evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];
return(new Template(Selector.xpath.operators[a[2]])).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b)return"";if(Object.isFunction(b))return b(a);return(new Template(Selector.xpath.pseudos[a[1]])).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},
pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(a){for(var b=a[6],c=Selector.patterns,d=Selector.xpath,e,f,j=[];b&&e!=b&&/\S/.test(b);){e=b;for(var h in c)if(a=b.match(c[h])){f=Object.isFunction(d[h])?d[h](a):
(new Template(d[h])).evaluate(a);j.push("("+f.substring(1,f.length-1)+")");b=b.replace(a[0],"");break}}return"[not("+j.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(a,b){var c=b[6];if(c=="even")c="2n+0";if(c=="odd")c="2n+1";if(b=c.match(/^(\d+)$/))return"["+a+"= "+b[1]+"]";if(b=c.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(b[1]=="-")b[1]=-1;c=b[1]?Number(b[1]):1;b=b[2]?
Number(b[2]):0;return(new Template("[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]")).evaluate({fragment:a,a:c,b:b})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=a[5]||a[6];return(new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;')).evaluate(a)},
pseudo:function(a){if(a[6])a[6]=a[6].replace(/"/g,'\\"');return(new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;')).evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
attrPresence:/^\[((?:[\w]+:)?[\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(a,b){return(a=Element.readAttribute(a,b[1]))&&Selector.operators[b[2]](a,b[5]||b[6])}},handlers:{concat:function(a,
b){for(var c=0,d;d=b[c];c++)a.push(d);return a},mark:function(a){for(var b=Prototype.emptyFunction,c=0,d;d=a[c];c++)d._countedByPrototype=b;return a},unmark:function(a){for(var b=0,c;c=a[b];b++)c._countedByPrototype=undefined;return a},index:function(a,b,c){a._countedByPrototype=Prototype.emptyFunction;if(b){a=a.childNodes;b=a.length-1;for(var d=1;b>=0;b--){var e=a[b];if(e.nodeType==1&&(!c||e._countedByPrototype))e.nodeIndex=d++}}else{b=0;d=1;for(a=a.childNodes;e=a[b];b++)if(e.nodeType==1&&(!c||e._countedByPrototype))e.nodeIndex=
d++}},unique:function(a){if(a.length==0)return a;for(var b=[],c,d=0,e=a.length;d<e;d++)if(!(c=a[d])._countedByPrototype){c._countedByPrototype=Prototype.emptyFunction;b.push(Element.extend(c))}return Selector.handlers.unmark(b)},descendant:function(a){for(var b=Selector.handlers,c=0,d=[],e;e=a[c];c++)b.concat(d,e.getElementsByTagName("*"));return d},child:function(a){for(var b=0,c=[],d;d=a[b];b++)for(var e=0,f;f=d.childNodes[e];e++)f.nodeType==1&&f.tagName!="!"&&c.push(f);return c},adjacent:function(a){for(var b=
0,c=[],d;d=a[b];b++)(d=this.nextElementSibling(d))&&c.push(d);return c},laterSibling:function(a){for(var b=Selector.handlers,c=0,d=[],e;e=a[c];c++)b.concat(d,Element.nextSiblings(e));return d},nextElementSibling:function(a){for(;a=a.nextSibling;)if(a.nodeType==1)return a;return null},previousElementSibling:function(a){for(;a=a.previousSibling;)if(a.nodeType==1)return a;return null},tagName:function(a,b,c,d){var e=c.toUpperCase(),f=[],j=Selector.handlers;if(a){if(d){if(d=="descendant"){for(b=0;d=a[b];b++)j.concat(f,
d.getElementsByTagName(c));return f}else a=this[d](a);if(c=="*")return a}for(b=0;d=a[b];b++)d.tagName.toUpperCase()===e&&f.push(d);return f}else return b.getElementsByTagName(c)},id:function(a,b,c,d){c=$(c);var e=Selector.handlers;if(!c)return[];if(!a&&b==document)return[c];if(a){if(d)if(d=="child")for(b=0;d=a[b];b++){if(c.parentNode==d)return[c]}else if(d=="descendant")for(b=0;d=a[b];b++){if(Element.descendantOf(c,d))return[c]}else if(d=="adjacent")for(b=0;d=a[b];b++){if(Selector.handlers.previousElementSibling(c)==
d)return[c]}else a=e[d](a);for(b=0;d=a[b];b++)if(d==c)return[c];return[]}return c&&Element.descendantOf(c,b)?[c]:[]},className:function(a,b,c,d){if(a&&d)a=this[d](a);return Selector.handlers.byClassName(a,b,c)},byClassName:function(a,b,c){a||(a=Selector.handlers.descendant([b]));b=" "+c+" ";for(var d=0,e=[],f,j;f=a[d];d++){j=f.className;if(j.length!=0)if(j==c||(" "+j+" ").include(b))e.push(f)}return e},attrPresence:function(a,b,c,d){a||(a=b.getElementsByTagName("*"));if(a&&d)a=this[d](a);b=[];d=0;
for(var e;e=a[d];d++)Element.hasAttribute(e,c)&&b.push(e);return b},attr:function(a,b,c,d,e,f){a||(a=b.getElementsByTagName("*"));if(a&&f)a=this[f](a);b=Selector.operators[e];e=[];f=0;for(var j;j=a[f];f++){var h=Element.readAttribute(j,c);h!==null&&b(h,d)&&e.push(j)}return e},pseudo:function(a,b,c,d,e){if(a&&e)a=this[e](a);a||(a=d.getElementsByTagName("*"));return Selector.pseudos[b](a,c,d)}},pseudos:{"first-child":function(a){for(var b=0,c=[],d;d=a[b];b++)Selector.handlers.previousElementSibling(d)||
c.push(d);return c},"last-child":function(a){for(var b=0,c=[],d;d=a[b];b++)Selector.handlers.nextElementSibling(d)||c.push(d);return c},"only-child":function(a){for(var b=Selector.handlers,c=0,d=[],e;e=a[c];c++)!b.previousElementSibling(e)&&!b.nextElementSibling(e)&&d.push(e);return d},"nth-child":function(a,b,c){return Selector.pseudos.nth(a,b,c)},"nth-last-child":function(a,b,c){return Selector.pseudos.nth(a,b,c,true)},"nth-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,false,true)},
"nth-last-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,true,true)},"first-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,false,true)},"last-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,true,true)},"only-of-type":function(a,b,c){var d=Selector.pseudos;return d["last-of-type"](d["first-of-type"](a,b,c),b,c)},getIndices:function(a,b,c){if(a==0)return b>0?[b]:[];return $R(1,c).inject([],function(d,e){0==(e-b)%a&&(e-b)/a>=0&&d.push(e);return d})},nth:function(a,
b,c,d,e){if(a.length==0)return[];if(b=="even")b="2n+0";if(b=="odd")b="2n+1";c=Selector.handlers;var f=[],j=[],h;c.mark(a);for(var g=0;h=a[g];g++)if(!h.parentNode._countedByPrototype){c.index(h.parentNode,d,e);j.push(h.parentNode)}if(b.match(/^\d+$/)){b=Number(b);for(g=0;h=a[g];g++)h.nodeIndex==b&&f.push(h)}else if(h=b.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(h[1]=="-")h[1]=-1;g=h[1]?Number(h[1]):1;h=h[2]?Number(h[2]):0;b=Selector.pseudos.getIndices(g,h,a.length);g=0;for(d=b.length;h=a[g];g++)for(e=0;e<
d;e++)h.nodeIndex==b[e]&&f.push(h)}c.unmark(a);c.unmark(j);return f},empty:function(a){for(var b=0,c=[],d;d=a[b];b++)d.tagName=="!"||d.firstChild||c.push(d);return c},not:function(a,b,c){var d=Selector.handlers;b=(new Selector(b)).findElements(c);d.mark(b);c=0;for(var e=[],f;f=a[c];c++)f._countedByPrototype||e.push(f);d.unmark(b);return e},enabled:function(a){for(var b=0,c=[],d;d=a[b];b++)if(!d.disabled&&(!d.type||d.type!=="hidden"))c.push(d);return c},disabled:function(a){for(var b=0,c=[],d;d=a[b];b++)d.disabled&&
c.push(d);return c},checked:function(a){for(var b=0,c=[],d;d=a[b];b++)d.checked&&c.push(d);return c}},operators:{"=":function(a,b){return a==b},"!=":function(a,b){return a!=b},"^=":function(a,b){return a==b||a&&a.startsWith(b)},"$=":function(a,b){return a==b||a&&a.endsWith(b)},"*=":function(a,b){return a==b||a&&a.include(b)},"$=":function(a,b){return a.endsWith(b)},"*=":function(a,b){return a.include(b)},"~=":function(a,b){return(" "+a+" ").include(" "+b+" ")},"|=":function(a,b){return("-"+(a||"").toUpperCase()+
"-").include("-"+(b||"").toUpperCase()+"-")}},split:function(a){var b=[];a.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){b.push(c[1].strip())});return b},matchElements:function(a,b){b=$$(b);var c=Selector.handlers;c.mark(b);for(var d=0,e=[],f;f=a[d];d++)f._countedByPrototype&&e.push(f);c.unmark(b);return e},findElement:function(a,b,c){if(Object.isNumber(b)){c=b;b=false}return Selector.matchElements(a,b||"*")[c||0]},findChildElements:function(a,b){b=Selector.split(b.join(","));for(var c=
[],d=Selector.handlers,e=0,f=b.length,j;e<f;e++){j=new Selector(b[e].strip());d.concat(c,j.findElements(a))}return f>1?d.unique(c):c}});Prototype.Browser.IE&&Object.extend(Selector.handlers,{concat:function(a,b){for(var c=0,d;d=b[c];c++)d.tagName!=="!"&&a.push(d);return a},unmark:function(a){for(var b=0,c;c=a[b];b++)c.removeAttribute("_countedByPrototype");return a}});function $$(){return Selector.findChildElements(document,$A(arguments))}
var Form={reset:function(a){$(a).reset();return a},serializeElements:function(a,b){if(typeof b!="object")b={hash:!!b};else if(Object.isUndefined(b.hash))b.hash=true;var c,d,e=false,f=b.submit;a=a.inject({},function(j,h){if(!h.disabled&&h.name){c=h.name;d=$(h).getValue();if(d!=null&&h.type!="file"&&(h.type!="submit"||!e&&f!==false&&(!f||c==f)&&(e=true)))if(c in j){Object.isArray(j[c])||(j[c]=[j[c]]);j[c].push(d)}else j[c]=d}return j});return b.hash?a:Object.toQueryString(a)}};
Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){Form.Element.Serializers[c.tagName.toLowerCase()]&&b.push(Element.extend(c));return b})},getInputs:function(a,b,c){a=$(a);a=a.getElementsByTagName("input");if(!b&&!c)return $A(a).map(Element.extend);for(var d=0,e=[],f=a.length;d<f;d++){var j=a[d];b&&j.type!=b||c&&j.name!=c||e.push(Element.extend(j))}return e},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(a){a=$(a).getElements().findAll(function(c){return"hidden"!=c.type&&!c.disabled});var b=a.findAll(function(c){return c.hasAttribute("tabIndex")&&c.tabIndex>=0}).sortBy(function(c){return c.tabIndex}).first();return b?b:a.find(function(c){return["input","select","textarea"].include(c.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();
return a},request:function(a,b){a=$(a);b=Object.clone(b||{});var c=b.parameters,d=a.readAttribute("action")||"";if(d.blank())d=window.location.href;b.parameters=a.serialize(true);if(c){if(Object.isString(c))c=c.toQueryParams();Object.extend(b.parameters,c)}if(a.hasAttribute("method")&&!b.method)b.method=a.method;return new Ajax.Request(d,b)}};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.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element,$F=Form.Element.Methods.getValue;
Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case "checkbox":case "radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b))return a.checked?a.value:null;else a.checked=!!b},textarea:function(a,b){if(Object.isUndefined(b))return a.value;else a.value=b},select:function(a,b){if(Object.isUndefined(b))return this[a.type=="select-one"?"selectOne":"selectMany"](a);
else for(var c,d,e=!Object.isArray(b),f=0,j=a.length;f<j;f++){c=a.options[f];d=this.optionValue(c);if(e){if(d==b){c.selected=true;return}}else c.selected=b.include(d)}},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var b,c=a.length;if(!c)return null;var d=0;for(b=[];d<c;d++){var e=a.options[d];e.selected&&b.push(this.optionValue(e))}return b},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,c,d){$super(d,c);this.element=$(b);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();this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():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(a){switch(a.type){case "mouseover":a=a.fromElement;break;case "mouseout":a=a.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(c,d){return c.button==b[d]}}else a=Prototype.Browser.WebKit?function(c,d){switch(d){case 0:return c.which==1&&!c.metaKey;case 1:return c.which==1&&c.metaKey;default:return false}}:function(c,d){return c.which?c.which===d+1:c.button===d};return{isLeftClick:function(c){return a(c,0)},isMiddleClick:function(c){return a(c,1)},isRightClick:function(c){return a(c,2)},element:function(c){c=Event.extend(c);var d=c.target,
e=c.type;if((c=c.currentTarget)&&c.tagName)if(e==="load"||e==="error"||e==="click"&&c.tagName.toLowerCase()==="input"&&c.type==="radio")d=c;if(d.nodeType==Node.TEXT_NODE)d=d.parentNode;return Element.extend(d)},findElement:function(c,d){c=Event.element(c);if(!d)return c;c=[c].concat(c.ancestors());return Selector.findElement(c,d,0)},pointer:function(c){var d=document.documentElement,e=document.body||{scrollLeft:0,scrollTop:0};return{x:c.pageX||c.clientX+(d.scrollLeft||e.scrollLeft)-(d.clientLeft||
0),y:c.pageY||c.clientY+(d.scrollTop||e.scrollTop)-(d.clientTop||0)}},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(){function a(k){if(k._prototypeEventID)return k._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return k._prototypeEventID=[++arguments.callee.id]}function b(k){if(k&&k.include(":"))return"dataavailable";return k}function c(k){return g[k]=g[k]||{}}function d(k,l){k=c(k);return k[l]=k[l]||[]}function e(k,l,p){var m=a(k);m=d(m,l);if(m.pluck("handler").include(p))return false;var t=function(q){if(!Event||!Event.extend||q.eventName&&q.eventName!=l)return false;
Event.extend(q);p.call(k,q)};t.handler=p;m.push(t);return t}function f(k,l,p){return d(k,l).find(function(m){return m.handler==p})}function j(k,l,p){var m=c(k);if(!m[l])return false;m[l]=m[l].without(f(k,l,p))}function h(){for(var k in g)for(var l in g[k])g[k][l]=null}var g=Event.cache;window.attachEvent&&window.attachEvent("onunload",h);Prototype.Browser.WebKit&&window.addEventListener("unload",Prototype.emptyFunction,false);return{observe:function(k,l,p){k=$(k);var m=b(l);l=e(k,l,p);if(!l)return k;
k.addEventListener?k.addEventListener(m,l,false):k.attachEvent("on"+m,l);return k},stopObserving:function(k,l,p){k=$(k);var m=a(k),t=b(l);if(!p&&l){d(m,l).each(function(v){k.stopObserving(l,v.handler)});return k}else if(!l){Object.keys(c(m)).each(function(v){k.stopObserving(v)});return k}var q=f(m,l,p);if(!q)return k;k.removeEventListener?k.removeEventListener(t,q,false):k.detachEvent("on"+t,q);j(m,l,p);return k},fire:function(k,l,p){k=$(k);if(k==document&&document.createEvent&&!k.dispatchEvent)k=
document.documentElement;var m;if(document.createEvent){m=document.createEvent("HTMLEvents");m.initEvent("dataavailable",true,true)}else{m=document.createEventObject();m.eventType="ondataavailable"}m.eventName=l;m.memo=p||{};document.createEvent?k.dispatchEvent(m):k.fireEvent(m.eventType,m);return Event.extend(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(),loaded:false});
(function(){function a(){if(!document.loaded){b&&window.clearInterval(b);document.fire("dom:loaded");document.loaded=true}}var b;if(document.addEventListener)if(Prototype.Browser.WebKit){b=window.setInterval(function(){/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})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),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(a,b,c){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,b,c);this.xcomp=b;this.ycomp=c;this.offset=Element.cumulativeOffset(a);return c>=this.offset[1]&&c<this.offset[1]+a.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+a.offsetWidth},withinIncludingScrolloffsets:function(a,b,c){var d=Element.cumulativeScrollOffset(a);this.xcomp=b+d[0]-this.deltaX;this.ycomp=c+d[1]-this.deltaY;this.offset=Element.cumulativeOffset(a);
return this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth},overlap:function(a,b){if(!a)return 0;if(a=="vertical")return(this.offset[1]+b.offsetHeight-this.ycomp)/b.offsetHeight;if(a=="horizontal")return(this.offset[0]+b.offsetWidth-this.xcomp)/b.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(a,b,c){c=c||{};return Element.clonePosition(b,a,c)}};
if(!document.getElementsByClassName)document.getElementsByClassName=function(a){function b(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}a.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,d){d=d.toString().strip();return(d=/\s/.test(d)?$w(d).map(b).join(""):b(d))?document._getElementsByXPath(".//*"+d,c):[]}:function(c,d){d=d.toString().strip();var e=[],f=/\s/.test(d)?$w(d):null;if(!f&&!d)return e;c=$(c).getElementsByTagName("*");d=" "+d+" ";for(var j=
0,h,g;h=c[j];j++)if(h.className&&(g=" "+h.className+" ")&&(g.include(d)||f&&f.all(function(k){return!k.toString().blank()&&g.include(" "+k+" ")})))e.push(Element.extend(h));return e};return function(c,d){return $(d||document.body).getElementsByClassName(c)}}(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){this.include(a)||this.set($A(this).concat(a).join(" "))},remove:function(a){this.include(a)&&this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();
var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(a,b,c){a=a.toUpperCase();var d=document.createElement(this.NODEMAP[a]||"div");try{d.innerHTML="<"+a+"></"+a+">"}catch(e){}var f=d.firstChild||null;if(f&&f.tagName.toUpperCase()!=a)f=f.getElementsByTagName(a)[0];f||(f=document.createElement(a));if(f){if(b)if(this._isStringOrNumber(b)||
b instanceof Array||b.tagName)this._children(f,b);else{var j=this._attributes(b);if(j.length){try{d.innerHTML="<"+a+" "+j+"></"+a+">"}catch(h){}f=d.firstChild||null;if(!f){f=document.createElement(a);for(attr in b)f[attr=="class"?"className":attr]=b[attr]}if(f.tagName.toUpperCase()!=a)f=d.getElementsByTagName(a)[0]}}c&&this._children(f,c);return f}},_text:function(a){return document.createTextNode(a)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(a){var b=[];for(attribute in a)b.push((attribute in
this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+a[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+'"');return b.join(" ")},_children:function(a,b){if(b.tagName)a.appendChild(b);else if(typeof b=="object")b.flatten().each(function(c){if(typeof c=="object")a.appendChild(c);else Builder._isStringOrNumber(c)&&a.appendChild(Builder._text(c))});else Builder._isStringOrNumber(b)&&a.appendChild(Builder._text(b))},_isStringOrNumber:function(a){return typeof a=="string"||typeof a=="number"},build:function(a){var b=
this.node("div");$(b).update(a.strip());return b.down()},dump:function(a){if(typeof a!="object"&&typeof a!="function")a=window;"A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR".split(/\s+/).each(function(b){a[b]=
function(){return Builder.node.apply(Builder,[b].concat($A(arguments)))}})}};String.prototype.parseColor=function(a){var b="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(","),d=0;do b+=parseInt(c[d]).toColorPart();while(++d<3)}else if(this.slice(0,1)=="#"){if(this.length==4)for(d=1;d<4;d++)b+=(this.charAt(d)+this.charAt(d)).toLowerCase();if(this.length==7)b=this.toLowerCase()}return b.length==7?b:a||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"});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 b=document.createTextNode(" ");a.appendChild(b);a.removeChild(b)}catch(c){}};
var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return-Math.cos(a*Math.PI)/2+0.5},reverse:function(a){return 1-a},flicker:function(a){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(a,b){b=b||5;return(a%(1/b)*b).round()==0?a*b*2-(a*b*2).floor():
1-(a*b*2-(a*b*2).floor())},spring:function(a){return 1-Math.cos(a*4.5*Math.PI)*Math.exp(-a*6)},none:function(){return 0},full:function(){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE)b+=";zoom:1";a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore((new Element("span",{style:b})).update(d==" "?String.fromCharCode(160):
d),c)});Element.remove(c)}})},multiple:function(a,b,c){a=(typeof a=="object"||Object.isFunction(a))&&a.length?a:$(a).childNodes;var d=Object.extend({speed:0.1,delay:0},c||{}),e=d.delay;$A(a).each(function(f,j){new b(f,Object.extend(d,{delay:j*d.speed+e}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(a,b,c){a=$(a);b=(b||"appear").toLowerCase();c=Object.extend({queue:{position:"end",scope:a.id||"global",limit:1}},c||{});Effect[a.visible()?
Effect.PAIRS[b][1]:Effect.PAIRS[b][0]](a,c)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;
Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(a){var b=(new Date).getTime();switch(Object.isString(a.options.queue)?a.options.queue:a.options.queue.position){case "front":this.effects.findAll(function(c){return c.state=="idle"}).each(function(c){c.startOn+=a.finishOn;c.finishOn+=a.finishOn});break;case "with-last":b=this.effects.pluck("startOn").max()||b;break;case "end":b=this.effects.pluck("finishOn").max()||
b;break}a.startOn+=b;a.finishOn+=b;if(!a.options.queue.limit||this.effects.length<a.options.queue.limit)this.effects.push(a);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(){for(var a=(new Date).getTime(),b=0,c=this.effects.length;b<c;b++)this.effects[b]&&this.effects[b].loop(a)}});
Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a))return a;return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue)}};Effect.Queue=Effect.Queues.get("global");
Effect.Base=Class.create({position:null,start:function(a){function b(c,d){return(c[d+"Internal"]?"this.options."+d+"Internal(this);":"")+(c[d]?"this.options."+d+"(this);":"")}if(a&&a.transition===false)a.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1E3;this.finishOn=this.startOn+this.options.duration*1E3;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";'+b(this.options,"beforeSetup")+(this.setup?"this.setup();":"")+b(this.options,"afterSetup")+'};if (this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+b(this.options,"beforeUpdate")+(this.update?"this.update(pos);":"")+b(this.options,"afterUpdate")+"}}");this.event("beforeStart");
this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)},loop:function(a){if(a>=this.startOn)if(a>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");this.finish&&this.finish();this.event("afterFinish")}else{a=(a-this.startOn)/this.totalTime;var b=(a*this.totalFrames).round();if(b>this.currentFrame){this.render(a);this.currentFrame=b}}},cancel:function(){this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?
"global":this.options.queue.scope).remove(this);this.state="finished"},event:function(a){this.options[a+"Internal"]&&this.options[a+"Internal"](this);this.options[a]&&this.options[a](this)},inspect:function(){var a=$H();for(property in this)Object.isFunction(this[property])||a.set(property,this[property]);return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});
Effect.Parallel=Class.create(Effect.Base,{initialize:function(a,b){this.effects=a||[];this.start(b)},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");b.finish&&b.finish(a);b.event("afterFinish")})}});
Effect.Tween=Class.create(Effect.Base,{initialize:function(a,b,c){a=Object.isString(a)?$(a):a;var d=$A(arguments),e=d.last();d=d.length==5?d[3]:null;this.method=Object.isFunction(e)?e.bind(a):Object.isFunction(a[e])?a[e].bind(a):function(f){a[e]=f};this.start(Object.extend({from:b,to:c},d||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(a){this.start(Object.extend({duration:0},a||{}))},update:Prototype.emptyFunction});
Effect.Opacity=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});this.start(Object.extend({from:this.element.getOpacity()||0,to:1},b||{}))},update:function(a){this.element.setOpacity(a)}});
Effect.Move=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({x:0,y:0,mode:"relative"},b||{}))},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.originalLeft;this.options.y-=this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*
a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(a,b,c,d){return new Effect.Move(a,Object.extend({x:c,y:b},d||{}))};
Effect.Scale=Class.create(Effect.Base,{initialize:function(a,b,c){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:b},c||{}))},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){a=this.options.scaleFrom/100+this.factor*a;this.options.scaleContent&&this.fontSize&&this.element.setStyle({fontSize:this.fontSize*a+this.fontSizeType});this.setDimensions(this.dims[0]*a,this.dims[1]*a)},finish:function(){this.restoreAfterFinish&&this.element.setStyle(this.originalStyle)},setDimensions:function(a,b){var c={};
if(this.options.scaleX)c.width=b.round()+"px";if(this.options.scaleY)c.height=a.round()+"px";if(this.options.scaleFromCenter){a=(a-this.dims[0])/2;b=(b-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY)c.top=this.originalTop-a+"px";if(this.options.scaleX)c.left=this.originalLeft-b+"px"}else{if(this.options.scaleY)c.top=-a+"px";if(this.options.scaleX)c.left=-b+"px"}}this.element.setStyle(c)}});
Effect.Highlight=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({startcolor:"#ffff99"},b||{}))},setup:function(){if(this.element.getStyle("display")=="none")this.cancel();else{this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor)this.options.endcolor=
this.element.getStyle("background-color").parseColor("#ffffff");if(!this.options.restorecolor)this.options.restorecolor=this.element.getStyle("background-color");this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))}},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+
(this._base[d]+this._delta[d]*a).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(a,b){b=b||{};var c=document.viewport.getScrollOffsets();a=$(a).cumulativeOffset();var d=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(b.offset)a[1]+=b.offset;return new Effect.Tween(null,c.top,a[1]>d?d:a[1],b,function(e){scrollTo(c.left,e.round())})};
Effect.Fade=function(a,b){a=$(a);var c=a.getInlineOpacity();b=Object.extend({from:a.getOpacity()||1,to:0,afterFinishInternal:function(d){d.options.to==0&&d.element.hide().setStyle({opacity:c})}},b||{});return new Effect.Opacity(a,b)};
Effect.Appear=function(a,b){a=$(a);b=Object.extend({from:a.getStyle("display")=="none"?0:a.getOpacity()||0,to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},b||{});return new Effect.Opacity(a,b)};
Effect.Puff=function(a,b){a=$(a);var c={opacity:a.getInlineOpacity(),position:a.getStyle("position"),top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};return new Effect.Parallel([new Effect.Scale(a,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(d){Position.absolutize(d.effects[0].element)},afterFinishInternal:function(d){d.effects[0].element.hide().setStyle(c)}},
b||{}))};Effect.BlindUp=function(a,b){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(c){c.element.hide().undoClipping()}},b||{}))};
Effect.BlindDown=function(a,b){a=$(a);var c=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(d){d.element.undoClipping()}},b||{}))};
Effect.SwitchOff=function(a,b){a=$(a);var c=a.getInlineOpacity();return new Effect.Appear(a,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(d){new Effect.Scale(d.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(e){e.element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned().setStyle({opacity:c})}})}},b||{}))};
Effect.DropOut=function(a,b){a=$(a);var c={top:a.getStyle("top"),left:a.getStyle("left"),opacity:a.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(a,{x:0,y:100,sync:true}),new Effect.Opacity(a,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(d){d.effects[0].element.makePositioned()},afterFinishInternal:function(d){d.effects[0].element.hide().undoPositioned().setStyle(c)}},b||{}))};
Effect.Shake=function(a,b){a=$(a);b=Object.extend({distance:20,duration:0.5},b||{});var c=parseFloat(b.distance),d=parseFloat(b.duration)/10,e={top:a.getStyle("top"),left:a.getStyle("left")};return new Effect.Move(a,{x:c,y:0,duration:d,afterFinishInternal:function(f){new Effect.Move(f.element,{x:-c*2,y:0,duration:d*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:c*2,y:0,duration:d*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-c*2,y:0,duration:d*2,afterFinishInternal:function(g){new Effect.Move(g.element,
{x:c*2,y:0,duration:d*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-c,y:0,duration:d,afterFinishInternal:function(l){l.element.undoPositioned().setStyle(e)}})}})}})}})}})}})};
Effect.SlideDown=function(a,b){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),d=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:d.height,originalWidth:d.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();e.element.down().makePositioned();window.opera&&e.element.setStyle({top:""});e.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:e.dims[0]-
e.element.clientHeight+"px"})},afterFinishInternal:function(e){e.element.undoClipping().undoPositioned();e.element.down().undoPositioned().setStyle({bottom:c})}},b||{}))};
Effect.SlideUp=function(a,b){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),d=a.getDimensions();return new Effect.Scale(a,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:d.height,originalWidth:d.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();e.element.down().makePositioned();window.opera&&e.element.setStyle({top:""});e.element.makeClipping().show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:e.dims[0]-
e.element.clientHeight+"px"})},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned();e.element.down().undoPositioned().setStyle({bottom:c})}},b||{}))};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(a,b){a=$(a);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},b||{}),d={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()},e=a.getDimensions(),f,j,h,g;switch(c.direction){case "top-left":f=j=h=g=0;break;case "top-right":f=e.width;j=g=0;h=-e.width;break;case "bottom-left":f=h=0;j=e.height;g=-e.height;break;
case "bottom-right":f=e.width;j=e.height;h=-e.width;g=-e.height;break;case "center":f=e.width/2;j=e.height/2;h=-e.width/2;g=-e.height/2;break}return new Effect.Move(a,{x:f,y:j,duration:0.01,beforeSetup:function(k){k.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(k){new Effect.Parallel([new Effect.Opacity(k.element,{sync:true,to:1,from:0,transition:c.opacityTransition}),new Effect.Move(k.element,{x:h,y:g,sync:true,transition:c.moveTransition}),new Effect.Scale(k.element,
100,{scaleMode:{originalHeight:e.height,originalWidth:e.width},sync:true,scaleFrom:window.opera?1:0,transition:c.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(l){l.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(l){l.effects[0].element.undoClipping().undoPositioned().setStyle(d)}},c))}})};
Effect.Shrink=function(a,b){a=$(a);b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},b||{});var c={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()},d=a.getDimensions(),e,f;switch(b.direction){case "top-left":e=f=0;break;case "top-right":e=d.width;f=0;break;case "bottom-left":e=0;f=d.height;break;case "bottom-right":e=d.width;f=
d.height;break;case "center":e=d.width/2;f=d.height/2;break}return new Effect.Parallel([new Effect.Opacity(a,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(a,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(a,{x:e,y:f,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(j){j.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(j){j.effects[0].element.hide().undoClipping().undoPositioned().setStyle(c)}},
b))};Effect.Pulsate=function(a,b){a=$(a);var c=b||{},d=a.getInlineOpacity(),e=c.transition||Effect.Transitions.sinoidal;b=function(f){return e(1-Effect.Transitions.pulse(f,c.pulses))};b.bind(e);return new Effect.Opacity(a,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:d})}},c),{transition:b}))};
Effect.Fold=function(a,b){a=$(a);var c={top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};a.makeClipping();return new Effect.Scale(a,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(){new Effect.Scale(a,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(c)}})}},b||{}))};
Effect.Morph=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;a=Object.extend({style:{}},b||{});if(Object.isString(a.style))if(a.style.include(":"))this.style=a.style.parseStyle();else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var c=this.element.getStyles();this.style=this.style.reject(function(d){return d.value==c[d.key]});a.afterFinishInternal=function(d){d.element.addClassName(d.options.style);
d.transforms.each(function(e){d.element.style[e.style]=""})}}else this.style=$H(a.style);this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b))b="#ffffff";b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(b){var c=b[0];b=b[1];var d=null;if(b.parseColor("#zzzzzz")!="#zzzzzz"){b=b.parseColor();d="color"}else if(c=="opacity"){b=parseFloat(b);Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&
this.element.setStyle({zoom:1})}else if(Element.CSS_LENGTH.test(b)){d=b.match(/^([\+\-]?[0-9\.]+)(.*)$/);b=parseFloat(d[1]);d=d.length==3?d[2]:null}var e=this.element.getStyle(c);return{style:c.camelize(),originalValue:d=="color"?a(e):parseFloat(e||0),targetValue:d=="color"?a(b):b,unit:d}}.bind(this)).reject(function(b){return b.originalValue==b.targetValue||b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))})},update:function(a){for(var b={},c,d=this.transforms.length;d--;)b[(c=this.transforms[d]).style]=
c.unit=="color"?"#"+Math.round(c.originalValue[0]+(c.targetValue[0]-c.originalValue[0])*a).toColorPart()+Math.round(c.originalValue[1]+(c.targetValue[1]-c.originalValue[1])*a).toColorPart()+Math.round(c.originalValue[2]+(c.targetValue[2]-c.originalValue[2])*a).toColorPart():(c.originalValue+(c.targetValue-c.originalValue)*a).toFixed(3)+(c.unit===null?"":c.unit);this.element.setStyle(b,true)}});
Effect.Transform=Class.create({initialize:function(a,b){this.tracks=[];this.options=b||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var b=a.get("ids"),c=a.get("effect"),d=a.get("options");return[$(b)||$$(b)].flatten().map(function(e){return new c(e,Object.extend({sync:true},
d))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");
Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");
String.prototype.parseStyle=function(){var a,b=$H();if(Prototype.Browser.WebKit)a=(new Element("div",{style:this})).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';a=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){a[c]&&b.set(c,a[c])});Prototype.Browser.IE&&this.include("opacity")&&b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return b};
Element.getStyles=document.defaultView&&document.defaultView.getComputedStyle?function(a){var b=document.defaultView.getComputedStyle($(a),null);return Element.CSS_PROPERTIES.inject({},function(c,d){c[d]=b[d];return c})}:function(a){a=$(a);var b=a.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(d,e){d.set(e,b[e]);return d});c.opacity||c.set("opacity",a.getOpacity());return c};
Effect.Methods={morph:function(a,b,c){a=$(a);new Effect.Morph(a,Object.extend({style:b},c||{}));return a},visualEffect:function(a,b,c){a=$(a);b=b.dasherize().camelize();b=b.charAt(0).toUpperCase()+b.substring(1);new Effect[b](a,c);return a},highlight:function(a,b){a=$(a);new Effect.Highlight(a,b);return a}};
$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(b,c){b=$(b);Effect[a.charAt(0).toUpperCase()+a.substring(1)](b,c);return b}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);
var GetText={catalog:new Hash,update:function(a){GetText.catalog.merge(a)},get:function(a){var b=GetText.catalog[a]||a;if(arguments.length>1){values=$A(arguments).slice(1,arguments.length);b=b.replace(/%[sdf]/g,function(){return String(values.shift())})}return b}};function gettext(a){return GetText.get.apply(this,arguments)}function _(){return GetText.get.apply(this,arguments)}var postloaded_ads=[];function registerAd(a){postloaded_ads.push(a)}
function movePostloadedAds(){var a=detectBrowser();for(a=0;a<postloaded_ads.length;a++){var b=postloaded_ads[a],c=document.getElementsByClassName("postloaded_ad "+b)[0];if(c!=undefined){var d=c.getElementsByTagName("script");if(d!=null)for(i=0;i<d.length;i++){var e=d[i];if(e.src.replace!=undefined)e.src.replace="/javascripts/ads_empty_script.js";else e.src="/javascripts/ads_empty_script.js"}d=document.getElementsByClassName("advertising ad_container "+b)[0];d.innerHTML="";d.className="advertising served_ad "+
b;c.parentNode.removeChild(c);c.className="";d.appendChild(c)}}}
var Application={useAssetServers:true,assetHost:function(a){a||(a="");return this.useAssetServers?"http://media"+(1+a.length%4)+".origo.no"+a:a}},LazyLoading={add:function(a,b){Event.observe(window,"load",function(){new Ajax.Request("/-/site/populate_fragments",{method:"GET",asynchronous:true,evalScripts:true,parameters:a})});b&&window.setInterval(function(){new Ajax.Request("/-/site/populate_fragments",{method:"GET",asynchronous:true,evalScripts:true,parameters:a})},12E4)}},Window={getDimensions:function(){var a,
b;if(window.innerWidth){a=window.innerWidth;b=window.innerHeight}else if(document.documentElement&&document.documentElement.clientWidth){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else if(document.body&&document.body.clientWidth){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else b=a=0;return{width:a,height:b}}},Browser={supportsFlash:function(){if(navigator.plugins&&navigator.mimeTypes.length)return navigator.plugins["Shockwave Flash"]!=
null?true:new ActiveXObject("ShockwaveFlash.ShockwaveFlash")!=null?true:false}};Object.extend(Event,{getKey:function(a){return typeof a.keyCode!="undefined"?a.keyCode:a.which}});function setCookie(a,b,c,d,e,f){document.cookie=a+"="+escape(b)+(c?"; expires="+c.toGMTString():"")+(d?"; path="+d:"")+(e?"; domain="+e:"")+(f?"; secure":"")}
function getCookie(a){var b=document.cookie;a=a+"=";var c=b.indexOf("; "+a);if(c==-1){c=b.indexOf(a);if(c!=0)return null}else c+=2;var d=document.cookie.indexOf(";",c);if(d==-1)d=b.length;return unescape(b.substring(c+a.length,d))}
function detectBrowser(){var a="",b=navigator.userAgent.toLowerCase();if(b.indexOf("opera")!=-1)a="opera";else if(b.indexOf("safari")!=-1)a="safari";else if(b.indexOf("msie 8")!=-1)a="ie8";else if(b.indexOf("msie 7")!=-1)a="ie7";else if(b.indexOf("msie 6")!=-1)a="ie6";else if(b.indexOf("msie 5")!=-1)a="ie5";else if(b.indexOf("netscape")!=-1)a="netscape";else if(b.indexOf("firefox")!=-1)a="firefox";else if(b.indexOf("gecko")!=-1)a="mozilla";return a}
var TokenCompletionContinuation=Class.create({initialize:function(a){this.excess=a},getExcess:function(){return this.excess}}),TokenField=Class.create();
TokenField.prototype={initialize:function(a,b,c){this.element=$(document.createElement("div"));this.containerElement=$(a);this.containerElement.appendChild(this.element);this.completer=b;this.options=c;this.create()},clear:function(){if(this.element){Element.getElementsBySelector(this.element,".token_field_atom").each(function(a){this.removeAtomByElement(a)}.bind(this));this.adaptSize();this.hideCompletions();this.deactivate()}},create:function(){if(this.element)if(!this.inputElement){this.element.style.cursor=
"text";this.element.observe("click",function(){this.activate()}.bind(this));var a=$(document.createElement("span"));a.style.position="relative";a.style.styleFloat="left";a.style.cssFloat="left";a.style.paddingTop="8px";a.style.display="block";a.style.overflow="hidden";a.style.width="0px";a.style.cssFloat="left";a.style.styleFloat="left";a.appendChild(document.createTextNode("Moo"));this.element.appendChild(a);a=$(document.createElement("input"));a.type="text";a._internal=true;a.setAttribute("autocomplete",
"off");a.style.position="absolute";a.style.left="0";a.style.top="-10000px";a.observe("focus",function(){this.aboutToEnableFakeInput||this.activate();this.aboutToEnableFakeInput=false}.bind(this));a.observe("keydown",function(d){switch(d.keyCode){case Event.KEY_BACKSPACE:this.removeSelectedAtom();Element.getElementsBySelector(this.element,".token_field_atom.token_field_atom_selected").length==0&&this.activate();Event.stop(d);break;case Event.KEY_LEFT:case Event.KEY_UP:this.selectPreviousAtom();break;
case Event.KEY_RIGHT:case Event.KEY_DOWN:this.selectNextAtom();break;case Event.KEY_RETURN:Event.stop(d);break}}.bind(this),true);a.observe("keypress",function(d){Event.getKey(d)==Event.KEY_RETURN&&Event.stop(d);if(d.charCode&&d.charCode!=0&&!(d.ctrlKey||d.shiftKey||d.metaKey||d.altKey)&&d.keyCode>40){this.inputElement.value+=String.fromCharCode(d.charCode);this.activate();Event.stop(d)}}.bind(this),false);this.fakeInputElement=a;var b=$(document.createElement("span"));b.style.styleFloat="left";b.style.cssFloat=
"left";b.style.overflow="hidden";b.style.width="0px";b.style.height="0px";b.style.display="block";b.appendChild(a);this.element.appendChild(b);var c=$(document.createElement("input"));c.type="text";c.setAttribute("autocomplete","off");c.setAttribute("style","float: left");c.style.styleFloat="left";c.style.border="none";c.style.backgroundColor="transparent";c.style.verticalAlign="baseline";if(navigator.userAgent.match(/MSIE/)){c.style.position="relative";c.style.top="2px"}c.observe("keypress",function(d){Event.getKey(d)==
Event.KEY_RETURN&&Event.stop(d);this.allowEntry()||Event.stop(d)}.bind(this));c.observe("keydown",function(d){var e=Event.getKey(d);switch(e){case Event.KEY_BACKSPACE:if(c.value==""){this.selectLastAtom();Event.stop(d)}break;case Event.KEY_LEFT:case Event.KEY_UP:this.completionBox||this.selectLastAtom();break;case Event.KEY_ESCAPE:if(this.completionBox){this.hideCompletions();Event.stop(d)}default:this.allowEntry()||Event.stop(d)}if(e==Event.KEY_RETURN||e==Event.KEY_TAB||e==188)if(this.addCompletionAsAtom()||
e==Event.KEY_RETURN)Event.stop(d)}.bind(this),false);c.observe("keyup",function(d){d.keyCode!=Event.KEY_BACKSPACE&&this.deselectAtoms();switch(d.keyCode){case Event.KEY_UP:this.selectPreviousCompletion();break;case Event.KEY_DOWN:this.selectNextCompletion();break;default:this.offerCompletions(c.value)}}.bind(this),true);c.observe("blur",function(d){Event.element(d)&&this.deactivate()}.bind(this));this.element.appendChild(c);this.inputElement=c;a=$(document.createElement("div"));a.style.clear="both";
a.style.overflow="hidden";a.style.width="0px";a.style.height="0px";this.element.appendChild(a)}},activate:function(){this.fakeInputElement.disabled="";this.inputElement.show();this.inputElement.focus();this.containerElement.addClassName("focused")},deactivate:function(){this.containerElement.removeClassName("focused");this.hideCompletions();if(this.inputElement.value==""){this.inputElement.hide();this.fakeInputElement.disabled=""}},allowEntry:function(){return this.options.singleToken?Element.getElementsBySelector(this.element,
".token_field_atom").length==0:true},adaptSize:function(){var a=0,b=Element.getElementsBySelector(this.element,".token_field_atom").last();if(b){a=Position.cumulativeOffset(b)[0]-Position.cumulativeOffset(this.element)[0]+Element.getDimensions(b).width;a+=parseInt(Element.getStyle(b,"marginRight").gsub(/px$/,""))}b=(parseInt(Element.getStyle(this.element,"paddingLeft").gsub(/px$/,""))||0)+(parseInt(Element.getStyle(this.element,"paddingRight").gsub(/px$/,""))||0);if(Element.getStyle(this.element,
"borderLeft")!="")b+=1;if(Element.getStyle(this.element,"borderRight")!="")b+=1;b+=14;var c=Element.getDimensions(this.element);a=c.width-b-a;if(a<100)a=Math.max(0,c.width-b);this.inputElement.style.width=a+"px"},hideCompletions:function(){if(this.completionBox){this.completionBox.remove();this.completionBox=null}},offerCompletions:function(a){if(this.allowEntry()){a=a.strip();if(a!=""){if(this.completionOfferTimeout){window.clearTimeout(this.completionOfferTimeout);this.completionOfferTimeout=null}this.completionOfferTimeout=
window.setTimeout(function(){var b=function(c){this.populateCompletions(a,c)}.bind(this);if(this.completer.beginComplete)this.completer.beginComplete(a,b)&&this.setProgressing(true);else b(this.completer.complete(a))}.bind(this),this.options.completionDelay||500)}}},populateCompletions:function(a,b){this.setProgressing(false);this.hideCompletions();if(a.length>0){var c=this.inputElement.cumulativeOffset();c.left-=this.inputElement.cumulativeScrollOffset().left;c.left+=$(document.body).cumulativeScrollOffset().left;
c.top-=this.inputElement.cumulativeScrollOffset().top;c.top+=$(document.body).cumulativeScrollOffset().top;var d=this.inputElement.getDimensions(),e=$(document.createElement("div"));e.className="token_field_completion_box";e.style.left=c.left+"px";e.style.top=c.top+d.height+"px";e.style.width=Math.max(200,d.width)+"px";if(b.length>0)b.each(function(f,j){if(f instanceof TokenCompletionContinuation){j=$(document.createElement("div"));j.innerHTML="&hellip; "+_("og %d andre",f.getExcess());j.className=
"token_field_completion_meta";e.appendChild(j)}else{var h=$(document.createElement("a"));h.style.display="block";h.addClassName("token_field_completion_item");h._cookie=f;if(f.iconUrl){var g=$(document.createElement("img"));g.addClassName("token_field_completion_item_image");g.src=f.iconUrl;g.alt="";h.appendChild(g)}g=f.text.toLowerCase().indexOf(a.toLowerCase());g>0&&h.appendChild(document.createTextNode(f.text.substring(0,g)));var k=$(document.createElement("strong"));k.appendChild(document.createTextNode(f.text.substring(g,
g+a.length)));k.addClassName("token_field_completion_item_highlight");h.appendChild(k);g<f.text.length&&h.appendChild(document.createTextNode(f.text.substring(g+a.length)));j==0&&h.addClassName("token_field_completion_item_selected");h.observe("mousedown",function(){this.addCompletionAsAtom(f)}.bind(this),true);e.appendChild(h)}}.bind(this));else{b=$(document.createElement("div"));b.innerHTML=_("Ingen treff");b.addClassName("token_field_completion_meta");e.appendChild(b)}document.body.appendChild(e);
this.completionBox=e}},selectNextCompletion:function(){if(this.completionBox){var a=Element.getElementsBySelector(this.completionBox,".token_field_completion_item_selected")[0]||this.completionBox.firstChild,b=a.nextSibling||this.completionBox.firstChild;a.removeClassName("token_field_completion_item_selected");b.addClassName("token_field_completion_item_selected")}},selectPreviousCompletion:function(){if(this.completionBox){var a=Element.getElementsBySelector(this.completionBox,".token_field_completion_item_selected")[0]||
this.completionBox.lastChild,b=a.previousSibling||this.completionBox.lastChild;a.removeClassName("token_field_completion_item_selected");b.addClassName("token_field_completion_item_selected")}},selectedCompletion:function(){var a=null;if(this.completionBox){var b=Element.getElementsBySelector(this.completionBox,".token_field_completion_item_selected")[0];if(b)a=b._cookie}return a},addCompletionAsAtom:function(a){var b=false;if(a=a||this.selectedCompletion()){var c=$(document.createElement("a"));c.href=
"#";c.className="token_field_atom";c.tabIndex=-1;c.observe("click",function(e){this.selectAtomByElement(c);Event.stop(e)}.bind(this));if(a.iconUrl){b=$(document.createElement("img"));b.addClassName("token_field_atom_image");b.src=a.iconUrl;b.alt="";c.appendChild(b)}c.appendChild(document.createTextNode(a.text));var d=$(document.createElement("img"));d.src="/images/forms/token_field_close.png";d.className="token_field_atom_close";d.observe("mouseover",function(){d.src="/images/forms/token_field_close_hover.png"}.bind(this));
d.observe("mouseout",function(){d.src="/images/forms/token_field_close.png"}.bind(this));d.observe("click",function(){this.removeAtomByElement(c)}.bind(this));c.appendChild(d);b=$(document.createElement("input"));b.type="hidden";b.name=this.options.fieldName;b.value=a.id;c.appendChild(b);this.element.insertBefore(c,this.inputElement);this.inputElement.value="";b=true;this.atomsChanged()}return b},selectAtomByElement:function(a){this.deselectAtoms();a&&a.addClassName("token_field_atom_selected");this.aboutToEnableFakeInput=
true;this.fakeInputElement.disabled="";this.fakeInputElement.focus()},selectNextAtom:function(){var a=Element.getElementsBySelector(this.element,".token_field_atom_selected")[0];if(a){var b=a.nextSibling;if(b.hasClassName("token_field_atom")){a.removeClassName("token_field_atom_selected");b.addClassName("token_field_atom_selected")}else this.activate()}},selectPreviousAtom:function(){var a=Element.getElementsBySelector(this.element,".token_field_atom_selected")[0];if(a){var b=a.previousSibling;if(b.hasClassName("token_field_atom")){a.removeClassName("token_field_atom_selected");
b.addClassName("token_field_atom_selected")}}},selectLastAtom:function(){var a=Element.getElementsBySelector(this.element,".token_field_atom").last();a&&this.selectAtomByElement(a)},deselectAtoms:function(){Element.getElementsBySelector(this.element,".token_field_atom.token_field_atom_selected").each(function(a){a.removeClassName("token_field_atom_selected")})},removeAtomByElement:function(a){a.remove();this.atomsChanged()},removeSelectedAtom:function(){var a=Element.getElementsBySelector(this.element,
".token_field_atom.token_field_atom_selected").first();a?this.removeAtomByElement(a):this.selectLastAtom()},atomsChanged:function(){this.hideCompletions();this.adaptSize()},wrapInSpan:function(a,b){var c=$(document.createElement("span"));c.className=b;c.appendChild(a);return c},setProgressing:function(a){a?this.containerElement.addClassName("token_field_progressing"):this.containerElement.removeClassName("token_field_progressing")}};
var ObscuringElements={hide:function(a){this.show();this.findAll(a).each(function(b){b.style.visibility="hidden";this.hiddenElements.push(b)}.bind(this))},show:function(){this.hiddenElements&&this.hiddenElements.each(function(a){a.style.visibility=""});this.hiddenElements=[]},findAll:function(a){var b=[];b=b.concat($$("object"));b=b.concat($$("embed")).select(function(c){return Element.visible(c)&&c.parentNode&&c.parentNode.nodeType==1&&c.parentNode.tagName.toUpperCase()!="OBJECT"});b=b.concat($$("input[type!=hidden]"));
b=b.concat($$("select"));if(a)b=b.select(a);return b}},BalloonGroups={},Balloons={all:[],lastHitBalloon:null,close:function(a){this.each(function(b){b.close(a)})},reposition:function(){this.each(function(a){a.reposition()})},find:function(a){return this.all.find(a)},closeByElement:function(a){var b=this.all.find(function(c){return c.getFrameElement().id==a});if(b){b.close();return true}else return false},findByElement:function(a){return this.all.find(function(b){return b.getFrameElement().id==a})},
register:function(a){this.all.push(a);this.balloonsChanged()},unregister:function(a){this.all=this.all.without(a);this.balloonsChanged()},each:function(a){return this.all.each(a)},findHitByEvent:function(a){var b=null;Balloons.each(function(c){if(c.isWithin(a)){b=c;throw $break;}});return b},start:function(){Event.observe(document,"click",function(a){(this.lastHitBalloon=a=this.findHitByEvent(a))||Balloons.close()}.bind(this));Event.observe(window,"resize",function(){Balloons.reposition()});navigator.userAgent.match(/Gecko/)&&
Event.observe(window,"scroll",function(){Balloons.reposition()});Event.observe(window,"keypress",function(a){a.keyCode==27&&Balloons.close()},true)},balloonsChanged:function(){this.all.length>0?ObscuringElements.hide(function(a){return!this.all.find(function(b){b=b.getFrameElement();return a.childOf(b)})}.bind(this)):ObscuringElements.show()}},Balloon=Class.create({initialize:function(a){this.options=a;this.group=a.group||"default";this.tail=typeof a.tail=="undefined"?"pyramid":a.tail;this.trigger=
typeof a.trigger=="undefined"?null:a.trigger;this.origin=typeof a.origin=="undefined"?null:a.origin;this.position=a.position;if(!this.position)this.position=new Balloon.Position.Vertical;this.onShow=a.onShow;this.onMayShow=a.onMayShow;this.onHide=a.onHide;this.onBeforeHide=a.onBeforeHide;this.onCreate=a.onCreate;this.progressLabel=a.progressLabel;this.width=a.width;this.url=a.url;this.parameters=a.parameters||{};this.dontCache=a.dontCache;this.id=a.id;this.loaded=false;this.closeable=a.closeable!=
false;this.timeout=a.timeout;this.className=a.className;this.overlayClass=a.overlayClass;this.frameElement=this.progressElement=this.overlayElement=null;this.contentElement=$(a.content);this.progressing=false;this.observers=[];this.border=null;this.assetHost=a.assetHost||"";this.requestType=!a.requestType&&typeof ORIGO!="undefined"&&typeof ORIGO.EMBED!=="undefined"?"embed":a.requestType||"ajax";this.requestType=="embed"&&this.assetHost!=""&&Balloon.Tails.setAssetHost(this.assetHost);this.contentElement&&
this.contentElement.hide();this.contentBody=a.contentHtml;a.trigger&&this.attach(a.trigger)},attach:function(a,b){b=b||"click";a=$(a);this.detach();this.trigger=a;this.observe(a,b,function(c){b=="click"?this.toggle():this.open();Event.stop(c)}.bind(this));b=="focus"&&this.observe(a,"blur",function(){window.setTimeout(function(){Balloons.lastHitBalloon!=this&&this.delayedClose();Balloons.lastHitBalloon=null}.bind(this),100)}.bind(this))},detach:function(){if(this.trigger&&this.observingEvent){this.unobserve(this.trigger);
this.trigger=null}},delayedClose:function(){window.setTimeout(function(){this.close()}.bind(this),100)},toggle:function(){this.isOpen()?this.close():this.open()},open:function(){if(!this.isOpen()){if(this.onMayShow)if(!this.onMayShow(this))return;if(this.group){var a=BalloonGroups[this.group];a&&a.close();BalloonGroups[this.group]=this}this.create();Position.prepare();Element.setOpacity(this.frameElement,1);Element.show(this.frameElement);if(this.tailElement){Element.setOpacity(this.tailElement,1);
Element.show(this.tailElement)}(a=$(this.trigger))&&a.addClassName("active");(a=$(this.origin))&&a.addClassName("active");this.reposition();this.onShow&&this.onShow(this);Balloons.register(this);this.url&&!this.loaded&&!this.loading&&this.loadFromUrl(this.url);this.timeout&&window.setTimeout(function(){this.close()}.bind(this),this.timeout)}},close:function(){if(this.isOpen()){Balloons.unregister(this);var a=false;if(this.onBeforeHide)a=this.onBeforeHide(panel)==false;if(!a){this.onHide&&function(){this.onHide(this)}.bind(this);
this.frameElement.hide();this.tailElement&&this.tailElement.hide()}(a=$(this.trigger))&&a.removeClassName("active");(a=$(this.origin))&&a.removeClassName("active");if(this.overlayElement){this.overlayElement.parentNode&&this.overlayElement.parentNode.removeChild(this.overlayElement);this.overlayElement=null}if(this.dontCache&&this.contentElement){this.contentElement.parentNode&&this.contentElement.parentNode.removeChild(this.contentElement);this.contentElement=null;this.loaded=false}}},isOpen:function(){return this.frameElement!=
null&&Element.visible(this.frameElement)},isWithin:function(a){a=Event.element(a);return this.contentElement!=null&&($(this.contentElement)==a||Element.childOf(a,$(this.contentElement)))||this.trigger!=null&&($(this.trigger)==a||Element.childOf(a,$(this.trigger)))},reposition:function(){this.frameElement&&this.position.position(this)},isLoaded:function(){return this.loaded},disableLoading:function(){this.url=null;this.loaded=false},setContentHtml:function(a){this.contentBody=a},getContentElement:function(){this.create();
return this.contentElement},getFrameElement:function(){this.create();return this.frameElement},getOverlayElement:function(){this.create();return this.overlayElement},getTailElement:function(){this.create();return this.tailElement},getTailStyle:function(){return this.tail},create:function(){var a=false;if(!this.frameElement){a=true;this.frameElement=this.createFrameElement();this.frameElement.style.display="none";if(this.width)this.frameElement.style.width=this.width+"px";this.appendElementToDocument(this.frameElement);
if(this.options.rounded){this.border=new Border(null,{width:6,height:6,shadow:true,shadowX:0,shadowY:3,shadowBlurRadius:10,shadowBlurSigma:5,shadowMargin:10,shadowPadding:0,colour:"fff"});this.frameElement.appendChild(this.border.getFrame())}}var b=this.border?this.border.getContainer():this.frameElement;if(!this.progressElement){this.progressElement=this.createProgressElement();this.progressElement.style.display="none";b.appendChild(this.progressElement)}if(!this.contentElement){this.contentElement=
this.createContentElement();if(this.contentBody)this.contentElement.innerHTML=this.contentBody}if(this.contentElement.parentNode!=b){this.contentElement.parentNode&&this.contentElement.parentNode.removeChild(this.contentElement);b.appendChild(this.contentElement);$(this.contentElement).show()}if(!this.tailElement)if((this.trigger||this.origin)&&this.tail){this.tailElement=this.createTailElement(this.tail);this.tailElement.style.display="none";this.appendElementToDocument(this.tailElement)}if(this.overlayClass&&
!this.overlayElement){this.overlayElement=document.createElement("div");this.overlayElement.className=this.overlayClass;this.appendElementToDocument(this.overlayElement)}a&&this.onCreate&&this.onCreate(this)},appendElementToDocument:function(a){if(this.requestType=="embed")try{var b=document.getElementsByClassName("origo_embed");b&&b[0].appendChild(a)}catch(c){document.body.appendChild(a)}else document.body.appendChild(a)},loadFromUrl:function(a){this.loading=true;this.setProgress(true);var b=this.contentElement;
if(this.requestType=="embed"){var c=(new Function("this.loading = false;\tthis.loaded = true;\tthis.setProgress(false);")).bind(this);if(a.substring(a.length-1,a.length)!="?"&&a.indexOf("?")==-1)a+="?";a=a+"&request_type=embed&update="+encodeURIComponent(b.id);ORIGO.EMBED.AJAST.call(a,"js_callback",c)}else new Ajax.Updater({success:b},a,{asynchronous:true,evalScripts:true,method:"get",parameters:this.parameters,onFailure:function(d){Errors.reportForAjax(d,null);this.close()}.bind(this),onSuccess:function(){this.loaded=
true}.bind(this),onComplete:function(){this.loading=false;this.setProgress(false)}.bind(this)})},setProgress:function(a){if(this.closeControlElement)a?Element.hide(this.closeControlElement):Element.show(this.closeControlElement);if(this.contentElement)a?Element.hide(this.contentElement):Element.show(this.contentElement);if(this.progressElement)a?Element.show(this.progressElement):Element.hide(this.progressElement)},setTail:function(a){this.tail=a;this.reposition()},createFrameElement:function(){var a=
document.createElement("div");if(this.id)a.id=this.id;var b="balloon";if(this.className){b+=" ";b+=this.className}a.className=b;if(this.closeable){this.closeControlElement=this.createCloseControlElement();a.appendChild(this.closeControlElement)}return a},createContentElement:function(){var a=document.createElement("div");a.className="balloon_content";var b="balloon_content_"+(new Date).getTime();a.setAttribute("id",b);return a},createTailElement:function(a){a=Balloon.Tails.get(a).up;var b=document.createElement("img");
b.src=a.image;b.className="balloon_tail";b.alt="";return b},createCloseControlElement:function(){var a=Balloon.Tails.assetHost||"",b=document.createElement("img");b.src=a+"/images/balloon/close.png";b.className="balloon_close_control";b.alt="Lukk";b.title=b.alt;Event.observe(b,"click",function(c){this.close();Event.stop(c)}.bind(this));Event.observe(b,"selectstart",function(){return false});return b},createProgressElement:function(){var a=Balloon.Tails.assetHost||"",b=document.createElement("img");
b.className="progress_indicator";b.src=a+"/images/progress/spinner_16.gif";b.style.width=16;b.style.height=16;b.alt=_("Vent litt");a=document.createElement("div");a.className="progress_message";a.appendChild(document.createTextNode(this.progressLabel||""));a.appendChild(b);b=document.createElement("div");b.className="balloon_progress";b.appendChild(a);return b},observe:function(a,b,c){a.observe(b,c);this.observers[a]||(this.observers[a]=[]);this.observers[a].push([b,c])},unobserve:function(a){var b=
this.observers[a];if(b){b.each(function(c){a.stopObserving(c[0],c[1])});delete this.observers[a]}}});Balloon.Position={};
Balloon.Position.Vertical=Class.create({initialize:function(a,b,c){this.adjustX=a||0;this.adjustY=b||0;this.alignment=c||Balloon.Position.Vertical.LEFT;this.positioned=false},position:function(a){var b=this.adjustX,c=this.adjustY,d=a.trigger?$(a.trigger):null,e=a.origin?$(a.origin):d,f=a.getTailElement(),j=a.getFrameElement(),h=a.getOverlayElement();if(f){var g=Balloon.Tails.get(a.getTailStyle()).up;f.src=g.image;f.style.width=g.width+"px";f.style.height=g.height+"px"}if(!this.positioned)if(j.style.position!=
"absolute"){j.style.top="-500px";j.style.position="absolute";if(f){f.style.top="-500px";f.style.position="absolute"}}var k=Position.cumulativeOffset(e);g=Position.cumulativeOffset(e);var l=[],p=Element.getDimensions(j);if(this.alignment==Balloon.Position.Vertical.RIGHT){var m=Element.getDimensions(e);l[0]=k[0]+m.width-p.width;l[0]-=b}else{l[0]=k[0];l[0]+=b}if(f){b=Element.getDimensions(f);g[0]+=e.offsetWidth/2-b.width/2;g[1]+=e.offsetHeight;g[1]+=c;if(g[0]<l[0])g[0]=l[0];f.style.left=g[0]+"px";f.style.top=
g[1]+"px";l[1]=g[1];l[1]+=b.height-1}else{l[1]=k[1];l[1]+=e.offsetHeight+1;l[1]+=c}if(a.border){l[0]-=a.border.getTileWidth()/2+1;l[1]-=a.border.getTileHeight()/2+1;if(!f){l[0]-=10;l[1]-=5}}l[0]=Math.min(document.body.clientWidth-12-p.width,l[0]);l[0]=Math.max(12,l[0]);j.style.left=l[0]+"px";j.style.top=l[1]+"px";if(h&&d){a=Position.positionedOffset(d);e=Element.getDimensions(d);c=e.width-2;e=e.height-1;if(navigator.userAgent.match(/MSIE/)&&d.tagName.toUpperCase()!="INPUT"){c-=4;e-=2;a[1]+=2}h.style.position=
"absolute";h.style.left=a[0]+"px";h.style.top=a[1]+"px";h.style.width=c+"px";h.style.height=e+"px"}this.positioned=true}});Balloon.Position.Vertical.LEFT=0;Balloon.Position.Vertical.RIGHT=1;
Balloon.Position.Horizontal=Class.create({initialize:function(a,b,c){this.adjustX=a||0;this.adjustY=b||0;this.alignment=c||Balloon.Position.Horizontal.LEFT},position:function(a){var b=this.adjustX,c=this.adjustY,d=a.trigger?$(a.trigger):null,e=d?$(a.trigger):$(a.origin),f=a.getTailElement(),j=a.getFrameElement(),h=a.getOverlayElement();if(f){a=Balloon.Tails.get(a.getTailStyle());a=this.alignment==Balloon.Position.Horizontal.RIGHT?a.left:a.right;f.src=a.image;f.style.width=a.width+"px";f.style.height=
a.height+"px"}if(j.style.position!="absolute"){j.style.top="-500px";j.style.position="absolute";if(f){f.style.top="-500px";f.style.position="absolute"}}a=Position.cumulativeOffset(e);var g=Position.cumulativeOffset(e),k=[],l=Element.getDimensions(j);if(f){var p=Element.getDimensions(f);if(this.alignment==Balloon.Position.Horizontal.RIGHT){b=Element.getDimensions(e);k[0]=a[0];k[0]+=b.width;k[0]+=p.width;k[1]=a[1];k[1]-=5;k[1]+=c;g[0]+=b.width;g[0]+=1;g[1]+=c}else{k[0]=a[0];k[0]+=b;k[0]-=l.width;k[0]-=
p.width;k[1]=a[1];k[1]-=5;k[1]+=c;g[0]-=p.width;g[0]-=1;g[1]+=c;if(g[1]<k[1])g[1]=k[1]+1}f.style.left=g[0]+"px";f.style.top=g[1]+"px"}else{if(this.alignment==Balloon.Position.Horizontal.RIGHT){b=Element.getDimensions(e);k[0]=a[0];k[0]+=b.width;k[1]=a[1]}else{k[0]=a[0];k[0]+=b;k[1]=a[1];k[1]+=e.offsetHeight+1}k[1]+=c}if(k[0]+l.width>document.body.clientWidth-12)k[0]=document.body.clientWidth-12-l.width;k[0]=Math.max(12,k[0]);j.style.left=k[0]+"px";j.style.top=k[1]+"px";if(h&&d){c=Position.positionedOffset(d);
f=Element.getDimensions(d);d=f.width-2;f=f.height-4;if(navigator.userAgent.match(/MSIE/)){d-=4;f-=2;c[1]+=2}h.style.position="absolute";h.style.left=c[0]+"px";h.style.top=c[1]+"px";h.style.width=d+"px";h.style.height=f+"px"}}});Balloon.Position.Horizontal.LEFT=0;Balloon.Position.Horizontal.RIGHT=1;
Balloon.Tails={tails:{},assetHost:"",register:function(a,b){this.tails[a]=b},get:function(a){return this.tails[a]},setAssetHost:function(a){if(this.assetHost==""){this.assetHost=a;for(var b in this.tails)for(var c in this.tails[b])this.tails[b][c].image=this.assetHost+this.tails[b][c].image}}};
Balloon.Tails.register("pyramid",{up:{image:"/images/balloon/balloon_tail_pyramid_up.png",width:52,height:17},down:{image:"/images/balloon/balloon_tail_pyramid_down.png",width:52,height:17},left:{image:"/images/balloon/balloon_tail_pyramid_left.png",width:17,height:34},right:{image:"/images/balloon/balloon_tail_pyramid_right.png",width:17,height:34}});Balloon.Tails.register("pyramid_with_shadow",{up:{image:"/images/balloon/balloon_tail_pyramid_up_shadowed_24.png",width:52,height:17}});
Balloon.Tails.register("slanted",{up:{image:"/images/balloon/balloon_tail_slanted_up.png",width:41,height:33},down:{image:"/images/balloon/balloon_tail_slanted_down.png",width:41,height:33}});Balloons.start();
var BorderSupport={shouldFixImages:function(){if(this.weFixImages==null){var a=false;if(navigator.userAgent.match(/MSIE [0-6]/)){a=parseFloat(navigator.appVersion.split("MSIE")[1]);a=a>=5.5&&a<7&&document.body.filters}this.weFixImages=a}return this.weFixImages},fixImage:function(a){if(this.shouldFixImages())if(a.width&&a.height&&a.width>0&&a.height>0){a.style.width=a.width+"px";a.style.height=a.height+"px";a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.src+"', sizingMethod='scale')";
a.src="/images/blank.png"}return a},fixCell:function(a){if(this.shouldFixImages())if(a.style.backgroundImage){var b=a.style.backgroundImage.match(/url\((.*)\)/);a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b[1]+"', sizingMethod='scale')";a.style.backgroundImage="none"}return a}},Border=Class.create();
Border.prototype={initialize:function(a,b){this.spec=(new Hash(b)).toArray().map(function(k){return Border.LONG_TO_SHORT_OPTIONS[k[0]]+"="+k[1]}).join("_");var c=b.width||b.height,d=b.height||b.width,e=(b.width||b.height)-2;d=(b.height||b.width)-2;c=0;if(b.borderWidth&&b.borderColour)c=b.borderWidth;if(b.borderGradient)c=1;var f=e*2+1-c,j=d*2+1-c;e=f+c+1;d=j+c+1;if(b.shadow){f+=10;j+=10;var h=b.shadowPadding;if(!h&&h!=0)h=2;var g=b.shadowY||0;f=f+c*2+h*2;c=j+c*2+h*2;j=b.shadowMargin||0;e=Math.max(e,
Math.max(h+Math.abs(b.shadowX||0)*2)+f+2*j+2);d=Math.max(d,Math.max(h+Math.abs(g)*2)+c+2*j+2)}if(e%2==1)e+=1;if(d%2==1)d+=1;c=Math.floor(e/2);d=Math.floor(d/2);this.tileWidth=c;this.tileHeight=d;e=document.createElement("table");e.style.borderSpacing=0;e.style.borderCollapse="collapse";e.style.border="none";if(a=$(a)){h=null;if(document.defaultView&&document.defaultView.getComputedStyle)h=document.defaultView.getComputedStyle(a,"");else if(a.currentStyle)h=a.currentStyle;if(h){if(g=h.cssFloat||h.styleFloat){e.setAttribute("style",
"float: "+g);e.style.styleFloat=g;e.style.cssFloat=g}e.style.marginTop=h.marginTop;e.style.marginLeft=h.marginLeft;e.style.marginRight=h.marginRight;e.style.marginBottom=h.marginBottom;e.style.position=h.position;e.style.left=h.left;e.style.top=h.top;e.style.right=h.right;e.style.bottom=h.bottom}if(b.colour)a.style.backgroundColor="#"+b.colour;a.style.margin="0px";a.style.position="static";a.style.left="auto";a.style.top="auto";a.style.right="auto";a.style.bottom="auto";a.style.styleFloat="none";
a.style.cssFloat="none";if(a.parentNode){a.parentNode.insertBefore(e,a);a.remove()}this.content=a}a=document.createElement("thead");h=document.createElement("tr");g=document.createElement("td");g.style.padding="0";g.style.verticalAlign="bottom";f=document.createElement("img");f.src=this.getTile("tl");f.width=c;f.height=d;BorderSupport.fixImage(f);g.appendChild(f);h.appendChild(g);g=document.createElement("td");g.style.padding="0";g.style.background="url("+this.getTile("tm")+") repeat-x";g.style.height=
d;BorderSupport.fixCell(g);h.appendChild(g);g=document.createElement("td");g.style.padding="0";g.style.verticalAlign="bottom";f=document.createElement("img");f.src=this.getTile("tr");f.width=c;f.height=d;f=BorderSupport.fixImage(f);g.appendChild(f);h.appendChild(g);a.appendChild(h);e.appendChild(a);a=document.createElement("tbody");h=document.createElement("tr");g=document.createElement("td");g.style.padding="0";g.style.background="url("+this.getTile("l")+") repeat-y";g.width=c;BorderSupport.fixCell(g);
h.appendChild(g);g=document.createElement("td");g.style.padding="0";g.style.verticalAlign="top";if(b.colour)g.style.backgroundColor="#"+b.colour;this.content&&g.appendChild(this.content);this.container=g;h.appendChild(g);g=document.createElement("td");g.style.padding="0";g.style.background="url("+this.getTile("r")+") repeat-y";g.width=c;BorderSupport.fixCell(g);h.appendChild(g);a.appendChild(h);e.appendChild(a);if(!b.skipBottom){b=document.createElement("tfoot");a=document.createElement("tr");h=document.createElement("td");
h.style.padding="0";g=document.createElement("img");g.src=this.getTile("bl");g.width=c;g.height=d;g=BorderSupport.fixImage(g);h.appendChild(g);a.appendChild(h);h=document.createElement("td");h.style.padding="0";h.style.background="url("+this.getTile("bm")+") repeat-x";h.height=d;BorderSupport.fixCell(h);a.appendChild(h);h=document.createElement("td");h.style.padding="0";g=document.createElement("img");g.src=this.getTile("br");g.width=c;g.height=d;g=BorderSupport.fixImage(g);h.appendChild(g);a.appendChild(h);
b.appendChild(a);e.appendChild(b)}this.frame=e},getTile:function(a){return Application.assetHost("/-/cache/border/"+this.spec+"_t="+a+"_24.png")},getFrame:function(){return this.frame},getContent:function(){return this.content},getContainer:function(){return this.container},getTileWidth:function(){return this.tileWidth},getTileHeight:function(){return this.tileHeight}};
Border.LONG_TO_SHORT_OPTIONS={width:"w",height:"h",borderWidth:"bw",borderColour:"bc",borderGradient:"bgr",backgroundColour:"bg",colour:"c",shadow:"sw",shadowX:"sx",shadowY:"sy",shadowMargin:"sm",shadowPadding:"sp",shadowBlurRadius:"sbr",shadowBlurSigma:"sbs",tile:"t"};
var DatePicker=Class.create({initialize:function(a,b){this.options=b;this.horizontalPages=this.options.horizontalPages||2;this.date=a||new Date;this.selectedElement=null;this.pageMargin=5;this.buffer=1;this.scrollOffset=this.acceleration=this.speed=0;this.balloon=this.totalWidth=null;this.focusDate=this.date},create:function(){var a=$(document.createElement("table"));a.className="pages_table";var b=$(document.createElement("tbody"));a.appendChild(b);var c=$(document.createElement("tr"));b.appendChild(c);
if(!this.options.noArrows){b=$(document.createElement("td"));b.className="arrow_left";b.observe("click",function(e){this.scrollPrevious();var f=window.getSelection?window.getSelection():null;f&&f.removeAllRanges();Event.stop(e);return false}.bind(this));c.appendChild(b)}b=$(document.createElement("td"));b.className="pages_cell";c.appendChild(b);var d=$(document.createElement("div"));d.className="pages_container";d.style.position="relative";b.appendChild(d);this.pagesContainerElement=d;b=$(document.createElement("div"));
b.className="pages";this.pagesElement=b;this.pagesContainerElement.appendChild(this.pagesElement);if(!this.options.noArrows){b=$(document.createElement("td"));b.className="arrow_right";b.observe("click",function(e){this.scrollNext();var f=window.getSelection?window.getSelection():null;f&&f.removeAllRanges();Event.stop(e);return false}.bind(this));c.appendChild(b)}c=$(document.createElement("div"));c.className="date_picker";c.appendChild(a);return c},createPages:function(a,b){for(var c=[],d=a.getFullYear();d<=
b.getFullYear();d++)for(var e=0;e<12;e++){var f=new Date(d,e,1);if(f.getTime()>=a.getTime()&&f<=b.getTime()){f=this.createPage(f);c.push(f)}}return c},createPage:function(a){var b=$(document.createElement("div"));b.className="page";for(var c=new Date(a.getFullYear(),a.getMonth(),1);c.getDay()!=1;)c.setDate(c.getDate()-1);for(var d=new Date(a.getFullYear(),a.getMonth()+1,-1);d.getDay()<6;)d.setDate(d.getDate()+1);var e=$(document.createElement("table"));b.appendChild(e);var f=$(document.createElement("tbody"));
e.appendChild(f);e=$(document.createElement("tr"));var j=$(document.createElement("th"));j.colSpan=7;j.className="month_heading";j.appendChild(document.createTextNode(DatePicker.MONTH_NAMES[a.getMonth()]));j.appendChild(document.createTextNode(" "));j.appendChild(document.createTextNode(a.getFullYear()));e.appendChild(j);f.appendChild(e);e=[1,2,3,4,5,6,0];var h=$(document.createElement("tr"));e.each(function(t){var q=$(document.createElement("th"));q.className="day";if(t==0)q.className+=" holiday";
q.appendChild(document.createTextNode(DatePicker.DAY_NAMES[t].slice(0,1)));h.appendChild(q)});f.appendChild(h);for(var g=c,k=new Date,l=function(t){Event.element(t).addClassName("hover")},p=function(t){Event.element(t).removeClassName("hover")};g<=d;){var m=$(document.createElement("tr"));e.each(function(t){var q=$(document.createElement("td"));if(g.getMonth()==a.getMonth()){q.className="day";if(g.getFullYear()==k.getFullYear()&&g.getMonth()==k.getMonth()&&g.getDate()==k.getDate())q.className+=" today";
if(t==0)q.className+=" holiday";q.appendChild(document.createTextNode(g.getDate()));q.date=g;if(navigator.userAgent.match(/MSIE [0-6]/)){q.observe("mouseover",l);q.observe("mouseout",p)}q.observe("click",function(v){v=Event.element(v);this.selected(v.date,v)}.bind(this))}m.appendChild(q);g=new Date(g);g.setDate(g.getDate()+1)}.bind(this));f.appendChild(m)}return b},selected:function(a,b){if(this.selectedElement){this.selectedElement.removeClassName("selected");this.selectedElement=null}b.addClassName("selected");
this.selectedElement=b;this.date=a;this.options.onSelect&&this.options.onSelect(a);this.balloon&&this.balloon.close()},scrollToDate:function(a){if(a.getFullYear()!=this.focusDate.getFullYear()||a.getMonth()!=this.focusDate.getMonth()){var b=this.dateWithRelativeMonth(this.focusDate,-1),c=this.dateWithRelativeMonth(this.focusDate,this.horizontalPages+1);if(a<b||a>=c){this.focusDate=this.dateWithRelativeMonth(a,0);this.repopulate()}else this.scrollRelative(a<this.focusDate?-1:1)}},scrollRelative:function(a){if(a!=
0){a/=Math.abs(a);if(a<0)new Effect.ScrollElementTo(this.pagesContainerElement,{toX:this.scrollOffsetForPage(-1),duration:0.5,transition:Effect.Transitions.sinoidal,afterFinish:function(){$(this.pagesElement.lastChild).remove();this.focusDate=this.dateWithRelativeMonth(this.focusDate,a);this.pagesElement.insertBefore(this.createPage(this.dateWithRelativeMonth(this.focusDate,-this.buffer)),this.pagesElement.firstChild);this.pagesContainerElement.scrollLeft=this.scrollOffsetForPage(0)}.bind(this),queue:"end"});
else new Effect.ScrollElementTo(this.pagesContainerElement,{toX:this.scrollOffsetForPage(1),duration:0.5,transition:Effect.Transitions.sinoidal,afterFinish:function(){$(this.pagesElement.firstChild).remove();this.focusDate=this.dateWithRelativeMonth(this.focusDate,a);this.pagesElement.appendChild(this.createPage(this.dateWithRelativeMonth(this.focusDate,this.horizontalPages+this.buffer-1)));this.pagesContainerElement.scrollLeft=this.scrollOffsetForPage(0)}.bind(this),queue:"end"})}},scrollPrevious:function(){this.scrollRelative(-1)},
scrollNext:function(){this.scrollRelative(1)},scrollOffsetForPage:function(a){var b=this.pageMargin*2,c=(this.buffer+a)*this.pageWidth;c+=b/2;if(navigator.userAgent.match(/MSIE/)){if(a==1)c+=b/2;c+=b}if(a>=0)c+=b/2;return c},setBalloon:function(a){this.balloon=a},repopulate:function(){for(;this.pagesElement.firstChild;)this.pagesElement.removeChild(this.pagesElement.firstChild);this.populate()},populate:function(){if(!this.pageWidth){var a=this.createPage(this.date);this.pagesElement.appendChild(a);
this.pageWidth=a.getDimensions().width+this.pageMargin;this.pagesContainerElement.style.height=a.getDimensions().height+"px";this.pagesContainerElement.style.width=this.horizontalPages*this.pageWidth+"px";this.pagesElement.removeChild(a)}if(!this.pagesElement.firstChild){a=this.dateWithRelativeMonth(this.focusDate,-this.buffer);var b=this.dateWithRelativeMonth(this.focusDate,this.horizontalPages+this.buffer-1);this.createPages(a,b).each(function(c){this.pagesElement.appendChild(c)}.bind(this));this.pagesContainerElement.scrollLeft=
this.scrollOffsetForPage(0)}},dateWithRelativeMonth:function(a,b){return new Date(a.getFullYear(),a.getMonth()+b,1)},insertInto:function(a){$(a).appendChild(this.create());this.populate()}});DatePicker.DAY_NAMES=[_("s\u00f8ndag"),_("mandag"),_("tirsdag"),_("onsdag"),_("torsdag"),_("fredag"),_("l\u00f8rdag")];DatePicker.MONTH_NAMES=[_("januar"),_("februar"),_("mars"),_("april"),_("mai"),_("juni"),_("juli"),_("august"),_("september"),_("oktober"),_("november"),_("desember")];
DatePicker.attachBalloon=function(a,b){b=$(b);var c=document.createElement("img");c.className="date_picker_arrow";c.src="/images/forms/date_picker_button.png";c.alt="...";b.parentNode.insertBefore(c,b.nextSibling);var d=new Balloon({content:a.create(),className:"date_picker_balloon",closeable:true,position:new Balloon.Position.Vertical(-145,0),origin:b,tail:null,rounded:true,onMayShow:function(){return!b.disabled},onShow:function(){a.populate()}});d.attach(c);a.setBalloon(d);return a};
var DropDownGroups={},DropDowns={_all:[],close:function(a){this.each(function(b){b.close(a)})},find:function(a){return this._all.find(a)},register:function(a){this._all[this._all.length]=a},each:function(a){return this._all.each(a)}},DropDown=Class.create();
DropDown.prototype={initialize:function(a,b,c){this.panel=b;this.link=a;$(this.link).onclick=function(){this.toggle();return false}.bind(this);this.group=c.group;this.position=c.position;this.onShow=c.onShow;this.onHide=c.onHide;this.onAfterHide=c.onAfterHide;DropDowns.register(this)},toggle:function(){this.isOpen()?this.close():this.open()},open:function(){if(!this.isOpen()){var a=$(this.panel),b=$(this.link);if(this.group){var c=DropDownGroups[this.group];c&&c.close();DropDownGroups[this.group]=
this}a.parentElement.removeChild(a);document.body.appendChild(a);Element.addClassName(b,"active");this.position&&this.position(b,a);b=false;if(this.onShow)b=this.onShow(a)==false;b||Element.show(a)}},close:function(a){if(this.isOpen()){var b=$(this.panel),c=$(this.link),d=false;if(this.onHide)d=this.onHide(b)==false;if(!d)if(a){Element.hide(b);this.onAfterHide&&this.onAfterHide(b)}else new Effect.Fade(b,{duration:0.25,from:1,afterFinish:function(){this.onAfterHide&&this.onAfterHide(b)}.bind(this)});
Element.removeClassName(c,"active")}},isOpen:function(){return Element.visible($(this.panel))}};DropDown.Above=function(a,b,c){b||(b=0);c||(c=0);return function(d,e){var f=b,j=c;for(d=d;d;){f+=d.offsetLeft;j+=d.offsetTop;d=d.offsetParent}e.style.position="absolute";e.style.top=j-a+1+"px";e.style.left=f+"px"}};
DropDown.Below=function(a,b){a||(a=0);b||(b=0);return function(c,d){for(var e=Element.getDimensions(d),f=a,j=b,h=c;h;){f+=h.offsetLeft;j+=h.offsetTop;h=h.offsetParent}j+=c.clientHeight;j-=1;if(f+e.width>=document.width-10)f=document.width-e.width-10;d.style.position="absolute";d.style.top=j+"px";d.style.left=f+"px"}};
DropDown.BelowFlushRight=function(a,b){a||(a=0);b||(b=0);return function(c,d){d.style.position="absolute";d.style.top=b+c.offsetTop+c.offsetHeight-1+"px";d.style.left=a+c.offsetLeft+c.offsetWidth-Element.getDimensions(d)+"px"}};Event.observe(document,"click",function(a){var b=Event.element(a),c=false;DropDowns.each(function(d){c=c||b==$(d.panel)||b==$(d.link)||Element.childOf(b,$(d.panel))||Element.childOf(b,$(d.link))});c||DropDowns.close()});Event.observe(window,"resize",function(){DropDowns.close(true)});
Event.observe(window,"blur",function(){});Effect.ScrollElementTo=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);this.start(b||{})},setup:function(){this.scrollStartX=this.element.scrollLeft;this.scrollStartY=this.element.scrollTop;this.deltaX=this.options.toX-this.scrollStartX;this.deltaY=this.options.toY-this.scrollStartY},update:function(a){this.element.scrollLeft=this.scrollStartX+a*this.deltaX;this.element.scrollTop=this.scrollStartY+a*this.deltaY}});
Effect.MoveAbsolutely=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);this.start(b||{})},setup:function(){this.element.makePositioned();var a=parseFloat(this.element.getStyle("left")||"0"),b=parseFloat(this.element.getStyle("top")||"0");this.startX=this.options.fromX||a;this.startY=this.options.fromY||b;this.deltaX=(this.options.toX||a)-this.startX;this.deltaY=(this.options.toY||b)-this.startY},update:function(a){if(this.options.fromX||this.options.toX)this.element.style.left=
this.startX+a*this.deltaX+"px";if(this.options.fromY||this.options.toY)this.element.style.top=this.startY+a*this.deltaY+"px"}});
var Errors={exceptionHandler:function(a,b){this.reportForAjax(a,b.toString())},descriptionFromRequest:function(a,b){var c=null;if(a.getResponseHeader)c=a.getResponseHeader("X-Error-Message");c=c||b;if(c==null&&a.statusText&&a.statusText!="OK")c=a.statusText;if(!c)if(a.status==503)c=_("Vi oppgraderer Origo akkurat n\u00e5. Dette kan ta et minutt eller to.");else{c=_("Beklager, noe gikk galt ved kontakt med tjeneren");if(a.status&&a.status!=500){c+=" (feilkode ";c+=a.status;c+=")"}}c+=".";return c},
reportException:function(a){a=a.message;if(a==null||a=="")a=_("(Ingen feilmelding)");alert(_("En feil skjedde: %s",a))},reportForAjax:function(a,b){alert(this.descriptionFromRequest(a,b))},reportForEmbed:function(){alert(_("Beklager, noe gikk galt ved kontakt med tjeneren"))},log:function(a){typeof console!="undefined"&&console.log(a.toString())}},TextileEditing=Class.create({initialize:function(a){this._fieldElement=$(a)},bold:function(){var a=Form.getSelection(this._fieldElement)||prompt(_("Skriv tekst som skal legges inn som uthevet"),
"");a&&Form.insertIntoTextField(this._fieldElement,"*"+a+"*",{focusAfter:true})},italic:function(){var a=Form.getSelection(this._fieldElement)||prompt(_("Skriv tekst som skal legges inn i kursiv"),"");a&&Form.insertIntoTextField(this._fieldElement,"_"+a+"_",{focusAfter:true})},continuationBreak:function(){if(/<!--mer.*--\>/.match(this._fieldElement.value))return alert(_("Du har allerede et ingress-skille ('<!--mer--\>') i teksten din."));var a=prompt(_("Skriv tekst som skal brukes til \u00e5 lage 'Les mer'-lenken som g\u00e5r til innholdssiden. Om du ikke skriver noe her vil 'Les mer' brukes."),
""),b="mer";if(a&&a!="")b+=" "+a;Form.insertIntoTextField(this._fieldElement,"\n\n<!--"+b+"--\>\n\n",{deselectBefore:true,focusAfter:true})},link:function(){var a=Form.getSelection(this._fieldElement)||prompt(_("Skriv lenketeksten"),"");if(a){var b=prompt(_("Skriv adressen som skal lenkes til"),"http://");b&&Form.insertIntoTextField(this._fieldElement,'"'+a+'":'+b,{focusAfter:true})}},addImage:function(a,b){a.length||(a=$A([a]));if(a.length>0){var c;c=b=="left"?" venstre 250x":b=="right"?" h\u00f8yre 250x":
"";var d="";if(b=="slideshow"){d+="[bildeserie]\n";a.each(function(e){d+="!bilde "+e.id+c+"!\n"});d+="[/bildeserie]"}else if(b=="grid"){d+="[bilderutenett 3]\n";a.each(function(e){d+="!bilde "+e.id+c+"!\n"});d+="[/bilderutenett]"}else a.each(function(e){if(d.length>0)d+="\n";d+="!bilde "+e.id+c+"!"});Form.insertIntoTextField(this._fieldElement,d,{deselectBefore:true,padding:"\n\n",selectAfter:true,focusAfter:true})}},observeImages:function(a,b){a=$(a);b=$(b);if(!this.selectorElement){selectorElement=
$(document.createElement("div"));selectorElement.hide();selectorElement.addClassName("textile_image_selector");var c=$(document.createElement("p"));c.appendChild(document.createTextNode(_("Velg hvilket bilde som skal brukes i sammendrag, feeds, lokalavisen osv.")));selectorElement.appendChild(c);this.imageListElement=$(document.createElement("ul"));this.imageListElement.addClassName("textile_image_selector_images");selectorElement.appendChild(this.imageListElement);c=$(document.createElement("div"));
c.addClassName("clear");selectorElement.appendChild(c);a.parentNode.insertBefore(selectorElement,a.nextSibling);this.selectorElement=selectorElement;this.cachedImageIds=$A();this.firstImage=true}c=function(){var d=$A();a.value.scan(/!bilde (\d+)/,function(j){d.push(j[1])}.bind(this));d=d.uniq().sort();if(d.length!=this.cachedImageIds.length||d.intersect(this.cachedImageIds).length!=d.length){this.cachedImageIds=d;if(!d.include(b.value))b.value="";for(;this.imageListElement.firstChild;)this.imageListElement.removeChild(this.imageListElement.firstChild);
if(d.length>0){if(this.firstImage){this.firstImage=false;b.value=d[0]}var e=$(document.createElement("li")),f=$(document.createElement("p"));f.appendChild(document.createTextNode(_("Ikke bruk bilde")));e.appendChild(f);e.observe("click",function(){this.imageListElement.select("li").each(function(j){j.removeClassName("selected")});b.value="";e.addClassName("selected")}.bind(this));b.value==""&&e.addClassName("selected");this.imageListElement.appendChild(e);d.each(function(j){var h=$(document.createElement("li")),
g=$(document.createElement("img"));g.src=Application.assetHost("/-/image/preview/"+j+"_h0_48x48.jpg");g.alt="";h.observe("click",function(){this.imageListElement.select("li").each(function(k){k.removeClassName("selected")});b.value=j;g.parentNode.addClassName("selected")}.bind(this));h.appendChild(g);b.value==j&&h.addClassName("selected");this.imageListElement.appendChild(h)}.bind(this));this.selectorElement.show()}else{b.value="";this.selectorElement.hide()}}}.bind(this);window.setInterval(c,1E3);
a.value!=""&&c()}}),LiveValidation=Class.create({initialize:function(a,b){this.options=b;this.containerElement=$(a);this.messageElement=this.containerElement.select(".live_validation_message")[0];this.delay=500;this.attachedElements=[];window.setInterval(function(){this._attachContainer()}.bind(this),this.delay)},_attachContainer:function(){var a=false;this.containerElement.select("input, textarea, select").each(function(b){if(!b._internal)if(this._attachElement(b))a=true}.bind(this));this.attachedElements.clone().each(function(b){if(!this._mayAttachElement(b)){this.attachedElements=
this.attachedElements.without(b);a=true}}.bind(this));a&&this._update()},_nodeInDocument:function(a){for(;a.parentNode!=null;)a=a.parentNode;return a==document},_mayAttachElement:function(a){return this._nodeInDocument(a)&&a.ancestors().all(function(b){return b.visible()})},_attachElement:function(a){var b=false;if(!this.attachedElements.include(a)&&this._mayAttachElement(a)){this.attachedElements.push(a);if(this.options.validateOn=="blur")new FocusBasedFieldElementObserver(a,this._update.bind(this));
else new DelayedFieldElementObserver(a,this.delay,this._update.bind(this));if(a.value)b=true}return b},_update:function(){if(this.request&&this.request.transport){try{this.request.transport.abort()}catch(a){}this.messageElement.removeClassName("spinner");this.messageElement.innerHTML="";this.messageElement.hide()}var b=Form.getForm(this.containerElement);this.request=new Ajax.Request(this.options.url,{parameters:Form.serialize(b)+"&"+this.options.parameters,evalScripts:false,onLoading:function(){this.containerElement.removeClassName("live_validation_rejected");
this.containerElement.removeClassName("live_validation_accepted");this.messageElement.addClassName("spinner");this.messageElement.innerHTML=this.options.progressLabel;this.messageElement.show();window.setTimeout(function(){if(this.messageElement.visible()&&this.messageElement.hasClassName("spinner")&&this.messageElement.select("a").length==0){var c=$(document.createElement("a"));c.addClassName("small");c.appendChild(document.createTextNode(_("Pr\u00f8v igjen")));c.href="#";c.observe("click",function(d){this._update();
d.stop()}.bind(this));this.messageElement.appendChild(document.createTextNode(" "));this.messageElement.appendChild(c)}}.bind(this),3500)}.bind(this),onFailure:function(c){Errors.reportForAjax(c)}.bind(this),onSuccess:function(c){if(c=eval("("+c.responseText+")")){if(c.error){this.containerElement.addClassName("live_validation_rejected");this.containerElement.removeClassName("live_validation_accepted");this.messageElement.innerHTML=c.error}else if(c.reset)this.messageElement.innerHTML="";else{this.containerElement.removeClassName("live_validation_rejected");
this.containerElement.addClassName("live_validation_accepted");this.messageElement.innerHTML=this.options.acceptLabel}if(this.messageElement.childNodes.length==0)this.messageElement.innerHTML="&nbsp;"}}.bind(this),onComplete:function(){this.messageElement.removeClassName("spinner")}.bind(this),onException:function(c,d){Errors.log(d)}.bind(this)})}}),DelayedFieldElementObserver=Class.create({initialize:function(a,b,c){this.element=$(a);this.delay=b;this.callback=c;this.oldValue=this.getValue();switch(this.element.type.toLowerCase()){case "checkbox":case "radio":this.element.observe("click",
this.scheduleCallback.bind(this));break;case "hidden":window.setInterval(this.changed.bind(this),this.delay);break;default:this.element.observe("keydown",this.scheduleCallback.bind(this));this.element.observe("change",this.changed.bind(this));break}},getValue:function(){switch(this.element.type.toLowerCase()){case "checkbox":case "radio":return this.element.checked;default:return this.element.value}},changed:function(){var a=this.getValue();if(this.element.type.toLowerCase()=="radio"||a!=this.oldValue){this.oldValue=
a;this.cancel();this.callback()}},scheduleCallback:function(){this.cancel();this.timeoutId=window.setTimeout(this.changed.bind(this),this.delay)},cancel:function(){if(this.timeoutId){window.clearTimeout(this.timeoutId);this.timeoutId=null}}}),FocusBasedFieldElementObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.oldValue=this.getValue();this.element.observe("blur",this.changed.bind(this))},getValue:function(){switch(this.element.type.toLowerCase()){case "checkbox":case "radio":return this.element.checked;
default:return this.element.value}},changed:function(){if(this.getValue()!=this.oldValue){this.oldValue=this.getValue();this.callback()}}}),DynamicTextAreaResizing=Class.create({initialize:function(a,b){this.fieldElement=$(a);if(b){this.minHeight=b.minHeight;this.maxHeight=b.maxHeight}$(document).observe("dom:loaded",this.setup.bind(this))},setup:function(){this.fieldElement.style.resize="none";this.fieldElement.observe("change",this.resize.bind(this));this.fieldElement.observe("keydown",this.resize.bind(this));
this.fieldElement.observe("keyup",this.resize.bind(this));this.fieldElement.observe("focus",this.resize.bind(this));this.fieldElement.observe("blur",this.resize.bind(this));this.fieldElement.rows&&this.computeMinHeight();this.resize()},resize:function(){var a=this.fieldElement.getDimensions().width;if(!this.hiddenElement&&a){this.hiddenElement=this.cloneStyles(this.fieldElement,$(document.createElement("textarea")));this.hiddenElement.style.visibility="hidden";this.hiddenElement.style.position="absolute";
this.hiddenElement.style.left="0px";this.hiddenElement.style.top="0px";this.hiddenElement.style.width=a+"px";this.hiddenElement.style.height="1px";this.fieldElement.parentNode.appendChild(this.hiddenElement)}if(this.hiddenElement){this.hiddenElement.value=this.fieldElement.value;this.hiddenElement.scrollTop=0;a=this.hiddenElement.scrollHeight;a+=30;if(this.maxHeight)a=Math.min(a,this.maxHeight);if(this.minHeight)a=Math.max(a,this.minHeight);this.fieldElement.style.height=a+"px"}},computeMinHeight:function(){var a=
this.cloneStyles(this.fieldElement,$(document.createElement("div")));a.style.position="absolute";a.style.top="0px";for(var b="",c=0;c<this.fieldElement.rows;c++)b+="<br/>";a.innerHTML=b;var d=this.fieldElement.parentNode;d.appendChild(a);window.setTimeout(function(){var e=Math.max(33,a.getDimensions().height);d.removeChild(a);this.minHeight=e;this.resize()}.bind(this),1)},cloneStyles:function(a,b){b.style.fontFamily=a.getStyle("font-family");b.style.fontSize=a.getStyle("font-size");b.style.lineHeight=
a.getStyle("line-height");b.style.paddingTop=a.getStyle("padding-top");b.style.paddingRight=a.getStyle("padding-right");b.style.paddingBottom=a.getStyle("padding-bottom");b.style.paddingLeft=a.getStyle("padding-left");b.style.borderTopWidth=a.getStyle("border-top-width");b.style.borderRightWidth=a.getStyle("border-right-width");b.style.borderBottomWidth=a.getStyle("border-bottom-width");b.style.borderLeftWidth=a.getStyle("border-left-width");b.style.borderTopColor=a.getStyle("border-top-color");b.style.borderRightColor=
a.getStyle("border-right-color");b.style.borderBottomColor=a.getStyle("border-bottom-color");b.style.borderLeftColor=a.getStyle("border-left-color");b.style.borderTopStyle=a.getStyle("border-top-style");b.style.borderRightStyle=a.getStyle("border-right-style");b.style.borderBottomStyle=a.getStyle("border-bottom-style");b.style.borderLeftStyle=a.getStyle("border-left-style");b.style.overflow=a.getStyle("overflow");b.style.resize="none";return b}}),TextAreaCharacterCounter=Class.create({initialize:function(a,
b,c){this.fieldElement=$(a);this.counterElement=$(b);this.maximumCharacters=c.maximumCharacters;this.errorClassName=c.errorClassName||"limit_exceeded";this.setup()},setup:function(){this.fieldElement.observe("keydown",this.update.bind(this));this.fieldElement.observe("keyup",this.update.bind(this));this.fieldElement.observe("change",this.update.bind(this));this.counterElement.style.cursor=this.fieldElement.getStyle("cursor");this.counterElement.observe("click",function(){this.fieldElement.focus()}.bind(this));
this.update()},update:function(){var a=this.maximumCharacters-this.fieldElement.value.length;a>0?this.counterElement.removeClassName(this.errorClassName):this.counterElement.addClassName(this.errorClassName);this.counterElement.innerHTML=a==0?_("N\u00e5 er det fullt!"):a>=0?_("%d tegn ledig",a):_("%d tegn for mange!",-a)}});
Object.extend(Form,{getForm:function(a){for(a=$(a);a;){if(a.nodeType==Node.ELEMENT_NODE&&a.tagName.toUpperCase()=="FORM")return a;a=a.parentNode}return null},getCaretPosition:function(a){if(a=$(a))if(document.selection){a.focus();document.selection.createRange().duplicate();return Math.abs(document.selection.createRange().moveStart("character",-a.value.length))}else return a.selectionStart>=0?(position=a.selectionStart):a.value.length},getSelection:function(a){if(a=$(a))if(document.selection){a.focus();
return document.selection.createRange().text}else return a.selectionStart>=0?a.value.substring(a.selectionStart,a.selectionEnd):null},insertIntoTextField:function(a,b,c){if(a=$(a))if(b){c=c||{};var d=c.position;if(d==null)d=Form.getCaretPosition(a);if(c.deselectBefore)if(document.selection)var e=document.selection.createRange();else typeof a.setSelectionRange!="undefined"&&a.setSelectionRange(0,0);else if(document.selection){e=document.selection.createRange();e.text="";e.moveStart("character",0)}else if(typeof a.setSelectionRange!=
"undefined"){e=a.selectionStart;a.value=a.value.substring(0,a.selectionStart)+a.value.substring(a.selectionEnd,a.value.length);a.setSelectionRange(e,e)}e=0;var f=c.padding||"";if(d>0&&!a.value.substring(d-2).startsWith(f)){b=f+b;e+=f.length}if(d<a.value.length&&!a.value.substring(d).startsWith(f))b+=f;if(document.selection){a.focus();e=document.selection.createRange();e.text=b;e.moveStart("character",b.length)}else if(a.selectionStart>=0){a.value=a.value.substring(0,d)+b+a.value.substring(d);if(typeof a.setSelectionRange!=
"undefined")if(c.selectAfter)a.setSelectionRange(d+e,d+b.length);else{d+=b.length;a.setSelectionRange(d,d)}}else a.value+=b;c.focusAfter&&a.focus();a.onchange&&a.onchange()}}});
var TagFields={toggle:function(a,b,c){a=$(a);var d=" "+a.value+" ",e=d.search(" "+b+" ");if(e>=0)a.value=(d.substring(0,e)+d.substring(e+b.length+1,d.length)).strip();else Form.insertIntoTextField(a,b,{position:a.value.length,padding:" ",deselectBefore:true,selectAfter:true});a.focus();$(c).toggleClassName("selected")}},FieldPlaceholder=Class.create();
FieldPlaceholder.prototype={initialize:function(a){this.field=$(a);if(this.field.type=="password")this.isPassword=true;if(this.field.title!=""&&this.field.title!=null){a=null;for(var b=this.field.parentNode;b;){if(b.tagName.toLowerCase()=="form"){a=b;break}b=b.parentNode}a&&this.observeForm(a);this.field.observe("focus",function(){this.focus()}.bind(this));this.field.observe("blur",function(){this.blur()}.bind(this));this.blur()}},observeForm:function(a){$(a).observe("submit",function(){this.focus()}.bind(this))},
blur:function(){if(this.getValue()==""){if(this.isPassword)this.field.type="text";this.field.addClassName("placeholder");this.setValue(this.field.title)}},focus:function(){if(this.getValue()==this.field.title){if(this.isPassword)this.field.type="password";this.setValue("");this.field.removeClassName("placeholder")}},getValue:function(){return this.field.value},setValue:function(a){this.field.value=a}};var FormModalityManager=Class.create();
FormModalityManager.prototype={initialize:function(a){this.form=$(a);this.enabled=false;this.warningMessage=this.previousUnloadHandler=null},begin:function(){if(!this.enabled){this.enabled=true;this.data=Form.serialize(this.form);this.previousBeforeUnloadHandler=window.onbeforeunload;window.onbeforeunload=this._beforeUnloadHandler.bind(this)}},end:function(){if(this.enabled){this.enabled=false;this.data=null;if(window.onbeforeunload==this._beforeBeforeUnloadHandler){window.onbeforeunload=this.previousBeforeUnloadHandler;
this.previousBeforeUnloadHandler=null}}},defer:function(){if(this.enabled){this.end();window.setTimeout(this.begin.bind(this),3E3)}},setWarningMessage:function(a){this.warningMessage=a},isFormModified:function(){return Form.serialize(this.form)!=this.data},_beforeUnloadHandler:function(){if(this.previousUnloadHandler){var a=this.previousBeforeUnloadHandler.apply(this,arguments);if(a)return a}if(this.enabled&&this.isFormModified()){(a=this.warningMessage)||(a=_("Dersom du g\u00e5r videre vil du miste endringene dine."));
return a}}};
var Button={create:function(a,b){var c=$(document.createElement("button"));this.configureElement(c,b);b=$(document.createElement("span"));b.className="button_label";b.appendChild(document.createTextNode(a));c.appendChild(b);return c},linkTo:function(a,b,c){var d=$(document.createElement("a"));d.href=b;this.configureElement(d,c);b=$(document.createElement("span"));b.className="button_label";b.appendChild(document.createTextNode(a));d.appendChild(b);return d},linkToFunction:function(a,b,c){if(navigator.userAgent.match(/MSIE/)){var d=
$(document.createElement("a"));d.href="#";d.observe("click",function(e){b(e);Event.stop(e)});d.appendChild(document.createTextNode(a))}else{d=$(document.createElement("a"));d.href="#";d.observe("click",function(e){b(e);Event.stop(e)});this.configureElement(d,c);c=$(document.createElement("span"));c.className="button_label";typeof a=="string"?c.appendChild(document.createTextNode(a)):c.appendChild(a);d.appendChild(c)}return d},configureElement:function(a,b){b=$H(b||{});var c=b.get("size")||"normal";
b=b.get("color")||"grey";a.setAttribute("class","button "+c+"_button "+c+"_"+b+"_button "+b+"_button")}},EditableText=Class.create();
EditableText.prototype={initialize:function(a){this.options=a;this.value=this.previousValue=this.options.value||"";this.content=this.options.content||this.value||"";this.editing=false;this.type=this.options.type||"field";this.hiddenField=this.progressIndicator=null;if(this.options.elementId)this.attach(this.options.elementId);else this.options.container&&this.attach(this.options.container)},attach:function(a){a=$(a);this.detach();this.element=a;this.element.addClassName("editable_text");Event.observe(a,
"click",function(b){this.edit();Event.stop(b)}.bind(this));Event.observe(a,"mouseover",function(){!this.deleted&&!this.isEditing()&&Element.addClassName(this.element,"editable_text_hover")}.bind(this));Event.observe(a,"mouseout",function(){!this.deleted&&!this.isEditing()&&Element.removeClassName(this.element,"editable_text_hover")}.bind(this));if(!this.options.url&&!this.hiddenField){a=$(document.createElement("input"));a.name=this.options.name;a.type="hidden";a.value=this.value;this.hiddenField=
a;this.element.parentNode.appendChild(this.hiddenField)}this.reset()},detach:function(){},edit:function(){if(!this.deleted)if(!this.isEditing()){for(var a=$(this.element),b=a.getDimensions().height;a.firstChild;)a.removeChild(a.firstChild);Element.removeClassName(a,"editable_text_placeholder");Element.removeClassName(a,"editable_text_hover");var c;if(this.options.url){c=$(document.createElement("form"));c.method="POST";c.action=this.options.url}var d=$(document.createElement("div"));d.className="editable_text_fields";
var e;if(this.type=="field"){e=$(document.createElement("input"));e.className="field";e.type="text";e.value=this.value}else{e=$(document.createElement("textarea"));e.className="field";e.cols=30;e.rows=4;e.style.height=(b<150?150:b)+"px";e.appendChild(document.createTextNode(this.value))}e.observe("keypress",function(j){if(Event.getKey(j)==Event.KEY_RETURN)if(this.type=="field"){Event.stop(j);this.value=e.value;this.save()}if(j.keyCode==27){this.cancel();Event.stop(j)}}.bind(this));d.appendChild(e);
b=document.createElement("div");b.className="button_bar button_bar_left";var f=Button.create(_("Lagre"),{color:"green",size:"small"});Event.observe(f,"click",function(j){this.value=e.value;this.save();Event.stop(j);return false}.bind(this));b.appendChild(f);f=Button.create(_("Avbryt"),{color:"grey",size:"small"});Event.observe(f,"click",function(j){this.cancel();Event.stop(j);return false}.bind(this));b.appendChild(f);if(this.options.deleteUrl){f=Button.create(_("Slett"),{color:"grey",size:"small"});
Event.observe(f,"click",function(j){window.confirm(_("Er du sikker?"))&&this.doDelete();Event.stop(j);return false}.bind(this));b.appendChild(f)}f=document.createElement("img");f.alt=_("Lagrer\u2026");f.src="/images/progress/spinner_16.gif";f.title="";f.className="progress_indicator";f.style.display="none";b.appendChild(f);this.progressIndicator=f;d.appendChild(b);if(c){c.appendChild(d);a.appendChild(c)}else a.appendChild(d);Field.focus(e);this.editing=true}},save:function(){if(!this.deleted)if(this.editing)if(this.options.url)if(this.value!=
this.previousValue){this.progressIndicator&&Element.show(this.progressIndicator);this.saving=true;var a=encodeURIComponent(this.options.name)+"="+encodeURIComponent(this.value);if(this.options.parameters){a+="&";a+=this.options.parameters}new Ajax.Request(this.options.url,{parameters:a,evalScripts:false,onFailure:function(b){Errors.reportForAjax(b)}.bind(this),onSuccess:function(b){this.previousValue=this.value;this.content=(b=b.responseText)?b.stripScripts():"";this.reset()}.bind(this),onComplete:function(){this.saving=
false;this.progressIndicator&&Element.hide(this.progressIndicator)}.bind(this),onException:function(b,c){this.saving=false;Errors.log(c)}.bind(this)})}else this.cancel();else{this.content=this.value;if(this.hiddenField)this.hiddenField.value=this.value;this.reset()}},cancel:function(){this.deleted||this.editing&&this.reset()},doDelete:function(){this.progressIndicator&&Element.show(this.progressIndicator);this.saving=true;new Ajax.Request(this.options.deleteUrl,{onFailure:function(a){Errors.reportForAjax(a)}.bind(this),
onSuccess:function(a){a=a.responseText;this.value="";this.deletedText=a?a.stripScripts():"";this.deleted=true;this.element.removeClassName("editable_text");this.reset()}.bind(this),onComplete:function(){this.saving=false;this.progressIndicator&&Element.hide(this.progressIndicator)}.bind(this),onException:function(a,b){this.saving=false;Errors.log(b)}.bind(this)})},reset:function(){var a=$(this.element);if(this.deleted){a.innerHTML=this.deletedText;Element.removeClassName(a,"editable_text_placeholder")}else if(this.value==
""){a.innerHTML=this.options.placeholderText||a.title;Element.addClassName(a,"editable_text_placeholder")}else{if(this.content)a.innerHTML=this.content;else a.appendChild(document.createTextNode(this.value));Element.removeClassName(a,"editable_text_placeholder")}this.progressIndicator=null;this.editing=false},isEditing:function(){return this.editing}};
var HelpBox=Class.create({initialize:function(a,b){if(this.element=$(a)){this.content=this.element.title;this.element.title="";b&&!b.noIcon&&this.element.addClassName("help_box_indicator");this.visible=false;Event.observe(this.element,"mouseover",this.show.bind(this))}},show:function(){if(!this.visible){this.visible=true;this.create();this.boxElement.style.position="absolute";this.boxElement.style.left="0px";this.boxElement.style.top="-20000px";this.boxElement.show();this.element.insertBefore(this.boxElement,
null);var a=Position.positionedOffset(this.element).left-16,b=Position.positionedOffset(this.element).top-Element.getDimensions(this.boxElement).height;this.boxElement.style.left=a+"px";this.boxElement.style.top=b+"px";$(document.body).observe("mousemove",this._mouseMove.bind(this))}},hide:function(){if(this.visible){this.visible=false;this.boxElement.remove();document.body.stopObserving("mousemove",this._mouseMove.bind(this))}},create:function(){if(!this.boxElement){var a=$(document.createElement("div"));
a.className="text";a.innerHTML=this.content;this.boxElement=$(document.createElement("div"));this.boxElement.className="help_box";this.boxElement.appendChild(a)}},_mouseMove:function(a){a=Event.element(a);if(!(a==this.element||Element.childOf(a,this.element))||a==this.boxElement||Element.childOf(a,this.boxElement))this.hide()}}),Modal=Class.create();
Modal.prototype={initialize:function(a,b){this.element=$(a);this.options=b||{};if(this.options.closeOnEscapeKey)this.keyObserver=function(c){c.charCode==0&&this.hide()}.bind(this)},prepare:function(){var a=this._showBackground();this._createProgress().show();a&&this._start()},show:function(){this._showBackground();if(!(this.containerElement&&this.containerElement.visible())){this.progressElement&&new Effect.Fade(this.progressElement,{duration:0.2,afterFinish:function(){this.progressElement.remove();
this.progressElement=null}.bind(this)});this.options.onBeforeShow&&this.options.onBeforeShow();this.element=$(this.element);this.element.show();var a=this._createContainer();if(this.element.parentNode!=a){this.element.parentNode&&this.element.parentNode.removeChild(this.element);(this.containerCell||a).appendChild(this.element);if(this.content){this.element.innerHTML=this.content;this.content=null}}a.style.left="-50000px";a.style.top="-50000px";a.show();window.setTimeout(this._appear.bind(this),10)}},
hide:function(){if(this.backgroundElement&&this.backgroundElement.visible()){this._stop();this.backgroundElement&&new Effect.Fade(this.backgroundElement,{duration:0.2,afterFinish:function(){this.backgroundElement&&this.backgroundElement.remove();this.backgroundElement=null}.bind(this)});this.progressElement&&new Effect.Fade(this.progressElement,{duration:0.2,afterFinish:function(){this.progressElement&&this.progressElement.remove();this.progressElement=null}.bind(this)});this.containerElement&&new Effect.Fade(this.containerElement,
{duration:0.2})}},reposition:function(){var a=this.containerElement;if(navigator.userAgent.match(/MSIE [0-7]/)){if(a){var b=a.clientWidth,c=a.clientHeight;c=Math.max(document.documentElement.scrollTop+document.documentElement.clientHeight/2-c/2,-46);a.style.top=c+"px";a.style.left=document.documentElement.scrollLeft+document.documentElement.clientWidth/2-b/2+"px"}if(b=this.backgroundElement){b.style.top=document.documentElement.scrollTop+"px";b.style.left=document.documentElement.scrollLeft+"px";
b.style.width=document.documentElement.clientWidth+"px";b.style.height=document.documentElement.clientHeight+"px"}if(a=this.progressElement){b=a.clientWidth;c=a.clientHeight;a.style.top=document.documentElement.scrollTop+document.documentElement.clientHeight/2-c/2+"px";a.style.left=document.documentElement.scrollLeft+document.documentElement.clientWidth/2-b/2+"px"}}else if(a){a.style.left=Math.max(Window.getDimensions().width/2-a.clientWidth/2,0)+"px";if(a.clientHeight<Window.getDimensions().height){c=
Math.max(Window.getDimensions().height/2-a.clientHeight/2,0);c+=document.documentElement.scrollTop||document.body.scrollTop;a.style.top=c+"px"}}},_createContainer:function(){if(!this.containerElement){var a=$(document.createElement("div"));a.style.position="absolute";a.style.zIndex=50001;a.style.display="none";if(!this.options.noClickToClose){a.title=_("Klikk for \u00e5 lukke");a.onclick=function(){this.hide()}.bind(this)}document.body.appendChild(a);if(this.options.closeIcon){var b=document.createElement("img");
b.src=Application.assetHost("/images/modal_close_24.png");b.style.position="absolute";b.style.top="38px";b.style.right="38px";b.style.zIndex=50002;b.alt=_("Lukk");b.onmouseover=function(){this.src=Application.assetHost("/images/modal_close_hover_24.png")};b.onmouseout=function(){this.src=Application.assetHost("/images/modal_close_24.png")};b.onclick=function(){this.hide()}.bind(this);a.appendChild(b)}a.appendChild(this._createShadowTable());this.containerElement=a}return this.containerElement},_createShadowTile:function(a,
b,c){a=Application.assetHost("/images/shadow/big_"+a+"_24.png");var d=$(document.createElement("td"));if(navigator.userAgent.match(/MSIE [0-6]/))d.style.background="#444";else{d.style.verticalAlign="top";d.style.padding="0px";d.style.lineHeight="0";d.style.width="46px";d.style.height="46px";d.style.background="url("+a+") repeat"}if(b)d.style.width=b;if(c)d.style.height=c;return d},_createShadowTable:function(){var a=$(document.createElement("table"));a.cellSpacing=0;a.cellPadding=0;a.border=0;var b=
$(document.createElement("tbody")),c=$(document.createElement("tr"));c.style.height="46px";c.appendChild(this._createShadowTile("tl","46px","46px"));c.appendChild(this._createShadowTile("t",null,"46px"));c.appendChild(this._createShadowTile("tr","46px"));b.appendChild(c);c=$(document.createElement("tr"));c.appendChild(this._createShadowTile("l","46px",null));var d=$(document.createElement("td"));d.style.verticalAlign="top";c.appendChild(d);this.containerCell=d;c.appendChild(this._createShadowTile("r",
"46px",null));b.appendChild(c);c=$(document.createElement("tr"));c.style.height="46px";c.appendChild(this._createShadowTile("bl","46px","46px"));c.appendChild(this._createShadowTile("b",null,"46px"));c.appendChild(this._createShadowTile("br","46px"));b.appendChild(c);a.appendChild(b);return a},_createProgress:function(){if(!this.progressElement){var a=$(document.createElement("div"));a.style.position=navigator.userAgent.match(/MSIE [0-6]/)?"absolute":"fixed";a.style.top="50%";a.style.left="50%";a.style.width=
"64px";a.style.height="28px";a.style.marginLeft="-32px";a.style.marginTop="-14px";a.style.background="#fff";a.style.zIndex=50003;a.style.display="none";a.style.border="solid 1px #ddd";var b=$(document.createElement("img"));b.alt=_("Laster\u2026");b.src=Application.assetHost("/images/progress/lights.gif");b.style.position="relative";b.style.left="10px";b.style.top="8px";a.appendChild(b);document.body.appendChild(a);this.progressElement=a}return this.progressElement},_createBackground:function(){if(!this.backgroundElement){var a=
$(document.createElement("div"));a.style.position=navigator.userAgent.match(/MSIE [0-6]/)?"absolute":"fixed";a.style.top=0;a.style.left=0;a.style.width="100%";a.style.height="100%";a.style.background=this.options.background||"#000";a.style.zIndex=5E4;a.style.display="none";document.body.appendChild(a);this.backgroundElement=a}return this.backgroundElement},_showBackground:function(){var a=this._createBackground();if(!a.visible()){new Effect.Appear(a,{duration:0.3,to:this.options.opacity||0.5});this._start();
return true}},_start:function(){this.keyObserver&&Event.observe(window,"keypress",this.keyObserver,true);navigator.userAgent.match(/MSIE [0-6]/)&&this.reposition();navigator.userAgent.match(/MSIE [0-7]/)&&Event.observe(window,"scroll",this.reposition.bind(this));Event.observe(window,"resize",this.reposition.bind(this))},_stop:function(){this.keyObserver&&Event.stopObserving(window,"keypress",this.keyObserver);navigator.userAgent.match(/MSIE [0-7]/)&&Event.observe(window,"scroll",this.reposition.bind(this));
Event.stopObserving(window,"resize",this.reposition.bind(this))},_appear:function(){this.reposition();var a=this.containerElement;if(a){var b=Math.max(Window.getDimensions().height/2-a.clientHeight/2,-38);b+=document.documentElement.scrollTop||document.body.scrollTop;a.style.top=b+"px"}this.options.onShow&&this.options.onShow();new Effect.Appear(this.containerElement,{duration:0.2,to:1})}};
var ImageStripPager=Class.create({initialize:function(a,b,c){this.url=a;this.container=$(b);this.pager=new BufferedHorizontalPager($(this.container).select(".image_strip_scrollable")[0],{cellWidth:72,visibleCount:3,bufferCount:3,scrollCount:3,initialCells:c.initialCells,onChanged:function(){var d=this.container.select(".image_strip_arrow_left")[0];this.pager.canMovePrevious()?d.removeClassName("disabled"):d.addClassName("disabled");d=this.container.select(".image_strip_arrow_right")[0];this.pager.canMoveNext()?
d.removeClassName("disabled"):d.addClassName("disabled")}.bind(this),onPopulate:function(d,e,f,j){new Ajax.Request(this.url,{parameters:"id="+d+"&context="+(f==-1?"after":"before")+"&count="+e,method:"GET",onLoading:function(){this.container.select(".image_strip_progress")[0].show()}.bind(this),onSuccess:function(h,g){try{if(g=g||this.evaluateJson(h)){var k=[];g.images.each(function(p){k[k.length]={content:p.html,identifier:p.id}});j(k,g.first,g.last)}}catch(l){console.log("err: "+l)}}.bind(this),
onComplete:function(){this.container.select(".image_strip_progress")[0].hide()}.bind(this),onException:function(h,g){Errors.log(g)}.bind(this)})}.bind(this)});this.container.select(".image_strip_arrow_left")[0].observe("click",function(){this.pager.movePrevious()}.bind(this));this.container.select(".image_strip_arrow_right")[0].observe("click",function(){this.pager.moveNext()}.bind(this))},evaluateJson:function(a){var b=null;if((a=a.responseText)&&a.toString().strip().length>0)b=eval("("+a+")");return b}}),
BufferedHorizontalPager=Class.create({initialize:function(a,b){this.scrollableElement=$(a);this.options=b||{};this.options.scrollSpeed=this.options.scrollSpeed||0.3;this.visibleCount=this.options.visibleCount||3;this.scrollCount=this.options.scrollCount||this.visibleCount;this.bufferCount=this.options.bufferCount||this.visibleCount*2;this.cellWidth=this.options.cellWidth||72;this.containerElement=$(document.createElement("div"));this.containerElement.style.overflow="hidden";this.containerElement.style.whiteSpace=
"nowrap";this.containerElement.style.height="100%";this.scrolling=false;this.scrollIndex=0;this.cellElements=[];this.cellFilled=[];this.cellIdentifiers=[];this.lastId=this.firstId=null;this.stateCount=0;this.options.initialCells.each(function(c,d){var e=this._createCell();e.innerHTML=c.content;this.cellElements[d]=e;this.cellIdentifiers[d]=c.identifier;this.cellFilled[d]=true;if(c.first)this.firstId=c.identifier;if(c.last)this.lastId=c.identifier;this.containerElement.appendChild(e)}.bind(this));
this._clearElement(this.scrollableElement);this._updateSize();this.scrollableElement.appendChild(this.containerElement);this.scrollableElement.scrollLeft=0;window.setTimeout(function(){this.options.onChanged&&this.options.onChanged()}.bind(this),1)},canMovePrevious:function(){return this.firstId?this.cellIdentifiers.indexOf(this.firstId)<this.scrollIndex:true},canMoveNext:function(){return this.lastId?this.cellIdentifiers.indexOf(this.lastId)>this.scrollIndex+this.visibleCount:true},movePrevious:function(a){if(this.canMovePrevious()){a=
a||this.scrollCount;var b=this.scrollIndex-a;if(b<0){this._prependCells(-b);b=0}for(var c=b;c<b+a;){if(this.cellFilled[c])break;c++}if(c>b){var d=++this.stateCount;this.options.onPopulate(this.cellIdentifiers[c],c-b,-1,function(e,f,j){if(this.stateCount==d&&e.length>0){b=c-e.length;for(var h=0;h<e.length;h++){var g=b+h;this.cellElements[g].innerHTML=e[h].content;this.cellIdentifiers[g]=e[h].identifier;this.cellFilled[g]=true}if(f)this.firstId=e[0].identifier;if(j)this.lastId=e[e.length-1].identifier;
this._scrollToIndex(b)}}.bind(this))}else this._scrollToIndex(b)}},moveNext:function(a){if(this.canMoveNext()){a=a||this.scrollCount;var b=this.scrollIndex+this.visibleCount+a;if(b>=this.cellElements.length){this._appendCells(b-this.cellElements.length);b=this.scrollIndex+this.visibleCount+a}for(var c=b;c>this.scrollIndex;){if(this.cellFilled[c])break;c--}c+=1;if(b>c){var d=++this.stateCount;this.options.onPopulate(this.cellIdentifiers[c-1],b-c,1,function(e,f,j){if(this.stateCount==d&&e.length>0){for(var h=
0;h<e.length;h++){var g=c+h;this.cellElements[g].innerHTML=e[h].content;this.cellIdentifiers[g]=e[h].identifier;this.cellFilled[g]=true}if(f)this.firstId=e[0].identifier;if(j)this.lastId=e[e.length-1].identifier;this._scrollToIndex(b-e.length)}}.bind(this))}else this._scrollToIndex(b-a)}},_prependCells:function(a){if(a>0){for(var b=0;b<a;b++){var c=this._createCell();this.cellElements.unshift(c);this.cellIdentifiers.unshift(null);this.cellFilled.unshift(false);this.containerElement.insertBefore(c,
this.containerElement.firstChild)}this._updateSize();this._scrollToIndex(this.scrollIndex+a,true)}},_appendCells:function(a){if(a>0){for(var b=0;b<a;b++){var c=this._createCell();this.cellElements.push(c);this.cellIdentifiers.push(null);this.cellFilled.push(false);this.containerElement.appendChild(c)}this._updateSize()}},_clearElement:function(a){for(;a.firstChild;)a.removeChild(a.firstChild)},_scrollToIndex:function(a,b){if(!this.scrolling){this.scrollIndex=a;this._changed();a=this.scrollIndex*this.cellWidth;
if(b)this.scrollableElement.scrollLeft=a;else{this.scrolling=true;new Effect.ScrollElementTo(this.scrollableElement,{toX:a,duration:this.options.scrollSpeed,transition:Effect.Transitions.sinoidal,queue:"end",afterFinish:function(){this.scrolling=false}.bind(this)})}}},_changed:function(){this.options.onChanged&&this.options.onChanged()},_createCell:function(){var a=$(document.createElement("div"));a.style.width=this.cellWidth+"px";a.style.height="100%";a.style.styleFloat="left";a.style.cssFloat="left";
a.style.overflow="hidden";a.style.whiteSpace="nowrap";return a},_updateSize:function(){this.containerElement.style.width=this.cellElements.length*this.cellWidth+"px"}}),SimpleHorizontalPager=Class.create({initialize:function(a,b){this.scrollableElement=$(a);this.scrollableElement.scrollLeft=0;this.scrollableElement.style.overflow="hidden";this.scrollableElement.style.position="relative";this.options=b||{};this.options.scrollSpeed=this.options.scrollSpeed||0.3;this.scrolling=false;this.scrollIndex=
this.options.initialIndex||0;Event.observe(window,"load",this.setup.bind(this))},setup:function(){this.scrollableWidth=this.scrollableElement.getDimensions().width;if(this.scrollableWidth==0)window.setTimeout(this.setup.bind(this),100);else{this.cellWidth=this.options.cellWidth||this.scrollableWidth;for(var a=this.itemCount=0;a<this.scrollableElement.childNodes.length;a++){var b=this.scrollableElement.childNodes[a];if(b&&b.nodeType==Node.ELEMENT_NODE){b.style.position="absolute";b.style.width=this.cellWidth+
"px";b.style.left=this.itemCount*this.cellWidth+"px";b.style.top="0px";this.itemCount++}else{this.scrollableElement.removeChild(b);a--}}this.containerWidth=this.itemCount*this.cellWidth;this._updateSize();this.moveTo(this.scrollIndex);this.options.onChanged&&this.options.onChanged();window.setInterval(this._updateSize.bind(this),500)}},getScrollIndex:function(){return this.scrollIndex},canMovePrevious:function(){return this.scrollIndex>0},canMoveNext:function(){return this.scrollIndex<this.itemCount-
1},movePrevious:function(a){if(a==null)a=1;this.canMovePrevious()&&this.moveTo(Math.max(0,this.scrollIndex-a))},moveNext:function(a){if(a==null)a=1;this.canMoveNext()&&this.moveTo(Math.min(this.scrollIndex+a,this.itemCount))},moveTo:function(a,b){if(!this.scrolling&&a!=this.scrollIndex){this.scrollIndex=a;this._changed();a=this.scrollIndex*this.scrollableWidth;if(!isNaN(a))if(b==true)this.scrollableElement.scrollLeft=a;else{this.scrolling=true;new Effect.ScrollElementTo(this.scrollableElement,{toX:a,
duration:this.options.scrollSpeed,transition:Effect.Transitions.sinoidal,queue:"end",afterFinish:function(){this.scrolling=false}.bind(this)})}}},_changed:function(){this.options.onChanged&&this.options.onChanged()},_updateSize:function(){for(var a=this.scrollableElement.getDimensions().height,b=0;b<this.scrollableElement.childNodes.length;b++){var c=$(this.scrollableElement.childNodes[b]);if(c&&c.nodeType==Node.ELEMENT_NODE&&c.visible())a=Math.max(a,c.getDimensions().height)}a-=parseInt(this.scrollableElement.getStyle("paddingTop")||
0);a-=parseInt(this.scrollableElement.getStyle("paddingBottom")||0);this.scrollableElement.style.height=a+"px"}}),SimpleSlideshow=Class.create();
SimpleSlideshow.prototype={initialize:function(a,b,c,d,e,f,j,h){this.containerElement=$(a);this.images=a.select("img");this.imageWidth=b;this.counterElement=e;this.count=this.images.length;this.captionElement=j;this.captions=h;this.titleElement=f;this.containerElement.observe("click",function(){this.hideTitle()}.bind(this));this.titleElement.observe("click",function(){this.hideTitle()}.bind(this));this.counterElement.hide();this.targetIndex=0;this.arrowLeftElement=$(c);this.arrowLeftElement.observe("click",
function(g){this.jumpToPrevious();g.stopPropagation()}.bind(this));this.arrowRightElement=$(d);this.arrowRightElement.observe("click",function(g){this.jumpToNext();g.stopPropagation()}.bind(this));this.counterEffect=null;this.jumpTo(0)},hideTitle:function(){this.titleElement.hide()},jumpTo:function(a){if(a>=0&&a<this.count){a>0&&this.hideTitle();this.targetIndex=a;this.targetIndex==0?this.arrowLeftElement.hide():this.arrowLeftElement.show();this.targetIndex==this.count-1?this.arrowRightElement.hide():
this.arrowRightElement.show();this.captionElement.innerHTML=(this.captions[this.targetIndex]||"")+"&nbsp;";this.counterElement.innerHTML=this.targetIndex+1+" / "+this.count;this.counterElement.show();new Effect.ScrollElementTo(this.containerElement,{toX:this.targetIndex*this.imageWidth,duration:0.3,transition:Effect.Transitions.sinoidal,afterFinish:this.finishedScrolling.bind(this)})}},jumpToNext:function(){this.jumpTo(this.targetIndex+1)},jumpToPrevious:function(){this.jumpTo(this.targetIndex-1)},
finishedScrolling:function(){this.counterTimeout&&window.clearTimeout(this.counterTimeout);this.counterTimeout=window.setTimeout(function(){this.counterElement.hide()}.bind(this),500)}};var spring_site="test",_cy_="undefined";
if(!this.spring)var spring=function(){function a(){if("https"==document.location.href.slice(0,5))return"https://ssl-";return"http://"}function b(o,n){if(!n){n=o;o={r:document.referrer};v=n}var r=n.s?n.s:o.s;r||(r=n.site?n.site:o.site?o.site:g);t[r]||(t[r]=[]);t[r].push([o,n]);q=1;return this}function c(o){q||b({});var n;for(s in t)for(var r=t[s];r.length>0;){n=",";for(var u=[];r.length>0;){n+=e(f(r.shift(),u),u);if(n.length>l)break;if(r.length>0)n+="+"}n=d(n+";",s,o)}t={};return n}function d(o,n,
r){o=a()+(n?n:g)+"."+k+"/j0="+o;n=o+"?lt="+(new Date).getTime().toString(36)+"&x="+screen.width+"x"+screen.height+"x"+screen.colorDepth;if(r)r==1&&document.write('<img src="'+n+'"" width="1" height=""1">');else(new Image).src=n;p&&alert(n);return o}function e(o,n){for(i in n)if(n[i]==o)return"~"+i;n.push(o);return o}function f(o,n){var r,u,w;r=/[+&,;=~]/g;n||(n=[]);switch(typeof o){case "string":return r.test(o)?escape(o).replace(r,function(x){var y=m[x];if(y)return y;return x}):escape(o);case "number":return isFinite(o)?
String(o):"null";case "boolean":case "null":return String(o);case "object":if(!o)return"null";r=[];if(typeof o.length==="number"&&!o.propertyIsEnumerable("length")){w=o.length;for(u=0;u<w;u+=1)r.push(e(f(o[u],n),n)||"null");return","+r.join("+")+";"}for(u in o)if(typeof u==="string")if(u!="site")(w=f(o[u],n))&&r.push(e(f(u,n)+"="+w,n));return","+r.join("+")+";"}return""}function j(o,n,r){b(o,n);return c(r)}var h=_cy_,g=spring_site,k="tns-cs.net",l=typeof spring_ms!=h?spring_ms:2048,p=typeof spring_debug!=
h?spring_debug:null,m={"+":"%2B",",":"%2C",";":"%3B","=":"%3D","~":"%7E"},t={},q=null,v={};return{a:b,add:b,c:j,commit:j}}();
var Tab=Class.create({initialize:function(a,b,c){this.id=a;this.itemElement=$(b);this.panelElement=$(c)},setActive:function(a){if(a){this.panelElement.show();this.itemElement.addClassName("active")}else this.itemElement.removeClassName("active")}}),TabViewController=Class.create({initialize:function(a){this.element=$(a);this.tabs=[];this.currentTab=null;this.pager=new SimpleHorizontalPager(this.element.select(".tab_view_panels")[0]);this.started=false;Event.observe(window,"load",this._start.bind(this))},
registerTab:function(a,b,c){a=new Tab(a,b,c);this.tabs.push(a);this.currentTab||this.goToTab(a)},currentTab:function(){return this.currentTab},goToTab:function(a){if(this.currentTab){this.currentTab.setActive(false);this.currentTab=null}(this.currentTab=a instanceof Tab?a:this.tabs.find(function(b){return b.id==a}))&&this.started&&this._moveToCurrent();this._changed()},_moveToCurrent:function(){this.pager.moveTo(this.tabs.indexOf(this.currentTab),!this.started);this.currentTab.setActive(true)},_start:function(){var a=
Form.getForm(this.element);if(a){this.anchorInputElement=$(document.createElement("input"));this.anchorInputElement.type="hidden";this.anchorInputElement.name="anchor";a.appendChild(this.anchorInputElement)}(a=window.location.toString().match(/^(.*)#([^#]+)$/))&&a[2]&&this.goToTab(a[2]);this._moveToCurrent();this._markErrors();this.started=true},_changed:function(){if(this.started){var a=window.location.toString().match(/^(.*)#([^#]+)$/);if(a&&a[1]){if(a[2]!=this.currentTab.id)window.location=a[1]+
"#"+this.currentTab.id}else window.location=window.location+"#"+this.currentTab.id}if(this.anchorInputElement)this.anchorInputElement.value=this.currentTab?this.currentTab.id:null;typeof GoogleMapsSupport!="undefined"&&GoogleMapsSupport.checkAllResize()},_markErrors:function(){this.tabs._each(function(a){Element.getElementsBySelector(a.panelElement,".field_with_errors, .field_error").length>0&&a.itemElement.addClassName("tab_with_errors")}.bind(this))}}),TimePicker=Class.create();
TimePicker.prototype={initialize:function(a,b){this.value=a;this.options=b;this.balloon=null},create:function(){var a=$(document.createElement("div")),b=$(document.createElement("span"));b.className="time";b.observe("click",function(f){this.selected(null);Event.stop(f)}.bind(this));b.appendChild(document.createTextNode(_("Ingen")));a.appendChild(b);for(var c=0;c<=23;c++)for(var d=0;d<60;d+=30){var e=this.formatTime(c,d);b=$(document.createElement("span"));b.className="time";b.time=e;b.observe("click",
function(f){this.selected(Event.element(f).time);Event.stop(f)}.bind(this));b.appendChild(document.createTextNode(e));a.appendChild(b)}return a},selected:function(a){this.value=a;this.options.onSelect&&this.options.onSelect(a);this.balloon&&this.balloon.close()},formatTime:function(a,b){return this.zeroPad(a,2)+":"+this.zeroPad(b,2)},zeroPad:function(a,b){for(a=a.toString();a.length<b;)a="0"+a;return a},setBalloon:function(a){this.balloon=a}};
TimePicker.attachBalloon=function(a,b){b=$(b);var c=document.createElement("img");c.className="time_picker_arrow";c.src="/images/forms/time_picker_button_24.png";c.alt="...";b.parentNode.insertBefore(c,b.nextSibling);var d=new Balloon({content:a.create(),className:"time_picker_balloon",closeable:false,position:new Balloon.Position.Vertical(0,-2),origin:b,tail:null,onMayShow:function(){return!b.disabled}});d.attach(c);a.setBalloon(d);return a};
function link_share(a,b,c){var d;switch(c){case "facebook":d=window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(b)+"&t="+encodeURIComponent(a),c,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "kudos":d=window.open("http://www.kudos.no/giKudos.php?tittel="+escape(a)+"&url="+escape(b),c,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "twitter":d=
window.open("http://www.twitter.com/home?status="+b,c,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "nettby":d=window.open("http://www.nettby.no/user/edit_link.php?name="+escape(a)+"&url="+encodeURIComponent(b)+"&description=",c,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "google":d=window.open("http://www.google.com/bookmarks/mark?op=edit&bkmk="+
encodeURIComponent(b)+"&title="+encodeURIComponent(a),c,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "delicious":d=window.open("http://del.icio.us/post?url="+encodeURIComponent(b)+"&title="+encodeURIComponent(a),c,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break}d.focus();return false}var DHTMLGoodies={};
if(!String.trim)String.prototype.trim=function(){return this.replace(/^\s+|\s+$/,"")};DHTMLGoodies.ChessFen=function(a){this.pieceType="cases";this.squareSize=45;this.isOldMSIE=navigator.userAgent.toLowerCase().match(/msie\s[0-6]/gi)?true:false;this.isOpera=navigator.userAgent.toLowerCase().indexOf("opera")>=0?true:false;this.parentRef=document.body;this.imageFolder="images/";this.flipBoardWhenBlackToMove=this.boardLabels=true;a&&this.__setInitProps(a);this.init()};
DHTMLGoodies.ChessFen.prototype={__setInitProps:function(a){if(a.imageFolder)this.imageFolder=a.imageFolder;if(a.squareSize)this.squareSize=a.squareSize;if(a.boardLabels||a.boardLabels===false)this.boardLabels=a.boardLabels;if(a.flipBoardWhenBlackToMove||a.flipBoardWhenBlackToMove===false)this.flipBoardWhenBlackToMove=a.flipBoardWhenBlackToMove;if(a.pieceType)this.pieceType=a.pieceType},setSquareSize:function(a){this.squareSize=a},setPieceType:function(a){this.pieceType=a},init:function(){},setFlipBoardWhenBlackToMove:function(a){this.flipBoardWhenBlackToMove=
a},getWhoToMove:function(){return this.whoToMove},setBoardLabels:function(a){this.boardLabels=a},__setWhoToMove:function(a){this.whoToMove=a.split(/\s/g)[1].trim()},loadFen:function(a,b){this.__setWhoToMove(a);b=this.__getEl(b);b.innerHTML="";var c=document.createElement("DIV");c.className="ChessBoard"+this.squareSize;c.style.position="relative";var d=document.createElement("DIV");d.className="ChessBoardInner"+this.squareSize;if(this.boardLabels){this.__addBoardLabels(c);c.appendChild(d);d.style.position=
"absolute";d.style.top="0px";d.style.right="0px";b.appendChild(c)}else{d.style.position="relative";b.appendChild(d)}this.__loadFen(a,d)},__addBoardLabels:function(a){for(var b=1;b<=8;b++){var c=document.createElement("DIV");c.style.position="absolute";c.style.right=(8-b)*this.squareSize+"px";c.style.bottom="0px";c.innerHTML="ABCDEFGH".substr(b-1,1);c.style.textAlign="center";c.style.width=this.squareSize+"px";a.appendChild(c);c.className="ChessBoardLabel ChessBoardLabel"+this.squareSize;var d=document.createElement("DIV");
d.style.position="absolute";d.style.left="0px";d.style.top=(8-b)*this.squareSize+"px";d.innerHTML=b;d.style.height=this.squareSize+"px";d.style.lineHeight=this.squareSize+"px";a.appendChild(d);d.className="ChessBoardLabel ChessBoardLabel"+this.squareSize;if(this.whoToMove=="b"&&this.flipBoardWhenBlackToMove){d.innerHTML=9-b;c.innerHTML="ABCDEFGH".substr(8-b,1)}}},__loadFen:function(a,b){a=a.split(/\s/g)[0];for(var c=0,d=0;d<a.length;d++){var e=a.substr(d,1);if(e.match(/[A-Z]/i)){var f=this.__getBoardPosByCol(c),
j=document.createElement("DIV");j.style.position="absolute";j.style.left=f.x+"px";j.style.top=f.y+"px";if(e.match(/[A-Z]/))var h="w";if(e.match(/[a-z]/))h="b";f=document.createElement("IMG");f.src=this.imageFolder+this.pieceType+this.squareSize+h+e.toLowerCase()+".png";self.status=this.imageFolder+this.pieceType+this.squareSize+h+e.toLowerCase()+".png";j.appendChild(f);j.className="ChessPiece"+this.squareSize;b.appendChild(j);c++;this.isOldMSIE&&!this.isOpera&&this.correctPng(f)}if(e.match(/[0-8]/))c+=
e/1}},__getBoardPosByCol:function(a){for(var b=0;a>=8;){b++;a-=8}var c={};if(this.whoToMove=="b"&&this.flipBoardWhenBlackToMove){a=7-a;b=7-b}c.x=a*this.squareSize;c.y=b*this.squareSize;return c},__getEl:function(a){if(typeof a=="string"){if(document.getElementById(a))return document.getElementById(a);if(document.forms[a])return document.forms[a];if(document[a])return document[a];if(window[a])return window[a]}return a},correctPng:function(a){a=a=this.__getEl(a);a.outerHTML="<span style=\"position:absolute;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
a.src+"',sizingMethod='scale');width:"+a.width+";height:"+a.height+'"></span>'}};var ObjectFinder=Class.create();
ObjectFinder.prototype={initialize:function(a,b){this.searchField=$(a);this.searchField.observe("blur",this.scheduleSearch.bind(this));this.options=b||{};this.request=null;this.lastQuery="";this.scheduled=null},scheduleSearch:function(){var a=this.searchField.value.strip();if(a!=this.lastQuery&&(!this.selectedHit||this.selectedHit.title!=a)){this.cancelSearch();this.unselect();if(this.scheduled){window.clearTimeout(this.scheduled);this.scheduled=null}if(a.length>0)this.scheduled=window.setTimeout(function(){this.search(a)}.bind(this),
this.options.delay||1E3);else this.depopulate()}},cancelSearch:function(){if(this.request){this.lastQuery=null;this.setRequest(null)}},searchNow:function(){var a=this.searchField.value.strip();a!=""&&this.search(a)},search:function(a){this.lastQuery=a;var b=$(this.searchField.id+"_progress_indicator");this.setRequest(new Ajax.Request(this.options.url,{method:"get",asynchronous:true,evalScripts:true,parameters:encodeURIComponent(this.options.parameter)+"="+a,onLoading:function(){b&&b.show()}.bind(this),
onFailure:function(c){Errors.reportForAjax(c)}.bind(this),onSuccess:function(c,d){c=d||this.evaluateJson(c);this.populate(a,c)}.bind(this),onComplete:function(){b&&b.hide()}.bind(this),onException:function(c,d){Errors.log(d)}.bind(this)}))},evaluateJson:function(a){var b=null;if((a=a.responseText)&&a.toString().strip().length>0)b=eval("("+a+")");return b},depopulate:function(){for(var a=$(this.options.hitContainer||this.options.fieldContainer.nextSibling);a.firstChild;)a.removeChild(a.firstChild);
a.hide();this.selectionElement=null},populate:function(a,b){this.depopulate();if(this.options.maxHits&&b.length>this.options.maxHits){this.display_max_hits_warning=true;b=b.slice(0,this.options.maxHits)}var c=$(this.options.hitContainer||this.options.fieldContainer.nextSibling),d=this.createHitHeader(a,b);d&&c.appendChild(d);d=$(document.createElement("table"));d.className="hit_table";c.appendChild(d);var e=$(document.createElement("tbody"));d.appendChild(e);var f=null;b.each(function(j,h){if(h%1==
0){f=$(document.createElement("tr"));e.appendChild(f)}h=$(document.createElement("td"));var g=$(document.createElement("div"));g.className="hit";g.innerHTML=j.html;h.appendChild(g);f.appendChild(h)}.bind(this));(a=this.createHitFooter(a,b))&&c.appendChild(a);c.show()},createHitHeader:function(a,b){var c=$(document.createElement("div"));if(this.display_max_hits_warning){c.className="max_hits";c.innerHTML=_("Vi kunne ikke vise alle treffene. Skriv litt mer for \u00e5 snevre inn s\u00f8ket.")}else if(b.length==
0)if(this.options.allowCreation){c.className="create_offer";if(this.options.willBeCreated){a=_("<strong>%s</strong> vil bli opprettet. Vil du fylle ut mer informasjon?",a);b=_("Ja takk!")}else{if(this.options.required){c.className="no_results";a=_("Beklager, <strong>%s</strong> fant vi ikke.",a)}else a=_("Du kan opprette <strong>%s</strong> om du vil.",a);b=_("Opprett stedet")}c.innerHTML=a;c.appendChild(document.createTextNode(" "));b=Button.linkToFunction(b,function(){this.showForm();return false}.bind(this),
{color:"green"});c.appendChild(b)}else{c.className="no_results";c.innerHTML=_("Beklager, ingen treff p\u00e5 <strong>%s</strong>.",a)}else if(this.options.allowCreation){c.className="hit_header";c.appendChild(document.createTextNode(this.getHitHeaderText(b)))}return c},getHitHeaderText:function(a){return a.length==1?_("Mente du dette?"):_("Mente du en av disse?")},createHitFooter:function(a,b){if(this.options.allowCreation)if(b.length>0){a=$(document.createElement("div"));a.className="hit_footer";
a.appendChild(document.createTextNode(_("Stod det ikke der?")));a.appendChild(document.createTextNode(" "));b=Button.linkToFunction(this.getHitFooterText(),function(){this.showForm();return false}.bind(this),{color:"green"});a.appendChild(b);return a}},getHitFooterText:function(){return _("Opprett nytt sted")},showForm:function(){var a=$(this.options.createForm);if(a){Form.getElements(a).each(function(b){b.disabled=""});if(!a.visible()){$(this.options.fieldContainer).hide();$(this.options.hitContainer).hide();
a.show();if(a=(new Selector("input[type=text]")).findElements(a)[0]){if(a.value=="")a.value=this.searchField.value;a.focus()}$(this.options.klass);field.value="";field.disabled="true";GoogleMapsSupport.checkAllResize()}this.searchField.blur();this.searchField.disabled="true"}},unselect:function(){this.depopulate();$(this.options.fieldContainer).show();this.searchField.disabled="";this.searchField.focus()},makeSelection:function(a){var b=$(document.createElement("div")),c=$(document.createElement("img"));
c.src="/images/action_icons/remove_24.png";c.alt=_("Fjern valg");c.title=c.alt;var d=$(document.createElement("a"));d.href="#";d.observe("click",function(e){this.unselect();this.searchField.value="";Event.stop(e)}.bind(this));d.className="picker_change_link";d.appendChild(c);b.appendChild(d);c=$(document.createElement("span"));c.innerHTML=a.html;this.stripHighlight(c);b.appendChild(c);return b},stripHighlight:function(a){(new Selector("strong.highlight")).findElements(a).each(function(b){for(var c=
$(document.createElement("span"));b.firstChild;){var d=b.firstChild;b.removeChild(d);c.appendChild(d)}b.parentNode.replaceChild(c,b);throw $break;})},setRequest:function(a){if(this.request){if(this.request.transport)try{this.request.transport.abort()}catch(b){}this.request=null}this.request=a}};
var WizardStep=Class.create({initialize:function(a,b){this.number=a;this.stepElement=b;this.enabled=true},enable:function(){this.stepElement.style.visibility="visible"},disable:function(){this.stepElement.style.visibility="hidden"},setHasNext:function(a){this.stepElement.select(".wizard_step_next_button").each(function(b){b.style.display=a?"":"none"});this.stepElement.select(".wizard_step_finish_button").each(function(b){b.style.display=!a?"":"none"})},isAutoAccept:function(){return this.stepElement.select(".live_validation_auto_accept").length>
0},entered:function(){this._entered=true;this.stepElement.show();this.stepElement.select(".live_validation_auto_accept").each(function(a){a.addClassName("live_validation_accepted")})},update:function(){var a=this.isValid();this.stepElement.select(".wizard_step_next_button").each(function(b){b.setOpacity(a?1:0.3)})},isExplicitlyInvalid:function(){return this.stepElement.select(".live_validation.live_validation_rejected").length>0},isValid:function(){if(!this._entered)return false;var a=0,b=0,c=0;this.stepElement.select(".live_validation").each(function(d){if(d.getWidth()>
0){if(d.hasClassName("live_validation_accepted"))b++;else c++;a++}});return b==a&&c==0}}),WizardController=Class.create({initialize:function(a){this.stepsElement=$(a);this.steps=[];this.currentIndex=0;this.pager=new SimpleHorizontalPager(this.stepsElement.select(".wizard_items")[0]);this.setup()},setup:function(){for(var a=0;a<999;a++){var b=this.stepsElement.select(".wizard_step_"+(a+1))[0];if(!b)break;var c=new WizardStep(a,b);c.title=b.title;c.setHasNext(true);this.steps.push(c)}this.steps.length>
0&&this.steps[this.steps.length-1].setHasNext(false);window.setInterval(this.update.bind(this),1E3);this.goToStep(0)},currentStep:function(){return this.steps[this.currentIndex]},lastStep:function(){return this.steps[this.steps.length-1]},goToStep:function(a){if(this.checkIfMayJumpTo(a)){for(var b=this.currentIndex;b<=a;b++)this.steps[b].entered();this.currentIndex=a;this.pager.moveTo(a);new Effect.ScrollElementTo(document.documentElement.scrollTop?document.documentElement:document.body,{toY:this.stepsElement.cumulativeOffset().top,
duration:0.5});this.moved()}},goPrevious:function(){this.currentIndex>0&&this.goToStep(this.currentIndex-1)},goNext:function(){this.currentIndex<this.steps.length-1&&this.checkIfMayJumpTo(this.currentIndex+1)&&this.goToStep(this.currentIndex+1)},checkIfMayJumpTo:function(a){for(var b=this.currentIndex;b<a;b++){var c=this.steps[b];if(!(c.isAutoAccept()||c.isValid())){this.goToStep(b);alert(_("Du m\u00e5 fylle ut feltene riktig f\u00f8r du kan g\u00e5 videre."));return false}}return true},moved:function(){this.stepsElement.select(".wizard_step_previous_button").each(function(a){a.style.display=
this.currentIndex>0?"":"none"}.bind(this));this.stepsElement.select(".wizard_navigation li").each(function(a){a.removeClassName("active")});this.stepsElement.select(".wizard_navigation li.wizard_navigation_for_step_"+(this.currentIndex+1)).each(function(a){a.addClassName("active")});this.update()},update:function(){for(var a=null,b=0;b<this.steps.length;b++){var c=this.steps[b];b==0||a?c.enable():c.disable();c.update();this.stepsElement.select(".wizard_navigation li.wizard_navigation_for_step_"+(b+
1)).each(function(d){if(c.isValid()){d.addClassName("valid");d.removeClassName("invalid")}else if(c.isExplicitlyInvalid()){d.addClassName("invalid");d.removeClassName("valid")}else{d.removeClassName("valid");d.removeClassName("invalid")}});if(a==null||a)a=c.isValid()}}}),GlobalMenu=Class.create({initialize:function(){this.logo=$("global_header_logo");this.logo.observe("mouseover",this.showIfGotFocus.bind(this));this.logo.observe("click",this.toggle.bind(this));this.hasFocus=true;Event.observe(window,
"focus",function(){this.hasFocus=true}.bind(this));Event.observe(window,"blur",function(){this.hasFocus=false}.bind(this));this.menu=$("global_menu_container");this._handleMouseMoveObserver=this._handleMouseMove.bind(this);this.screenshotCount=$$("#global_menu_brag_screenshots img").length;this.screenshotIndex=0;this.firstTime=true;$(document.documentElement).observe("mousemove",this._handleMouseMoveObserver)},toggle:function(){this.showing?this.hide():this.show()},showIfGotFocus:function(){this.hasFocus&&
this.show()},show:function(){if(!this.showing){this.showing=true;ObscuringElements.hide(function(b){return!(b==this.menu||b.childOf(this.menu))}.bind(this));this.logo.addClassName("active");this.menu.show();if(this.screenshotCount>0){this._goToNextScreenshot();this.animationIntervalId=window.setInterval(this._goToNextScreenshot.bind(this),3E3)}if(this.firstTime){this.firstTime=false;var a=$("global_menu_sandboxes_container");a&&new Ajax.Request("/-/user/top_sandboxes",{method:"GET",onLoading:function(){a.addClassName("global_menu_sandboxes_loading")},
onSuccess:function(b,c){if(c=c||eval("("+b.responseText+")")){var d=$(document.createElement("ul"));c.each(function(e){var f=$(document.createElement("li")),j=$(document.createElement("a"));j.setAttribute("href",e.url);j.addClassName(e.css_classes);j.appendChild(document.createTextNode(e.title));f.appendChild(j);d.appendChild(f)});a.appendChild(d)}},onComplete:function(){a.removeClassName("global_menu_sandboxes_loading")},onException:function(){a.innerHTML=_("Noe gikk galt i lastingen.")}})}}},hide:function(){if(this.showing){this.showing=
false;ObscuringElements.show();if(this.animationIntervalId){window.clearInterval(this.animationIntervalId);this.animationIntervalId=null}this.menu.hide();this.logo.removeClassName("active")}},_handleMouseMove:function(a){if(this.showing)this._within(this.menu,a.pointerX(),a.pointerY())||this._within(this.logo,a.pointerX(),a.pointerY())||this.hide()},_within:function(a,b,c){var d=a.cumulativeOffset();a=a.getDimensions();return b>=d.left&&b<d.left+a.width&&c>=d.top&&c<d.top+a.height},_goToNextScreenshot:function(){for(var a=
this.screenshotIndex;a==this.screenshotIndex;)this.screenshotIndex=Math.floor(Math.random()*this.screenshotCount);new Effect.Fade($$("#global_menu_brag_screenshots img")[a],{duration:1,to:0});new Effect.Appear($$("#global_menu_brag_screenshots img")[this.screenshotIndex],{duration:1,to:1})}});current_tracker_request={};
function trackers_openCategory(a,b,c,d,e){current_tracker_request[b]&&current_tracker_request[b].transport.abort();if(a){$(d).innerHTML="";$$("."+b+" .tracker_category").each(function(f){f.removeClassName("selected")});c&&$$("."+c)[0].addClassName("selected")}$(d).insert({bottom:'<div class="tracker_items_loading"><img src="/images/progress/lights.gif"/></div>'});e.component_class=b;e.content_id=d;current_tracker_request[b]=new Ajax.Updater({success:d},"/-/tracker/embedded_list",{asynchronous:true,
parameters:e,evalScripts:true,insertion:a?null:Insertion.Bottom,onSuccess:function(){$$("."+b+" .tracker_items_loading")[0].remove();delete current_tracker_request[b]}})};
