var a,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(b){return b}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;
var Class={create:function(){function b(){this.initialize.apply(this,arguments)}var c=null,d=$A(arguments);if(Object.isFunction(d[0]))c=d.shift();Object.extend(b,Class.Methods);b.superclass=c;b.subclasses=[];if(c){var e=function(){};e.prototype=c.prototype;b.prototype=new e;c.subclasses.push(b)}for(c=0;c<d.length;c++)b.addMethods(d[c]);if(!b.prototype.initialize)b.prototype.initialize=Prototype.emptyFunction;return b.prototype.constructor=b}};
Class.Methods={addMethods:function(b){var c=this.superclass&&this.superclass.prototype,d=Object.keys(b);Object.keys({toString:true}).length||d.push("toString","valueOf");for(var e=0,f=d.length;e<f;e++){var g=d[e],k=b[g];if(c&&Object.isFunction(k)&&k.argumentNames().first()=="$super"){var j=k;k=function(h){return function(){return c[h].apply(this,arguments)}}(g).wrap(j);k.valueOf=j.valueOf.bind(j);k.toString=j.toString.bind(j)}this.prototype[g]=k}return this}};var Abstract={};
Object.extend=function(b,c){for(var d in c)b[d]=c[d];return b};
Object.extend(Object,{inspect:function(b){try{if(Object.isUndefined(b))return"undefined";if(b===null)return"null";return b.inspect?b.inspect():String(b)}catch(c){if(c instanceof RangeError)return"...";throw c;}},toJSON:function(b){switch(typeof b){case "undefined":case "function":case "unknown":return;case "boolean":return b.toString()}if(b===null)return"null";if(b.toJSON)return b.toJSON();if(!Object.isElement(b)){var c=[];for(var d in b){var e=Object.toJSON(b[d]);Object.isUndefined(e)||c.push(d.toJSON()+
": "+e)}return"{"+c.join(", ")+"}"}},toQueryString:function(b){return $H(b).toQueryString()},toHTML:function(b){return b&&b.toHTML?b.toHTML():String.interpret(b)},keys:function(b){var c=[];for(var d in b)c.push(d);return c},values:function(b){var c=[];for(var d in b)c.push(b[d]);return c},clone:function(b){return Object.extend({},b)},isElement:function(b){return!!(b&&b.nodeType==1)},isArray:function(b){return b!=null&&typeof b=="object"&&"splice"in b&&"join"in b},isHash:function(b){return b instanceof
Hash},isFunction:function(b){return typeof b=="function"},isString:function(b){return typeof b=="string"},isNumber:function(b){return typeof b=="number"},isUndefined:function(b){return typeof b=="undefined"}});
Object.extend(Function.prototype,{argumentNames:function(){var b=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,"").split(",");return b.length==1&&!b[0]?[]:b},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var b=this,c=$A(arguments),d=c.shift();return function(){return b.apply(d,c.concat($A(arguments)))}},bindAsEventListener:function(){var b=this,c=$A(arguments),d=c.shift();return function(e){return b.apply(d,[e||window.event].concat(c))}},
curry:function(){if(!arguments.length)return this;var b=this,c=$A(arguments);return function(){return b.apply(this,c.concat($A(arguments)))}},delay:function(){var b=this,c=$A(arguments),d=c.shift()*1E3;return window.setTimeout(function(){return b.apply(b,c)},d)},defer:function(){return this.delay.apply(this,[0.01].concat($A(arguments)))},wrap:function(b){var c=this;return function(){return b.apply(this,[c.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized)return this._methodized;
var b=this;return this._methodized=function(){return b.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 b,c=0,d=arguments.length;c<d;c++){var e=arguments[c];try{b=e();break}catch(f){}}return b}};
RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(b){return String(b).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};
var PeriodicalExecuter=Class.create({initialize:function(b,c){this.callback=b;this.frequency=c;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(b){return b==null?"":String(b)},specialChar:{"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(b,c){var d="",e=this,f;for(c=arguments.callee.prepareReplacement(c);e.length>0;)if(f=e.match(b)){d+=e.slice(0,f.index);d+=String.interpret(c(f));e=e.slice(f.index+f[0].length)}else{d+=e;e=""}return d},sub:function(b,c,d){c=this.gsub.prepareReplacement(c);d=Object.isUndefined(d)?1:d;return this.gsub(b,function(e){if(--d<0)return e[0];return c(e)})},scan:function(b,c){this.gsub(b,c);return String(this)},truncate:function(b,c){b=b||30;c=Object.isUndefined(c)?
"...":c;return this.length>b?this.slice(0,b-c.length)+c:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img"),c=new RegExp(Prototype.ScriptFragment,"im");return(this.match(b)||[]).map(function(d){return(d.match(c)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(b){return eval(b)})},
escapeHTML:function(){var b=arguments.callee;b.text.data=this;return b.div.innerHTML},unescapeHTML:function(){var b=new Element("div");b.innerHTML=this.stripTags();return b.childNodes[0]?b.childNodes.length>1?$A(b.childNodes).inject("",function(c,d){return c+d.nodeValue}):b.childNodes[0].nodeValue:""},toQueryParams:function(b){var c=this.strip().match(/([^?#]*)(#.*)?$/);if(!c)return{};return c[1].split(b||"&").inject({},function(d,e){if((e=e.split("="))[0]){var f=decodeURIComponent(e.shift());e=e.length>
1?e.join("="):e[0];if(e!=undefined)e=decodeURIComponent(e);if(f in d){Object.isArray(d[f])||(d[f]=[d[f]]);d[f].push(e)}else d[f]=e}return d})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(b){return b<1?"":(new Array(b+1)).join(this)},camelize:function(){var b=this.split("-"),c=b.length;if(c==1)return b[0];for(var d=this.charAt(0)=="-"?b[0].charAt(0).toUpperCase()+b[0].substring(1):
b[0],e=1;e<c;e++)d+=b[e].charAt(0).toUpperCase()+b[e].substring(1);return d},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(b){var c=this.gsub(/[\x00-\x1f\\]/,function(d){var e=String.specialChar[d[0]];return e?e:"\\u00"+d[0].charCodeAt().toPaddedString(2,
16)});if(b)return'"'+c.replace(/"/g,'\\"')+'"';return"'"+c.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(b){return this.sub(b||Prototype.JSONFilter,"#{1}")},isJSON:function(){var b=this;if(b.blank())return false;b=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(b)},evalJSON:function(b){var c=this.unfilterJSON();try{if(!b||c.isJSON())return eval("("+c+")")}catch(d){}throw new SyntaxError("Badly formed JSON string: "+
this.inspect());},include:function(b){return this.indexOf(b)>-1},startsWith:function(b){return this.indexOf(b)===0},endsWith:function(b){var c=this.length-b.length;return c>=0&&this.lastIndexOf(b)===c},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(b,c){return(new Template(this,c)).evaluate(b)}});
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(b){if(Object.isFunction(b))return b;var c=new Template(b);return function(d){return c.evaluate(d)}};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(b,c){this.template=b.toString();this.pattern=c||Template.Pattern},evaluate:function(b){if(Object.isFunction(b.toTemplateReplacements))b=b.toTemplateReplacements();return this.template.gsub(this.pattern,function(c){if(b==null)return"";var d=c[1]||"";if(d=="\\")return c[2];var e=b,f=c[3],g=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;c=g.exec(f);if(c==null)return d;for(;c!=null;){var k=c[1].startsWith("[")?c[2].gsub("\\\\]","]"):c[1];e=e[k];if(null==e||""==
c[3])break;f=f.substring("["==c[3]?c[1].length:c[0].length);c=g.exec(f)}return d+String.interpret(e)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={},Enumerable={each:function(b,c){var d=0;try{this._each(function(f){b.call(c,f,d++)})}catch(e){if(e!=$break)throw e;}return this},eachSlice:function(b,c,d){var e=-b,f=[],g=this.toArray();if(b<1)return g;for(;(e+=b)<g.length;)f.push(g.slice(e,e+b));return f.collect(c,d)},all:function(b,c){b=b||Prototype.K;var d=true;this.each(function(e,f){d=d&&!!b.call(c,e,f);if(!d)throw $break;});return d},any:function(b,c){b=b||Prototype.K;var d=false;this.each(function(e,f){if(d=!!b.call(c,e,f))throw $break;
});return d},collect:function(b,c){b=b||Prototype.K;var d=[];this.each(function(e,f){d.push(b.call(c,e,f))});return d},detect:function(b,c){var d;this.each(function(e,f){if(b.call(c,e,f)){d=e;throw $break;}});return d},findAll:function(b,c){var d=[];this.each(function(e,f){b.call(c,e,f)&&d.push(e)});return d},grep:function(b,c,d){c=c||Prototype.K;var e=[];if(Object.isString(b))b=new RegExp(b);this.each(function(f,g){b.match(f)&&e.push(c.call(d,f,g))});return e},include:function(b){if(Object.isFunction(this.indexOf))if(this.indexOf(b)!=
-1)return true;var c=false;this.each(function(d){if(d==b){c=true;throw $break;}});return c},inGroupsOf:function(b,c){c=Object.isUndefined(c)?null:c;return this.eachSlice(b,function(d){for(;d.length<b;)d.push(c);return d})},inject:function(b,c,d){this.each(function(e,f){b=c.call(d,b,e,f)});return b},invoke:function(b){var c=$A(arguments).slice(1);return this.map(function(d){return d[b].apply(d,c)})},max:function(b,c){b=b||Prototype.K;var d;this.each(function(e,f){e=b.call(c,e,f);if(d==null||e>=d)d=
e});return d},min:function(b,c){b=b||Prototype.K;var d;this.each(function(e,f){e=b.call(c,e,f);if(d==null||e<d)d=e});return d},partition:function(b,c){b=b||Prototype.K;var d=[],e=[];this.each(function(f,g){(b.call(c,f,g)?d:e).push(f)});return[d,e]},pluck:function(b){var c=[];this.each(function(d){c.push(d[b])});return c},reject:function(b,c){var d=[];this.each(function(e,f){b.call(c,e,f)||d.push(e)});return d},sortBy:function(b,c){return this.map(function(d,e){return{value:d,criteria:b.call(c,d,e)}}).sort(function(d,
e){d=d.criteria;e=e.criteria;return d<e?-1:d>e?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var b=Prototype.K,c=$A(arguments);if(Object.isFunction(c.last()))b=c.pop();var d=[this].concat(c).map($A);return this.map(function(e,f){return b(d.pluck(f))})},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(b){if(!b)return[];if(b.toArray)return b.toArray();for(var c=b.length||0,d=new Array(c);c--;)d[c]=b[c];return d}
if(Prototype.Browser.WebKit)$A=function(b){if(!b)return[];if(!(typeof b==="function"&&typeof b.length==="number"&&typeof b.item==="function")&&b.toArray)return b.toArray();for(var c=b.length||0,d=new Array(c);c--;)d[c]=b[c];return d};Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;
Object.extend(Array.prototype,{_each:function(b){for(var c=0,d=this.length;c<d;c++)b(this[c])},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(b){return b!=null})},flatten:function(){return this.inject([],function(b,c){return b.concat(Object.isArray(c)?c.flatten():[c])})},without:function(){var b=$A(arguments);return this.select(function(c){return!b.include(c)})},reverse:function(b){return(b!==
false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(b){return this.inject([],function(c,d,e){if(0==e||(b?c.last()!=d:!c.include(d)))c.push(d);return c})},intersect:function(b){return this.uniq().findAll(function(c){return b.detect(function(d){return c===d})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var b=[];this.each(function(c){c=
Object.toJSON(c);Object.isUndefined(c)||b.push(c)});return"["+b.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach))Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(b,c){c||(c=0);var d=this.length;if(c<0)c=d+c;for(;c<d;c++)if(this[c]===b)return c;return-1};
if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(b,c){c=isNaN(c)?this.length:(c<0?this.length+c:c)+1;b=this.slice(0,c).reverse().indexOf(b);return b<0?b:c-b-1};Array.prototype.toArray=Array.prototype.clone;function $w(b){if(!Object.isString(b))return[];return(b=b.strip())?b.split(/\s+/):[]}
if(Prototype.Browser.Opera)Array.prototype.concat=function(){for(var b=[],c=0,d=this.length;c<d;c++)b.push(this[c]);c=0;for(d=arguments.length;c<d;c++)if(Object.isArray(arguments[c]))for(var e=0,f=arguments[c].length;e<f;e++)b.push(arguments[c][e]);else b.push(arguments[c]);return b};
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(b,c){$R(0,this,true).each(b,c);return this},toPaddedString:function(b,c){c=this.toString(c||10);return"0".times(b-c.length)+c},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(b){Number.prototype[b]=Math[b].methodize()});function $H(b){return new Hash(b)}
var Hash=Class.create(Enumerable,function(){function b(c,d){if(Object.isUndefined(d))return c;return c+"="+encodeURIComponent(String.interpret(d))}return{initialize:function(c){this._object=Object.isHash(c)?c.toObject():Object.clone(c)},_each:function(c){for(var d in this._object){var e=this._object[d],f=[d,e];f.key=d;f.value=e;c(f)}},set:function(c,d){return this._object[c]=d},get:function(c){if(this._object[c]!==Object.prototype[c])return this._object[c]},unset:function(c){var d=this._object[c];
delete this._object[c];return d},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(c){var d=this.detect(function(e){return e.value===c});return d&&d.key},merge:function(c){return this.clone().update(c)},update:function(c){return(new Hash(c)).inject(this,function(d,e){d.set(e.key,e.value);return d})},toQueryString:function(){return this.inject([],function(c,d){var e=encodeURIComponent(d.key);
if((d=d.value)&&typeof d=="object"){if(Object.isArray(d))return c.concat(d.map(b.curry(e)))}else c.push(b(e,d));return c}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(c){return c.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}}());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;
var ObjectRange=Class.create(Enumerable,{initialize:function(b,c,d){this.start=b;this.end=c;this.exclusive=d},_each:function(b){for(var c=this.start;this.include(c);){b(c);c=c.succ()}},include:function(b){if(b<this.start)return false;if(this.exclusive)return b<this.end;return b<=this.end}}),$R=function(b,c,d){return new ObjectRange(b,c,d)},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(b){this.responders._each(b)},register:function(b){this.include(b)||this.responders.push(b)},unregister:function(b){this.responders=this.responders.without(b)},dispatch:function(b,c,d,e){this.each(function(f){if(Object.isFunction(f[b]))try{f[b].apply(f,[c,d,e])}catch(g){}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});
Ajax.Base=Class.create({initialize:function(b){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,b||{});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,c,d){$super(d);this.transport=Ajax.getTransport();this.request(c)},request:function(b){this.url=b;this.method=this.options.method;b=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){b._method=this.method;this.method="post"}this.parameters=b;if(b=Object.toQueryString(b))if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+b;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))b+=
"&_=";try{var c=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(c);Ajax.Responders.dispatch("onCreate",this,c);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||b:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&
this.onStateChange()}catch(d){this.dispatchException(d)}},onStateChange:function(){var b=this.transport.readyState;b>1&&!(b==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var b={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){b["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)b.Connection="close"}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push))for(var d=0,e=c.length;d<e;d+=2)b[c[d]]=c[d+1];else $H(c).each(function(g){b[g.key]=g.value})}for(var f in b)this.transport.setRequestHeader(f,b[f])},success:function(){var b=this.getStatus();return!b||b>=200&&b<300},getStatus:function(){try{return this.transport.status||
0}catch(b){return 0}},respondToReadyState:function(b){b=Ajax.Request.Events[b];var c=new Ajax.Response(this);if(b=="Complete"){try{this._complete=true;(this.options["on"+c.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(c,c.headerJSON)}catch(d){this.dispatchException(d)}var e=c.getHeader("Content-type");if(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&e&&e.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))this.evalResponse()}try{(this.options["on"+
b]||Prototype.emptyFunction)(c,c.headerJSON);Ajax.Responders.dispatch("on"+b,this,c,c.headerJSON)}catch(f){this.dispatchException(f)}if(b=="Complete")this.transport.onreadystatechange=Prototype.emptyFunction},isSameOrigin:function(){var b=this.url.match(/^\s*https?:\/\/[^\/]*/);return!b||b[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""})},getHeader:function(b){try{return this.transport.getResponseHeader(b)||
null}catch(c){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(b){this.dispatchException(b)}},dispatchException:function(b){(this.options.onException||Prototype.emptyFunction)(this,b);Ajax.Responders.dispatch("onException",this,b)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Response=Class.create({initialize:function(b){this.request=b;b=this.transport=b.transport;var c=this.readyState=b.readyState;if(c>2&&!Prototype.Browser.IE||c==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(b.responseText);this.headerJSON=this._getHeaderJSON()}if(c==4){b=b.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,
getStatusText:function(){try{return this.transport.statusText||""}catch(b){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(b){return null}},getResponseHeader:function(b){return this.transport.getResponseHeader(b)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var b=this.getHeader("X-JSON");if(!b)return null;b=decodeURIComponent(escape(b));try{return b.evalJSON(this.request.options.sanitizeJSON||
!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}},_getResponseJSON:function(){var b=this.request.options;if(!b.evalJSON||b.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json")||this.responseText.blank())return null;try{return this.responseText.evalJSON(b.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}}});
Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,c,d,e){this.container={success:c.success||c,failure:c.failure||(c.success?null:c)};e=Object.clone(e);var f=e.onComplete;e.onComplete=function(g,k){this.updateContent(g.responseText);Object.isFunction(f)&&f(g,k)}.bind(this);$super(d,e)},updateContent:function(b){var c=this.container[this.success()?"success":"failure"],d=this.options;d.evalScripts||(b=b.stripScripts());if(c=$(c))if(d.insertion)if(Object.isString(d.insertion)){var e=
{};e[d.insertion]=b;c.insert(e)}else d.insertion(c,b);else c.update(b)}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,c,d,e){$super(e);this.onComplete=this.options.onComplete;this.frequency=this.options.frequency||2;this.decay=this.options.decay||1;this.updater={};this.container=c;this.url=d;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(b){if(this.options.decay){this.decay=b.responseText==this.lastText?this.decay*this.options.decay:1;this.lastText=b.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});
function $(b){if(arguments.length>1){for(var c=0,d=[],e=arguments.length;c<e;c++)d.push($(arguments[c]));return d}if(Object.isString(b))b=document.getElementById(b);return Element.extend(b)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(b,c){var d=[];b=document.evaluate(b,$(c)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);c=0;for(var e=b.snapshotLength;c<e;c++)d.push(Element.extend(b.snapshotItem(c)));return d};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 b=this.Element;this.Element=function(c,d){d=d||{};c=c.toLowerCase();var e=Element.cache;if(Prototype.Browser.IE&&d.name){c="<"+c+' name="'+d.name+'">';delete d.name;return Element.writeAttribute(document.createElement(c),d)}e[c]||(e[c]=Element.extend(document.createElement(c)));return Element.writeAttribute(e[c].cloneNode(false),d)};Object.extend(this.Element,b||{});if(b)this.Element.prototype=b.prototype}).call(window);Element.cache={};
Element.Methods={visible:function(b){return $(b).style.display!="none"},toggle:function(b){b=$(b);Element[Element.visible(b)?"hide":"show"](b);return b},hide:function(b){b=$(b);b.style.display="none";return b},show:function(b){b=$(b);b.style.display="";return b},remove:function(b){b=$(b);b.parentNode.removeChild(b);return b},update:function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();if(Object.isElement(c))return b.update().insert(c);c=Object.toHTML(c);b.innerHTML=c.stripScripts();c.evalScripts.bind(c).defer();
return b},replace:function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();else if(!Object.isElement(c)){c=Object.toHTML(c);var d=b.ownerDocument.createRange();d.selectNode(b);c.evalScripts.bind(c).defer();c=d.createContextualFragment(c.stripScripts())}b.parentNode.replaceChild(c,b);return b},insert:function(b,c){b=$(b);if(Object.isString(c)||Object.isNumber(c)||Object.isElement(c)||c&&(c.toElement||c.toHTML))c={bottom:c};var d,e,f;for(var g in c){d=c[g];g=g.toLowerCase();e=Element._insertionTranslations[g];
if(d&&d.toElement)d=d.toElement();if(Object.isElement(d))e(b,d);else{d=Object.toHTML(d);f=(g=="before"||g=="after"?b.parentNode:b).tagName.toUpperCase();f=Element._getContentFromAnonymousElement(f,d.stripScripts());if(g=="top"||g=="after")f.reverse();f.each(e.curry(b));d.evalScripts.bind(d).defer()}}return b},wrap:function(b,c,d){b=$(b);if(Object.isElement(c))$(c).writeAttribute(d||{});else c=Object.isString(c)?new Element(c,d):new Element("div",c);b.parentNode&&b.parentNode.replaceChild(c,b);c.appendChild(b);
return c},inspect:function(b){b=$(b);var c="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(d){var e=d.first();d=d.last();if(e=(b[e]||"").toString())c+=" "+d+"="+e.inspect(true)});return c+">"},recursivelyCollect:function(b,c){b=$(b);for(var d=[];b=b[c];)b.nodeType==1&&d.push(Element.extend(b));return d},ancestors:function(b){return $(b).recursivelyCollect("parentNode")},descendants:function(b){return $(b).select("*")},firstDescendant:function(b){for(b=$(b).firstChild;b&&
b.nodeType!=1;)b=b.nextSibling;return $(b)},immediateDescendants:function(b){if(!(b=$(b).firstChild))return[];for(;b&&b.nodeType!=1;)b=b.nextSibling;if(b)return[b].concat($(b).nextSiblings());return[]},previousSiblings:function(b){return $(b).recursivelyCollect("previousSibling")},nextSiblings:function(b){return $(b).recursivelyCollect("nextSibling")},siblings:function(b){b=$(b);return b.previousSiblings().reverse().concat(b.nextSiblings())},match:function(b,c){if(Object.isString(c))c=new Selector(c);
return c.match($(b))},up:function(b,c,d){b=$(b);if(arguments.length==1)return $(b.parentNode);var e=b.ancestors();return Object.isNumber(c)?e[c]:Selector.findElement(e,c,d)},down:function(b,c,d){b=$(b);if(arguments.length==1)return b.firstDescendant();return Object.isNumber(c)?b.descendants()[c]:Element.select(b,c)[d||0]},previous:function(b,c,d){b=$(b);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(b));var e=b.previousSiblings();return Object.isNumber(c)?e[c]:Selector.findElement(e,
c,d)},next:function(b,c,d){b=$(b);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(b));var e=b.nextSiblings();return Object.isNumber(c)?e[c]:Selector.findElement(e,c,d)},select:function(){var b=$A(arguments),c=$(b.shift());return Selector.findChildElements(c,b)},adjacent:function(){var b=$A(arguments),c=$(b.shift());return Selector.findChildElements(c.parentNode,b).without(c)},identify:function(b){b=$(b);var c=b.readAttribute("id"),d=arguments.callee;if(c)return c;do c="anonymous_element_"+
d.counter++;while($(c));b.writeAttribute("id",c);return c},readAttribute:function(b,c){b=$(b);if(Prototype.Browser.IE){var d=Element._attributeTranslations.read;if(d.values[c])return d.values[c](b,c);if(d.names[c])c=d.names[c];if(c.include(":"))return!b.attributes||!b.attributes[c]?null:b.attributes[c].value}return b.getAttribute(c)},writeAttribute:function(b,c,d){b=$(b);var e={},f=Element._attributeTranslations.write;if(typeof c=="object")e=c;else e[c]=Object.isUndefined(d)?true:d;for(var g in e){c=
f.names[g]||g;d=e[g];if(f.values[g])c=f.values[g](b,d);if(d===false||d===null)b.removeAttribute(c);else d===true?b.setAttribute(c,c):b.setAttribute(c,d)}return b},getHeight:function(b){return $(b).getDimensions().height},getWidth:function(b){return $(b).getDimensions().width},classNames:function(b){return new Element.ClassNames(b)},hasClassName:function(b,c){if(b=$(b)){b=b.className;return b.length>0&&(b==c||(new RegExp("(^|\\s)"+c+"(\\s|$)")).test(b))}},addClassName:function(b,c){if(b=$(b)){b.hasClassName(c)||
(b.className+=(b.className?" ":"")+c);return b}},removeClassName:function(b,c){if(b=$(b)){b.className=b.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)")," ").strip();return b}},toggleClassName:function(b,c){if(b=$(b))return b[b.hasClassName(c)?"removeClassName":"addClassName"](c)},cleanWhitespace:function(b){b=$(b);for(var c=b.firstChild;c;){var d=c.nextSibling;c.nodeType==3&&!/\S/.test(c.nodeValue)&&b.removeChild(c);c=d}return b},empty:function(b){return $(b).innerHTML.blank()},descendantOf:function(b,
c){b=$(b);c=$(c);if(b.compareDocumentPosition)return(b.compareDocumentPosition(c)&8)===8;if(c.contains)return c.contains(b)&&c!==b;for(;b=b.parentNode;)if(b==c)return true;return false},scrollTo:function(b){b=$(b);var c=b.cumulativeOffset();window.scrollTo(c[0],c[1]);return b},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d||d=="auto")d=(b=document.defaultView.getComputedStyle(b,null))?b[c]:null;if(c=="opacity")return d?parseFloat(d):1;return d=="auto"?null:
d},getOpacity:function(b){return $(b).getStyle("opacity")},setStyle:function(b,c){b=$(b);var d=b.style;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var e in c)if(e=="opacity")b.setOpacity(c[e]);else d[e=="float"||e=="cssFloat"?Object.isUndefined(d.styleFloat)?"cssFloat":"styleFloat":e]=c[e];return b},setOpacity:function(b,c){b=$(b);b.style.opacity=c==1||c===""?"":c<1.0E-5?0:c;return b},getDimensions:function(b){b=
$(b);var c=b.getStyle("display");if(c!="none"&&c!=null)return{width:b.offsetWidth,height:b.offsetHeight};c=b.style;var d=c.visibility,e=c.position,f=c.display;c.visibility="hidden";c.position="absolute";c.display="block";var g=b.clientWidth;b=b.clientHeight;c.display=f;c.position=e;c.visibility=d;return{width:g,height:b}},makePositioned:function(b){b=$(b);var c=Element.getStyle(b,"position");if(c=="static"||!c){b._madePositioned=true;b.style.position="relative";if(Prototype.Browser.Opera){b.style.top=
0;b.style.left=0}}return b},undoPositioned:function(b){b=$(b);if(b._madePositioned){b._madePositioned=undefined;b.style.position=b.style.top=b.style.left=b.style.bottom=b.style.right=""}return b},makeClipping:function(b){b=$(b);if(b._overflow)return b;b._overflow=Element.getStyle(b,"overflow")||"auto";if(b._overflow!=="hidden")b.style.overflow="hidden";return b},undoClipping:function(b){b=$(b);if(!b._overflow)return b;b.style.overflow=b._overflow=="auto"?"":b._overflow;b._overflow=null;return b},
cumulativeOffset:function(b){var c=0,d=0;do{c+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(d,c)},positionedOffset:function(b){var c=0,d=0;do{c+=b.offsetTop||0;d+=b.offsetLeft||0;if(b=b.offsetParent){if(b.tagName.toUpperCase()=="BODY")break;if(Element.getStyle(b,"position")!=="static")break}}while(b);return Element._returnOffset(d,c)},absolutize:function(b){b=$(b);if(b.getStyle("position")=="absolute")return b;var c=b.positionedOffset(),d=c[1];c=c[0];var e=
b.clientWidth,f=b.clientHeight;b._originalLeft=c-parseFloat(b.style.left||0);b._originalTop=d-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=d+"px";b.style.left=c+"px";b.style.width=e+"px";b.style.height=f+"px";return b},relativize:function(b){b=$(b);if(b.getStyle("position")=="relative")return b;b.style.position="relative";var c=parseFloat(b.style.top||0)-(b._originalTop||0),d=parseFloat(b.style.left||0)-(b._originalLeft||
0);b.style.top=c+"px";b.style.left=d+"px";b.style.height=b._originalHeight;b.style.width=b._originalWidth;return b},cumulativeScrollOffset:function(b){var c=0,d=0;do{c+=b.scrollTop||0;d+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(d,c)},getOffsetParent:function(b){if(b.offsetParent)return $(b.offsetParent);if(b==document.body)return $(b);for(;(b=b.parentNode)&&b!=document.body;)if(Element.getStyle(b,"position")!="static")return $(b);return $(document.body)},viewportOffset:function(b){var c=
0,d=0,e=b;do{c+=e.offsetTop||0;d+=e.offsetLeft||0;if(e.offsetParent==document.body&&Element.getStyle(e,"position")=="absolute")break}while(e=e.offsetParent);e=b;do if(!Prototype.Browser.Opera||e.tagName&&e.tagName.toUpperCase()=="BODY"){c-=e.scrollTop||0;d-=e.scrollLeft||0}while(e=e.parentNode);return Element._returnOffset(d,c)},clonePosition:function(b,c,d){d=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},d||{});c=$(c);var e=c.viewportOffset();b=$(b);
var f=[0,0],g=null;if(Element.getStyle(b,"position")=="absolute"){g=b.getOffsetParent();f=g.viewportOffset()}if(g==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop}if(d.setLeft)b.style.left=e[0]-f[0]+d.offsetLeft+"px";if(d.setTop)b.style.top=e[1]-f[1]+d.offsetTop+"px";if(d.setWidth)b.style.width=c.offsetWidth+"px";if(d.setHeight)b.style.height=c.offsetHeight+"px";return b}};Element.Methods.identify.counter=1;
Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};
if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(b,c,d){switch(d){case "left":case "top":case "right":case "bottom":if(b(c,"position")==="static")return null;case "height":case "width":if(!Element.visible(c))return null;var e=parseInt(b(c,d),10);if(e!==c["offset"+d.capitalize()])return e+"px";return(d==="height"?["border-top-width","padding-top","padding-bottom","border-bottom-width"]:["border-left-width","padding-left","padding-right","border-right-width"]).inject(e,
function(f,g){g=b(c,g);return g===null?f:f-parseInt(g,10)})+"px";default:return b(c,d)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(b,c,d){if(d==="title")return c.title;return b(c,d)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(b,c){c=$(c);var d=c.getStyle("position");if(d!=="static")return b(c);c.setStyle({position:"relative"});b=b(c);c.setStyle({position:d});return b});$w("positionedOffset viewportOffset").each(function(b){Element.Methods[b]=
Element.Methods[b].wrap(function(c,d){d=$(d);var e=d.getStyle("position");if(e!=="static")return c(d);var f=d.getOffsetParent();f&&f.getStyle("position")==="fixed"&&f.setStyle({zoom:1});d.setStyle({position:"relative"});c=c(d);d.setStyle({position:e});return c})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,c){return b(c)});Element.Methods.getStyle=function(b,c){b=$(b);c=c=="float"||c=="cssFloat"?"styleFloat":c.camelize();var d=b.style[c];if(!d&&b.currentStyle)d=
b.currentStyle[c];if(c=="opacity"){if(d=(b.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(d[1])return parseFloat(d[1])/100;return 1}if(d=="auto"){if((c=="width"||c=="height")&&b.getStyle("display")!="none")return b["offset"+c.capitalize()]+"px";return null}return d};Element.Methods.setOpacity=function(b,c){function d(g){return g.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var e=b.currentStyle;if(e&&!e.hasLayout||!e&&b.style.zoom=="normal")b.style.zoom=1;e=b.getStyle("filter");var f=b.style;
if(c==1||c===""){(e=d(e))?(f.filter=e):f.removeAttribute("filter");return b}else if(c<1.0E-5)c=0;f.filter=d(e)+"alpha(opacity="+c*100+")";return b};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(b,c){return b.getAttribute(c,2)},_getAttrNode:function(b,c){return(b=b.getAttributeNode(c))?b.value:""},_getEv:function(b,c){return(c=b.getAttribute(c))?c.toString().slice(23,-2):null},_flag:function(b,c){return $(b).hasAttribute(c)?c:null},style:function(b){return b.style.cssText.toLowerCase()},
title:function(b){return b.title}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(b,c){b.checked=!!c},style:function(b,c){b.style.cssText=c?c:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(b){Element._attributeTranslations.write.names[b.toLowerCase()]=
b;Element._attributeTranslations.has[b.toLowerCase()]=b});(function(b){Object.extend(b,{href:b._getAttr,src:b._getAttr,type:b._getAttr,action:b._getAttrNode,disabled:b._flag,checked:b._flag,readonly:b._flag,multiple:b._flag,onload:b._getEv,onunload:b._getEv,onclick:b._getEv,ondblclick:b._getEv,onmousedown:b._getEv,onmouseup:b._getEv,onmouseover:b._getEv,onmousemove:b._getEv,onmouseout:b._getEv,onfocus:b._getEv,onblur:b._getEv,onkeypress:b._getEv,onkeydown:b._getEv,onkeyup:b._getEv,onsubmit:b._getEv,
onreset:b._getEv,onselect:b._getEv,onchange:b._getEv})})(Element._attributeTranslations.read.values)}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent))Element.Methods.setOpacity=function(b,c){b=$(b);b.style.opacity=c==1?0.999999:c===""?"":c<1.0E-5?0:c;return b};else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(b,c){b=$(b);b.style.opacity=c==1||c===""?"":c<1.0E-5?0:c;if(c==1)if(b.tagName.toUpperCase()=="IMG"&&b.width){b.width++;b.width--}else try{var d=document.createTextNode(" ");
b.appendChild(d);b.removeChild(d)}catch(e){}return b};Element.Methods.cumulativeOffset=function(b){var c=0,d=0;do{c+=b.offsetTop||0;d+=b.offsetLeft||0;if(b.offsetParent==document.body)if(Element.getStyle(b,"position")=="absolute")break;b=b.offsetParent}while(b);return Element._returnOffset(d,c)}}
if(Prototype.Browser.IE||Prototype.Browser.Opera)Element.Methods.update=function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();if(Object.isElement(c))return b.update().insert(c);c=Object.toHTML(c);var d=b.tagName.toUpperCase();if(d in Element._insertionTranslations.tags){$A(b.childNodes).each(function(e){b.removeChild(e)});Element._getContentFromAnonymousElement(d,c.stripScripts()).each(function(e){b.appendChild(e)})}else b.innerHTML=c.stripScripts();c.evalScripts.bind(c).defer();return b};
if("outerHTML"in document.createElement("div"))Element.Methods.replace=function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();if(Object.isElement(c)){b.parentNode.replaceChild(c,b);return b}c=Object.toHTML(c);var d=b.parentNode,e=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[e]){var f=b.next();e=Element._getContentFromAnonymousElement(e,c.stripScripts());d.removeChild(b);f?e.each(function(g){d.insertBefore(g,f)}):e.each(function(g){d.appendChild(g)})}else b.outerHTML=c.stripScripts();
c.evalScripts.bind(c).defer();return b};Element._returnOffset=function(b,c){var d=[b,c];d.left=b;d.top=c;return d};Element._getContentFromAnonymousElement=function(b,c){var d=new Element("div");if(b=Element._insertionTranslations.tags[b]){d.innerHTML=b[0]+c+b[1];b[2].times(function(){d=d.firstChild})}else d.innerHTML=c;return $A(d.childNodes)};
Element._insertionTranslations={before:function(b,c){b.parentNode.insertBefore(c,b)},top:function(b,c){b.insertBefore(c,b.firstChild)},bottom:function(b,c){b.appendChild(c)},after:function(b,c){b.parentNode.insertBefore(c,b.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(b,c){c=Element._attributeTranslations.has[c]||c;b=$(b).getAttributeNode(c);return!!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);
if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}
Element.extend=function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)return Prototype.K;var b={},c=Element.Methods.ByTag,d=Object.extend(function(e){if(!e||e._extendedByPrototype||e.nodeType!=1||e==window)return e;var f=Object.clone(b),g=e.tagName.toUpperCase(),k;c[g]&&Object.extend(f,c[g]);for(k in f){g=f[k];if(Object.isFunction(g)&&!(k in e))e[k]=g.methodize()}e._extendedByPrototype=Prototype.emptyFunction;return e},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(b,
Element.Methods);Object.extend(b,Element.Methods.Simulated)}}});d.refresh();return d}();Element.hasAttribute=function(b,c){if(b.hasAttribute)return b.hasAttribute(c);return Element.Methods.Simulated.hasAttribute(b,c)};
Element.addMethods=function(b){function c(h){h=h.toUpperCase();Element.Methods.ByTag[h]||(Element.Methods.ByTag[h]={});Object.extend(Element.Methods.ByTag[h],b)}function d(h,l,m){m=m||false;for(var q in h){var n=h[q];if(Object.isFunction(n))if(!m||!(q in l))l[q]=n.methodize()}}function e(h){var l,m={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",
Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(m[h])l="HTML"+m[h]+"Element";if(window[l])return window[l];l="HTML"+h+"Element";if(window[l])return window[l];l="HTML"+h.capitalize()+"Element";if(window[l])return window[l];window[l]={};window[l].prototype=document.createElement(h).__proto__;
return window[l]}var f=Prototype.BrowserFeatures,g=Element.Methods.ByTag;if(!b){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 k=b;b=arguments[1]}if(k)Object.isArray(k)?k.each(c):c(k);else Object.extend(Element.Methods,b||{});if(f.ElementExtensions){d(Element.Methods,
HTMLElement.prototype);d(Element.Methods.Simulated,HTMLElement.prototype,true)}if(f.SpecificElementExtensions)for(var j in Element.Methods.ByTag){f=e(j);Object.isUndefined(f)||d(g[j],f.prototype)}Object.extend(Element,Element.Methods);delete Element.ByTag;Element.extend.refresh&&Element.extend.refresh();Element.cache={}};
document.viewport={getDimensions:function(){var b={},c=Prototype.Browser;$w("width height").each(function(d){var e=d.capitalize();b[d]=c.WebKit&&!document.evaluate?self["inner"+e]:c.Opera&&parseFloat(window.opera.version())<9.5?document.body["client"+e]:document.documentElement["client"+e]});return b},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(b){this.expression=b.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 b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty")))return false;if(/(\[[\w-]*?:|:checked)/.test(b))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(b){return false}return true},compileMatcher:function(){var b=this.expression,c=Selector.patterns,d=Selector.criteria,e,f;if(Selector._cache[b])this.matcher=Selector._cache[b];else{for(this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];b&&e!=b&&/\S/.test(b);){e=
b;for(var g in c){f=c[g];if(f=b.match(f)){this.matcher.push(Object.isFunction(d[g])?d[g](f):(new Template(d[g])).evaluate(f));b=b.replace(f[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher}},compileXPathMatcher:function(){var b=this.expression,c=Selector.patterns,d=Selector.xpath,e,f;if(Selector._cache[b])this.xpath=Selector._cache[b];else{for(this.matcher=[".//*"];b&&e!=b&&/\S/.test(b);){e=b;for(var g in c)if(f=
b.match(c[g])){this.matcher.push(Object.isFunction(d[g])?d[g](f):(new Template(d[g])).evaluate(f));b=b.replace(f[0],"");break}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath}},findElements:function(b){b=b||document;var c=this.expression;switch(this.mode){case "selectorsAPI":if(b!==document){var d=b.id;c="#"+$(b).identify()+" "+c}c=$A(b.querySelectorAll(c)).map(Element.extend);b.id=d;return c;case "xpath":return document._getElementsByXPath(this.xpath,b);default:return this.matcher(b)}},
match:function(b){this.tokens=[];for(var c=this.expression,d=Selector.patterns,e=Selector.assertions,f,g;c&&f!==c&&/\S/.test(c);){f=c;for(var k in d){g=d[k];if(g=c.match(g))if(e[k]){this.tokens.push([k,Object.clone(g)]);c=c.replace(g[0],"")}else return this.findElements(document).include(b)}}c=true;for(k=0;e=this.tokens[k];k++){d=e[0];e=e[1];if(!Selector.assertions[d](b,e)){c=false;break}}return c},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(b){if(b[1]=="*")return"";return"[local-name()='"+b[1].toLowerCase()+"' or local-name()='"+b[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(b){b[1]=b[1].toLowerCase();return(new Template("[@#{1}]")).evaluate(b)},attr:function(b){b[1]=b[1].toLowerCase();b[3]=b[5]||b[6];
return(new Template(Selector.xpath.operators[b[2]])).evaluate(b)},pseudo:function(b){var c=Selector.xpath.pseudos[b[1]];if(!c)return"";if(Object.isFunction(c))return c(b);return(new Template(Selector.xpath.pseudos[b[1]])).evaluate(b)},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(b){for(var c=b[6],d=Selector.patterns,e=Selector.xpath,f,g,k=[];c&&f!=c&&/\S/.test(c);){f=c;for(var j in d)if(b=c.match(d[j])){g=Object.isFunction(e[j])?e[j](b):
(new Template(e[j])).evaluate(b);k.push("("+g.substring(1,g.length-1)+")");c=c.replace(b[0],"");break}}return"[not("+k.join(" and ")+")]"},"nth-child":function(b){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",b)},"nth-last-child":function(b){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",b)},"nth-of-type":function(b){return Selector.xpath.pseudos.nth("position() ",b)},"nth-last-of-type":function(b){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",
b)},"first-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-of-type"](b)},"last-of-type":function(b){b[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](b)},"only-of-type":function(b){var c=Selector.xpath.pseudos;return c["first-of-type"](b)+c["last-of-type"](b)},nth:function(b,c){var d=c[6];if(d=="even")d="2n+0";if(d=="odd")d="2n+1";if(c=d.match(/^(\d+)$/))return"["+b+"= "+c[1]+"]";if(c=d.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(c[1]=="-")c[1]=-1;d=c[1]?Number(c[1]):1;c=c[2]?
Number(c[2]):0;return(new Template("[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]")).evaluate({fragment:b,a:d,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(b){b[3]=b[5]||b[6];return(new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;')).evaluate(b)},
pseudo:function(b){if(b[6])b[6]=b[6].replace(/"/g,'\\"');return(new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;')).evaluate(b)},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(b,c){return c[1].toUpperCase()==b.tagName.toUpperCase()},className:function(b,c){return Element.hasClassName(b,c[1])},id:function(b,c){return b.id===c[1]},attrPresence:function(b,c){return Element.hasAttribute(b,c[1])},attr:function(b,c){return(b=Element.readAttribute(b,c[1]))&&Selector.operators[c[2]](b,c[5]||c[6])}},handlers:{concat:function(b,
c){for(var d=0,e;e=c[d];d++)b.push(e);return b},mark:function(b){for(var c=Prototype.emptyFunction,d=0,e;e=b[d];d++)e._countedByPrototype=c;return b},unmark:function(b){for(var c=0,d;d=b[c];c++)d._countedByPrototype=undefined;return b},index:function(b,c,d){b._countedByPrototype=Prototype.emptyFunction;if(c){b=b.childNodes;c=b.length-1;for(var e=1;c>=0;c--){var f=b[c];if(f.nodeType==1&&(!d||f._countedByPrototype))f.nodeIndex=e++}}else{c=0;e=1;for(b=b.childNodes;f=b[c];c++)if(f.nodeType==1&&(!d||f._countedByPrototype))f.nodeIndex=
e++}},unique:function(b){if(b.length==0)return b;for(var c=[],d,e=0,f=b.length;e<f;e++)if(!(d=b[e])._countedByPrototype){d._countedByPrototype=Prototype.emptyFunction;c.push(Element.extend(d))}return Selector.handlers.unmark(c)},descendant:function(b){for(var c=Selector.handlers,d=0,e=[],f;f=b[d];d++)c.concat(e,f.getElementsByTagName("*"));return e},child:function(b){for(var c=0,d=[],e;e=b[c];c++)for(var f=0,g;g=e.childNodes[f];f++)g.nodeType==1&&g.tagName!="!"&&d.push(g);return d},adjacent:function(b){for(var c=
0,d=[],e;e=b[c];c++)(e=this.nextElementSibling(e))&&d.push(e);return d},laterSibling:function(b){for(var c=Selector.handlers,d=0,e=[],f;f=b[d];d++)c.concat(e,Element.nextSiblings(f));return e},nextElementSibling:function(b){for(;b=b.nextSibling;)if(b.nodeType==1)return b;return null},previousElementSibling:function(b){for(;b=b.previousSibling;)if(b.nodeType==1)return b;return null},tagName:function(b,c,d,e){var f=d.toUpperCase(),g=[],k=Selector.handlers;if(b){if(e){if(e=="descendant"){for(c=0;e=b[c];c++)k.concat(g,
e.getElementsByTagName(d));return g}else b=this[e](b);if(d=="*")return b}for(c=0;e=b[c];c++)e.tagName.toUpperCase()===f&&g.push(e);return g}else return c.getElementsByTagName(d)},id:function(b,c,d,e){d=$(d);var f=Selector.handlers;if(!d)return[];if(!b&&c==document)return[d];if(b){if(e)if(e=="child")for(c=0;e=b[c];c++){if(d.parentNode==e)return[d]}else if(e=="descendant")for(c=0;e=b[c];c++){if(Element.descendantOf(d,e))return[d]}else if(e=="adjacent")for(c=0;e=b[c];c++){if(Selector.handlers.previousElementSibling(d)==
e)return[d]}else b=f[e](b);for(c=0;e=b[c];c++)if(e==d)return[d];return[]}return d&&Element.descendantOf(d,c)?[d]:[]},className:function(b,c,d,e){if(b&&e)b=this[e](b);return Selector.handlers.byClassName(b,c,d)},byClassName:function(b,c,d){b||(b=Selector.handlers.descendant([c]));c=" "+d+" ";for(var e=0,f=[],g,k;g=b[e];e++){k=g.className;if(k.length!=0)if(k==d||(" "+k+" ").include(c))f.push(g)}return f},attrPresence:function(b,c,d,e){b||(b=c.getElementsByTagName("*"));if(b&&e)b=this[e](b);c=[];e=0;
for(var f;f=b[e];e++)Element.hasAttribute(f,d)&&c.push(f);return c},attr:function(b,c,d,e,f,g){b||(b=c.getElementsByTagName("*"));if(b&&g)b=this[g](b);c=Selector.operators[f];f=[];g=0;for(var k;k=b[g];g++){var j=Element.readAttribute(k,d);j!==null&&c(j,e)&&f.push(k)}return f},pseudo:function(b,c,d,e,f){if(b&&f)b=this[f](b);b||(b=e.getElementsByTagName("*"));return Selector.pseudos[c](b,d,e)}},pseudos:{"first-child":function(b){for(var c=0,d=[],e;e=b[c];c++)Selector.handlers.previousElementSibling(e)||
d.push(e);return d},"last-child":function(b){for(var c=0,d=[],e;e=b[c];c++)Selector.handlers.nextElementSibling(e)||d.push(e);return d},"only-child":function(b){for(var c=Selector.handlers,d=0,e=[],f;f=b[d];d++)!c.previousElementSibling(f)&&!c.nextElementSibling(f)&&e.push(f);return e},"nth-child":function(b,c,d){return Selector.pseudos.nth(b,c,d)},"nth-last-child":function(b,c,d){return Selector.pseudos.nth(b,c,d,true)},"nth-of-type":function(b,c,d){return Selector.pseudos.nth(b,c,d,false,true)},
"nth-last-of-type":function(b,c,d){return Selector.pseudos.nth(b,c,d,true,true)},"first-of-type":function(b,c,d){return Selector.pseudos.nth(b,"1",d,false,true)},"last-of-type":function(b,c,d){return Selector.pseudos.nth(b,"1",d,true,true)},"only-of-type":function(b,c,d){var e=Selector.pseudos;return e["last-of-type"](e["first-of-type"](b,c,d),c,d)},getIndices:function(b,c,d){if(b==0)return c>0?[c]:[];return $R(1,d).inject([],function(e,f){0==(f-c)%b&&(f-c)/b>=0&&e.push(f);return e})},nth:function(b,
c,d,e,f){if(b.length==0)return[];if(c=="even")c="2n+0";if(c=="odd")c="2n+1";d=Selector.handlers;var g=[],k=[],j;d.mark(b);for(var h=0;j=b[h];h++)if(!j.parentNode._countedByPrototype){d.index(j.parentNode,e,f);k.push(j.parentNode)}if(c.match(/^\d+$/)){c=Number(c);for(h=0;j=b[h];h++)j.nodeIndex==c&&g.push(j)}else if(j=c.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(j[1]=="-")j[1]=-1;h=j[1]?Number(j[1]):1;j=j[2]?Number(j[2]):0;c=Selector.pseudos.getIndices(h,j,b.length);h=0;for(e=c.length;j=b[h];h++)for(f=0;f<
e;f++)j.nodeIndex==c[f]&&g.push(j)}d.unmark(b);d.unmark(k);return g},empty:function(b){for(var c=0,d=[],e;e=b[c];c++)e.tagName=="!"||e.firstChild||d.push(e);return d},not:function(b,c,d){var e=Selector.handlers;c=(new Selector(c)).findElements(d);e.mark(c);d=0;for(var f=[],g;g=b[d];d++)g._countedByPrototype||f.push(g);e.unmark(c);return f},enabled:function(b){for(var c=0,d=[],e;e=b[c];c++)if(!e.disabled&&(!e.type||e.type!=="hidden"))d.push(e);return d},disabled:function(b){for(var c=0,d=[],e;e=b[c];c++)e.disabled&&
d.push(e);return d},checked:function(b){for(var c=0,d=[],e;e=b[c];c++)e.checked&&d.push(e);return d}},operators:{"=":function(b,c){return b==c},"!=":function(b,c){return b!=c},"^=":function(b,c){return b==c||b&&b.startsWith(c)},"$=":function(b,c){return b==c||b&&b.endsWith(c)},"*=":function(b,c){return b==c||b&&b.include(c)},"$=":function(b,c){return b.endsWith(c)},"*=":function(b,c){return b.include(c)},"~=":function(b,c){return(" "+b+" ").include(" "+c+" ")},"|=":function(b,c){return("-"+(b||"").toUpperCase()+
"-").include("-"+(c||"").toUpperCase()+"-")}},split:function(b){var c=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(d){c.push(d[1].strip())});return c},matchElements:function(b,c){c=$$(c);var d=Selector.handlers;d.mark(c);for(var e=0,f=[],g;g=b[e];e++)g._countedByPrototype&&f.push(g);d.unmark(c);return f},findElement:function(b,c,d){if(Object.isNumber(c)){d=c;c=false}return Selector.matchElements(b,c||"*")[d||0]},findChildElements:function(b,c){c=Selector.split(c.join(","));for(var d=
[],e=Selector.handlers,f=0,g=c.length,k;f<g;f++){k=new Selector(c[f].strip());e.concat(d,k.findElements(b))}return g>1?e.unique(d):d}});Prototype.Browser.IE&&Object.extend(Selector.handlers,{concat:function(b,c){for(var d=0,e;e=c[d];d++)e.tagName!=="!"&&b.push(e);return b},unmark:function(b){for(var c=0,d;d=b[c];c++)d.removeAttribute("_countedByPrototype");return b}});function $$(){return Selector.findChildElements(document,$A(arguments))}
var Form={reset:function(b){$(b).reset();return b},serializeElements:function(b,c){if(typeof c!="object")c={hash:!!c};else if(Object.isUndefined(c.hash))c.hash=true;var d,e,f=false,g=c.submit;b=b.inject({},function(k,j){if(!j.disabled&&j.name){d=j.name;e=$(j).getValue();if(e!=null&&j.type!="file"&&(j.type!="submit"||!f&&g!==false&&(!g||d==g)&&(f=true)))if(d in k){Object.isArray(k[d])||(k[d]=[k[d]]);k[d].push(e)}else k[d]=e}return k});return c.hash?b:Object.toQueryString(b)}};
Form.Methods={serialize:function(b,c){return Form.serializeElements(Form.getElements(b),c)},getElements:function(b){return $A($(b).getElementsByTagName("*")).inject([],function(c,d){Form.Element.Serializers[d.tagName.toLowerCase()]&&c.push(Element.extend(d));return c})},getInputs:function(b,c,d){b=$(b);b=b.getElementsByTagName("input");if(!c&&!d)return $A(b).map(Element.extend);for(var e=0,f=[],g=b.length;e<g;e++){var k=b[e];c&&k.type!=c||d&&k.name!=d||f.push(Element.extend(k))}return f},disable:function(b){b=
$(b);Form.getElements(b).invoke("disable");return b},enable:function(b){b=$(b);Form.getElements(b).invoke("enable");return b},findFirstElement:function(b){b=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var c=b.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return c?c:b.find(function(d){return["input","select","textarea"].include(d.tagName.toLowerCase())})},focusFirstElement:function(b){b=$(b);b.findFirstElement().activate();
return b},request:function(b,c){b=$(b);c=Object.clone(c||{});var d=c.parameters,e=b.readAttribute("action")||"";if(e.blank())e=window.location.href;c.parameters=b.serialize(true);if(d){if(Object.isString(d))d=d.toQueryParams();Object.extend(c.parameters,d)}if(b.hasAttribute("method")&&!c.method)c.method=b.method;return new Ajax.Request(e,c)}};Form.Element={focus:function(b){$(b).focus();return b},select:function(b){$(b).select();return b}};
Form.Element.Methods={serialize:function(b){b=$(b);if(!b.disabled&&b.name){var c=b.getValue();if(c!=undefined){var d={};d[b.name]=c;return Object.toQueryString(d)}}return""},getValue:function(b){b=$(b);var c=b.tagName.toLowerCase();return Form.Element.Serializers[c](b)},setValue:function(b,c){b=$(b);var d=b.tagName.toLowerCase();Form.Element.Serializers[d](b,c);return b},clear:function(b){$(b).value="";return b},present:function(b){return $(b).value!=""},activate:function(b){b=$(b);try{b.focus();
if(b.select&&(b.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(b.type)))b.select()}catch(c){}return b},disable:function(b){b=$(b);b.disabled=true;return b},enable:function(b){b=$(b);b.disabled=false;return b}};var Field=Form.Element,$F=Form.Element.Methods.getValue;
Form.Element.Serializers={input:function(b,c){switch(b.type.toLowerCase()){case "checkbox":case "radio":return Form.Element.Serializers.inputSelector(b,c);default:return Form.Element.Serializers.textarea(b,c)}},inputSelector:function(b,c){if(Object.isUndefined(c))return b.checked?b.value:null;else b.checked=!!c},textarea:function(b,c){if(Object.isUndefined(c))return b.value;else b.value=c},select:function(b,c){if(Object.isUndefined(c))return this[b.type=="select-one"?"selectOne":"selectMany"](b);
else for(var d,e,f=!Object.isArray(c),g=0,k=b.length;g<k;g++){d=b.options[g];e=this.optionValue(d);if(f){if(e==c){d.selected=true;return}}else d.selected=c.include(e)}},selectOne:function(b){var c=b.selectedIndex;return c>=0?this.optionValue(b.options[c]):null},selectMany:function(b){var c,d=b.length;if(!d)return null;var e=0;for(c=[];e<d;e++){var f=b.options[e];f.selected&&c.push(this.optionValue(f))}return c},optionValue:function(b){return Element.extend(b).hasAttribute("value")?b.value:b.text}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,c,d,e){$super(e,d);this.element=$(c);this.lastValue=this.getValue()},execute:function(){var b=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(b)?this.lastValue!=b:String(this.lastValue)!=String(b)){this.callback(this.element,b);this.lastValue=b}}});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(b,c){this.element=$(b);this.callback=c;this.lastValue=this.getValue();this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():this.registerCallback(this.element)},onElementEvent:function(){var b=this.getValue();if(this.lastValue!=b){this.callback(this.element,b);this.lastValue=b}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(b){if(b.type)switch(b.type.toLowerCase()){case "checkbox":case "radio":Event.observe(b,
"click",this.onElementEvent.bind(this));break;default:Event.observe(b,"change",this.onElementEvent.bind(this));break}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event)var Event={};
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(b){switch(b.type){case "mouseover":b=b.fromElement;break;case "mouseout":b=b.toElement;break;default:return null}return Element.extend(b)}});
Event.Methods=function(){var b;if(Prototype.Browser.IE){var c={0:1,1:4,2:2};b=function(d,e){return d.button==c[e]}}else b=Prototype.Browser.WebKit?function(d,e){switch(e){case 0:return d.which==1&&!d.metaKey;case 1:return d.which==1&&d.metaKey;default:return false}}:function(d,e){return d.which?d.which===e+1:d.button===e};return{isLeftClick:function(d){return b(d,0)},isMiddleClick:function(d){return b(d,1)},isRightClick:function(d){return b(d,2)},element:function(d){d=Event.extend(d);var e=d.target,
f=d.type;if((d=d.currentTarget)&&d.tagName)if(f==="load"||f==="error"||f==="click"&&d.tagName.toLowerCase()==="input"&&d.type==="radio")e=d;if(e.nodeType==Node.TEXT_NODE)e=e.parentNode;return Element.extend(e)},findElement:function(d,e){d=Event.element(d);if(!e)return d;d=[d].concat(d.ancestors());return Selector.findElement(d,e,0)},pointer:function(d){var e=document.documentElement,f=document.body||{scrollLeft:0,scrollTop:0};return{x:d.pageX||d.clientX+(e.scrollLeft||f.scrollLeft)-(e.clientLeft||
0),y:d.pageY||d.clientY+(e.scrollTop||f.scrollTop)-(e.clientTop||0)}},pointerX:function(d){return Event.pointer(d).x},pointerY:function(d){return Event.pointer(d).y},stop:function(d){Event.extend(d);d.preventDefault();d.stopPropagation();d.stopped=true}}}();
Event.extend=function(){var b=Object.keys(Event.Methods).inject({},function(c,d){c[d]=Event.Methods[d].methodize();return c});if(Prototype.Browser.IE){Object.extend(b,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(c){if(!c)return false;if(c._extendedByPrototype)return c;c._extendedByPrototype=Prototype.emptyFunction;var d=Event.pointer(c);Object.extend(c,{target:c.srcElement,relatedTarget:Event.relatedTarget(c),
pageX:d.x,pageY:d.y});return Object.extend(c,b)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,b);return Prototype.K}}();
Object.extend(Event,function(){function b(l){if(l._prototypeEventID)return l._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return l._prototypeEventID=[++arguments.callee.id]}function c(l){if(l&&l.include(":"))return"dataavailable";return l}function d(l){return h[l]=h[l]||{}}function e(l,m){l=d(l);return l[m]=l[m]||[]}function f(l,m,q){var n=b(l);n=e(n,m);if(n.pluck("handler").include(q))return false;var u=function(r){if(!Event||!Event.extend||r.eventName&&r.eventName!=m)return false;
Event.extend(r);q.call(l,r)};u.handler=q;n.push(u);return u}function g(l,m,q){return e(l,m).find(function(n){return n.handler==q})}function k(l,m,q){var n=d(l);if(!n[m])return false;n[m]=n[m].without(g(l,m,q))}function j(){for(var l in h)for(var m in h[l])h[l][m]=null}var h=Event.cache;window.attachEvent&&window.attachEvent("onunload",j);Prototype.Browser.WebKit&&window.addEventListener("unload",Prototype.emptyFunction,false);return{observe:function(l,m,q){l=$(l);var n=c(m);m=f(l,m,q);if(!m)return l;
l.addEventListener?l.addEventListener(n,m,false):l.attachEvent("on"+n,m);return l},stopObserving:function(l,m,q){l=$(l);var n=b(l),u=c(m);if(!q&&m){e(n,m).each(function(w){l.stopObserving(m,w.handler)});return l}else if(!m){Object.keys(d(n)).each(function(w){l.stopObserving(w)});return l}var r=g(n,m,q);if(!r)return l;l.removeEventListener?l.removeEventListener(u,r,false):l.detachEvent("on"+u,r);k(n,m,q);return l},fire:function(l,m,q){l=$(l);if(l==document&&document.createEvent&&!l.dispatchEvent)l=
document.documentElement;var n;if(document.createEvent){n=document.createEvent("HTMLEvents");n.initEvent("dataavailable",true,true)}else{n=document.createEventObject();n.eventType="ondataavailable"}n.eventName=m;n.memo=q||{};document.createEvent?l.dispatchEvent(n):l.fireEvent(n.eventType,n);return Event.extend(n)}}}());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 b(){if(!document.loaded){c&&window.clearInterval(c);document.fire("dom:loaded");document.loaded=true}}var c;if(document.addEventListener)if(Prototype.Browser.WebKit){c=window.setInterval(function(){/loaded|complete/.test(document.readyState)&&b()},0);Event.observe(window,"load",b)}else document.addEventListener("DOMContentLoaded",b,false);else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState==
"complete"){this.onreadystatechange=null;b()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;
var Insertion={Before:function(b,c){return Element.insert(b,{before:c})},Top:function(b,c){return Element.insert(b,{top:c})},Bottom:function(b,c){return Element.insert(b,{bottom:c})},After:function(b,c){return Element.insert(b,{after:c})}},$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(b,c,d){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(b,c,d);this.xcomp=c;this.ycomp=d;this.offset=Element.cumulativeOffset(b);return d>=this.offset[1]&&d<this.offset[1]+b.offsetHeight&&c>=this.offset[0]&&c<this.offset[0]+b.offsetWidth},withinIncludingScrolloffsets:function(b,c,d){var e=Element.cumulativeScrollOffset(b);this.xcomp=c+e[0]-this.deltaX;this.ycomp=d+e[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);
return this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth},overlap:function(b,c){if(!b)return 0;if(b=="vertical")return(this.offset[1]+c.offsetHeight-this.ycomp)/c.offsetHeight;if(b=="horizontal")return(this.offset[0]+c.offsetWidth-this.xcomp)/c.offsetWidth},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(b){Position.prepare();return Element.absolutize(b)},
relativize:function(b){Position.prepare();return Element.relativize(b)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,d){d=d||{};return Element.clonePosition(c,b,d)}};
if(!document.getElementsByClassName)document.getElementsByClassName=function(b){function c(d){return d.blank()?null:"[contains(concat(' ', @class, ' '), ' "+d+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(d,e){e=e.toString().strip();return(e=/\s/.test(e)?$w(e).map(c).join(""):c(e))?document._getElementsByXPath(".//*"+e,d):[]}:function(d,e){e=e.toString().strip();var f=[],g=/\s/.test(e)?$w(e):null;if(!g&&!e)return f;d=$(d).getElementsByTagName("*");e=" "+e+" ";for(var k=
0,j,h;j=d[k];k++)if(j.className&&(h=" "+j.className+" ")&&(h.include(e)||g&&g.all(function(l){return!l.toString().blank()&&h.include(" "+l+" ")})))f.push(Element.extend(j));return f};return function(d,e){return $(e||document.body).getElementsByClassName(d)}}(Element.Methods);Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(b){this.element=$(b)},_each:function(b){this.element.className.split(/\s+/).select(function(c){return c.length>0})._each(b)},set:function(b){this.element.className=b},add:function(b){this.include(b)||this.set($A(this).concat(b).join(" "))},remove:function(b){this.include(b)&&this.set($A(this).without(b).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(b,c,d){b=b.toUpperCase();var e=document.createElement(this.NODEMAP[b]||"div");try{e.innerHTML="<"+b+"></"+b+">"}catch(f){}var g=e.firstChild||null;if(g&&g.tagName.toUpperCase()!=b)g=g.getElementsByTagName(b)[0];g||(g=document.createElement(b));if(g){if(c)if(this._isStringOrNumber(c)||
c instanceof Array||c.tagName)this._children(g,c);else{var k=this._attributes(c);if(k.length){try{e.innerHTML="<"+b+" "+k+"></"+b+">"}catch(j){}g=e.firstChild||null;if(!g){g=document.createElement(b);for(attr in c)g[attr=="class"?"className":attr]=c[attr]}if(g.tagName.toUpperCase()!=b)g=e.getElementsByTagName(b)[0]}}d&&this._children(g,d);return g}},_text:function(b){return document.createTextNode(b)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(b){var c=[];for(attribute in b)c.push((attribute in
this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+b[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+'"');return c.join(" ")},_children:function(b,c){if(c.tagName)b.appendChild(c);else if(typeof c=="object")c.flatten().each(function(d){if(typeof d=="object")b.appendChild(d);else Builder._isStringOrNumber(d)&&b.appendChild(Builder._text(d))});else Builder._isStringOrNumber(c)&&b.appendChild(Builder._text(c))},_isStringOrNumber:function(b){return typeof b=="string"||typeof b=="number"},build:function(b){var c=
this.node("div");$(c).update(b.strip());return c.down()},dump:function(b){if(typeof b!="object"&&typeof b!="function")b=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(c){b[c]=
function(){return Builder.node.apply(Builder,[c].concat($A(arguments)))}})}};String.prototype.parseColor=function(b){var c="#";if(this.slice(0,4)=="rgb("){var d=this.slice(4,this.length-1).split(","),e=0;do c+=parseInt(d[e]).toColorPart();while(++e<3)}else if(this.slice(0,1)=="#"){if(this.length==4)for(e=1;e<4;e++)c+=(this.charAt(e)+this.charAt(e)).toLowerCase();if(this.length==7)c=this.toLowerCase()}return c.length==7?c:b||this};
Element.collectTextNodes=function(b){return $A($(b).childNodes).collect(function(c){return c.nodeType==3?c.nodeValue:c.hasChildNodes()?Element.collectTextNodes(c):""}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(b,c){return $A($(b).childNodes).collect(function(d){return d.nodeType==3?d.nodeValue:d.hasChildNodes()&&!Element.hasClassName(d,c)?Element.collectTextNodesIgnoreClass(d,c):""}).flatten().join("")};
Element.setContentZoom=function(b,c){b=$(b);b.setStyle({fontSize:c/100+"em"});Prototype.Browser.WebKit&&window.scrollBy(0,0);return b};Element.getInlineOpacity=function(b){return $(b).style.opacity||""};Element.forceRerendering=function(b){try{b=$(b);var c=document.createTextNode(" ");b.appendChild(c);b.removeChild(c)}catch(d){}};
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(b){return-Math.cos(b*Math.PI)/2+0.5},reverse:function(b){return 1-b},flicker:function(b){b=-Math.cos(b*Math.PI)/4+0.75+Math.random()/4;return b>1?1:b},wobble:function(b){return-Math.cos(b*Math.PI*9*b)/2+0.5},pulse:function(b,c){c=c||5;return(b%(1/c)*c).round()==0?b*c*2-(b*c*2).floor():
1-(b*c*2-(b*c*2).floor())},spring:function(b){return 1-Math.cos(b*4.5*Math.PI)*Math.exp(-b*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(b){var c="position:relative";if(Prototype.Browser.IE)c+=";zoom:1";b=$(b);$A(b.childNodes).each(function(d){if(d.nodeType==3){d.nodeValue.toArray().each(function(e){b.insertBefore((new Element("span",{style:c})).update(e==" "?String.fromCharCode(160):
e),d)});Element.remove(d)}})},multiple:function(b,c,d){b=(typeof b=="object"||Object.isFunction(b))&&b.length?b:$(b).childNodes;var e=Object.extend({speed:0.1,delay:0},d||{}),f=e.delay;$A(b).each(function(g,k){new c(g,Object.extend(e,{delay:k*e.speed+f}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c,d){b=$(b);c=(c||"appear").toLowerCase();d=Object.extend({queue:{position:"end",scope:b.id||"global",limit:1}},d||{});Effect[b.visible()?
Effect.PAIRS[c][1]:Effect.PAIRS[c][0]](b,d)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;
Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(b){this.effects._each(b)},add:function(b){var c=(new Date).getTime();switch(Object.isString(b.options.queue)?b.options.queue:b.options.queue.position){case "front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case "with-last":c=this.effects.pluck("startOn").max()||c;break;case "end":c=this.effects.pluck("finishOn").max()||
c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||this.effects.length<b.options.queue.limit)this.effects.push(b);if(!this.interval)this.interval=setInterval(this.loop.bind(this),15)},remove:function(b){this.effects=this.effects.reject(function(c){return c==b});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){for(var b=(new Date).getTime(),c=0,d=this.effects.length;c<d;c++)this.effects[c]&&this.effects[c].loop(b)}});
Effect.Queues={instances:$H(),get:function(b){if(!Object.isString(b))return b;return this.instances.get(b)||this.instances.set(b,new Effect.ScopedQueue)}};Effect.Queue=Effect.Queues.get("global");
Effect.Base=Class.create({position:null,start:function(b){function c(d,e){return(d[e+"Internal"]?"this.options."+e+"Internal(this);":"")+(d[e]?"this.options."+e+"(this);":"")}if(b&&b.transition===false)b.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),b||{});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";'+c(this.options,"beforeSetup")+(this.setup?"this.setup();":"")+c(this.options,"afterSetup")+'};if (this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+c(this.options,"beforeUpdate")+(this.update?"this.update(pos);":"")+c(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(b){if(b>=this.startOn)if(b>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");this.finish&&this.finish();this.event("afterFinish")}else{b=(b-this.startOn)/this.totalTime;var c=(b*this.totalFrames).round();if(c>this.currentFrame){this.render(b);this.currentFrame=c}}},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(b){this.options[b+"Internal"]&&this.options[b+"Internal"](this);this.options[b]&&this.options[b](this)},inspect:function(){var b=$H();for(property in this)Object.isFunction(this[property])||b.set(property,this[property]);return"#<Effect:"+b.inspect()+",options:"+$H(this.options).inspect()+">"}});
Effect.Parallel=Class.create(Effect.Base,{initialize:function(b,c){this.effects=b||[];this.start(c)},update:function(b){this.effects.invoke("render",b)},finish:function(b){this.effects.each(function(c){c.render(1);c.cancel();c.event("beforeFinish");c.finish&&c.finish(b);c.event("afterFinish")})}});
Effect.Tween=Class.create(Effect.Base,{initialize:function(b,c,d){b=Object.isString(b)?$(b):b;var e=$A(arguments),f=e.last();e=e.length==5?e[3]:null;this.method=Object.isFunction(f)?f.bind(b):Object.isFunction(b[f])?b[f].bind(b):function(g){b[f]=g};this.start(Object.extend({from:c,to:d},e||{}))},update:function(b){this.method(b)}});Effect.Event=Class.create(Effect.Base,{initialize:function(b){this.start(Object.extend({duration:0},b||{}))},update:Prototype.emptyFunction});
Effect.Opacity=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);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},c||{}))},update:function(b){this.element.setOpacity(b)}});
Effect.Move=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({x:0,y:0,mode:"relative"},c||{}))},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(b){this.element.setStyle({left:(this.options.x*
b+this.originalLeft).round()+"px",top:(this.options.y*b+this.originalTop).round()+"px"})}});Effect.MoveBy=function(b,c,d,e){return new Effect.Move(b,Object.extend({x:d,y:c},e||{}))};
Effect.Scale=Class.create(Effect.Base,{initialize:function(b,c,d){this.element=$(b);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},d||{}))},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(c){this.originalStyle[c]=
this.element.style[c]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var b=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(c){if(b.indexOf(c)>0){this.fontSize=parseFloat(b);this.fontSizeType=c}}.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(b){b=this.options.scaleFrom/100+this.factor*b;this.options.scaleContent&&this.fontSize&&this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType});this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(){this.restoreAfterFinish&&this.element.setStyle(this.originalStyle)},setDimensions:function(b,c){var d={};
if(this.options.scaleX)d.width=c.round()+"px";if(this.options.scaleY)d.height=b.round()+"px";if(this.options.scaleFromCenter){b=(b-this.dims[0])/2;c=(c-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY)d.top=this.originalTop-b+"px";if(this.options.scaleX)d.left=this.originalLeft-c+"px"}else{if(this.options.scaleY)d.top=-b+"px";if(this.options.scaleX)d.left=-c+"px"}}this.element.setStyle(d)}});
Effect.Highlight=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({startcolor:"#ffff99"},c||{}))},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(b){return parseInt(this.options.startcolor.slice(b*2+1,b*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(b){return parseInt(this.options.endcolor.slice(b*2+1,b*2+3),16)-this._base[b]}.bind(this))}},update:function(b){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(c,d,e){return c+
(this._base[e]+this._delta[e]*b).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(b,c){c=c||{};var d=document.viewport.getScrollOffsets();b=$(b).cumulativeOffset();var e=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(c.offset)b[1]+=c.offset;return new Effect.Tween(null,d.top,b[1]>e?e:b[1],c,function(f){scrollTo(d.left,f.round())})};
Effect.Fade=function(b,c){b=$(b);var d=b.getInlineOpacity();c=Object.extend({from:b.getOpacity()||1,to:0,afterFinishInternal:function(e){e.options.to==0&&e.element.hide().setStyle({opacity:d})}},c||{});return new Effect.Opacity(b,c)};
Effect.Appear=function(b,c){b=$(b);c=Object.extend({from:b.getStyle("display")=="none"?0:b.getOpacity()||0,to:1,afterFinishInternal:function(d){d.element.forceRerendering()},beforeSetup:function(d){d.element.setOpacity(d.options.from).show()}},c||{});return new Effect.Opacity(b,c)};
Effect.Puff=function(b,c){b=$(b);var d={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(e){Position.absolutize(e.effects[0].element)},afterFinishInternal:function(e){e.effects[0].element.hide().setStyle(d)}},
c||{}))};Effect.BlindUp=function(b,c){b=$(b);b.makeClipping();return new Effect.Scale(b,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(d){d.element.hide().undoClipping()}},c||{}))};
Effect.BlindDown=function(b,c){b=$(b);var d=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:d.height,originalWidth:d.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.element.undoClipping()}},c||{}))};
Effect.SwitchOff=function(b,c){b=$(b);var d=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(e){new Effect.Scale(e.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(f){f.element.makePositioned().makeClipping()},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned().setStyle({opacity:d})}})}},c||{}))};
Effect.DropOut=function(b,c){b=$(b);var d={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(e){e.effects[0].element.makePositioned()},afterFinishInternal:function(e){e.effects[0].element.hide().undoPositioned().setStyle(d)}},c||{}))};
Effect.Shake=function(b,c){b=$(b);c=Object.extend({distance:20,duration:0.5},c||{});var d=parseFloat(c.distance),e=parseFloat(c.duration)/10,f={top:b.getStyle("top"),left:b.getStyle("left")};return new Effect.Move(b,{x:d,y:0,duration:e,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-d*2,y:0,duration:e*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:d*2,y:0,duration:e*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:-d*2,y:0,duration:e*2,afterFinishInternal:function(h){new Effect.Move(h.element,
{x:d*2,y:0,duration:e*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:-d,y:0,duration:e,afterFinishInternal:function(m){m.element.undoPositioned().setStyle(f)}})}})}})}})}})}})};
Effect.SlideDown=function(b,c){b=$(b).cleanWhitespace();var d=b.down().getStyle("bottom"),e=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:e.height,originalWidth:e.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();window.opera&&f.element.setStyle({top:""});f.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:f.dims[0]-
f.element.clientHeight+"px"})},afterFinishInternal:function(f){f.element.undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:d})}},c||{}))};
Effect.SlideUp=function(b,c){b=$(b).cleanWhitespace();var d=b.down().getStyle("bottom"),e=b.getDimensions();return new Effect.Scale(b,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:e.height,originalWidth:e.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();window.opera&&f.element.setStyle({top:""});f.element.makeClipping().show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:f.dims[0]-
f.element.clientHeight+"px"})},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:d})}},c||{}))};Effect.Squish=function(b){return new Effect.Scale(b,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(c){c.element.makeClipping()},afterFinishInternal:function(c){c.element.hide().undoClipping()}})};
Effect.Grow=function(b,c){b=$(b);var d=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},c||{}),e={top:b.style.top,left:b.style.left,height:b.style.height,width:b.style.width,opacity:b.getInlineOpacity()},f=b.getDimensions(),g,k,j,h;switch(d.direction){case "top-left":g=k=j=h=0;break;case "top-right":g=f.width;k=h=0;j=-f.width;break;case "bottom-left":g=j=0;k=f.height;h=-f.height;break;
case "bottom-right":g=f.width;k=f.height;j=-f.width;h=-f.height;break;case "center":g=f.width/2;k=f.height/2;j=-f.width/2;h=-f.height/2;break}return new Effect.Move(b,{x:g,y:k,duration:0.01,beforeSetup:function(l){l.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(l){new Effect.Parallel([new Effect.Opacity(l.element,{sync:true,to:1,from:0,transition:d.opacityTransition}),new Effect.Move(l.element,{x:j,y:h,sync:true,transition:d.moveTransition}),new Effect.Scale(l.element,
100,{scaleMode:{originalHeight:f.height,originalWidth:f.width},sync:true,scaleFrom:window.opera?1:0,transition:d.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(m){m.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(m){m.effects[0].element.undoClipping().undoPositioned().setStyle(e)}},d))}})};
Effect.Shrink=function(b,c){b=$(b);c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},c||{});var d={top:b.style.top,left:b.style.left,height:b.style.height,width:b.style.width,opacity:b.getInlineOpacity()},e=b.getDimensions(),f,g;switch(c.direction){case "top-left":f=g=0;break;case "top-right":f=e.width;g=0;break;case "bottom-left":f=0;g=e.height;break;case "bottom-right":f=e.width;g=
e.height;break;case "center":f=e.width/2;g=e.height/2;break}return new Effect.Parallel([new Effect.Opacity(b,{sync:true,to:0,from:1,transition:c.opacityTransition}),new Effect.Scale(b,window.opera?1:0,{sync:true,transition:c.scaleTransition,restoreAfterFinish:true}),new Effect.Move(b,{x:f,y:g,sync:true,transition:c.moveTransition})],Object.extend({beforeStartInternal:function(k){k.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(k){k.effects[0].element.hide().undoClipping().undoPositioned().setStyle(d)}},
c))};Effect.Pulsate=function(b,c){b=$(b);var d=c||{},e=b.getInlineOpacity(),f=d.transition||Effect.Transitions.sinoidal;c=function(g){return f(1-Effect.Transitions.pulse(g,d.pulses))};c.bind(f);return new Effect.Opacity(b,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(g){g.element.setStyle({opacity:e})}},d),{transition:c}))};
Effect.Fold=function(b,c){b=$(b);var d={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(e){e.element.hide().undoClipping().setStyle(d)}})}},c||{}))};
Effect.Morph=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element)throw Effect._elementDoesNotExistError;b=Object.extend({style:{}},c||{});if(Object.isString(b.style))if(b.style.include(":"))this.style=b.style.parseStyle();else{this.element.addClassName(b.style);this.style=$H(this.element.getStyles());this.element.removeClassName(b.style);var d=this.element.getStyles();this.style=this.style.reject(function(e){return e.value==d[e.key]});b.afterFinishInternal=function(e){e.element.addClassName(e.options.style);
e.transforms.each(function(f){e.element.style[f.style]=""})}}else this.style=$H(b.style);this.start(b)},setup:function(){function b(c){if(!c||["rgba(0, 0, 0, 0)","transparent"].include(c))c="#ffffff";c=c.parseColor();return $R(0,2).map(function(d){return parseInt(c.slice(d*2+1,d*2+3),16)})}this.transforms=this.style.map(function(c){var d=c[0];c=c[1];var e=null;if(c.parseColor("#zzzzzz")!="#zzzzzz"){c=c.parseColor();e="color"}else if(d=="opacity"){c=parseFloat(c);Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&
this.element.setStyle({zoom:1})}else if(Element.CSS_LENGTH.test(c)){e=c.match(/^([\+\-]?[0-9\.]+)(.*)$/);c=parseFloat(e[1]);e=e.length==3?e[2]:null}var f=this.element.getStyle(d);return{style:d.camelize(),originalValue:e=="color"?b(f):parseFloat(f||0),targetValue:e=="color"?b(c):c,unit:e}}.bind(this)).reject(function(c){return c.originalValue==c.targetValue||c.unit!="color"&&(isNaN(c.originalValue)||isNaN(c.targetValue))})},update:function(b){for(var c={},d,e=this.transforms.length;e--;)c[(d=this.transforms[e]).style]=
d.unit=="color"?"#"+Math.round(d.originalValue[0]+(d.targetValue[0]-d.originalValue[0])*b).toColorPart()+Math.round(d.originalValue[1]+(d.targetValue[1]-d.originalValue[1])*b).toColorPart()+Math.round(d.originalValue[2]+(d.targetValue[2]-d.originalValue[2])*b).toColorPart():(d.originalValue+(d.targetValue-d.originalValue)*b).toFixed(3)+(d.unit===null?"":d.unit);this.element.setStyle(c,true)}});
Effect.Transform=Class.create({initialize:function(b,c){this.tracks=[];this.options=c||{};this.addTracks(b)},addTracks:function(b){b.each(function(c){c=$H(c);var d=c.values().first();this.tracks.push($H({ids:c.keys().first(),effect:Effect.Morph,options:{style:d}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(b){var c=b.get("ids"),d=b.get("effect"),e=b.get("options");return[$(c)||$$(c)].flatten().map(function(f){return new d(f,Object.extend({sync:true},
e))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");
Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");
String.prototype.parseStyle=function(){var b,c=$H();if(Prototype.Browser.WebKit)b=(new Element("div",{style:this})).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';b=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(d){b[d]&&c.set(d,b[d])});Prototype.Browser.IE&&this.include("opacity")&&c.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return c};
Element.getStyles=document.defaultView&&document.defaultView.getComputedStyle?function(b){var c=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(d,e){d[e]=c[e];return d})}:function(b){b=$(b);var c=b.currentStyle,d;d=Element.CSS_PROPERTIES.inject({},function(e,f){e.set(f,c[f]);return e});d.opacity||d.set("opacity",b.getOpacity());return d};
Effect.Methods={morph:function(b,c,d){b=$(b);new Effect.Morph(b,Object.extend({style:c},d||{}));return b},visualEffect:function(b,c,d){b=$(b);c=c.dasherize().camelize();c=c.charAt(0).toUpperCase()+c.substring(1);new Effect[c](b,d);return b},highlight:function(b,c){b=$(b);new Effect.Highlight(b,c);return b}};
$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(b){Effect.Methods[b]=function(c,d){c=$(c);Effect[b.charAt(0).toUpperCase()+b.substring(1)](c,d);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(b){Effect.Methods[b]=Element[b]});Element.addMethods(Effect.Methods);
var GetText={catalog:new Hash,update:function(b){GetText.catalog.merge(b)},get:function(b){var c=GetText.catalog[b]||b;if(arguments.length>1){values=$A(arguments).slice(1,arguments.length);c=c.replace(/%[sdf]/g,function(){return String(values.shift())})}return c}};function gettext(b){return GetText.get.apply(this,arguments)}function _(){return GetText.get.apply(this,arguments)}var postloaded_ads=[];function registerAd(b){postloaded_ads.push(b)}
function movePostloadedAds(){var b=detectBrowser();for(b=0;b<postloaded_ads.length;b++){var c=postloaded_ads[b],d=document.getElementsByClassName("postloaded_ad "+c)[0];if(d!=undefined){var e=d.getElementsByTagName("script");if(e!=null)for(i=0;i<e.length;i++){var f=e[i];if(f.src.replace!=undefined)f.src.replace="/javascripts/ads_empty_script.js";else f.src="/javascripts/ads_empty_script.js"}e=document.getElementsByClassName("advertising ad_container "+c)[0];e.innerHTML="";e.className="advertising served_ad "+
c;d.parentNode.removeChild(d);d.className="";e.appendChild(d)}}}
var Application={useAssetServers:true,assetHost:function(b){b||(b="");return this.useAssetServers?"http://media"+(1+b.length%4)+".origo.no"+b:b}},LazyLoading={add:function(b,c){Event.observe(window,"load",function(){new Ajax.Request("/-/site/populate_fragments",{method:"GET",asynchronous:true,evalScripts:true,parameters:b})});c&&window.setInterval(function(){new Ajax.Request("/-/site/populate_fragments",{method:"GET",asynchronous:true,evalScripts:true,parameters:b})},12E4)}},Window={getDimensions:function(){var b,
c;if(window.innerWidth){b=window.innerWidth;c=window.innerHeight}else if(document.documentElement&&document.documentElement.clientWidth){b=document.documentElement.clientWidth;c=document.documentElement.clientHeight}else if(document.body&&document.body.clientWidth){b=document.documentElement.clientWidth;c=document.documentElement.clientHeight}else c=b=0;return{width:b,height:c}}},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(b){return typeof b.keyCode!="undefined"?b.keyCode:b.which}});function setCookie(b,c,d,e,f,g){document.cookie=b+"="+escape(c)+(d?"; expires="+d.toGMTString():"")+(e?"; path="+e:"")+(f?"; domain="+f:"")+(g?"; secure":"")}
function getCookie(b){var c=document.cookie;b=b+"=";var d=c.indexOf("; "+b);if(d==-1){d=c.indexOf(b);if(d!=0)return null}else d+=2;var e=document.cookie.indexOf(";",d);if(e==-1)e=c.length;return unescape(c.substring(d+b.length,e))}
function detectBrowser(){var b="",c=navigator.userAgent.toLowerCase();if(c.indexOf("opera")!=-1)b="opera";else if(c.indexOf("safari")!=-1)b="safari";else if(c.indexOf("msie 8")!=-1)b="ie8";else if(c.indexOf("msie 7")!=-1)b="ie7";else if(c.indexOf("msie 6")!=-1)b="ie6";else if(c.indexOf("msie 5")!=-1)b="ie5";else if(c.indexOf("netscape")!=-1)b="netscape";else if(c.indexOf("firefox")!=-1)b="firefox";else if(c.indexOf("gecko")!=-1)b="mozilla";return b}
var TokenCompletionContinuation=Class.create({initialize:function(b){this.excess=b},getExcess:function(){return this.excess}}),TokenField=Class.create();
TokenField.prototype={initialize:function(b,c,d){this.element=$(document.createElement("div"));this.containerElement=$(b);this.containerElement.appendChild(this.element);this.completer=c;this.options=d;this.create()},clear:function(){if(this.element){Element.getElementsBySelector(this.element,".token_field_atom").each(function(b){this.removeAtomByElement(b)}.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 b=$(document.createElement("span"));b.style.position="relative";b.style.styleFloat="left";b.style.cssFloat="left";b.style.paddingTop="9px";b.style.display="block";b.style.overflow="hidden";b.style.width="0px";b.style.cssFloat="left";b.style.styleFloat="left";b.appendChild(document.createTextNode("Moo"));this.element.appendChild(b);b=$(document.createElement("input"));b.type="text";b.setAttribute("autocomplete","off");
b.style.position="absolute";b.style.left="0";b.style.top="-10000px";b.observe("focus",function(){this.aboutToEnableFakeInput||this.activate();this.aboutToEnableFakeInput=false}.bind(this));b.observe("keydown",function(e){switch(e.keyCode){case Event.KEY_BACKSPACE:this.removeSelectedAtom();Element.getElementsBySelector(this.element,".token_field_atom.token_field_atom_selected").length==0&&this.activate();Event.stop(e);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(e);break}}.bind(this),true);b.observe("keypress",function(e){Event.getKey(e)==Event.KEY_RETURN&&Event.stop(e);if(e.charCode&&e.charCode!=0&&!(e.ctrlKey||e.shiftKey||e.metaKey||e.altKey)&&e.keyCode>40){this.inputElement.value+=String.fromCharCode(e.charCode);this.activate();Event.stop(e)}}.bind(this),false);this.fakeInputElement=b;var c=$(document.createElement("span"));c.style.styleFloat="left";c.style.cssFloat="left";c.style.overflow="hidden";c.style.width=
"0px";c.style.height="0px";c.style.display="block";c.appendChild(b);this.element.appendChild(c);var d=$(document.createElement("input"));d.type="text";d.setAttribute("autocomplete","off");d.setAttribute("style","float: left");d.style.styleFloat="left";d.style.border="none";d.style.backgroundColor="transparent";d.style.verticalAlign="baseline";if(navigator.userAgent.match(/MSIE/)){d.style.position="relative";d.style.top="2px"}d.observe("keypress",function(e){Event.getKey(e)==Event.KEY_RETURN&&Event.stop(e);
this.allowEntry()||Event.stop(e)}.bind(this));d.observe("keydown",function(e){var f=Event.getKey(e);switch(f){case Event.KEY_BACKSPACE:if(d.value==""){this.selectLastAtom();Event.stop(e)}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(e)}default:this.allowEntry()||Event.stop(e)}if(f==Event.KEY_RETURN||f==Event.KEY_TAB||f==188)if(this.addCompletionAsAtom()||f==Event.KEY_RETURN)Event.stop(e)}.bind(this),
false);d.observe("keyup",function(e){e.keyCode!=Event.KEY_BACKSPACE&&this.deselectAtoms();switch(e.keyCode){case Event.KEY_UP:this.selectPreviousCompletion();break;case Event.KEY_DOWN:this.selectNextCompletion();break;default:this.offerCompletions(d.value)}}.bind(this),true);d.observe("blur",function(e){Event.element(e)&&this.deactivate()}.bind(this));this.element.appendChild(d);this.inputElement=d;b=$(document.createElement("div"));b.style.clear="both";b.style.overflow="hidden";b.style.width="0px";
b.style.height="0px";this.element.appendChild(b)}},activate:function(){this.fakeInputElement.disabled="";this.inputElement.show();this.inputElement.focus()},deactivate:function(){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 b=0,c=Element.getElementsBySelector(this.element,
".token_field_atom").last();if(c){b=Position.cumulativeOffset(c)[0]-Position.cumulativeOffset(this.element)[0]+Element.getDimensions(c).width;b+=parseInt(Element.getStyle(c,"marginRight").gsub(/px$/,""))}c=(parseInt(Element.getStyle(this.element,"paddingLeft").gsub(/px$/,""))||0)+(parseInt(Element.getStyle(this.element,"paddingRight").gsub(/px$/,""))||0);if(Element.getStyle(this.element,"borderLeft")!="")c+=1;if(Element.getStyle(this.element,"borderRight")!="")c+=1;c+=14;var d=Element.getDimensions(this.element);
b=d.width-c-b;if(b<100)b=Math.max(0,d.width-c);this.inputElement.style.width=b+"px"},hideCompletions:function(){if(this.completionBox){this.completionBox.remove();this.completionBox=null}},offerCompletions:function(b){b=b.strip();var c=function(d){this.populateCompletions(b,d)}.bind(this);if(this.completer.beginComplete)this.completer.beginComplete(b,c)&&this.setProgressing(true);else c(this.completer.complete(b))},populateCompletions:function(b,c){this.setProgressing(false);this.hideCompletions();
if(b.length>0){var d=this.inputElement.cumulativeOffset();d.left-=this.inputElement.cumulativeScrollOffset().left;d.left+=$(document.body).cumulativeScrollOffset().left;d.top-=this.inputElement.cumulativeScrollOffset().top;d.top+=$(document.body).cumulativeScrollOffset().top;var e=this.inputElement.getDimensions(),f=$(document.createElement("div"));f.className="token_field_completion_box";f.style.left=d.left+"px";f.style.top=d.top+e.height+"px";f.style.width=Math.max(200,e.width)+"px";if(c.length>
0)c.each(function(g,k){if(g instanceof TokenCompletionContinuation){k=$(document.createElement("div"));k.innerHTML="&hellip; "+_("og %d andre",g.getExcess());k.className="token_field_completion_meta";f.appendChild(k)}else{var j=$(document.createElement("a"));j.style.display="block";j.addClassName("token_field_completion_item");j._cookie=g;if(g.iconUrl){var h=$(document.createElement("img"));h.addClassName("token_field_completion_item_image");h.src=g.iconUrl;h.alt="";j.appendChild(h)}h=g.text.toLowerCase().indexOf(b.toLowerCase());
h>0&&j.appendChild(document.createTextNode(g.text.substring(0,h)));var l=$(document.createElement("strong"));l.appendChild(document.createTextNode(g.text.substring(h,h+b.length)));l.addClassName("token_field_completion_item_highlight");j.appendChild(l);h<g.text.length&&j.appendChild(document.createTextNode(g.text.substring(h+b.length)));k==0&&j.addClassName("token_field_completion_item_selected");j.observe("mousedown",function(){this.addCompletionAsAtom(g)}.bind(this),true);f.appendChild(j)}}.bind(this));
else{c=$(document.createElement("div"));c.innerHTML=_("Ingen treff");c.addClassName("token_field_completion_meta");f.appendChild(c)}document.body.appendChild(f);this.completionBox=f}},selectNextCompletion:function(){if(this.completionBox){var b=Element.getElementsBySelector(this.completionBox,".token_field_completion_item_selected")[0]||this.completionBox.firstChild,c=b.nextSibling||this.completionBox.firstChild;b.removeClassName("token_field_completion_item_selected");c.addClassName("token_field_completion_item_selected")}},
selectPreviousCompletion:function(){if(this.completionBox){var b=Element.getElementsBySelector(this.completionBox,".token_field_completion_item_selected")[0]||this.completionBox.lastChild,c=b.previousSibling||this.completionBox.lastChild;b.removeClassName("token_field_completion_item_selected");c.addClassName("token_field_completion_item_selected")}},selectedCompletion:function(){var b=null;if(this.completionBox){var c=Element.getElementsBySelector(this.completionBox,".token_field_completion_item_selected")[0];
if(c)b=c._cookie}return b},addCompletionAsAtom:function(b){var c=false;if(b=b||this.selectedCompletion()){var d=$(document.createElement("a"));d.href="#";d.className="token_field_atom";d.tabIndex=-1;d.observe("click",function(g){this.selectAtomByElement(d);Event.stop(g)}.bind(this));c=$(document.createElement("span"));c.className="b4";if(b.iconUrl){var e=$(document.createElement("img"));e.addClassName("token_field_atom_image");e.src=b.iconUrl;e.alt="";c.appendChild(e)}c.appendChild(document.createTextNode(b.text));
var f=$(document.createElement("img"));f.src="/images/forms/token_field_close.png";f.className="token_field_atom_close";f.observe("mouseover",function(){f.src="/images/forms/token_field_close_hover.png"}.bind(this));f.observe("mouseout",function(){f.src="/images/forms/token_field_close.png"}.bind(this));f.observe("click",function(){this.removeAtomByElement(d)}.bind(this));c.appendChild(f);c=this.wrapInSpan(c,"b3");c=this.wrapInSpan(c,"b2");c=this.wrapInSpan(c,"b1");d.appendChild(c);c=$(document.createElement("input"));
c.type="hidden";c.name=this.options.fieldName;c.value=b.id;d.appendChild(c);this.element.insertBefore(d,this.inputElement);this.inputElement.value="";c=true;this.atomsChanged()}return c},selectAtomByElement:function(b){this.deselectAtoms();b&&b.addClassName("token_field_atom_selected");this.aboutToEnableFakeInput=true;this.fakeInputElement.disabled="";this.fakeInputElement.focus()},selectNextAtom:function(){var b=Element.getElementsBySelector(this.element,".token_field_atom_selected")[0];if(b){var c=
b.nextSibling;if(c.hasClassName("token_field_atom")){b.removeClassName("token_field_atom_selected");c.addClassName("token_field_atom_selected")}else this.activate()}},selectPreviousAtom:function(){var b=Element.getElementsBySelector(this.element,".token_field_atom_selected")[0];if(b){var c=b.previousSibling;if(c.hasClassName("token_field_atom")){b.removeClassName("token_field_atom_selected");c.addClassName("token_field_atom_selected")}}},selectLastAtom:function(){var b=Element.getElementsBySelector(this.element,
".token_field_atom").last();b&&this.selectAtomByElement(b)},deselectAtoms:function(){Element.getElementsBySelector(this.element,".token_field_atom.token_field_atom_selected").each(function(b){b.removeClassName("token_field_atom_selected")})},removeAtomByElement:function(b){b.remove();this.atomsChanged()},removeSelectedAtom:function(){var b=Element.getElementsBySelector(this.element,".token_field_atom.token_field_atom_selected").first();b?this.removeAtomByElement(b):this.selectLastAtom()},atomsChanged:function(){this.hideCompletions();
this.adaptSize()},wrapInSpan:function(b,c){var d=$(document.createElement("span"));d.className=c;d.appendChild(b);return d},setProgressing:function(b){b?this.containerElement.addClassName("token_field_progressing"):this.containerElement.removeClassName("token_field_progressing")}};
var BalloonGroups={},Balloons={all:[],lastHitBalloon:null,close:function(b){this.each(function(c){c.close(b)})},reposition:function(){this.each(function(b){b.reposition()})},find:function(b){return this.all.find(b)},closeByElement:function(b){var c=this.all.find(function(d){return d.getFrameElement().id==b});if(c){c.close();return true}else return false},findByElement:function(b){return this.all.find(function(c){return c.getFrameElement().id==b})},register:function(b){this.all.push(b);this.balloonsChanged()},
unregister:function(b){this.all=this.all.without(b);this.balloonsChanged()},each:function(b){return this.all.each(b)},findHitByEvent:function(b){var c=null;Balloons.each(function(d){if(d.isWithin(b)){c=d;throw $break;}});return c},start:function(){Event.observe(document,"click",function(b){(this.lastHitBalloon=b=this.findHitByEvent(b))||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(b){b.keyCode==27&&Balloons.close()},true)},balloonsChanged:function(){this.all.length>0?this.hideObscuringObjects():this.showObscuringObjects()},hideObscuringObjects:function(){this.showObscuringObjects();this.findObscuringObjects().each(function(b){b.style.visibility="hidden";this.hiddenObscurableObjects.push(b)}.bind(this))},showObscuringObjects:function(){this.hiddenObscurableObjects&&this.hiddenObscurableObjects.each(function(b){b.style.visibility=""});
this.hiddenObscurableObjects=[]},findObscuringObjects:function(){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"));return b=b.select(function(c){return!this.all.find(function(d){d=d.getFrameElement();return c.childOf(d)})}.bind(this))}},Balloon=Class.create({initialize:function(b){this.options=b;
this.group=b.group||"default";this.tail=typeof b.tail=="undefined"?"pyramid":b.tail;this.trigger=typeof b.trigger=="undefined"?null:b.trigger;this.origin=typeof b.origin=="undefined"?null:b.origin;this.position=b.position;if(!this.position)this.position=new Balloon.Position.Vertical;this.onShow=b.onShow;this.onMayShow=b.onMayShow;this.onHide=b.onHide;this.onBeforeHide=b.onBeforeHide;this.onCreate=b.onCreate;this.progressLabel=b.progressLabel;this.width=b.width;this.url=b.url;this.parameters=b.parameters||
{};this.dontCache=b.dontCache;this.id=b.id;this.loaded=false;this.closeable=b.closeable!=false;this.timeout=b.timeout;this.className=b.className;this.overlayClass=b.overlayClass;this.frameElement=this.progressElement=this.overlayElement=null;this.contentElement=$(b.content);this.progressing=false;this.observers=[];this.border=null;this.contentElement&&this.contentElement.hide();this.contentBody=b.contentHtml;b.trigger&&this.attach(b.trigger)},attach:function(b,c){c=c||"click";b=$(b);this.detach();
this.trigger=b;this.observe(b,c,function(d){c=="click"?this.toggle():this.open();Event.stop(d)}.bind(this));c=="focus"&&this.observe(b,"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 b=BalloonGroups[this.group];b&&b.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)}(b=$(this.trigger))&&b.addClassName("active");(b=$(this.origin))&&b.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 b=false;if(this.onBeforeHide)b=this.onBeforeHide(panel)==false;if(!b){this.onHide&&function(){this.onHide(this)}.bind(this);this.frameElement.hide();this.tailElement&&this.tailElement.hide()}(b=$(this.trigger))&&b.removeClassName("active");
(b=$(this.origin))&&b.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(b){b=Event.element(b);
return this.contentElement!=null&&($(this.contentElement)==b||Element.childOf(b,$(this.contentElement)))||this.trigger!=null&&($(this.trigger)==b||Element.childOf(b,$(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(b){this.contentBody=b},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 b=false;if(!this.frameElement){b=true;this.frameElement=this.createFrameElement();this.frameElement.style.display="none";if(this.width)this.frameElement.style.width=this.width+"px";document.body.appendChild(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 c=this.border?this.border.getContainer():this.frameElement;if(!this.progressElement){this.progressElement=this.createProgressElement();this.progressElement.style.display="none";c.appendChild(this.progressElement)}if(!this.contentElement){this.contentElement=this.createContentElement();if(this.contentBody)this.contentElement.innerHTML=
this.contentBody}if(this.contentElement.parentNode!=c){this.contentElement.parentNode&&this.contentElement.parentNode.removeChild(this.contentElement);c.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";document.body.appendChild(this.tailElement)}if(this.overlayClass&&!this.overlayElement){this.overlayElement=document.createElement("div");
this.overlayElement.className=this.overlayClass;document.body.appendChild(this.overlayElement)}b&&this.onCreate&&this.onCreate(this)},loadFromUrl:function(b){this.loading=true;this.setProgress(true);new Ajax.Updater({success:this.contentElement},b,{asynchronous:true,evalScripts:true,method:"get",parameters:this.parameters,onFailure:function(c){Errors.reportForAjax(c,null);this.close()}.bind(this),onSuccess:function(){this.loaded=true}.bind(this),onComplete:function(){this.loading=false;this.setProgress(false)}.bind(this)})},
setProgress:function(b){if(this.closeControlElement)b?Element.hide(this.closeControlElement):Element.show(this.closeControlElement);if(this.contentElement)b?Element.hide(this.contentElement):Element.show(this.contentElement);if(this.progressElement)b?Element.show(this.progressElement):Element.hide(this.progressElement)},setTail:function(b){this.tail=b;this.reposition()},createFrameElement:function(){var b=document.createElement("div");if(this.id)b.id=this.id;var c="balloon";if(this.className){c+=
" ";c+=this.className}b.className=c;if(this.closeable){this.closeControlElement=this.createCloseControlElement();b.appendChild(this.closeControlElement)}return b},createContentElement:function(){var b=document.createElement("div");b.className="balloon_content";return b},createTailElement:function(b){b=Balloon.Tails.get(b).up;var c=document.createElement("img");c.src=b.image;c.className="balloon_tail";c.alt="";return c},createCloseControlElement:function(){var b=document.createElement("img");b.src=
"/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 b=document.createElement("img");b.className="progress_indicator";b.src="/images/progress/spinner_16.gif";b.style.width=16;b.style.height=16;b.alt=_("Vent litt");var c=document.createElement("div");c.className="progress_message";c.appendChild(document.createTextNode(this.progressLabel||
""));c.appendChild(b);b=document.createElement("div");b.className="balloon_progress";b.appendChild(c);return b},observe:function(b,c,d){b.observe(c,d);this.observers[b]||(this.observers[b]=[]);this.observers[b].push([c,d])},unobserve:function(b){var c=this.observers[b];if(c){c.each(function(d){b.stopObserving(d[0],d[1])});delete this.observers[b]}}});Balloon.Position={};
Balloon.Position.Vertical=Class.create({initialize:function(b,c,d){this.adjustX=b||0;this.adjustY=c||0;this.alignment=d||Balloon.Position.Vertical.LEFT;this.positioned=false},position:function(b){var c=this.adjustX,d=this.adjustY,e=b.trigger?$(b.trigger):null,f=b.origin?$(b.origin):e,g=b.getTailElement(),k=b.getFrameElement(),j=b.getOverlayElement();if(g){var h=Balloon.Tails.get(b.getTailStyle()).up;g.src=h.image;g.style.width=h.width+"px";g.style.height=h.height+"px"}if(!this.positioned)if(k.style.position!=
"absolute"){k.style.top="-500px";k.style.position="absolute";if(g){g.style.top="-500px";g.style.position="absolute"}}var l=Position.cumulativeOffset(f);h=Position.cumulativeOffset(f);var m=[],q=Element.getDimensions(k);if(this.alignment==Balloon.Position.Vertical.RIGHT){var n=Element.getDimensions(f);m[0]=l[0]+n.width-q.width;m[0]-=c}else{m[0]=l[0];m[0]+=c}if(g){c=Element.getDimensions(g);h[0]+=f.offsetWidth/2-c.width/2;h[1]+=f.offsetHeight;h[1]+=d;if(h[0]<m[0])h[0]=m[0];g.style.left=h[0]+"px";g.style.top=
h[1]+"px";m[1]=h[1];m[1]+=c.height-1}else{m[1]=l[1];m[1]+=f.offsetHeight+1;m[1]+=d}if(b.border){m[0]-=b.border.getTileWidth()/2+1;m[1]-=b.border.getTileHeight()/2+1;if(!g){m[0]-=10;m[1]-=5}}m[0]=Math.min(document.body.clientWidth-12-q.width,m[0]);m[0]=Math.max(12,m[0]);k.style.left=m[0]+"px";k.style.top=m[1]+"px";if(j&&e){b=Position.positionedOffset(e);f=Element.getDimensions(e);d=f.width-2;f=f.height-1;if(navigator.userAgent.match(/MSIE/)&&e.tagName.toUpperCase()!="INPUT"){d-=4;f-=2;b[1]+=2}j.style.position=
"absolute";j.style.left=b[0]+"px";j.style.top=b[1]+"px";j.style.width=d+"px";j.style.height=f+"px"}this.positioned=true}});Balloon.Position.Vertical.LEFT=0;Balloon.Position.Vertical.RIGHT=1;
Balloon.Position.Horizontal=Class.create({initialize:function(b,c,d){this.adjustX=b||0;this.adjustY=c||0;this.alignment=d||Balloon.Position.Horizontal.LEFT},position:function(b){var c=this.adjustX,d=this.adjustY,e=b.trigger?$(b.trigger):null,f=e?$(b.trigger):$(b.origin),g=b.getTailElement(),k=b.getFrameElement(),j=b.getOverlayElement();if(g){b=Balloon.Tails.get(b.getTailStyle());b=this.alignment==Balloon.Position.Horizontal.RIGHT?b.left:b.right;g.src=b.image;g.style.width=b.width+"px";g.style.height=
b.height+"px"}if(k.style.position!="absolute"){k.style.top="-500px";k.style.position="absolute";if(g){g.style.top="-500px";g.style.position="absolute"}}b=Position.cumulativeOffset(f);var h=Position.cumulativeOffset(f),l=[],m=Element.getDimensions(k);if(g){var q=Element.getDimensions(g);if(this.alignment==Balloon.Position.Horizontal.RIGHT){c=Element.getDimensions(f);l[0]=b[0];l[0]+=c.width;l[0]+=q.width;l[1]=b[1];l[1]-=5;l[1]+=d;h[0]+=c.width;h[0]+=1;h[1]+=d}else{l[0]=b[0];l[0]+=c;l[0]-=m.width;l[0]-=
q.width;l[1]=b[1];l[1]-=5;l[1]+=d;h[0]-=q.width;h[0]-=1;h[1]+=d;if(h[1]<l[1])h[1]=l[1]+1}g.style.left=h[0]+"px";g.style.top=h[1]+"px"}else{if(this.alignment==Balloon.Position.Horizontal.RIGHT){c=Element.getDimensions(f);l[0]=b[0];l[0]+=c.width;l[1]=b[1]}else{l[0]=b[0];l[0]+=c;l[1]=b[1];l[1]+=f.offsetHeight+1}l[1]+=d}if(l[0]+m.width>document.body.clientWidth-12)l[0]=document.body.clientWidth-12-m.width;l[0]=Math.max(12,l[0]);k.style.left=l[0]+"px";k.style.top=l[1]+"px";if(j&&e){d=Position.positionedOffset(e);
g=Element.getDimensions(e);e=g.width-2;g=g.height-4;if(navigator.userAgent.match(/MSIE/)){e-=4;g-=2;d[1]+=2}j.style.position="absolute";j.style.left=d[0]+"px";j.style.top=d[1]+"px";j.style.width=e+"px";j.style.height=g+"px"}}});Balloon.Position.Horizontal.LEFT=0;Balloon.Position.Horizontal.RIGHT=1;Balloon.Tails={tails:{},register:function(b,c){this.tails[b]=c},get:function(b){return this.tails[b]}};
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 b=false;if(navigator.userAgent.match(/MSIE [0-6]/)){b=parseFloat(navigator.appVersion.split("MSIE")[1]);b=b>=5.5&&b<7&&document.body.filters}this.weFixImages=b}return this.weFixImages},fixImage:function(b){if(this.shouldFixImages())if(b.width&&b.height&&b.width>0&&b.height>0){b.style.width=b.width+"px";b.style.height=b.height+"px";b.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='scale')";
b.src="/images/blank.png"}return b},fixCell:function(b){if(this.shouldFixImages())if(b.style.backgroundImage){var c=b.style.backgroundImage.match(/url\((.*)\)/);b.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c[1]+"', sizingMethod='scale')";b.style.backgroundImage="none"}return b}},Border=Class.create();
Border.prototype={initialize:function(b,c){this.spec=(new Hash(c)).toArray().map(function(l){return Border.LONG_TO_SHORT_OPTIONS[l[0]]+"="+l[1]}).join("_");var d=c.width||c.height,e=c.height||c.width,f=(c.width||c.height)-2;e=(c.height||c.width)-2;d=0;if(c.borderWidth&&c.borderColour)d=c.borderWidth;if(c.borderGradient)d=1;var g=f*2+1-d,k=e*2+1-d;f=g+d+1;e=k+d+1;if(c.shadow){g+=10;k+=10;var j=c.shadowPadding;if(!j&&j!=0)j=2;var h=c.shadowY||0;g=g+d*2+j*2;d=k+d*2+j*2;k=c.shadowMargin||0;f=Math.max(f,
Math.max(j+Math.abs(c.shadowX||0)*2)+g+2*k+2);e=Math.max(e,Math.max(j+Math.abs(h)*2)+d+2*k+2)}if(f%2==1)f+=1;if(e%2==1)e+=1;d=Math.floor(f/2);e=Math.floor(e/2);this.tileWidth=d;this.tileHeight=e;f=document.createElement("table");f.style.borderSpacing=0;f.style.borderCollapse="collapse";f.style.border="none";if(b=$(b)){j=null;if(document.defaultView&&document.defaultView.getComputedStyle)j=document.defaultView.getComputedStyle(b,"");else if(b.currentStyle)j=b.currentStyle;if(j){if(h=j.cssFloat||j.styleFloat){f.setAttribute("style",
"float: "+h);f.style.styleFloat=h;f.style.cssFloat=h}f.style.marginTop=j.marginTop;f.style.marginLeft=j.marginLeft;f.style.marginRight=j.marginRight;f.style.marginBottom=j.marginBottom;f.style.position=j.position;f.style.left=j.left;f.style.top=j.top;f.style.right=j.right;f.style.bottom=j.bottom}if(c.colour)b.style.backgroundColor="#"+c.colour;b.style.margin="0px";b.style.position="static";b.style.left="auto";b.style.top="auto";b.style.right="auto";b.style.bottom="auto";b.style.styleFloat="none";
b.style.cssFloat="none";if(b.parentNode){b.parentNode.insertBefore(f,b);b.remove()}this.content=b}b=document.createElement("thead");j=document.createElement("tr");h=document.createElement("td");h.style.padding="0";h.style.verticalAlign="bottom";g=document.createElement("img");g.src=this.getTile("tl");g.width=d;g.height=e;BorderSupport.fixImage(g);h.appendChild(g);j.appendChild(h);h=document.createElement("td");h.style.padding="0";h.style.background="url("+this.getTile("tm")+") repeat-x";h.style.height=
e;BorderSupport.fixCell(h);j.appendChild(h);h=document.createElement("td");h.style.padding="0";h.style.verticalAlign="bottom";g=document.createElement("img");g.src=this.getTile("tr");g.width=d;g.height=e;g=BorderSupport.fixImage(g);h.appendChild(g);j.appendChild(h);b.appendChild(j);f.appendChild(b);b=document.createElement("tbody");j=document.createElement("tr");h=document.createElement("td");h.style.padding="0";h.style.background="url("+this.getTile("l")+") repeat-y";h.width=d;BorderSupport.fixCell(h);
j.appendChild(h);h=document.createElement("td");h.style.padding="0";h.style.verticalAlign="top";if(c.colour)h.style.backgroundColor="#"+c.colour;this.content&&h.appendChild(this.content);this.container=h;j.appendChild(h);h=document.createElement("td");h.style.padding="0";h.style.background="url("+this.getTile("r")+") repeat-y";h.width=d;BorderSupport.fixCell(h);j.appendChild(h);b.appendChild(j);f.appendChild(b);if(!c.skipBottom){c=document.createElement("tfoot");b=document.createElement("tr");j=document.createElement("td");
j.style.padding="0";h=document.createElement("img");h.src=this.getTile("bl");h.width=d;h.height=e;h=BorderSupport.fixImage(h);j.appendChild(h);b.appendChild(j);j=document.createElement("td");j.style.padding="0";j.style.background="url("+this.getTile("bm")+") repeat-x";j.height=e;BorderSupport.fixCell(j);b.appendChild(j);j=document.createElement("td");j.style.padding="0";h=document.createElement("img");h.src=this.getTile("br");h.width=d;h.height=e;h=BorderSupport.fixImage(h);j.appendChild(h);b.appendChild(j);
c.appendChild(b);f.appendChild(c)}this.frame=f},getTile:function(b){return Application.assetHost("/-/cache/border/"+this.spec+"_t="+b+"_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(b,c){this.options=c;this.horizontalPages=this.options.horizontalPages||2;this.date=b||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 b=$(document.createElement("table"));b.className="pages_table";var c=$(document.createElement("tbody"));b.appendChild(c);var d=$(document.createElement("tr"));c.appendChild(d);
if(!this.options.noArrows){c=$(document.createElement("td"));c.className="arrow_left";c.observe("click",function(f){this.scrollPrevious();var g=window.getSelection?window.getSelection():null;g&&g.removeAllRanges();Event.stop(f);return false}.bind(this));d.appendChild(c)}c=$(document.createElement("td"));c.className="pages_cell";d.appendChild(c);var e=$(document.createElement("div"));e.className="pages_container";e.style.position="relative";c.appendChild(e);this.pagesContainerElement=e;c=$(document.createElement("div"));
c.className="pages";this.pagesElement=c;this.pagesContainerElement.appendChild(this.pagesElement);if(!this.options.noArrows){c=$(document.createElement("td"));c.className="arrow_right";c.observe("click",function(f){this.scrollNext();var g=window.getSelection?window.getSelection():null;g&&g.removeAllRanges();Event.stop(f);return false}.bind(this));d.appendChild(c)}d=$(document.createElement("div"));d.className="date_picker";d.appendChild(b);return d},createPages:function(b,c){for(var d=[],e=b.getFullYear();e<=
c.getFullYear();e++)for(var f=0;f<12;f++){var g=new Date(e,f,1);if(g.getTime()>=b.getTime()&&g<=c.getTime()){g=this.createPage(g);d.push(g)}}return d},createPage:function(b){var c=$(document.createElement("div"));c.className="page";for(var d=new Date(b.getFullYear(),b.getMonth(),1);d.getDay()!=1;)d.setDate(d.getDate()-1);for(var e=new Date(b.getFullYear(),b.getMonth()+1,-1);e.getDay()<6;)e.setDate(e.getDate()+1);var f=$(document.createElement("table"));c.appendChild(f);var g=$(document.createElement("tbody"));
f.appendChild(g);f=$(document.createElement("tr"));var k=$(document.createElement("th"));k.colSpan=7;k.className="month_heading";k.appendChild(document.createTextNode(DatePicker.MONTH_NAMES[b.getMonth()]));k.appendChild(document.createTextNode(" "));k.appendChild(document.createTextNode(b.getFullYear()));f.appendChild(k);g.appendChild(f);f=[1,2,3,4,5,6,0];var j=$(document.createElement("tr"));f.each(function(u){var r=$(document.createElement("th"));r.className="day";if(u==0)r.className+=" holiday";
r.appendChild(document.createTextNode(DatePicker.DAY_NAMES[u].slice(0,1)));j.appendChild(r)});g.appendChild(j);for(var h=d,l=new Date,m=function(u){Event.element(u).addClassName("hover")},q=function(u){Event.element(u).removeClassName("hover")};h<=e;){var n=$(document.createElement("tr"));f.each(function(u){var r=$(document.createElement("td"));if(h.getMonth()==b.getMonth()){r.className="day";if(h.getFullYear()==l.getFullYear()&&h.getMonth()==l.getMonth()&&h.getDate()==l.getDate())r.className+=" today";
if(u==0)r.className+=" holiday";r.appendChild(document.createTextNode(h.getDate()));r.date=h;if(navigator.userAgent.match(/MSIE [0-6]/)){r.observe("mouseover",m);r.observe("mouseout",q)}r.observe("click",function(w){w=Event.element(w);this.selected(w.date,w)}.bind(this))}n.appendChild(r);h=new Date(h);h.setDate(h.getDate()+1)}.bind(this));g.appendChild(n)}return c},selected:function(b,c){if(this.selectedElement){this.selectedElement.removeClassName("selected");this.selectedElement=null}c.addClassName("selected");
this.selectedElement=c;this.date=b;this.options.onSelect&&this.options.onSelect(b);this.balloon&&this.balloon.close()},scrollToDate:function(b){if(b.getFullYear()!=this.focusDate.getFullYear()||b.getMonth()!=this.focusDate.getMonth()){var c=this.dateWithRelativeMonth(this.focusDate,-1),d=this.dateWithRelativeMonth(this.focusDate,this.horizontalPages+1);if(b<c||b>=d){this.focusDate=this.dateWithRelativeMonth(b,0);this.repopulate()}else this.scrollRelative(b<this.focusDate?-1:1)}},scrollRelative:function(b){if(b!=
0){b/=Math.abs(b);if(b<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,b);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,b);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(b){var c=this.pageMargin*2,d=(this.buffer+b)*this.pageWidth;d+=c/2;if(navigator.userAgent.match(/MSIE/)){if(b==1)d+=c/2;d+=c}if(b>=0)d+=c/2;return d},setBalloon:function(b){this.balloon=b},repopulate:function(){for(;this.pagesElement.firstChild;)this.pagesElement.removeChild(this.pagesElement.firstChild);this.populate()},populate:function(){if(!this.pageWidth){var b=this.createPage(this.date);this.pagesElement.appendChild(b);
this.pageWidth=b.getDimensions().width+this.pageMargin;this.pagesContainerElement.style.height=b.getDimensions().height+"px";this.pagesContainerElement.style.width=this.horizontalPages*this.pageWidth+"px";this.pagesElement.removeChild(b)}if(!this.pagesElement.firstChild){b=this.dateWithRelativeMonth(this.focusDate,-this.buffer);var c=this.dateWithRelativeMonth(this.focusDate,this.horizontalPages+this.buffer-1);this.createPages(b,c).each(function(d){this.pagesElement.appendChild(d)}.bind(this));this.pagesContainerElement.scrollLeft=
this.scrollOffsetForPage(0)}},dateWithRelativeMonth:function(b,c){return new Date(b.getFullYear(),b.getMonth()+c,1)},insertInto:function(b){$(b).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(b,c){c=$(c);var d=document.createElement("img");d.className="date_picker_arrow";d.src="/images/forms/date_picker_button.png";d.alt="...";c.parentNode.insertBefore(d,c.nextSibling);var e=new Balloon({content:b.create(),className:"date_picker_balloon",closeable:true,position:new Balloon.Position.Vertical(-145,0),origin:c,tail:null,rounded:true,onMayShow:function(){return!c.disabled},onShow:function(){b.populate()}});e.attach(d);b.setBalloon(e);return b};
var DropDownGroups={},DropDowns={_all:[],close:function(b){this.each(function(c){c.close(b)})},find:function(b){return this._all.find(b)},register:function(b){this._all[this._all.length]=b},each:function(b){return this._all.each(b)}},DropDown=Class.create();
DropDown.prototype={initialize:function(b,c,d){this.panel=c;this.link=b;$(this.link).onclick=function(){this.toggle();return false}.bind(this);this.group=d.group;this.position=d.position;this.onShow=d.onShow;this.onHide=d.onHide;this.onAfterHide=d.onAfterHide;DropDowns.register(this)},toggle:function(){this.isOpen()?this.close():this.open()},open:function(){if(!this.isOpen()){var b=$(this.panel),c=$(this.link);if(this.group){var d=DropDownGroups[this.group];d&&d.close();DropDownGroups[this.group]=
this}b.parentElement.removeChild(b);document.body.appendChild(b);Element.addClassName(c,"active");this.position&&this.position(c,b);c=false;if(this.onShow)c=this.onShow(b)==false;c||Element.show(b)}},close:function(b){if(this.isOpen()){var c=$(this.panel),d=$(this.link),e=false;if(this.onHide)e=this.onHide(c)==false;if(!e)if(b){Element.hide(c);this.onAfterHide&&this.onAfterHide(c)}else new Effect.Fade(c,{duration:0.25,from:1,afterFinish:function(){this.onAfterHide&&this.onAfterHide(c)}.bind(this)});
Element.removeClassName(d,"active")}},isOpen:function(){return Element.visible($(this.panel))}};DropDown.Above=function(b,c,d){c||(c=0);d||(d=0);return function(e,f){var g=c,k=d;for(e=e;e;){g+=e.offsetLeft;k+=e.offsetTop;e=e.offsetParent}f.style.position="absolute";f.style.top=k-b+1+"px";f.style.left=g+"px"}};
DropDown.Below=function(b,c){b||(b=0);c||(c=0);return function(d,e){for(var f=Element.getDimensions(e),g=b,k=c,j=d;j;){g+=j.offsetLeft;k+=j.offsetTop;j=j.offsetParent}k+=d.clientHeight;k-=1;if(g+f.width>=document.width-10)g=document.width-f.width-10;e.style.position="absolute";e.style.top=k+"px";e.style.left=g+"px"}};
DropDown.BelowFlushRight=function(b,c){b||(b=0);c||(c=0);return function(d,e){e.style.position="absolute";e.style.top=c+d.offsetTop+d.offsetHeight-1+"px";e.style.left=b+d.offsetLeft+d.offsetWidth-Element.getDimensions(e)+"px"}};Event.observe(document,"click",function(b){var c=Event.element(b),d=false;DropDowns.each(function(e){d=d||c==$(e.panel)||c==$(e.link)||Element.childOf(c,$(e.panel))||Element.childOf(c,$(e.link))});d||DropDowns.close()});Event.observe(window,"resize",function(){DropDowns.close(true)});
Event.observe(window,"blur",function(){});Effect.ScrollElementTo=Class.create();Object.extend(Object.extend(Effect.ScrollElementTo.prototype,Effect.Base.prototype),{initialize:function(b,c){this.element=$(b);this.start(c||{})},setup:function(){this.scrollStart=this.element.scrollLeft;this.delta=this.options.toX-this.scrollStart},update:function(b){this.element.scrollLeft=this.scrollStart+b*this.delta}});
var Errors={exceptionHandler:function(b,c){this.reportForAjax(b,c.toString())},descriptionFromRequest:function(b,c){var d=null;if(b.getResponseHeader)d=b.getResponseHeader("X-Error-Message");d=d||c;if(d==null&&b.statusText&&b.statusText!="OK")d=b.statusText;if(!d)if(b.status==503)d=_("Vi oppgraderer Origo akkurat n\u00e5. Dette kan ta et minutt eller to.");else{d=_("Beklager, noe gikk galt ved kontakt med tjeneren");if(b.status&&b.status!=500){d+=" (feilkode ";d+=b.status;d+=")"}}d+=".";return d},
reportException:function(b){b=b.message;if(b==null||b=="")b=_("(Ingen feilmelding)");alert(_("En feil skjedde: %s",b))},reportForAjax:function(b,c){alert(this.descriptionFromRequest(b,c))},log:function(b){typeof console!="undefined"&&console.log(b.toString())}},LiveValidation=Class.create({initialize:function(b,c){this.options=c;this.containerElement=$(b);this.messageElement=this.containerElement.select(".live_validation_message")[0];this.delay=500;this._attachContainer();window.setInterval(function(){this._attachContainer()}.bind(this),
this.delay)},_attachContainer:function(){this.containerElement.select("input, textarea, select").each(function(b){this._attach(b)}.bind(this))},_attach:function(b){if(!b.attachedForLiveValidation){b.attachedForLiveValidation=true;var c=function(){var d=Form.getForm(b);new Ajax.Request(this.options.url,{parameters:Form.serialize(d)+"&"+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}.bind(this),onFailure:function(e){Errors.reportForAjax(e)}.bind(this),onSuccess:function(e){if(e=eval("("+e.responseText+")"))if(e.error){this.containerElement.addClassName("live_validation_rejected");this.containerElement.removeClassName("live_validation_accepted");this.messageElement.innerHTML=e.error}else if(e.reset)this.messageElement.innerHTML="";else{this.containerElement.removeClassName("live_validation_rejected");
this.containerElement.addClassName("live_validation_accepted");this.messageElement.innerHTML=this.options.acceptLabel}}.bind(this),onComplete:function(){this.messageElement.removeClassName("spinner")}.bind(this),onException:function(e,f){Errors.log(f)}.bind(this)})}.bind(this);new DelayedFieldElementObserver(b,this.delay,c);b.value&&window.setTimeout(c,this.delay)}}}),DelayedFieldElementObserver=Class.create({initialize:function(b,c,d){this.element=$(b);this.delay=c;this.callback=d;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(){if(this.getValue()!=this.oldValue){this.oldValue=this.getValue();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}}}),DynamicTextAreaResizing=Class.create({initialize:function(b,c){this.fieldElement=$(b);if(c){this.minHeight=c.minHeight;this.maxHeight=c.maxHeight}window.setTimeout(this.setup.bind(this),
50)},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 b=this.fieldElement.getDimensions().width;if(!this.hiddenElement&&
b){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=b+"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;b=this.hiddenElement.scrollHeight;
b+=30;if(this.maxHeight)b=Math.min(b,this.maxHeight);if(this.minHeight)b=Math.max(b,this.minHeight);this.fieldElement.style.height=b+"px"}},computeMinHeight:function(){var b=this.cloneStyles(this.fieldElement,$(document.createElement("div")));b.style.position="absolute";b.style.top="0px";for(var c="",d=0;d<this.fieldElement.rows;d++)c+="<br/>";b.innerHTML=c;var e=this.fieldElement.parentNode;e.appendChild(b);window.setTimeout(function(){var f=Math.max(33,b.getDimensions().height);e.removeChild(b);
this.minHeight=f;this.resize()}.bind(this),1)},cloneStyles:function(b,c){c.style.fontFamily=b.getStyle("font-family");c.style.fontSize=b.getStyle("font-size");c.style.lineHeight=b.getStyle("line-height");c.style.paddingTop=b.getStyle("padding-top");c.style.paddingRight=b.getStyle("padding-right");c.style.paddingBottom=b.getStyle("padding-bottom");c.style.paddingLeft=b.getStyle("padding-left");c.style.borderTopWidth=b.getStyle("border-top-width");c.style.borderRightWidth=b.getStyle("border-right-width");
c.style.borderBottomWidth=b.getStyle("border-bottom-width");c.style.borderLeftWidth=b.getStyle("border-left-width");c.style.borderTopColor=b.getStyle("border-top-color");c.style.borderRightColor=b.getStyle("border-right-color");c.style.borderBottomColor=b.getStyle("border-bottom-color");c.style.borderLeftColor=b.getStyle("border-left-color");c.style.borderTopStyle=b.getStyle("border-top-style");c.style.borderRightStyle=b.getStyle("border-right-style");c.style.borderBottomStyle=b.getStyle("border-bottom-style");
c.style.borderLeftStyle=b.getStyle("border-left-style");c.style.overflow=b.getStyle("overflow");c.style.resize="none";return c}}),TextAreaCharacterCounter=Class.create({initialize:function(b,c,d){this.fieldElement=$(b);this.counterElement=$(c);this.maximumCharacters=d.maximumCharacters;this.errorClassName=d.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 b=this.maximumCharacters-this.fieldElement.value.length;b>0?this.counterElement.removeClassName(this.errorClassName):this.counterElement.addClassName(this.errorClassName);this.counterElement.innerHTML=b==0?_("N\u00e5 er det fullt!"):b>=0?_("%d tegn ledig",b):_("%d tegn for mange!",-b)}});
Object.extend(Form,{getForm:function(b){for(b=$(b);b;){if(b.tagName.toUpperCase()=="FORM")return b;b=b.parentNode}return null},getCaretPosition:function(b){if(document.selection){b.focus();document.selection.createRange().duplicate();return Math.abs(document.selection.createRange().moveStart("character",-b.value.length))}else return b.selectionStart>=0?(position=b.selectionStart):b.value.length},insertIntoTextField:function(b,c,d){if(b=$(b)){d=d||{};var e=d.position;if(e==null)e=Form.getCaretPosition(b);
if(d.deselectBefore)if(document.selection)var f=document.selection.createRange();else typeof b.setSelectionRange!="undefined"&&b.setSelectionRange(0,0);f=0;var g=d.padding||"";if(e>0&&!b.value.substring(e-2).startsWith(g)){c=g+c;f+=g.length}if(e<b.value.length&&!b.value.substring(e).startsWith(g))c+=g;if(document.selection){b.focus();f=document.selection.createRange();f.text=c;f.moveStart("character",c.length)}else if(b.selectionStart>=0){b.value=b.value.substring(0,e)+c+b.value.substring(e);if(typeof b.setSelectionRange!=
"undefined")if(d.selectAfter)b.setSelectionRange(e+f,e+c.length);else{e+=c.length;b.setSelectionRange(e,e)}}else b.value+=c}}});var TagFields={toggle:function(b,c,d){b=$(b);var e=" "+b.value+" ",f=e.search(" "+c+" ");if(f>=0)b.value=(e.substring(0,f)+e.substring(f+c.length+1,e.length)).strip();else Form.insertIntoTextField(b,c,{position:b.value.length,padding:" ",deselectBefore:true,selectAfter:true});b.focus();$(d).toggleClassName("selected")}},FieldPlaceholder=Class.create();
FieldPlaceholder.prototype={initialize:function(b){this.field=$(b);if(this.field.type=="password")this.isPassword=true;if(this.field.title!=""&&this.field.title!=null){b=null;for(var c=this.field.parentNode;c;){if(c.tagName.toLowerCase()=="form"){b=c;break}c=c.parentNode}b&&this.observeForm(b);this.field.observe("focus",function(){this.focus()}.bind(this));this.field.observe("blur",function(){this.blur()}.bind(this));this.blur()}},observeForm:function(b){$(b).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(b){this.field.value=b}};var FormModalityManager=Class.create();
FormModalityManager.prototype={initialize:function(b){this.form=$(b);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(b){this.warningMessage=b},isFormModified:function(){return Form.serialize(this.form)!=this.data},_beforeUnloadHandler:function(){if(this.previousUnloadHandler){var b=this.previousBeforeUnloadHandler.apply(this,arguments);if(b)return b}if(this.enabled&&this.isFormModified()){(b=this.warningMessage)||(b=_("Dersom du g\u00e5r videre vil du miste endringene dine."));
return b}}};
var Button={create:function(b,c){var d=$(document.createElement("button"));this.configureElement(d,c);c=$(document.createElement("span"));c.className="button_label";c.appendChild(document.createTextNode(b));d.appendChild(c);return d},linkTo:function(b,c,d){var e=$(document.createElement("a"));e.href=c;this.configureElement(e,d);c=$(document.createElement("span"));c.className="button_label";c.appendChild(document.createTextNode(b));e.appendChild(c);return e},linkToFunction:function(b,c,d){if(navigator.userAgent.match(/MSIE/)){var e=
$(document.createElement("a"));e.href="#";e.observe("click",function(f){c(f);Event.stop(f)});e.appendChild(document.createTextNode(b))}else{e=$(document.createElement("a"));e.href="#";e.observe("click",function(f){c(f);Event.stop(f)});this.configureElement(e,d);d=$(document.createElement("span"));d.className="button_label";typeof b=="string"?d.appendChild(document.createTextNode(b)):d.appendChild(b);e.appendChild(d)}return e},configureElement:function(b,c){c=$H(c||{});var d=c.get("size")||"normal";
c=c.get("color")||"grey";b.setAttribute("class","button "+d+"_button "+d+"_"+c+"_button "+c+"_button")}},EditableText=Class.create();
EditableText.prototype={initialize:function(b){this.options=b;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(b){b=$(b);this.detach();this.element=b;this.element.addClassName("editable_text");Event.observe(b,
"click",function(c){this.edit();Event.stop(c)}.bind(this));Event.observe(b,"mouseover",function(){!this.deleted&&!this.isEditing()&&Element.addClassName(this.element,"editable_text_hover")}.bind(this));Event.observe(b,"mouseout",function(){!this.deleted&&!this.isEditing()&&Element.removeClassName(this.element,"editable_text_hover")}.bind(this));if(!this.options.url&&!this.hiddenField){b=$(document.createElement("input"));b.name=this.options.name;b.type="hidden";b.value=this.value;this.hiddenField=
b;this.element.parentNode.appendChild(this.hiddenField)}this.reset()},detach:function(){},edit:function(){if(!this.deleted)if(!this.isEditing()){for(var b=$(this.element),c=b.getDimensions().height;b.firstChild;)b.removeChild(b.firstChild);Element.removeClassName(b,"editable_text_placeholder");Element.removeClassName(b,"editable_text_hover");var d;if(this.options.url){d=$(document.createElement("form"));d.method="POST";d.action=this.options.url}var e=$(document.createElement("div"));e.className="editable_text_fields";
var f;if(this.type=="field"){f=$(document.createElement("input"));f.className="field";f.type="text";f.value=this.value}else{f=$(document.createElement("textarea"));f.className="field";f.cols=30;f.rows=4;f.style.height=(c<150?150:c)+"px";f.appendChild(document.createTextNode(this.value))}f.observe("keypress",function(k){if(Event.getKey(k)==Event.KEY_RETURN)if(this.type=="field"){Event.stop(k);this.value=f.value;this.save()}if(k.keyCode==27){this.cancel();Event.stop(k)}}.bind(this));e.appendChild(f);
c=document.createElement("div");c.className="button_bar button_bar_left";var g=Button.create(_("Lagre"),{color:"green",size:"small"});Event.observe(g,"click",function(k){this.value=f.value;this.save();Event.stop(k);return false}.bind(this));c.appendChild(g);g=Button.create(_("Avbryt"),{color:"grey",size:"small"});Event.observe(g,"click",function(k){this.cancel();Event.stop(k);return false}.bind(this));c.appendChild(g);if(this.options.deleteUrl){g=Button.create(_("Slett"),{color:"grey",size:"small"});
Event.observe(g,"click",function(k){window.confirm(_("Er du sikker?"))&&this.doDelete();Event.stop(k);return false}.bind(this));c.appendChild(g)}g=document.createElement("img");g.alt=_("Lagrer\u2026");g.src="/images/progress/spinner_16.gif";g.title="";g.className="progress_indicator";g.style.display="none";c.appendChild(g);this.progressIndicator=g;e.appendChild(c);if(d){d.appendChild(e);b.appendChild(d)}else b.appendChild(e);Field.focus(f);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 b=encodeURIComponent(this.options.name)+"="+encodeURIComponent(this.value);if(this.options.parameters){b+="&";b+=this.options.parameters}new Ajax.Request(this.options.url,{parameters:b,evalScripts:false,onFailure:function(c){Errors.reportForAjax(c)}.bind(this),onSuccess:function(c){this.previousValue=this.value;this.content=(c=c.responseText)?c.stripScripts():"";this.reset()}.bind(this),onComplete:function(){this.saving=
false;this.progressIndicator&&Element.hide(this.progressIndicator)}.bind(this),onException:function(c,d){this.saving=false;Errors.log(d)}.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(b){Errors.reportForAjax(b)}.bind(this),
onSuccess:function(b){b=b.responseText;this.value="";this.deletedText=b?b.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(b,c){this.saving=false;Errors.log(c)}.bind(this)})},reset:function(){var b=$(this.element);if(this.deleted){b.innerHTML=this.deletedText;Element.removeClassName(b,"editable_text_placeholder")}else if(this.value==
""){b.innerHTML=this.options.placeholderText||b.title;Element.addClassName(b,"editable_text_placeholder")}else{if(this.content)b.innerHTML=this.content;else b.appendChild(document.createTextNode(this.value));Element.removeClassName(b,"editable_text_placeholder")}this.progressIndicator=null;this.editing=false},isEditing:function(){return this.editing}};
var GoogleMapsSupport={_maps:[],registerMap:function(b,c){c=c||b.getCenter();this._maps.push({map:b,point:c})},checkAllResize:function(){this._maps.each(function(b){var c=b.map;c.checkResize();(b=b.point)&&c.setCenter(b)})}};
if(typeof GIcon!="undefined"){ICONS={};ICONS.venue=new GIcon;ICONS.venue.iconSize=new GSize(21,31);ICONS.venue.iconAnchor=new GPoint(10,31);ICONS.venue.shadowSize=new GSize(21,31);ICONS.venue.infoWindowAnchor=new GPoint(11,5);ICONS.venue.image="/images/markers/green.png";ICONS.venue.shadow="/images/markers/color_marker_shadow.png";ICONS.bulletin=new GIcon;ICONS.bulletin.iconSize=new GSize(21,31);ICONS.bulletin.iconAnchor=new GPoint(10,31);ICONS.bulletin.shadowSize=new GSize(21,31);ICONS.bulletin.infoWindowAnchor=
new GPoint(11,5);ICONS.bulletin.image="/images/markers/orange.png";ICONS.bulletin.shadow="/images/markers/color_marker_shadow.png";ICONS.pro_con=ICONS.bulletin;ICONS.workgroup=new GIcon;ICONS.workgroup.iconSize=new GSize(21,31);ICONS.workgroup.iconAnchor=new GPoint(10,31);ICONS.workgroup.shadowSize=new GSize(21,31);ICONS.workgroup.infoWindowAnchor=new GPoint(11,5);ICONS.workgroup.image="/images/markers/blue.png";ICONS.workgroup.shadow="/images/markers/color_marker_shadow.png";ICONS.local_paper=ICONS.workgroup;
ICONS.faceless_user=new GIcon;ICONS.faceless_user.iconSize=new GSize(22,29);ICONS.faceless_user.iconAnchor=new GPoint(10,28);ICONS.faceless_user.shadowSize=new GSize(21,31);ICONS.faceless_user.infoWindowAnchor=new GPoint(11,5);ICONS.faceless_user.image="/images/markers/faceless_user_24.png";ICONS.faceless_user.shadow="/images/markers/color_marker_shadow.png"}
var MarkerNavigator={attach:function(b,c,d){this.baseUrl=c;this.map=b;this.markers=new Hash;this.options=d||{};GEvent.addListener(this.map,"movestart",this.hideBubbles.bind(this));GEvent.addListener(this.map,"moveend",this.update.bind(this));GEvent.addListener(this.map,"zoomend",function(){this.clear_markers()}.bind(this));this.progressControl=new LProgressControl(this.map);this.map.addControl(this.progressControl);this.update()},hideBubbles:function(){},open_info_url:function(b,c){b.openInfoWindowHtml('<img src="/images/progress/lights.gif"/>');
new Ajax.Request(c,{method:"get",onComplete:function(d){b.openInfoWindowHtml(d.responseText)}.bind(this)})},set_markers:function(b){b.each(function(c){if(!this.markers[c.id]){var d=new GLatLng(c.lat,c.lng);if(c.icon.type)icon=ICONS[c.icon.type];else{icon=new GIcon;dims=c.icon.dimensions;icon.iconSize=new GSize(dims[0],dims[1]);icon.iconAnchor=new GPoint(dims[2],dims[3]);icon.shadowSize=new GSize(dims[4],dims[5]);icon.infoWindowAnchor=new GPoint(dims[6],dims[7]);icon.image=c.icon.image;icon.shadow=
c.icon.shadow}var e=new GMarker(d,icon);GEvent.addListener(e,"click",function(){this.open_info_url(e,c.content_url)}.bind(this));this.map.addOverlay(e);this.markers[c.id]=e}}.bind(this))},_getExpandedMapBounds:function(){var b=this.map.getBounds(),c=b.getSouthWest();b=b.getNorthEast();var d=(b.lng()-c.lng())*1.015,e=(b.lat()-c.lat())*1.1;return new GLatLngBounds(new GLatLng(b.lat()-e,b.lng()-d),new GLatLng(c.lat()+e,c.lng()+d))},prune_markers:function(){var b=this._getExpandedMapBounds();this.markers.each(function(c){if(!b.containsLatLng(c.value.getPoint())){this.map.removeOverlay(c.value);
delete this.markers[c.key]}}.bind(this))},clear_markers:function(){this.markers=new Hash;this.map.clearOverlays()},update:function(){this.prune_markers();var b=this.map.getBounds();this.progressControl.loading();requestUrl=this.options.sandboxId?"/markers/"+this.options.sandboxId:"/markers";if(this.options.limit)requestUrl+="?limit="+this.options.limit;new Ajax.Request(this.baseUrl+requestUrl,{method:"get",parameters:$H({sw_lat:b.getSouthWest().lat(),sw_lng:b.getSouthWest().lng(),ne_lat:b.getNorthEast().lat(),
ne_lng:b.getNorthEast().lng(),format:"json"}).toQueryString(),onComplete:function(c){this.progressControl.done();try{eval("markerData = "+c.responseText);this.set_markers(markerData.markers)}catch(d){alert("Error: "+d)}}.bind(this)})}};
if(typeof GControl!="undefined"){function LProgressControl(){}LProgressControl.prototype=new GControl;LProgressControl.prototype.initialize=function(b){this.map=b;b=$(document.createElement("div"));this.map.getContainer().appendChild(b);var c=$(document.createElement("img"));c.src="/images/progress/lights.gif";c.style.display="block";this.spinner=c;b.appendChild(c);this.loading_status=0;return b};LProgressControl.prototype.loading=function(){this.loading_status+=1;if(this.loading_status>0)this.spinner.style.display=
"block"};LProgressControl.prototype.done=function(){this.loading_status-=1;if(this.loading_status<1)this.spinner.style.display="none"};LProgressControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(3,17))};function LGeoCoderControl(){}LGeoCoderControl.prototype=new GControl;a=LGeoCoderControl.prototype;a.initialize=function(b){this.map=b;this.defaultText="Stedsnavn eller adresse";b=$(document.createElement("div"));this.map.getContainer().appendChild(b);
var c=$(document.createElement("div"));c.className="map_search_controls";locationInputElement=$(document.createElement("input"));locationInputElement.size=20;locationInputElement.value=this.defaultText;locationInputElement.addClassName("unset");locationInputElement.onfocus=function(){if(locationInputElement.value==this.defaultText){locationInputElement.value="";locationInputElement.removeClassName("unset")}}.bind(this);locationInputElement.onblur=function(){if(locationInputElement.value==""){locationInputElement.value=
this.defaultText;locationInputElement.addClassName("unset")}}.bind(this);Event.observe(locationInputElement,"keypress",function(d){if(Event.getKey(d)==Event.KEY_RETURN){this.lookup(this.locationInputElement.value);Event.stop(d)}}.bind(this));c.appendChild(locationInputElement);this.locationInputElement=locationInputElement;c.appendChild(Button.linkToFunction(_("S\u00f8k"),function(){this.lookup(this.locationInputElement.value)}.bind(this),{size:"small",color:"white"}));this.onRemove&&c.appendChild(Button.linkToFunction(_("Fjern"),
function(){this.remove()}.bind(this),{size:"small",color:"white"}));b.appendChild(c);c=$(document.createElement("img"));c.src="/images/progress/spinner_16.gif";c.className="progress_indicator";c.style.display="none";this.spinner=c;b.appendChild(this.spinner);c=$(document.createElement("div"));c.style.display="none";c.className="map_search_result";this.messageDiv=c;b.appendChild(c);return b};a.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(5,5))};a.remove=function(){this.closeBalloon();
this.onRemove&&this.onRemove()};a.lookup=function(b){if(b!=this.defaultText&&b.length>0){this.locationInputElement.value=b;this.locationInputElement.removeClassName("unset");this.spinner.style.display="inline";this.map.closeInfoWindow();this.onInitiate&&this.onInitiate();var c=this.map.getBounds(),d=c.getSouthWest(),e=c.getNorthEast();c=e.lat()-d.lat();d=e.lng()-d.lng();new Ajax.Request("/-/map/geocode",{method:"get",parameters:$H({location:b,lng:this.map.getCenter().lng(),lat:this.map.getCenter().lat(),
lat_diff:c,lng_diff:d}).toQueryString(),onFailure:function(){this.onMiss&&this.onMiss();this.messageDiv.innerHTML=_("Fikk ikke kontakt med serveren. Pr\u00f8v igjen senere");new Effect.Appear(this.messageDiv,{duration:0.2});new Effect.Fade(this.messageDiv,{delay:4,duration:2})}.bind(this),onComplete:function(f){this.closeBalloon();this.spinner.hide();eval(f.responseText);if(geoCode.message){this.messageDiv.innerHTML=geoCode.message;new Effect.Appear(this.messageDiv,{duration:0.2});new Effect.Fade(this.messageDiv,
{delay:4,duration:2})}if(geoCode.length&&geoCode.length>0){f=geoCode;var g=f[0];this.onHit(new GLatLng(g.lat,g.lng),f);if(geoCode.length>1){this.balloon=new Balloon({origin:this.locationInputElement,className:"map_geocoder_balloon",content:this.createHitList(b,f),position:new Balloon.Position.Vertical(-75,-5),tail:null,rounded:true});this.balloon.open()}}else this.onMiss&&this.onMiss()}.bind(this),onException:function(f,g){Errors.log(g)}.bind(this)})}};a.createHitList=function(b,c){b=$(document.createElement("div"));
var d=$(document.createElement("h4"));d.appendChild(document.createTextNode(_("Vi tror du mente %s i %s. Andre steder som passet:",c[0].matchText,c[0].municipality)));b.appendChild(d);var e=$(document.createElement("ul"));c.slice(0,3).each(function(g){e.appendChild(this.createHitItem(g,c))}.bind(this));b.appendChild(e);if(c.length>3){d=$(document.createElement("a"));d.href="#";d.appendChild(document.createTextNode(_("(Vis alle %s treff\u2026)",c.length)));d.observe("click",function(g){Event.element(g).remove();
f.show();Event.stop(g)});b.appendChild(d);var f=$(document.createElement("ul"));f.style.display="none";c.slice(3,100).each(function(g){f.appendChild(this.createHitItem(g))}.bind(this));b.appendChild(f)}return b};a.createHitItem=function(b,c){var d=$(document.createElement("li")),e=$(document.createElement("a"));e.href="#";e.appendChild(document.createTextNode(_("%s (%s)",b.matchText,b.municipality)));e.observe("click",function(f){this.closeBalloon();this.locationInputElement.value=b.matchText+", "+
b.municipality;this.onHit(new GLatLng(b.lat,b.lng),c);Event.stop(f)}.bind(this));d.appendChild(e);return d};a.closeBalloon=function(){if(this.balloon){this.balloon.close();this.balloon=null}}}
var HelpBox=Class.create({initialize:function(b,c){if(this.element=$(b)){this.content=this.element.title;this.element.title="";c&&!c.noIcon&&this.element.addClassName("help_box_indicator");this.visible=false;Event.observe(this.element,"mouseover",this.show.bind(this))}},show:function(){if(!this.visible){Element.getDimensions(this.element);var b=Position.cumulativeOffset(this.element)[0]-5,c=Position.cumulativeOffset(this.element)[1]+Element.getDimensions(this.element).height+3;this.visible=true;this.create();
var d=this.boxElement;d.style.position="absolute";d.style.top=c+"px";d.style.left=b+"px";d.show();b=$(document.body);b.insertBefore(d,null);b.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 b=$(document.createElement("div"));b.className="help_box";var c=$(document.createElement("div"));c.className="help_box_top";
b.appendChild(c);c=$(document.createElement("div"));c.className="text";c.innerHTML="<p>"+this.content+"</p>";var d=$(document.createElement("div"));d.className="help_box_middle";d.appendChild(c);b.appendChild(d);c=$(document.createElement("div"));c.className="help_box_bottom";b.appendChild(c);this.boxElement=b}},_mouseMove:function(b){b=Event.element(b);b==this.element||b==this.boxElement||Element.childOf(b,this.element)||Element.childOf(b,this.boxElement)||this.hide()}}),Modal=Class.create();
Modal.prototype={initialize:function(b,c){this.element=$(b);this.options=c||{};if(this.options.closeOnEscapeKey)this.keyObserver=function(d){d.charCode==0&&this.hide()}.bind(this)},prepare:function(){var b=this._showBackground();this._createProgress().show();b&&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.onShow&&this.options.onShow();this.element=$(this.element);this.element.show();var b=this._createContainer();if(this.element.parentNode!=b){this.element.parentNode&&this.element.parentNode.removeChild(this.element);(this.containerCell||b).appendChild(this.element)}b.style.left="-50000px";b.style.top="-50000px";b.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 b=this.containerElement;
if(navigator.userAgent.match(/MSIE [0-7]/)){if(b){var c=b.clientWidth,d=b.clientHeight;d=Math.max(document.documentElement.scrollTop+document.documentElement.clientHeight/2-d/2,-46);b.style.top=d+"px";b.style.left=document.documentElement.scrollLeft+document.documentElement.clientWidth/2-c/2+"px"}if(c=this.backgroundElement){c.style.top=document.documentElement.scrollTop+"px";c.style.left=document.documentElement.scrollLeft+"px";c.style.width=document.documentElement.clientWidth+"px";c.style.height=
document.documentElement.clientHeight+"px"}if(b=this.progressElement){c=b.clientWidth;d=b.clientHeight;b.style.top=document.documentElement.scrollTop+document.documentElement.clientHeight/2-d/2+"px";b.style.left=document.documentElement.scrollLeft+document.documentElement.clientWidth/2-c/2+"px"}}else if(b){b.style.left=Math.max(Window.getDimensions().width/2-b.clientWidth/2,0)+"px";if(b.clientHeight<Window.getDimensions().height){d=Math.max(Window.getDimensions().height/2-b.clientHeight/2,0);d+=document.documentElement.scrollTop||
document.body.scrollTop;b.style.top=d+"px"}}},_createContainer:function(){if(!this.containerElement){var b=$(document.createElement("div"));b.style.position="absolute";b.style.zIndex=50001;b.style.display="none";if(!this.options.noClickToClose){b.title=_("Klikk for \u00e5 lukke");b.onclick=function(){this.hide()}.bind(this)}document.body.appendChild(b);if(this.options.closeIcon){var c=document.createElement("img");c.src="/images/modal_close_24.png";c.style.position="absolute";c.style.top="38px";c.style.right=
"38px";c.style.zIndex=50002;c.alt=_("Lukk");c.onmouseover=function(){this.src="/images/modal_close_hover_24.png"};c.onmouseout=function(){this.src="/images/modal_close_24.png"};c.onclick=function(){this.hide()}.bind(this);b.appendChild(c)}b.appendChild(this._createShadowTable());this.containerElement=b}return this.containerElement},_createShadowTile:function(b,c,d){b="/images/shadow/big_"+b+"_24.png";var e=$(document.createElement("td"));if(navigator.userAgent.match(/MSIE [0-6]/))e.style.background=
"#444";else{e.style.verticalAlign="top";e.style.padding="0px";e.style.lineHeight="0";e.style.width="46px";e.style.height="46px";e.style.background="url("+b+") repeat"}if(c)e.style.width=c;if(d)e.style.height=d;return e},_createShadowTable:function(){var b=$(document.createElement("table"));b.cellSpacing=0;b.cellPadding=0;b.border=0;var c=$(document.createElement("tbody")),d=$(document.createElement("tr"));d.style.height="46px";d.appendChild(this._createShadowTile("tl","46px","46px"));d.appendChild(this._createShadowTile("t",
null,"46px"));d.appendChild(this._createShadowTile("tr","46px"));c.appendChild(d);d=$(document.createElement("tr"));d.appendChild(this._createShadowTile("l","46px",null));var e=$(document.createElement("td"));e.style.verticalAlign="top";d.appendChild(e);this.containerCell=e;d.appendChild(this._createShadowTile("r","46px",null));c.appendChild(d);d=$(document.createElement("tr"));d.style.height="46px";d.appendChild(this._createShadowTile("bl","46px","46px"));d.appendChild(this._createShadowTile("b",
null,"46px"));d.appendChild(this._createShadowTile("br","46px"));c.appendChild(d);b.appendChild(c);return b},_createProgress:function(){if(!this.progressElement){var b=$(document.createElement("div"));b.style.position=navigator.userAgent.match(/MSIE [0-6]/)?"absolute":"fixed";b.style.top="50%";b.style.left="50%";b.style.width="64px";b.style.height="28px";b.style.marginLeft="-32px";b.style.marginTop="-14px";b.style.background="#fff";b.style.zIndex=50003;b.style.display="none";b.style.border="solid 1px #ddd";
var c=$(document.createElement("img"));c.alt=_("Laster\u2026");c.src="/images/progress/lights.gif";c.style.position="relative";c.style.left="10px";c.style.top="8px";b.appendChild(c);document.body.appendChild(b);this.progressElement=b}return this.progressElement},_createBackground:function(){if(!this.backgroundElement){var b=$(document.createElement("div"));b.style.position=navigator.userAgent.match(/MSIE [0-6]/)?"absolute":"fixed";b.style.top=0;b.style.left=0;b.style.width="100%";b.style.height="100%";
b.style.background=this.options.background||"#000";b.style.zIndex=5E4;b.style.display="none";document.body.appendChild(b);this.backgroundElement=b}return this.backgroundElement},_showBackground:function(){var b=this._createBackground();if(!b.visible()){new Effect.Appear(b,{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 b=this.containerElement;if(b){var c=Math.max(Window.getDimensions().height/2-b.clientHeight/
2,0);c+=document.documentElement.scrollTop||document.body.scrollTop;b.style.top=c+"px"}new Effect.Appear(this.containerElement,{duration:0.2,to:1})}};
var ImageStripPager=Class.create({initialize:function(b,c,d){this.url=b;this.container=$(c);this.pager=new BufferedHorizontalPager($(this.container).select(".image_strip_scrollable")[0],{cellWidth:72,visibleCount:3,bufferCount:3,scrollCount:3,initialCells:d.initialCells,onChanged:function(){var e=this.container.select(".image_strip_arrow_left")[0];this.pager.canMovePrevious()?e.removeClassName("disabled"):e.addClassName("disabled");e=this.container.select(".image_strip_arrow_right")[0];this.pager.canMoveNext()?
e.removeClassName("disabled"):e.addClassName("disabled")}.bind(this),onPopulate:function(e,f,g,k){new Ajax.Request(this.url,{parameters:"id="+e+"&context="+(g==-1?"after":"before")+"&count="+f,method:"GET",onLoading:function(){this.container.select(".image_strip_progress")[0].show()}.bind(this),onSuccess:function(j,h){try{if(h=h||this.evaluateJson(j)){var l=[];h.images.each(function(q){l[l.length]={content:q.html,identifier:q.id}});k(l,h.first,h.last)}}catch(m){console.log("err: "+m)}}.bind(this),
onComplete:function(){this.container.select(".image_strip_progress")[0].hide()}.bind(this),onException:function(j,h){Errors.log(h)}.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(b){var c=null;if((b=b.responseText)&&b.toString().strip().length>0)c=eval("("+b+")");return c}}),
BufferedHorizontalPager=Class.create({initialize:function(b,c){this.scrollableElement=$(b);this.options=c||{};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(d,e){var f=this._createCell();f.innerHTML=d.content;this.cellElements[e]=f;this.cellIdentifiers[e]=d.identifier;this.cellFilled[e]=true;if(d.first)this.firstId=d.identifier;if(d.last)this.lastId=d.identifier;this.containerElement.appendChild(f)}.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(b){if(this.canMovePrevious()){b=
b||this.scrollCount;var c=this.scrollIndex-b;if(c<0){this._prependCells(-c);c=0}for(var d=c;d<c+b;){if(this.cellFilled[d])break;d++}if(d>c){var e=++this.stateCount;this.options.onPopulate(this.cellIdentifiers[d],d-c,-1,function(f,g,k){if(this.stateCount==e&&f.length>0){c=d-f.length;for(var j=0;j<f.length;j++){var h=c+j;this.cellElements[h].innerHTML=f[j].content;this.cellIdentifiers[h]=f[j].identifier;this.cellFilled[h]=true}if(g)this.firstId=f[0].identifier;if(k)this.lastId=f[f.length-1].identifier;
this._scrollToIndex(c)}}.bind(this))}else this._scrollToIndex(c)}},moveNext:function(b){if(this.canMoveNext()){b=b||this.scrollCount;var c=this.scrollIndex+this.visibleCount+b;if(c>=this.cellElements.length){this._appendCells(c-this.cellElements.length);c=this.scrollIndex+this.visibleCount+b}for(var d=c;d>this.scrollIndex;){if(this.cellFilled[d])break;d--}d+=1;if(c>d){var e=++this.stateCount;this.options.onPopulate(this.cellIdentifiers[d-1],c-d,1,function(f,g,k){if(this.stateCount==e&&f.length>0){for(var j=
0;j<f.length;j++){var h=d+j;this.cellElements[h].innerHTML=f[j].content;this.cellIdentifiers[h]=f[j].identifier;this.cellFilled[h]=true}if(g)this.firstId=f[0].identifier;if(k)this.lastId=f[f.length-1].identifier;this._scrollToIndex(c-f.length)}}.bind(this))}else this._scrollToIndex(c-b)}},_prependCells:function(b){if(b>0){for(var c=0;c<b;c++){var d=this._createCell();this.cellElements.unshift(d);this.cellIdentifiers.unshift(null);this.cellFilled.unshift(false);this.containerElement.insertBefore(d,
this.containerElement.firstChild)}this._updateSize();this._scrollToIndex(this.scrollIndex+b,true)}},_appendCells:function(b){if(b>0){for(var c=0;c<b;c++){var d=this._createCell();this.cellElements.push(d);this.cellIdentifiers.push(null);this.cellFilled.push(false);this.containerElement.appendChild(d)}this._updateSize()}},_clearElement:function(b){for(;b.firstChild;)b.removeChild(b.firstChild)},_scrollToIndex:function(b,c){if(!this.scrolling){this.scrollIndex=b;this._changed();b=this.scrollIndex*this.cellWidth;
if(c)this.scrollableElement.scrollLeft=b;else{this.scrolling=true;new Effect.ScrollElementTo(this.scrollableElement,{toX:b,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 b=$(document.createElement("div"));b.style.width=this.cellWidth+"px";b.style.height="100%";b.style.styleFloat="left";b.style.cssFloat="left";
b.style.overflow="hidden";b.style.whiteSpace="nowrap";return b},_updateSize:function(){this.containerElement.style.width=this.cellElements.length*this.cellWidth+"px"}}),SimpleHorizontalPager=Class.create({initialize:function(b,c){this.scrollableElement=$(b);this.scrollableElement.scrollLeft=0;this.scrollableElement.style.overflow="hidden";this.scrollableElement.style.position="relative";this.options=c||{};this.options.scrollSpeed=this.options.scrollSpeed||0.3;this.scrolling=false;this.scrollIndex=
this.options.initialIndex||0;window.setTimeout(this.setup.bind(this),100)},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 b=this.itemCount=0;b<this.scrollableElement.childNodes.length;b++){var c=this.scrollableElement.childNodes[b];if(c&&c.nodeType==Node.ELEMENT_NODE){c.style.position="absolute";c.style.width=this.cellWidth+
"px";c.style.left=this.itemCount*this.cellWidth+"px";c.style.top="0px";this.itemCount++}else{this.scrollableElement.removeChild(c);b--}}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(b){if(b==null)b=1;this.canMovePrevious()&&this.moveTo(Math.max(0,this.scrollIndex-b))},moveNext:function(b){if(b==null)b=1;this.canMoveNext()&&this.moveTo(Math.min(this.scrollIndex+b,this.itemCount))},moveTo:function(b){if(!this.scrolling){this.scrollIndex=b;this._changed();this.scrolling=true;new Effect.ScrollElementTo(this.scrollableElement,{toX:this.scrollIndex*this.scrollableWidth,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 b=this.scrollableElement.getDimensions().height,c=0;c<this.scrollableElement.childNodes.length;c++){var d=$(this.scrollableElement.childNodes[c]);if(d&&d.nodeType==Node.ELEMENT_NODE&&d.visible())b=Math.max(b,d.getDimensions().height)}b-=parseInt(this.scrollableElement.getStyle("paddingTop")||0);b-=parseInt(this.scrollableElement.getStyle("paddingBottom")||0);this.scrollableElement.style.height=
b+"px"}}),SimpleSlideshow=Class.create();
SimpleSlideshow.prototype={initialize:function(b,c,d,e,f,g,k,j){this.images=(new Selector("img")).findElements(b);this.imageWidth=c;this.counterElement=f;this.count=this.images.length;this.container=b;this.captionElement=k;this.captions=j;this.titleElement=g;this.container.observe("click",function(){this.hideTitle()}.bind(this));this.titleElement.observe("click",function(){this.hideTitle()}.bind(this));this.counterElement.hide();this.acceleration=this.speed=this.targetIndex=0;this.arrowLeft=d;this.arrowRight=
e;this.targetIndex=this.counterEffect=null;this.jumpTo(0)},hideTitle:function(){this.titleElement.hide()},jumpTo:function(b){if(b>=0&&b<this.count){b>0&&this.hideTitle();this.targetIndex=b;this.targetIndex==0?this.arrowLeft.hide():this.arrowLeft.show();this.targetIndex==this.count-1?this.arrowRight.hide():this.arrowRight.show();this.scrolling=true;new Effect.ScrollElementTo(this.container,{toX:this.targetIndex*this.imageWidth,duration:0.3,transition:Effect.Transitions.sinoidal,afterFinish:function(){this.scrolling=
false;this.finishedScrolling()}.bind(this)})}},jumpToNext:function(){this.jumpTo(this.targetIndex+1)},jumpToPrevious:function(){this.jumpTo(this.targetIndex-1)},finishedScrolling:function(){this.captionElement.innerHTML=(this.captions[this.targetIndex]||"")+"&nbsp;";this.counterEffect&&this.counterEffect.cancel();this.counterElement.hide();this.counterElement.innerHTML=_("%s av %s",this.targetIndex+1,this.count);this.counterElement.show();this.counterEffect=new Effect.Opacity(this.counterElement,
{delay:1,from:0.7,to:0,duration:2.5})}};var spring_site="test",_cy_="undefined";
if(!this.spring)var spring=function(){function b(){if("https"==document.location.href.slice(0,5))return"https://ssl-";return"http://"}function c(p,o){if(!o){o=p;p={r:document.referrer};w=o}var t=o.s?o.s:p.s;t||(t=o.site?o.site:p.site?p.site:h);u[t]||(u[t]=[]);u[t].push([p,o]);r=1;return this}function d(p){r||c({});var o;for(s in u)for(var t=u[s];t.length>0;){o=",";for(var v=[];t.length>0;){o+=f(g(t.shift(),v),v);if(o.length>m)break;if(t.length>0)o+="+"}o=e(o+";",s,p)}u={};return o}function e(p,o,
t){p=b()+(o?o:h)+"."+l+"/j0="+p;o=p+"?lt="+(new Date).getTime().toString(36)+"&x="+screen.width+"x"+screen.height+"x"+screen.colorDepth;if(t)t==1&&document.write('<img src="'+o+'"" width="1" height=""1">');else(new Image).src=o;q&&alert(o);return p}function f(p,o){for(i in o)if(o[i]==p)return"~"+i;o.push(p);return p}function g(p,o){var t,v,x;t=/[+&,;=~]/g;o||(o=[]);switch(typeof p){case "string":return t.test(p)?escape(p).replace(t,function(y){var z=n[y];if(z)return z;return y}):escape(p);case "number":return isFinite(p)?
String(p):"null";case "boolean":case "null":return String(p);case "object":if(!p)return"null";t=[];if(typeof p.length==="number"&&!p.propertyIsEnumerable("length")){x=p.length;for(v=0;v<x;v+=1)t.push(f(g(p[v],o),o)||"null");return","+t.join("+")+";"}for(v in p)if(typeof v==="string")if(v!="site")(x=g(p[v],o))&&t.push(f(g(v,o)+"="+x,o));return","+t.join("+")+";"}return""}function k(p,o,t){c(p,o);return d(t)}var j=_cy_,h=spring_site,l="tns-cs.net",m=typeof spring_ms!=j?spring_ms:2048,q=typeof spring_debug!=
j?spring_debug:null,n={"+":"%2B",",":"%2C",";":"%3B","=":"%3D","~":"%7E"},u={},r=null,w={};return{a:c,add:c,c:k,commit:k}}();
var Tab=Class.create({initialize:function(b,c,d){this.id=b;this.itemElement=$(c);this.panelElement=$(d)},setActive:function(b){b?this.itemElement.addClassName("active"):this.itemElement.removeClassName("active")}}),TabViewController=Class.create({initialize:function(b){this.element=$(b);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(b,c,d){b=
new Tab(b,c,d);this.tabs.push(b);this.currentTab||this.goToTab(b)},currentTab:function(){return this.currentTab},goToTab:function(b){if(this.currentTab){this.currentTab.setActive(false);this.currentTab=null}if(this.currentTab=b instanceof Tab?b:this.tabs.find(function(c){return c.id==b})){this.pager.moveTo(this.tabs.indexOf(this.currentTab));this.currentTab.setActive(true)}this._changed()},_start:function(){var b=window.location.toString().match(/^(.*)#([^#]+)$/);b&&b[2]&&this.goToTab(b[2]);this._markErrors();
this.started=true},_changed:function(){if(this.started){var b=window.location.toString().match(/^(.*)#([^#]+)$/);if(b&&b[1]){if(b[2]!=this.currentTab.id)window.location=b[1]+"#"+this.currentTab.id}else window.location=window.location+"#"+this.currentTab.id}typeof GoogleMapsSupport!="undefined"&&GoogleMapsSupport.checkAllResize()},_markErrors:function(){this.tabs._each(function(b){Element.getElementsBySelector(b.panelElement,".field_with_errors, .field_error").length>0&&b.itemElement.addClassName("tab_with_errors")}.bind(this))}}),
TimePicker=Class.create();
TimePicker.prototype={initialize:function(b,c){this.value=b;this.options=c;this.balloon=null},create:function(){for(var b=$(document.createElement("div")),c=0;c<=23;c++)for(var d=0;d<60;d+=30){var e=this.formatTime(c,d),f=$(document.createElement("span"));f.className="time";f.time=e;f.href="#";f.observe("click",function(g){this.selected(Event.element(g).time);Event.stop(g)}.bind(this));f.appendChild(document.createTextNode(e));b.appendChild(f)}return b},selected:function(b){this.value=b;this.options.onSelect&&
this.options.onSelect(b);this.balloon&&this.balloon.close()},formatTime:function(b,c){return this.zeroPad(b,2)+":"+this.zeroPad(c,2)},zeroPad:function(b,c){for(b=b.toString();b.length<c;)b="0"+b;return b},setBalloon:function(b){this.balloon=b}};
TimePicker.attachBalloon=function(b,c){c=$(c);var d=document.createElement("img");d.className="time_picker_arrow";d.src="/images/forms/time_picker_button_24.png";d.alt="...";c.parentNode.insertBefore(d,c.nextSibling);var e=new Balloon({content:b.create(),className:"time_picker_balloon",closeable:false,position:new Balloon.Position.Vertical(0,-2),origin:c,tail:null,onMayShow:function(){return!c.disabled}});e.attach(d);b.setBalloon(e);return b};
function link_share(b,c,d){var e;switch(d){case "facebook":e=window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(c)+"&t="+encodeURIComponent(b),d,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "kudos":e=window.open("http://www.kudos.no/giKudos.php?tittel="+escape(b)+"&url="+escape(c),d,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "twitter":e=
window.open("http://www.twitter.com/home?status="+c,d,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "nettby":e=window.open("http://www.nettby.no/user/edit_link.php?name="+escape(b)+"&url="+encodeURIComponent(c)+"&description=",d,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "google":e=window.open("http://www.google.com/bookmarks/mark?op=edit&bkmk="+
encodeURIComponent(c)+"&title="+encodeURIComponent(b),d,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break;case "delicious":e=window.open("http://del.icio.us/post?url="+encodeURIComponent(c)+"&title="+encodeURIComponent(b),d,"location=no,status=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,width=626,height=436");break}e.focus();return false}var DHTMLGoodies={};
if(!String.trim)String.prototype.trim=function(){return this.replace(/^\s+|\s+$/,"")};DHTMLGoodies.ChessFen=function(b){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;b&&this.__setInitProps(b);this.init()};
DHTMLGoodies.ChessFen.prototype={__setInitProps:function(b){if(b.imageFolder)this.imageFolder=b.imageFolder;if(b.squareSize)this.squareSize=b.squareSize;if(b.boardLabels||b.boardLabels===false)this.boardLabels=b.boardLabels;if(b.flipBoardWhenBlackToMove||b.flipBoardWhenBlackToMove===false)this.flipBoardWhenBlackToMove=b.flipBoardWhenBlackToMove;if(b.pieceType)this.pieceType=b.pieceType},setSquareSize:function(b){this.squareSize=b},setPieceType:function(b){this.pieceType=b},init:function(){},setFlipBoardWhenBlackToMove:function(b){this.flipBoardWhenBlackToMove=
b},getWhoToMove:function(){return this.whoToMove},setBoardLabels:function(b){this.boardLabels=b},__setWhoToMove:function(b){this.whoToMove=b.split(/\s/g)[1].trim()},loadFen:function(b,c){this.__setWhoToMove(b);c=this.__getEl(c);c.innerHTML="";var d=document.createElement("DIV");d.className="ChessBoard"+this.squareSize;d.style.position="relative";var e=document.createElement("DIV");e.className="ChessBoardInner"+this.squareSize;if(this.boardLabels){this.__addBoardLabels(d);d.appendChild(e);e.style.position=
"absolute";e.style.top="0px";e.style.right="0px";c.appendChild(d)}else{e.style.position="relative";c.appendChild(e)}this.__loadFen(b,e)},__addBoardLabels:function(b){for(var c=1;c<=8;c++){var d=document.createElement("DIV");d.style.position="absolute";d.style.right=(8-c)*this.squareSize+"px";d.style.bottom="0px";d.innerHTML="ABCDEFGH".substr(c-1,1);d.style.textAlign="center";d.style.width=this.squareSize+"px";b.appendChild(d);d.className="ChessBoardLabel ChessBoardLabel"+this.squareSize;var e=document.createElement("DIV");
e.style.position="absolute";e.style.left="0px";e.style.top=(8-c)*this.squareSize+"px";e.innerHTML=c;e.style.height=this.squareSize+"px";e.style.lineHeight=this.squareSize+"px";b.appendChild(e);e.className="ChessBoardLabel ChessBoardLabel"+this.squareSize;if(this.whoToMove=="b"&&this.flipBoardWhenBlackToMove){e.innerHTML=9-c;d.innerHTML="ABCDEFGH".substr(8-c,1)}}},__loadFen:function(b,c){b=b.split(/\s/g)[0];for(var d=0,e=0;e<b.length;e++){var f=b.substr(e,1);if(f.match(/[A-Z]/i)){var g=this.__getBoardPosByCol(d),
k=document.createElement("DIV");k.style.position="absolute";k.style.left=g.x+"px";k.style.top=g.y+"px";if(f.match(/[A-Z]/))var j="w";if(f.match(/[a-z]/))j="b";g=document.createElement("IMG");g.src=this.imageFolder+this.pieceType+this.squareSize+j+f.toLowerCase()+".png";self.status=this.imageFolder+this.pieceType+this.squareSize+j+f.toLowerCase()+".png";k.appendChild(g);k.className="ChessPiece"+this.squareSize;c.appendChild(k);d++;this.isOldMSIE&&!this.isOpera&&this.correctPng(g)}if(f.match(/[0-8]/))d+=
f/1}},__getBoardPosByCol:function(b){for(var c=0;b>=8;){c++;b-=8}var d={};if(this.whoToMove=="b"&&this.flipBoardWhenBlackToMove){b=7-b;c=7-c}d.x=b*this.squareSize;d.y=c*this.squareSize;return d},__getEl:function(b){if(typeof b=="string"){if(document.getElementById(b))return document.getElementById(b);if(document.forms[b])return document.forms[b];if(document[b])return document[b];if(window[b])return window[b]}return b},correctPng:function(b){b=b=this.__getEl(b);b.outerHTML="<span style=\"position:absolute;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
b.src+"',sizingMethod='scale');width:"+b.width+";height:"+b.height+'"></span>'}};var ObjectFinder=Class.create();
ObjectFinder.prototype={initialize:function(b,c){this.searchField=$(b);this.searchField.observe("blur",this.scheduleSearch.bind(this));this.options=c||{};this.request=null;this.lastQuery="";this.scheduled=null},scheduleSearch:function(){var b=this.searchField.value.strip();if(b!=this.lastQuery&&(!this.selectedHit||this.selectedHit.title!=b)){this.cancelSearch();this.unselect();if(this.scheduled){window.clearTimeout(this.scheduled);this.scheduled=null}if(b.length>0)this.scheduled=window.setTimeout(function(){this.search(b)}.bind(this),
this.options.delay||1E3);else this.depopulate()}},cancelSearch:function(){if(this.request){this.lastQuery=null;this.setRequest(null)}},searchNow:function(){var b=this.searchField.value.strip();b!=""&&this.search(b)},search:function(b){this.lastQuery=b;var c=$(this.searchField.id+"_progress_indicator");this.setRequest(new Ajax.Request(this.options.url,{method:"get",asynchronous:true,evalScripts:true,parameters:encodeURIComponent(this.options.parameter)+"="+b,onLoading:function(){c&&c.show()}.bind(this),
onFailure:function(d){Errors.reportForAjax(d)}.bind(this),onSuccess:function(d,e){d=e||this.evaluateJson(d);this.populate(b,d)}.bind(this),onComplete:function(){c&&c.hide()}.bind(this),onException:function(d,e){Errors.log(e)}.bind(this)}))},evaluateJson:function(b){var c=null;if((b=b.responseText)&&b.toString().strip().length>0)c=eval("("+b+")");return c},depopulate:function(){for(var b=$(this.options.hitContainer||this.options.fieldContainer.nextSibling);b.firstChild;)b.removeChild(b.firstChild);
b.hide();this.selectionElement=null},populate:function(b,c){this.depopulate();if(this.options.maxHits&&c.length>this.options.maxHits){this.display_max_hits_warning=true;c=c.slice(0,this.options.maxHits)}var d=$(this.options.hitContainer||this.options.fieldContainer.nextSibling),e=this.createHitHeader(b,c);e&&d.appendChild(e);e=$(document.createElement("table"));e.className="hit_table";d.appendChild(e);var f=$(document.createElement("tbody"));e.appendChild(f);var g=null;c.each(function(k,j){if(j%1==
0){g=$(document.createElement("tr"));f.appendChild(g)}j=$(document.createElement("td"));var h=$(document.createElement("div"));h.className="hit";h.innerHTML=k.html;j.appendChild(h);g.appendChild(j)}.bind(this));(b=this.createHitFooter(b,c))&&d.appendChild(b);d.show()},createHitHeader:function(b,c){var d=$(document.createElement("div"));if(this.display_max_hits_warning){d.className="max_hits";d.innerHTML=_("Vi kunne ikke vise alle treffene. Skriv litt mer for \u00e5 snevre inn s\u00f8ket.")}else if(c.length==
0)if(this.options.allowCreation){d.className="create_offer";if(this.options.willBeCreated){b=_("<strong>%s</strong> vil bli opprettet. Vil du fylle ut mer informasjon?",b);c=_("Ja takk!")}else{if(this.options.required){d.className="no_results";b=_("Beklager, <strong>%s</strong> fant vi ikke.",b)}else b=_("Du kan opprette <strong>%s</strong> om du vil.",b);c=_("Opprett stedet")}d.innerHTML=b;d.appendChild(document.createTextNode(" "));c=Button.linkToFunction(c,function(){this.showForm();return false}.bind(this),
{color:"green"});d.appendChild(c)}else{d.className="no_results";d.innerHTML=_("Beklager, ingen treff p\u00e5 <strong>%s</strong>.",b)}else if(this.options.allowCreation){d.className="hit_header";d.appendChild(document.createTextNode(this.getHitHeaderText(c)))}return d},getHitHeaderText:function(b){return b.length==1?_("Mente du dette?"):_("Mente du en av disse?")},createHitFooter:function(b,c){if(this.options.allowCreation)if(c.length>0){b=$(document.createElement("div"));b.className="hit_footer";
b.appendChild(document.createTextNode(_("Stod det ikke der?")));b.appendChild(document.createTextNode(" "));c=Button.linkToFunction(this.getHitFooterText(),function(){this.showForm();return false}.bind(this),{color:"green"});b.appendChild(c);return b}},getHitFooterText:function(){return _("Opprett nytt sted")},showForm:function(){var b=$(this.options.createForm);if(b){Form.getElements(b).each(function(c){c.disabled=""});if(!b.visible()){$(this.options.fieldContainer).hide();$(this.options.hitContainer).hide();
b.show();if(b=(new Selector("input[type=text]")).findElements(b)[0]){if(b.value=="")b.value=this.searchField.value;b.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(b){var c=$(document.createElement("div")),d=$(document.createElement("img"));
d.src="/images/action_icons/remove_24.png";d.alt=_("Fjern valg");d.title=d.alt;var e=$(document.createElement("a"));e.href="#";e.observe("click",function(f){this.unselect();this.searchField.value="";Event.stop(f)}.bind(this));e.className="picker_change_link";e.appendChild(d);c.appendChild(e);d=$(document.createElement("span"));d.innerHTML=b.html;this.stripHighlight(d);c.appendChild(d);return c},stripHighlight:function(b){(new Selector("strong.highlight")).findElements(b).each(function(c){for(var d=
$(document.createElement("span"));c.firstChild;){var e=c.firstChild;c.removeChild(e);d.appendChild(e)}c.parentNode.replaceChild(d,c);throw $break;})},setRequest:function(b){if(this.request){if(this.request.transport)try{this.request.transport.abort()}catch(c){}this.request=null}this.request=b}};
var WizardStep=Class.create({initialize:function(b,c){this.number=b;this.stepElement=c;this.enabled=true},enable:function(){this.stepElement.select("input, select, textarea").each(function(b){b.disabled=""})},disable:function(){this.stepElement.select("input, select, textarea").each(function(b){b.disabled=true})},setHasNext:function(b){if(b){this.stepElement.select(".wizard_step_next_button").each(Element.show);this.stepElement.select(".wizard_step_finish_button").each(Element.hide)}else{this.stepElement.select(".wizard_step_next_button").each(Element.hide);
this.stepElement.select(".wizard_step_finish_button").each(Element.show)}},isAutoAccept:function(){return this.stepElement.select(".live_validation_auto_accept").length>0},entered:function(){this.stepElement.select(".live_validation_auto_accept").each(function(b){b.addClassName("live_validation_accepted")})},update:function(){var b=this.isValid();this.stepElement.select(".wizard_step_next_button").each(function(c){c.setOpacity(b?1:0.3)})},isExplicitlyInvalid:function(){return this.stepElement.select(".live_validation.live_validation_rejected").length>
0},isValid:function(){var b=0,c=0;this.stepElement.select(".live_validation").each(function(){var d=false;this.stepElement.select(".live_validation_accepted").each(function(e){if(e.visible())d=true});if(d)b+=1;else c+=1}.bind(this));return b>0&&c==0}}),WizardController=Class.create({initialize:function(b){this.stepsElement=$(b);this.steps=[];this.currentIndex=0;this.pager=new SimpleHorizontalPager(this.stepsElement.select(".wizard_items")[0]);this.setup()},setup:function(){for(var b=0;b<999;b++){var c=
this.stepsElement.select(".wizard_step_"+(b+1))[0];if(!c)break;var d=new WizardStep(b,c);d.title=c.title;d.setHasNext(true);this.steps.push(d)}this.steps.length>0&&this.steps[this.steps.length-1].setHasNext(false);this.goToStep(0);this.update();window.setInterval(this.update.bind(this),500)},currentStep:function(){return this.steps[this.currentIndex]},lastStep:function(){return this.steps[this.steps.length-1]},goToStep:function(b){if(this.checkIfMayJumpTo(b)){for(var c=this.currentIndex;c<=b;c++)this.steps[c].entered();
this.currentIndex=b;this.pager.moveTo(b);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(b){for(var c=this.currentIndex;c<b;c++){var d=this.steps[c];if(!(d.isAutoAccept()||d.isValid())){this.goToStep(c);alert(_("Du m\u00e5 fylle ut feltene riktig f\u00f8r du kan g\u00e5 videre."));return false}}return true},
moved:function(){this.currentIndex>0?this.stepsElement.select(".wizard_step_previous_button").each(Element.show):this.stepsElement.select(".wizard_step_previous_button").each(Element.hide);this.stepsElement.select(".wizard_map li").each(function(b){b.removeClassName("active")});this.stepsElement.select(".wizard_map li.wizard_map_for_step_"+(this.currentIndex+1)).each(function(b){b.addClassName("active")})},update:function(){for(var b=null,c=0;c<this.steps.length;c++){var d=this.steps[c];c==0||b?d.enable():
d.disable();d.update();this.stepsElement.select(".wizard_map li.wizard_map_for_step_"+(c+1)).each(function(e){if(d.isValid()){e.addClassName("valid");e.removeClassName("invalid")}else if(d.isExplicitlyInvalid()){e.addClassName("invalid");e.removeClassName("valid")}else{e.removeClassName("valid");e.removeClassName("invalid")}});if(b==null||b)b=d.isValid()}}});
