window.debug=(function(){var i=this,b=Array.prototype.slice,d=i.console,h={},f,g,m=9,c=["error","warn","info","debug","log"],l="assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace".split(" "),j=l.length,a=[];while(--j>=0){(function(n){h[n]=function(){m!==0&&d&&d[n]&&d[n].apply(d,arguments)}})(l[j])}j=c.length;while(--j>=0){(function(n,o){h[o]=function(){var q=b.call(arguments),p=[o].concat(q);a.push(p);e(p);if(!d||!k(n)){return}d.firebug?d[o].apply(i,q):d[o]?d[o](q):d.log(q)}})(j,c[j])}function e(n){if(f&&(g||!d||!d.log)){f.apply(i,n)}}h.setLevel=function(n){m=typeof n==="number"?n:9};function k(n){return m>0?m>n:c.length+m<=n}h.setCallback=function(){var o=b.call(arguments),n=a.length,p=n;f=o.shift()||null;g=typeof o[0]==="boolean"?o.shift():false;p-=typeof o[0]==="number"?o.shift():n;while(p<n){e(a[p++])}};return h})();

var Prototype={Version:'1.7',Browser:(function(){var ua=navigator.userAgent;var isOpera=Object.prototype.toString.call(window.opera)=='[object Opera]';return{IE:!!window.attachEvent&&!isOpera,Opera:isOpera,WebKit:ua.indexOf('AppleWebKit/')>-1,Gecko:ua.indexOf('Gecko')>-1&&ua.indexOf('KHTML')===-1,MobileSafari:/Apple.*Mobile/.test(ua)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var constructor=window.Element||window.HTMLElement;return!!(constructor&&constructor.prototype);})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=='undefined')
return true;var div=document.createElement('div'),form=document.createElement('form'),isSupported=false;if(div['__proto__']&&(div['__proto__']!==form['__proto__'])){isSupported=true;}
div=form=null;return isSupported;})()},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)
Prototype.BrowserFeatures.SpecificElementExtensions=false;var Abstract={};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}};var Class=(function(){var IS_DONTENUM_BUGGY=(function(){for(var p in{toString:1}){if(p==='toString')return false;}
return true;})();function subclass(){};function create(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))
parent=properties.shift();function klass(){this.initialize.apply(this,arguments);}
Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
for(var i=0,length=properties.length;i<length;i++)
klass.addMethods(properties[i]);if(!klass.prototype.initialize)
klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}
function addMethods(source){var ancestor=this.superclass&&this.superclass.prototype,properties=Object.keys(source);if(IS_DONTENUM_BUGGY){if(source.toString!=Object.prototype.toString)
properties.push("toString");if(source.valueOf!=Object.prototype.valueOf)
properties.push("valueOf");}
for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames()[0]=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments);};})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method);}
this.prototype[property]=value;}
return this;}
return{create:create,Methods:{addMethods:addMethods}};})();(function(){var _toString=Object.prototype.toString,NULL_TYPE='Null',UNDEFINED_TYPE='Undefined',BOOLEAN_TYPE='Boolean',NUMBER_TYPE='Number',STRING_TYPE='String',OBJECT_TYPE='Object',FUNCTION_CLASS='[object Function]',BOOLEAN_CLASS='[object Boolean]',NUMBER_CLASS='[object Number]',STRING_CLASS='[object String]',ARRAY_CLASS='[object Array]',DATE_CLASS='[object Date]',NATIVE_JSON_STRINGIFY_SUPPORT=window.JSON&&typeof JSON.stringify==='function'&&JSON.stringify(0)==='0'&&typeof JSON.stringify(Prototype.K)==='undefined';function Type(o){switch(o){case null:return NULL_TYPE;case(void 0):return UNDEFINED_TYPE;}
var type=typeof o;switch(type){case'boolean':return BOOLEAN_TYPE;case'number':return NUMBER_TYPE;case'string':return STRING_TYPE;}
return OBJECT_TYPE;}
function extend(destination,source){for(var property in source)
destination[property]=source[property];return destination;}
function inspect(object){try{if(isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object);}catch(e){if(e instanceof RangeError)return'...';throw e;}}
function toJSON(value){return Str('',{'':value},[]);}
function Str(key,holder,stack){var value=holder[key],type=typeof value;if(Type(value)===OBJECT_TYPE&&typeof value.toJSON==='function'){value=value.toJSON(key);}
var _class=_toString.call(value);switch(_class){case NUMBER_CLASS:case BOOLEAN_CLASS:case STRING_CLASS:value=value.valueOf();}
switch(value){case null:return'null';case true:return'true';case false:return'false';}
type=typeof value;switch(type){case'string':return value.inspect(true);case'number':return isFinite(value)?String(value):'null';case'object':for(var i=0,length=stack.length;i<length;i++){if(stack[i]===value){throw new TypeError();}}
stack.push(value);var partial=[];if(_class===ARRAY_CLASS){for(var i=0,length=value.length;i<length;i++){var str=Str(i,value,stack);partial.push(typeof str==='undefined'?'null':str);}
partial='['+partial.join(',')+']';}else{var keys=Object.keys(value);for(var i=0,length=keys.length;i<length;i++){var key=keys[i],str=Str(key,value,stack);if(typeof str!=="undefined"){partial.push(key.inspect(true)+':'+str);}}
partial='{'+partial.join(',')+'}';}
stack.pop();return partial;}}
function stringify(object){return JSON.stringify(object);}
function toQueryString(object){return $H(object).toQueryString();}
function toHTML(object){return object&&object.toHTML?object.toHTML():String.interpret(object);}
function keys(object){if(Type(object)!==OBJECT_TYPE){throw new TypeError();}
var results=[];for(var property in object){if(object.hasOwnProperty(property)){results.push(property);}}
return results;}
function values(object){var results=[];for(var property in object)
results.push(object[property]);return results;}
function clone(object){return extend({},object);}
function isElement(object){return!!(object&&object.nodeType==1);}
function isArray(object){return _toString.call(object)===ARRAY_CLASS;}
var hasNativeIsArray=(typeof Array.isArray=='function')&&Array.isArray([])&&!Array.isArray({});if(hasNativeIsArray){isArray=Array.isArray;}
function isHash(object){return object instanceof Hash;}
function isFunction(object){return _toString.call(object)===FUNCTION_CLASS;}
function isString(object){return _toString.call(object)===STRING_CLASS;}
function isNumber(object){return _toString.call(object)===NUMBER_CLASS;}
function isDate(object){return _toString.call(object)===DATE_CLASS;}
function isUndefined(object){return typeof object==="undefined";}
extend(Object,{extend:extend,inspect:inspect,toJSON:NATIVE_JSON_STRINGIFY_SUPPORT?stringify:toJSON,toQueryString:toQueryString,toHTML:toHTML,keys:Object.keys||keys,values:values,clone:clone,isElement:isElement,isArray:isArray,isHash:isHash,isFunction:isFunction,isString:isString,isNumber:isNumber,isDate:isDate,isUndefined:isUndefined});})();Object.extend(Function.prototype,(function(){var slice=Array.prototype.slice;function update(array,args){var arrayLength=array.length,length=args.length;while(length--)array[arrayLength+length]=args[length];return array;}
function merge(array,args){array=slice.call(array,0);return update(array,args);}
function argumentNames(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,'').replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names;}
function bind(context){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=slice.call(arguments,1);return function(){var a=merge(args,arguments);return __method.apply(context,a);}}
function bindAsEventListener(context){var __method=this,args=slice.call(arguments,1);return function(event){var a=update([event||window.event],args);return __method.apply(context,a);}}
function curry(){if(!arguments.length)return this;var __method=this,args=slice.call(arguments,0);return function(){var a=merge(args,arguments);return __method.apply(this,a);}}
function delay(timeout){var __method=this,args=slice.call(arguments,1);timeout=timeout*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);}
function defer(){var args=update([0.01],arguments);return this.delay.apply(this,args);}
function wrap(wrapper){var __method=this;return function(){var a=update([__method.bind(this)],arguments);return wrapper.apply(this,a);}}
function methodize(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){var a=update([this],arguments);return __method.apply(null,a);};}
return{argumentNames:argumentNames,bind:bind,bindAsEventListener:bindAsEventListener,curry:curry,delay:delay,defer:defer,wrap:wrap,methodize:methodize}})());(function(proto){function toISOString(){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';}
function toJSON(){return this.toISOString();}
if(!proto.toISOString)proto.toISOString=toISOString;if(!proto.toJSON)proto.toJSON=toJSON;})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:function(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false;}catch(e){this.currentlyExecuting=false;throw e;}}}});Object.extend(String,{interpret:function(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==='function'&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};}
function gsub(pattern,replacement){var result='',source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern))
pattern=RegExp.escape(pattern);if(!(pattern.length||pattern.source)){replacement=replacement('');return replacement+source.split('').join(replacement)+replacement;}
while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;}
function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});}
function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this);}
function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);}
function strip(){return this.replace(/^\s+/,'').replace(/\s+$/,'');}
function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,'');}
function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');}
function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,'img'),matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});}
function evalScripts(){return this.extractScripts().map(function(script){return eval(script)});}
function escapeHTML(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}
function unescapeHTML(){return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');}
function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
else hash[key]=value;}
return hash;});}
function toArray(){return this.split('');}
function succ(){return this.slice(0,this.length-1)+
String.fromCharCode(this.charCodeAt(this.length-1)+1);}
function times(count){return count<1?'':new Array(count+1).join(this);}
function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():'';});}
function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();}
function underscore(){return this.replace(/::/g,'/').replace(/([A-Z]+)([A-Z][a-z])/g,'$1_$2').replace(/([a-z\d])([A-Z])/g,'$1_$2').replace(/-/g,'_').toLowerCase();}
function dasherize(){return this.replace(/_/g,'-');}
function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character];}
return'\\u00'+character.charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'";}
function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,'$1');}
function isJSON(){var str=this;if(str.blank())return false;str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@');str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,'');return(/^[\],:{}\s]*$/).test(str);}
function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
throw new SyntaxError('Badly formed JSON string: '+this.inspect());}
function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json);}
function include(pattern){return this.indexOf(pattern)>-1;}
function startsWith(pattern){return this.lastIndexOf(pattern,0)===0;}
function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d;}
function empty(){return this=='';}
function blank(){return/^\s*$/.test(this);}
function interpolate(object,pattern){return new Template(this,pattern).evaluate(object);}
return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate};})());var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(object&&Object.isFunction(object.toTemplateReplacements))
object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return(match[1]+'');var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3],pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].replace(/\\\\]/g,']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}
return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function each(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;}
return this;}
function eachSlice(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)<array.length)
slices.push(array.slice(index,index+number));return slices.collect(iterator,context);}
function all(iterator,context){iterator=iterator||Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result)throw $break;});return result;}
function any(iterator,context){iterator=iterator||Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index))
throw $break;});return result;}
function collect(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index));});return results;}
function detect(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break;}});return result;}
function findAll(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))
results.push(value);});return results;}
function grep(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))
filter=new RegExp(RegExp.escape(filter));this.each(function(value,index){if(filter.match(value))
results.push(iterator.call(context,value,index));});return results;}
function include(object){if(Object.isFunction(this.indexOf))
if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;}
function inGroupsOf(number,fillWith){fillWith=Object.isUndefined(fillWith)?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice;});}
function inject(memo,iterator,context){this.each(function(value,index){memo=iterator.call(context,memo,value,index);});return memo;}
function invoke(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});}
function max(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
result=value;});return result;}
function min(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result)
result=value;});return result;}
function partition(iterator,context){iterator=iterator||Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value);});return[trues,falses];}
function pluck(property){var results=[];this.each(function(value){results.push(value[property]);});return results;}
function reject(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))
results.push(value);});return results;}
function sortBy(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');}
function toArray(){return this.map();}
function zip(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});}
function size(){return this.toArray().length;}
function inspect(){return'#<Enumerable:'+this.toArray().inspect()+'>';}
return{each:each,eachSlice:eachSlice,all:all,every:all,any:any,some:any,collect:collect,map:collect,detect:detect,findAll:findAll,select:findAll,filter:findAll,grep:grep,include:include,member:include,inGroupsOf:inGroupsOf,inject:inject,invoke:invoke,max:max,min:min,partition:partition,pluck:pluck,reject:reject,sortBy:sortBy,toArray:toArray,entries:toArray,zip:zip,size:size,inspect:inspect,find:detect};})();function $A(iterable){if(!iterable)return[];if('toArray'in Object(iterable))return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
Array.from=$A;(function(){var arrayProto=Array.prototype,slice=arrayProto.slice,_each=arrayProto.forEach;function each(iterator,context){for(var i=0,length=this.length>>>0;i<length;i++){if(i in this)iterator.call(context,this[i],i,this);}}
if(!_each)_each=each;function clear(){this.length=0;return this;}
function first(){return this[0];}
function last(){return this[this.length-1];}
function compact(){return this.select(function(value){return value!=null;});}
function flatten(){return this.inject([],function(array,value){if(Object.isArray(value))
return array.concat(value.flatten());array.push(value);return array;});}
function without(){var values=slice.call(arguments,0);return this.select(function(value){return!values.include(value);});}
function reverse(inline){return(inline===false?this.toArray():this)._reverse();}
function uniq(sorted){return this.inject([],function(array,value,index){if(0==index||(sorted?array.last()!=value:!array.include(value)))
array.push(value);return array;});}
function intersect(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});}
function clone(){return slice.call(this,0);}
function size(){return this.length;}
function inspect(){return'['+this.map(Object.inspect).join(', ')+']';}
function indexOf(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)
if(this[i]===item)return i;return-1;}
function lastIndexOf(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;}
function concat(){var array=slice.call(this,0),item;for(var i=0,length=arguments.length;i<length;i++){item=arguments[i];if(Object.isArray(item)&&!('callee'in item)){for(var j=0,arrayLength=item.length;j<arrayLength;j++)
array.push(item[j]);}else{array.push(item);}}
return array;}
Object.extend(arrayProto,Enumerable);if(!arrayProto._reverse)
arrayProto._reverse=arrayProto.reverse;Object.extend(arrayProto,{_each:_each,clear:clear,first:first,last:last,compact:compact,flatten:flatten,without:without,reverse:reverse,uniq:uniq,intersect:intersect,clone:clone,toArray:clone,size:size,inspect:inspect});var CONCAT_ARGUMENTS_BUGGY=(function(){return[].concat(arguments)[0][0]!==1;})(1,2)
if(CONCAT_ARGUMENTS_BUGGY)arrayProto.concat=concat;if(!arrayProto.indexOf)arrayProto.indexOf=indexOf;if(!arrayProto.lastIndexOf)arrayProto.lastIndexOf=lastIndexOf;})();function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function initialize(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);}
function _each(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}}
function set(key,value){return this._object[key]=value;}
function get(key){if(this._object[key]!==Object.prototype[key])
return this._object[key];}
function unset(key){var value=this._object[key];delete this._object[key];return value;}
function toObject(){return Object.clone(this._object);}
function keys(){return this.pluck('key');}
function values(){return this.pluck('value');}
function index(value){var match=this.detect(function(pair){return pair.value===value;});return match&&match.key;}
function merge(object){return this.clone().update(object);}
function update(object){return new Hash(object).inject(this,function(result,pair){result.set(pair.key,pair.value);return result;});}
function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
function toQueryString(){return this.inject([],function(results,pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values)){var queryValues=[];for(var i=0,len=values.length,value;i<len;i++){value=values[i];queryValues.push(toQueryPair(key,value));}
return results.concat(queryValues);}}else results.push(toQueryPair(key,values));return results;}).join('&');}
function inspect(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';}
function clone(){return new Hash(this);}
return{initialize:initialize,_each:_each,set:set,get:get,unset:unset,toObject:toObject,toTemplateReplacements:toObject,keys:keys,values:values,index:index,merge:merge,update:update,toQueryString:toQueryString,inspect:inspect,toJSON:toObject,clone:clone};})());Hash.from=$H;Object.extend(Number.prototype,(function(){function toColorPart(){return this.toPaddedString(2,16);}
function succ(){return this+1;}
function times(iterator,context){$R(0,this,true).each(iterator,context);return this;}
function toPaddedString(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string;}
function abs(){return Math.abs(this);}
function round(){return Math.round(this);}
function ceil(){return Math.ceil(this);}
function floor(){return Math.floor(this);}
return{toColorPart:toColorPart,succ:succ,times:times,toPaddedString:toPaddedString,abs:abs,round:round,ceil:ceil,floor:floor};})());function $R(start,end,exclusive){return new ObjectRange(start,end,exclusive);}
var ObjectRange=Class.create(Enumerable,(function(){function initialize(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;}
function _each(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}}
function include(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end;}
return{initialize:initialize,_each:_each,include:include};})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
this.responders.push(responder);},unregister:function(responder){this.responders=this.responders.without(responder);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(Object.isFunction(responder[callback])){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters))
this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!['get','post'].include(this.method)){params+=(params?'&':'')+"_method="+this.method;this.method='post';}
if(params&&this.method==='get'){this.url+=(this.url.include('?')?'&':'?')+params;}
this.parameters=params.toQueryParams();try{var response=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(response);Ajax.Responders.dispatch('onCreate',this,response);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous)this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
this.onStateChange();}
catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))
this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['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)
headers['Connection']='close';}
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))
for(var i=0,length=extras.length;i<length;i+=2)
headers[extras[i]]=extras[i+1];else
$H(extras).each(function(pair){headers[pair.key]=pair.value});}
for(var name in headers)
this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300)||status==304;},getStatus:function(){try{if(this.transport.status===1223)return 204;return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}
var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
this.evalResponse();}
try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{protocol}//#{domain}#{port}'.interpolate({protocol:location.protocol,domain:document.domain,port:location.port?':'+location.port:''}));},getHeader:function(name){try{return this.transport.getResponseHeader(name)||null;}catch(e){return null;}},evalResponse:function(){try{return eval((this.transport.responseText||'').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=this._getResponseJSON();}},status:0,statusText:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return''}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders();}catch(e){return null}},getResponseHeader:function(name){return this.transport.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders();},_getHeaderJSON:function(){var json=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
else options.insertion(receiver,responseText);}
else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;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(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.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 $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
elements.push($(arguments[i]));return elements;}
if(Object.isString(element))
element=document.getElementById(element);return Element.extend(element);}
if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)
results.push(Element.extend(query.snapshotItem(i)));return results;};}
if(!Node)var Node={};if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});}
(function(global){function shouldUseCache(tagName,attributes){if(tagName==='select')return false;if('type'in attributes)return false;return true;}
var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX=(function(){try{var el=document.createElement('<input name="x">');return el.tagName.toLowerCase()==='input'&&el.name==='x';}
catch(err){return false;}})();var element=global.Element;global.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(HAS_EXTENDED_CREATE_ELEMENT_SYNTAX&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));var node=shouldUseCache(tagName,attributes)?cache[tagName].cloneNode(false):document.createElement(tagName);return Element.writeAttribute(node,attributes);};Object.extend(global.Element,element||{});if(element)global.Element.prototype=element.prototype;})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(element){var uid=element._prototypeUID;if(uid){Element.stopObserving(element);element._prototypeUID=void 0;delete Element.Storage[uid];}}
Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:(function(){var SELECT_ELEMENT_INNERHTML_BUGGY=(function(){var el=document.createElement("select"),isBuggy=true;el.innerHTML="<option value=\"test\">test</option>";if(el.options&&el.options[0]){isBuggy=el.options[0].nodeName.toUpperCase()!=="OPTION";}
el=null;return isBuggy;})();var TABLE_ELEMENT_INNERHTML_BUGGY=(function(){try{var el=document.createElement("table");if(el&&el.tBodies){el.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var isBuggy=typeof el.tBodies[0]=="undefined";el=null;return isBuggy;}}catch(e){return true;}})();var LINK_ELEMENT_INNERHTML_BUGGY=(function(){try{var el=document.createElement('div');el.innerHTML="<link>";var isBuggy=(el.childNodes.length===0);el=null;return isBuggy;}catch(e){return true;}})();var ANY_INNERHTML_BUGGY=SELECT_ELEMENT_INNERHTML_BUGGY||TABLE_ELEMENT_INNERHTML_BUGGY||LINK_ELEMENT_INNERHTML_BUGGY;var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING=(function(){var s=document.createElement("script"),isBuggy=false;try{s.appendChild(document.createTextNode(""));isBuggy=!s.firstChild||s.firstChild&&s.firstChild.nodeType!==3;}catch(e){isBuggy=true;}
s=null;return isBuggy;})();function update(element,content){element=$(element);var purgeElement=Element._purgeElement;var descendants=element.getElementsByTagName('*'),i=descendants.length;while(i--)purgeElement(descendants[i]);if(content&&content.toElement)
content=content.toElement();if(Object.isElement(content))
return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName==='SCRIPT'&&SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING){element.text=content;return element;}
if(ANY_INNERHTML_BUGGY){if(tagName in Element._insertionTranslations.tags){while(element.firstChild){element.removeChild(element.firstChild);}
Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)});}else if(LINK_ELEMENT_INNERHTML_BUGGY&&Object.isString(content)&&content.indexOf('<link')>-1){while(element.firstChild){element.removeChild(element.firstChild);}
var nodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts(),true);nodes.each(function(node){element.appendChild(node)});}
else{element.innerHTML=content.stripScripts();}}
else{element.innerHTML=content.stripScripts();}
content.evalScripts.bind(content).defer();return element;}
return update;})(),replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;}
content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
$(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last(),value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property,maximumLength){element=$(element);maximumLength=maximumLength||-1;var elements=[];while(element=element[property]){if(element.nodeType==1)
elements.push(Element.extend(element));if(elements.length==maximumLength)
break;}
return elements;},ancestors:function(element){return Element.recursivelyCollect(element,'parentNode');},descendants:function(element){return Element.select(element,"*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){var results=[],child=$(element).firstChild;while(child){if(child.nodeType===1){results.push(Element.extend(child));}
child=child.nextSibling;}
return results;},previousSiblings:function(element,maximumLength){return Element.recursivelyCollect(element,'previousSibling');},nextSiblings:function(element){return Element.recursivelyCollect(element,'nextSibling');},siblings:function(element){element=$(element);return Element.previousSiblings(element).reverse().concat(Element.nextSiblings(element));},match:function(element,selector){element=$(element);if(Object.isString(selector))
return Prototype.Selector.match(element,selector);return selector.match(element);},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=Element.ancestors(element);return Object.isNumber(expression)?ancestors[expression]:Prototype.Selector.find(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return Element.firstDescendant(element);return Object.isNumber(expression)?Element.descendants(element)[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(Object.isNumber(expression))index=expression,expression=false;if(!Object.isNumber(index))index=0;if(expression){return Prototype.Selector.find(element.previousSiblings(),expression,index);}else{return element.recursivelyCollect("previousSibling",index+1)[index];}},next:function(element,expression,index){element=$(element);if(Object.isNumber(expression))index=expression,expression=false;if(!Object.isNumber(index))index=0;if(expression){return Prototype.Selector.find(element.nextSiblings(),expression,index);}else{var maximumLength=Object.isNumber(index)?index+1:1;return element.recursivelyCollect("nextSibling",index+1)[index];}},select:function(element){element=$(element);var expressions=Array.prototype.slice.call(arguments,1).join(', ');return Prototype.Selector.select(expressions,element);},adjacent:function(element){element=$(element);var expressions=Array.prototype.slice.call(arguments,1).join(', ');return Prototype.Selector.select(expressions,element.parentNode).without(element);},identify:function(element){element=$(element);var id=Element.readAttribute(element,'id');if(id)return id;do{id='anonymous_element_'+Element.idCounter++}while($(id));Element.writeAttribute(element,'id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)
element.removeAttribute(name);else if(value===true)
element.setAttribute(name,name);else element.setAttribute(name,value);}
return element;},getHeight:function(element){return Element.getDimensions(element).height;},getWidth:function(element){return Element.getDimensions(element).width;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!Element.hasClassName(element,className))
element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return Element[Element.hasClassName(element,className)?'removeClassName':'addClassName'](element,className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
element.removeChild(node);node=nextNode;}
return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)
return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)
return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)
if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=Element.cumulativeOffset(element);window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}
if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;}
for(var property in styles)
if(property=='opacity')element.setOpacity(styles[property]);else
elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}}
return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')
element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=Element.viewportOffset(source),delta=[0,0],parent=null;element=$(element);if(Element.getStyle(element,'position')=='absolute'){parent=Element.getOffsetParent(element);delta=Element.viewportOffset(parent);}
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};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(proceed,element,style){switch(style){case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});}
else if(Prototype.Browser.IE){Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))
if(value[1])return parseFloat(value[1])/100;return 1.0;}
if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))
return element['offset'+style.capitalize()]+'px';return null;}
return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');}
element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))
element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations=(function(){var classProp='className',forProp='for',el=document.createElement('div');el.setAttribute(classProp,'x');if(el.className!=='x'){el.setAttribute('class','x');if(el.className==='x'){classProp='class';}}
el=null;el=document.createElement('label');el.setAttribute(forProp,'x');if(el.htmlFor!=='x'){el.setAttribute('htmlFor','x');if(el.htmlFor==='x'){forProp='htmlFor';}}
el=null;return{read:{names:{'class':classProp,'className':classProp,'for':forProp,'htmlFor':forProp},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute);},_getAttr2:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:(function(){var el=document.createElement('div'),f;el.onclick=Prototype.emptyFunction;var value=el.getAttribute('onclick');if(String(value).indexOf('{')>-1){f=function(element,attribute){attribute=element.getAttribute(attribute);if(!attribute)return null;attribute=attribute.toString();attribute=attribute.split('{')[1];attribute=attribute.split('}')[0];return attribute.strip();};}
else if(value===''){f=function(element,attribute){attribute=element.getAttribute(attribute);if(!attribute)return null;return attribute.strip();};}
el=null;return f;})(),_flag:function(element,attribute){return $(element).hasAttribute(attribute)?attribute:null;},style:function(element){return element.style.cssText.toLowerCase();},title:function(element){return element.title;}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr;});(function(v){Object.extend(v,{href:v._getAttr2,src:v._getAttr2,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v._getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv});})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function _descendants(element){var nodes=element.getElementsByTagName('*'),results=[];for(var i=0,node;node=nodes[i];i++)
if(node.tagName!=="!")
results.push(node);return results;}
Element.Methods.down=function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?_descendants(element)[expression]:Element.select(element,expression)[index||0];}})();}}
else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)
if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}
return element;};}
if('outerHTML'in document.documentElement){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next(),fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)
fragments.each(function(node){parent.insertBefore(node,nextSibling)});else
fragments.each(function(node){parent.appendChild(node)});}
else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html,force){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];var workaround=false;if(t)workaround=true;else if(force){workaround=true;t=['','',0];}
if(workaround){div.innerHTML='&nbsp;'+t[0]+html+t[1];div.removeChild(div.firstChild);for(var i=t[2];i--;){div=div.firstChild;}}
else{div.innerHTML=html;}
return $A(div.childNodes);};Element._insertionTranslations={before:function(element,node){element.parentNode.insertBefore(node,element);},top:function(element,node){element.insertBefore(node,element.firstChild);},bottom:function(element,node){element.appendChild(node);},after:function(element,node){element.parentNode.insertBefore(node,element.nextSibling);},tags:{TABLE:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</select>',1]}};(function(){var tags=Element._insertionTranslations.tags;Object.extend(tags,{THEAD:tags.TBODY,TFOOT:tags.TBODY,TH:tags.TD});})();Element.Methods.Simulated={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(div){if(!Prototype.BrowserFeatures.ElementExtensions&&div['__proto__']){window.HTMLElement={};window.HTMLElement.prototype=div['__proto__'];Prototype.BrowserFeatures.ElementExtensions=true;}
div=null;})(document.createElement('div'));Element.extend=(function(){function checkDeficiency(tagName){if(typeof window.Element!='undefined'){var proto=window.Element.prototype;if(proto){var id='_'+(Math.random()+'').slice(2),el=document.createElement(tagName);proto[id]='x';var isBuggy=(el[id]!=='x');delete proto[id];el=null;return isBuggy;}}
return false;}
function extendElementWith(element,methods){for(var property in methods){var value=methods[property];if(Object.isFunction(value)&&!(property in element))
element[property]=value.methodize();}}
var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY=checkDeficiency('object');if(Prototype.BrowserFeatures.SpecificElementExtensions){if(HTMLOBJECTELEMENT_PROTOTYPE_BUGGY){return function(element){if(element&&typeof element._extendedByPrototype=='undefined'){var t=element.tagName;if(t&&(/^(?:object|applet|embed)$/i.test(t))){extendElementWith(element,Element.Methods);extendElementWith(element,Element.Methods.Simulated);extendElementWith(element,Element.Methods.ByTag[t.toUpperCase()]);}}
return element;}}
return Prototype.K;}
var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||typeof element._extendedByPrototype!='undefined'||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase();if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);extendElementWith(element,methods);element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(element,attribute){return element.hasAttribute(attribute);};}
else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute;}
Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!methods){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),"BUTTON":Object.clone(Form.Element.Methods)});}
if(arguments.length==2){var tagName=methods;methods=arguments[1];}
if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}
function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])
Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);}
function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))
destination[property]=value.methodize();}}
function findDOMClass(tagName){var klass;var trans={"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(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];var element=document.createElement(tagName),proto=element['__proto__']||element.constructor.prototype;element=null;return proto;}
var elementPrototype=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(F.ElementExtensions){copy(Element.Methods,elementPrototype);copy(Element.Methods.Simulated,elementPrototype,true);}
if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}
Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()};},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);}};(function(viewport){var B=Prototype.Browser,doc=document,element,property={};function getRootElement(){if(B.WebKit&&!doc.evaluate)
return document;if(B.Opera&&window.parseFloat(window.opera.version())<9.5)
return document.body;return document.documentElement;}
function define(D){if(!element)element=getRootElement();property[D]='client'+D;viewport['get'+D]=function(){return element[property[D]]};return viewport['get'+D]();}
viewport.getWidth=define.curry('Width');viewport.getHeight=define.curry('Height');})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(element){if(!(element=$(element)))return;var uid;if(element===window){uid=0;}else{if(typeof element._prototypeUID==="undefined")
element._prototypeUID=Element.Storage.UID++;uid=element._prototypeUID;}
if(!Element.Storage[uid])
Element.Storage[uid]=$H();return Element.Storage[uid];},store:function(element,key,value){if(!(element=$(element)))return;if(arguments.length===2){Element.getStorage(element).update(key);}else{Element.getStorage(element).set(key,value);}
return element;},retrieve:function(element,key,defaultValue){if(!(element=$(element)))return;var hash=Element.getStorage(element),value=hash.get(key);if(Object.isUndefined(value)){hash.set(key,defaultValue);value=defaultValue;}
return value;},clone:function(element,deep){if(!(element=$(element)))return;var clone=element.cloneNode(deep);clone._prototypeUID=void 0;if(deep){var descendants=Element.select(clone,'*'),i=descendants.length;while(i--){descendants[i]._prototypeUID=void 0;}}
return Element.extend(clone);},purge:function(element){if(!(element=$(element)))return;var purgeElement=Element._purgeElement;purgeElement(element);var descendants=element.getElementsByTagName('*'),i=descendants.length;while(i--)purgeElement(descendants[i]);return null;}});(function(){function toDecimal(pctString){var match=pctString.match(/^(\d+)%?$/i);if(!match)return null;return(Number(match[1])/100);}
function getPixelValue(value,property,context){var element=null;if(Object.isElement(value)){element=value;value=element.getStyle(property);}
if(value===null){return null;}
if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)){return window.parseFloat(value);}
var isPercentage=value.include('%'),isViewport=(context===document.viewport);if(/\d/.test(value)&&element&&element.runtimeStyle&&!(isPercentage&&isViewport)){var style=element.style.left,rStyle=element.runtimeStyle.left;element.runtimeStyle.left=element.currentStyle.left;element.style.left=value||0;value=element.style.pixelLeft;element.style.left=style;element.runtimeStyle.left=rStyle;return value;}
if(element&&isPercentage){context=context||element.parentNode;var decimal=toDecimal(value);var whole=null;var position=element.getStyle('position');var isHorizontal=property.include('left')||property.include('right')||property.include('width');var isVertical=property.include('top')||property.include('bottom')||property.include('height');if(context===document.viewport){if(isHorizontal){whole=document.viewport.getWidth();}else if(isVertical){whole=document.viewport.getHeight();}}else{if(isHorizontal){whole=$(context).measure('width');}else if(isVertical){whole=$(context).measure('height');}}
return(whole===null)?0:whole*decimal;}
return 0;}
function toCSSPixels(number){if(Object.isString(number)&&number.endsWith('px')){return number;}
return number+'px';}
function isDisplayed(element){var originalElement=element;while(element&&element.parentNode){var display=element.getStyle('display');if(display==='none'){return false;}
element=$(element.parentNode);}
return true;}
var hasLayout=Prototype.K;if('currentStyle'in document.documentElement){hasLayout=function(element){if(!element.currentStyle.hasLayout){element.style.zoom=1;}
return element;};}
function cssNameFor(key){if(key.include('border'))key=key+'-width';return key.camelize();}
Element.Layout=Class.create(Hash,{initialize:function($super,element,preCompute){$super();this.element=$(element);Element.Layout.PROPERTIES.each(function(property){this._set(property,null);},this);if(preCompute){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false;}},_set:function(property,value){return Hash.prototype.set.call(this,property,value);},set:function(property,value){throw"Properties of Element.Layout are read-only.";},get:function($super,property){var value=$super(property);return value===null?this._compute(property):value;},_begin:function(){if(this._prepared)return;var element=this.element;if(isDisplayed(element)){this._prepared=true;return;}
var originalStyles={position:element.style.position||'',width:element.style.width||'',visibility:element.style.visibility||'',display:element.style.display||''};element.store('prototype_original_styles',originalStyles);var position=element.getStyle('position'),width=element.getStyle('width');if(width==="0px"||width===null){element.style.display='block';width=element.getStyle('width');}
var context=(position==='fixed')?document.viewport:element.parentNode;element.setStyle({position:'absolute',visibility:'hidden',display:'block'});var positionedWidth=element.getStyle('width');var newWidth;if(width&&(positionedWidth===width)){newWidth=getPixelValue(element,'width',context);}else if(position==='absolute'||position==='fixed'){newWidth=getPixelValue(element,'width',context);}else{var parent=element.parentNode,pLayout=$(parent).getLayout();newWidth=pLayout.get('width')-
this.get('margin-left')-
this.get('border-left')-
this.get('padding-left')-
this.get('padding-right')-
this.get('border-right')-
this.get('margin-right');}
element.setStyle({width:newWidth+'px'});this._prepared=true;},_end:function(){var element=this.element;var originalStyles=element.retrieve('prototype_original_styles');element.store('prototype_original_styles',null);element.setStyle(originalStyles);this._prepared=false;},_compute:function(property){var COMPUTATIONS=Element.Layout.COMPUTATIONS;if(!(property in COMPUTATIONS)){throw"Property not found.";}
return this._set(property,COMPUTATIONS[property].call(this,this.element));},toObject:function(){var args=$A(arguments);var keys=(args.length===0)?Element.Layout.PROPERTIES:args.join(' ').split(' ');var obj={};keys.each(function(key){if(!Element.Layout.PROPERTIES.include(key))return;var value=this.get(key);if(value!=null)obj[key]=value;},this);return obj;},toHash:function(){var obj=this.toObject.apply(this,arguments);return new Hash(obj);},toCSS:function(){var args=$A(arguments);var keys=(args.length===0)?Element.Layout.PROPERTIES:args.join(' ').split(' ');var css={};keys.each(function(key){if(!Element.Layout.PROPERTIES.include(key))return;if(Element.Layout.COMPOSITE_PROPERTIES.include(key))return;var value=this.get(key);if(value!=null)css[cssNameFor(key)]=value+'px';},this);return css;},inspect:function(){return"#<Element.Layout>";}});Object.extend(Element.Layout,{PROPERTIES:$w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'),COMPOSITE_PROPERTIES:$w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'),COMPUTATIONS:{'height':function(element){if(!this._preComputing)this._begin();var bHeight=this.get('border-box-height');if(bHeight<=0){if(!this._preComputing)this._end();return 0;}
var bTop=this.get('border-top'),bBottom=this.get('border-bottom');var pTop=this.get('padding-top'),pBottom=this.get('padding-bottom');if(!this._preComputing)this._end();return bHeight-bTop-bBottom-pTop-pBottom;},'width':function(element){if(!this._preComputing)this._begin();var bWidth=this.get('border-box-width');if(bWidth<=0){if(!this._preComputing)this._end();return 0;}
var bLeft=this.get('border-left'),bRight=this.get('border-right');var pLeft=this.get('padding-left'),pRight=this.get('padding-right');if(!this._preComputing)this._end();return bWidth-bLeft-bRight-pLeft-pRight;},'padding-box-height':function(element){var height=this.get('height'),pTop=this.get('padding-top'),pBottom=this.get('padding-bottom');return height+pTop+pBottom;},'padding-box-width':function(element){var width=this.get('width'),pLeft=this.get('padding-left'),pRight=this.get('padding-right');return width+pLeft+pRight;},'border-box-height':function(element){if(!this._preComputing)this._begin();var height=element.offsetHeight;if(!this._preComputing)this._end();return height;},'border-box-width':function(element){if(!this._preComputing)this._begin();var width=element.offsetWidth;if(!this._preComputing)this._end();return width;},'margin-box-height':function(element){var bHeight=this.get('border-box-height'),mTop=this.get('margin-top'),mBottom=this.get('margin-bottom');if(bHeight<=0)return 0;return bHeight+mTop+mBottom;},'margin-box-width':function(element){var bWidth=this.get('border-box-width'),mLeft=this.get('margin-left'),mRight=this.get('margin-right');if(bWidth<=0)return 0;return bWidth+mLeft+mRight;},'top':function(element){var offset=element.positionedOffset();return offset.top;},'bottom':function(element){var offset=element.positionedOffset(),parent=element.getOffsetParent(),pHeight=parent.measure('height');var mHeight=this.get('border-box-height');return pHeight-mHeight-offset.top;},'left':function(element){var offset=element.positionedOffset();return offset.left;},'right':function(element){var offset=element.positionedOffset(),parent=element.getOffsetParent(),pWidth=parent.measure('width');var mWidth=this.get('border-box-width');return pWidth-mWidth-offset.left;},'padding-top':function(element){return getPixelValue(element,'paddingTop');},'padding-bottom':function(element){return getPixelValue(element,'paddingBottom');},'padding-left':function(element){return getPixelValue(element,'paddingLeft');},'padding-right':function(element){return getPixelValue(element,'paddingRight');},'border-top':function(element){return getPixelValue(element,'borderTopWidth');},'border-bottom':function(element){return getPixelValue(element,'borderBottomWidth');},'border-left':function(element){return getPixelValue(element,'borderLeftWidth');},'border-right':function(element){return getPixelValue(element,'borderRightWidth');},'margin-top':function(element){return getPixelValue(element,'marginTop');},'margin-bottom':function(element){return getPixelValue(element,'marginBottom');},'margin-left':function(element){return getPixelValue(element,'marginLeft');},'margin-right':function(element){return getPixelValue(element,'marginRight');}}});if('getBoundingClientRect'in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{'right':function(element){var parent=hasLayout(element.getOffsetParent());var rect=element.getBoundingClientRect(),pRect=parent.getBoundingClientRect();return(pRect.right-rect.right).round();},'bottom':function(element){var parent=hasLayout(element.getOffsetParent());var rect=element.getBoundingClientRect(),pRect=parent.getBoundingClientRect();return(pRect.bottom-rect.bottom).round();}});}
Element.Offset=Class.create({initialize:function(left,top){this.left=left.round();this.top=top.round();this[0]=this.left;this[1]=this.top;},relativeTo:function(offset){return new Element.Offset(this.left-offset.left,this.top-offset.top);},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this);},toString:function(){return"[#{left}, #{top}]".interpolate(this);},toArray:function(){return[this.left,this.top];}});function getLayout(element,preCompute){return new Element.Layout(element,preCompute);}
function measure(element,property){return $(element).getLayout().get(property);}
function getDimensions(element){element=$(element);var display=Element.getStyle(element,'display');if(display&&display!=='none'){return{width:element.offsetWidth,height:element.offsetHeight};}
var style=element.style;var originalStyles={visibility:style.visibility,position:style.position,display:style.display};var newStyles={visibility:'hidden',display:'block'};if(originalStyles.position!=='fixed')
newStyles.position='absolute';Element.setStyle(element,newStyles);var dimensions={width:element.offsetWidth,height:element.offsetHeight};Element.setStyle(element,originalStyles);return dimensions;}
function getOffsetParent(element){element=$(element);if(isDocument(element)||isDetached(element)||isBody(element)||isHtml(element))
return $(document.body);var isInline=(Element.getStyle(element,'display')==='inline');if(!isInline&&element.offsetParent)return $(element.offsetParent);while((element=element.parentNode)&&element!==document.body){if(Element.getStyle(element,'position')!=='static'){return isHtml(element)?$(document.body):$(element);}}
return $(document.body);}
function cumulativeOffset(element){element=$(element);var valueT=0,valueL=0;if(element.parentNode){do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);}
return new Element.Offset(valueL,valueT);}
function positionedOffset(element){element=$(element);var layout=element.getLayout();var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(isBody(element))break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);valueL-=layout.get('margin-top');valueT-=layout.get('margin-left');return new Element.Offset(valueL,valueT);}
function cumulativeScrollOffset(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return new Element.Offset(valueL,valueT);}
function viewportOffset(forElement){element=$(element);var valueT=0,valueL=0,docBody=document.body;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==docBody&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(element!=docBody){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return new Element.Offset(valueL,valueT);}
function absolutize(element){element=$(element);if(Element.getStyle(element,'position')==='absolute'){return element;}
var offsetParent=getOffsetParent(element);var eOffset=element.viewportOffset(),pOffset=offsetParent.viewportOffset();var offset=eOffset.relativeTo(pOffset);var layout=element.getLayout();element.store('prototype_absolutize_original_styles',{left:element.getStyle('left'),top:element.getStyle('top'),width:element.getStyle('width'),height:element.getStyle('height')});element.setStyle({position:'absolute',top:offset.top+'px',left:offset.left+'px',width:layout.get('width')+'px',height:layout.get('height')+'px'});return element;}
function relativize(element){element=$(element);if(Element.getStyle(element,'position')==='relative'){return element;}
var originalStyles=element.retrieve('prototype_absolutize_original_styles');if(originalStyles)element.setStyle(originalStyles);return element;}
if(Prototype.Browser.IE){getOffsetParent=getOffsetParent.wrap(function(proceed,element){element=$(element);if(isDocument(element)||isDetached(element)||isBody(element)||isHtml(element))
return $(document.body);var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});positionedOffset=positionedOffset.wrap(function(proceed,element){element=$(element);if(!element.parentNode)return new Element.Offset(0,0);var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed')
hasLayout(offsetParent);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});}else if(Prototype.Browser.Webkit){cumulativeOffset=function(element){element=$(element);var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return new Element.Offset(valueL,valueT);};}
Element.addMethods({getLayout:getLayout,measure:measure,getDimensions:getDimensions,getOffsetParent:getOffsetParent,cumulativeOffset:cumulativeOffset,positionedOffset:positionedOffset,cumulativeScrollOffset:cumulativeScrollOffset,viewportOffset:viewportOffset,absolutize:absolutize,relativize:relativize});function isBody(element){return element.nodeName.toUpperCase()==='BODY';}
function isHtml(element){return element.nodeName.toUpperCase()==='HTML';}
function isDocument(element){return element.nodeType===Node.DOCUMENT_NODE;}
function isDetached(element){return element!==document.body&&!Element.descendantOf(element,document.body);}
if('getBoundingClientRect'in document.documentElement){Element.addMethods({viewportOffset:function(element){element=$(element);if(isDetached(element))return new Element.Offset(0,0);var rect=element.getBoundingClientRect(),docEl=document.documentElement;return new Element.Offset(rect.left-docEl.clientLeft,rect.top-docEl.clientTop);}});}})();window.$$=function(){var expression=$A(arguments).join(', ');return Prototype.Selector.select(expression,document);};Prototype.Selector=(function(){function select(){throw new Error('Method "Prototype.Selector.select" must be defined.');}
function match(){throw new Error('Method "Prototype.Selector.match" must be defined.');}
function find(elements,expression,index){index=index||0;var match=Prototype.Selector.match,length=elements.length,matchIndex=0,i;for(i=0;i<length;i++){if(match(elements[i],expression)&&index==matchIndex++){return Element.extend(elements[i]);}}}
function extendElements(elements){for(var i=0,length=elements.length;i<length;i++){Element.extend(elements[i]);}
return elements;}
var K=Prototype.K;return{select:select,match:match,find:find,extendElements:(Element.extend===K)?K:extendElements,extendElement:Element.extend};})();Prototype._original_property=window.Sizzle;(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true;[0,0].sort(function(){baseHasDuplicate=false;return 0;});var Sizzle=function(selector,context,results,seed){results=results||[];var origContext=context=context||document;if(context.nodeType!==1&&context.nodeType!==9){return[];}
if(!selector||typeof selector!=="string"){return results;}
var parts=[],m,set,checkSet,check,mode,extra,prune=true,contextXML=isXML(context),soFar=selector;while((chunker.exec(""),m=chunker.exec(soFar))!==null){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break;}}
if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector])
selector+=parts.shift();set=posProcess(selector,set);}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){var ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0];}
if(context){var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,contextXML);}}else{checkSet=parts=[];}}
if(!checkSet){checkSet=set;}
if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context&&context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results);}
return results;};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[];}
for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.leftMatch[type].exec(expr))){var left=match[1];match.splice(1,1);if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=context.getElementsByTagName("*");}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;anyFound=false;if(curLoop==result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr;}else{break;}}
old=expr;}
return curLoop;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag&&!isXML){part=part.toUpperCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName===part?parent:false;}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(!/\W/.test(part)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[];}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){return context.getElementsByTagName(match[1]);}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace)
result.push(elem);}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(/\\/g,"");},TAG:function(match,curLoop){for(var i=0;curLoop[i]===false;i++){}
return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase();},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return/h\d/i.test(elem.nodeName);},text:function(elem){return"text"===elem.type;},radio:function(elem){return"radio"===elem.type;},checkbox:function(elem){return"checkbox"===elem.type;},file:function(elem){return"file"===elem.type;},password:function(elem){return"password"===elem.type;},submit:function(elem){return"submit"===elem.type;},image:function(elem){return"image"===elem.type;},reset:function(elem){return"reset"===elem.type;},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON";},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName);}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0==i;},eq:function(elem,i,match){return match[3]-0==i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false;}}
return true;}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while((node=node.previousSibling)){if(node.nodeType===1)return false;}
if(type=='first')return true;node=elem;case'last':while((node=node.nextSibling)){if(node.nodeType===1)return false;}
return true;case'nth':var first=match[2],last=match[3];if(first==1&&last==0){return true;}
var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent.sizcache=doneName;}
var diff=elem.nodeIndex-last;if(first==0){return diff==0;}else{return(diff%first==0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source);}
var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes,0);}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i]);}}else{for(var i=0;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(!a.compareDocumentPosition||!b.compareDocumentPosition){if(a==b){hasDuplicate=true;}
return 0;}
var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true;}
return ret;};}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){if(!a.sourceIndex||!b.sourceIndex){if(a==b){hasDuplicate=true;}
return 0;}
var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true;}
return ret;};}else if(document.createRange){sortOrder=function(a,b){if(!a.ownerDocument||!b.ownerDocument){if(a==b){hasDuplicate=true;}
return 0;}
var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.setStart(a,0);aRange.setEnd(a,0);bRange.setStart(b,0);bRange.setEnd(b,0);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true;}
return ret;};}
(function(){var form=document.createElement("div"),id="script"+(new Date).getTime();form.innerHTML="<a name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);root=form=null;})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}
div=null;})();if(document.querySelectorAll)(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra);}catch(e){}}
return oldSizzle(query,context,extra,seed);};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop];}
div=null;})();if(document.getElementsByClassName&&document.documentElement.getElementsByClassName)(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(div.getElementsByClassName("e").length===0)
return;div.lastChild.className="e";if(div.getElementsByClassName("e").length===1)
return;Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};div=null;})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;}
elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(elem.nodeName===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;}
elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16;}:function(a,b){return a!==b&&(a.contains?a.contains(b):true);};var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&elem.ownerDocument.documentElement.nodeName!=="HTML";};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);}
return Sizzle.filter(later,tmpSet);};window.Sizzle=Sizzle;})();;(function(engine){var extendElements=Prototype.Selector.extendElements;function select(selector,scope){return extendElements(engine(selector,scope||document));}
function match(element,selector){return engine.matches(selector,[element]).length==1;}
Prototype.Selector.engine=engine;Prototype.Selector.select=select;Prototype.Selector.match=match;})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(form){form=$(form);form.reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit,accumulator,initial;if(options.hash){initial={};accumulator=function(result,key,value){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}else result[key]=value;return result;};}else{initial='';accumulator=function(result,key,value){return result+(result?'&':'')+encodeURIComponent(key)+'='+encodeURIComponent(value);}}
return elements.inject(initial,function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){result=accumulator(result,key,value);}}
return result;});}};Form.Methods={serialize:function(form,options){return Form.serializeElements(Form.getElements(form),options);},getElements:function(form){var elements=$(form).getElementsByTagName('*'),element,arr=[],serializers=Form.Element.Serializers;for(var i=0;element=elements[i];i++){arr.push(element);}
return arr.inject([],function(elements,child){if(serializers[child.tagName.toLowerCase()])
elements.push(Element.extend(child));return elements;})},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(Element.extend(input));}
return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return/^(?:input|select|textarea)$/i.test(element.tagName);});},focusFirstElement:function(form){form=$(form);var element=form.findFirstElement();if(element)element.activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}
if(form.hasAttribute('method')&&!options.method)
options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!(/^(?:button|reset|submit)$/i.test(element.type))))
element.select();}catch(e){}
return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function input(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return inputSelector(element,value);default:return valueSelector(element,value);}}
function inputSelector(element,value){if(Object.isUndefined(value))
return element.checked?element.value:null;else element.checked=!!value;}
function valueSelector(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;}
function select(element,value){if(Object.isUndefined(value))
return(element.type==='select-one'?selectOne:selectMany)(element);var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return;}}
else opt.selected=value.include(currentValue);}}
function selectOne(element){var index=element.selectedIndex;return index>=0?optionValue(element.options[index]):null;}
function selectMany(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i];if(opt.selected)values.push(optionValue(opt));}
return values;}
function optionValue(opt){return Element.hasAttribute(opt,'value')?opt.value:opt.text;}
return{input:input,inputSelector:inputSelector,textarea:valueSelector,select:select,selectOne:selectOne,selectMany:selectMany,optionValue:optionValue,button:valueSelector};})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(this.element,value);this.lastValue=value;}}});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(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
this.registerFormCallbacks();else
this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;default:Event.observe(element,'change',this.onElementEvent.bind(this));break;}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element);}});(function(){var 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:{}};var docEl=document.documentElement;var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED='onmouseenter'in docEl&&'onmouseleave'in docEl;var isIELegacyEvent=function(event){return false;};if(window.attachEvent){if(window.addEventListener){isIELegacyEvent=function(event){return!(event instanceof window.Event);};}else{isIELegacyEvent=function(event){return true;};}}
var _isButton;function _isButtonForDOMEvents(event,code){return event.which?(event.which===code+1):(event.button===code);}
var legacyButtonMap={0:1,1:4,2:2};function _isButtonForLegacyEvents(event,code){return event.button===legacyButtonMap[code];}
function _isButtonForWebKit(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==2||(event.which==1&&event.metaKey);case 2:return event.which==3;default:return false;}}
if(window.attachEvent){if(!window.addEventListener){_isButton=_isButtonForLegacyEvents;}else{_isButton=function(event,code){return isIELegacyEvent(event)?_isButtonForLegacyEvents(event,code):_isButtonForDOMEvents(event,code);}}}else if(Prototype.Browser.WebKit){_isButton=_isButtonForWebKit;}else{_isButton=_isButtonForDOMEvents;}
function isLeftClick(event){return _isButton(event,0)}
function isMiddleClick(event){return _isButton(event,1)}
function isRightClick(event){return _isButton(event,2)}
function element(event){event=Event.extend(event);var node=event.target,type=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='input'&&currentTarget.type==='radio'))
node=currentTarget;}
if(node.nodeType==Node.TEXT_NODE)
node=node.parentNode;return Element.extend(node);}
function findElement(event,expression){var element=Event.element(event);if(!expression)return element;while(element){if(Object.isElement(element)&&Prototype.Selector.match(element,expression)){return Element.extend(element);}
element=element.parentNode;}}
function pointer(event){return{x:pointerX(event),y:pointerY(event)};}
function pointerX(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0};return event.pageX||(event.clientX+
(docElement.scrollLeft||body.scrollLeft)-
(docElement.clientLeft||0));}
function pointerY(event){var docElement=document.documentElement,body=document.body||{scrollTop:0};return event.pageY||(event.clientY+
(docElement.scrollTop||body.scrollTop)-
(docElement.clientTop||0));}
function stop(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true;}
Event.Methods={isLeftClick:isLeftClick,isMiddleClick:isMiddleClick,isRightClick:isRightClick,element:element,findElement:findElement,pointer:pointer,pointerX:pointerX,pointerY:pointerY,stop:stop};var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(window.attachEvent){function _relatedTarget(event){var element;switch(event.type){case'mouseover':case'mouseenter':element=event.fromElement;break;case'mouseout':case'mouseleave':element=event.toElement;break;default:return null;}
return Element.extend(element);}
var additionalMethods={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return'[object Event]'}};Event.extend=function(event,element){if(!event)return false;if(!isIELegacyEvent(event))return event;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement||element,relatedTarget:_relatedTarget(event),pageX:pointer.x,pageY:pointer.y});Object.extend(event,methods);Object.extend(event,additionalMethods);return event;};}else{Event.extend=Prototype.K;}
if(window.addEventListener){Event.prototype=window.Event.prototype||document.createEvent('HTMLEvents').__proto__;Object.extend(Event.prototype,methods);}
function _createResponder(element,eventName,handler){var registry=Element.retrieve(element,'prototype_event_registry');if(Object.isUndefined(registry)){CACHE.push(element);registry=Element.retrieve(element,'prototype_event_registry',$H());}
var respondersForEvent=registry.get(eventName);if(Object.isUndefined(respondersForEvent)){respondersForEvent=[];registry.set(eventName,respondersForEvent);}
if(respondersForEvent.pluck('handler').include(handler))return false;var responder;if(eventName.include(":")){responder=function(event){if(Object.isUndefined(event.eventName))
return false;if(event.eventName!==eventName)
return false;Event.extend(event,element);handler.call(element,event);};}else{if(!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED&&(eventName==="mouseenter"||eventName==="mouseleave")){if(eventName==="mouseenter"||eventName==="mouseleave"){responder=function(event){Event.extend(event,element);var parent=event.relatedTarget;while(parent&&parent!==element){try{parent=parent.parentNode;}
catch(e){parent=element;}}
if(parent===element)return;handler.call(element,event);};}}else{responder=function(event){Event.extend(event,element);handler.call(element,event);};}}
responder.handler=handler;respondersForEvent.push(responder);return responder;}
function _destroyCache(){for(var i=0,length=CACHE.length;i<length;i++){Event.stopObserving(CACHE[i]);CACHE[i]=null;}}
var CACHE=[];if(Prototype.Browser.IE)
window.attachEvent('onunload',_destroyCache);if(Prototype.Browser.WebKit)
window.addEventListener('unload',Prototype.emptyFunction,false);var _getDOMEventName=Prototype.K,translations={mouseenter:"mouseover",mouseleave:"mouseout"};if(!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED){_getDOMEventName=function(eventName){return(translations[eventName]||eventName);};}
function observe(element,eventName,handler){element=$(element);var responder=_createResponder(element,eventName,handler);if(!responder)return element;if(eventName.include(':')){if(element.addEventListener)
element.addEventListener("dataavailable",responder,false);else{element.attachEvent("ondataavailable",responder);element.attachEvent("onlosecapture",responder);}}else{var actualEventName=_getDOMEventName(eventName);if(element.addEventListener)
element.addEventListener(actualEventName,responder,false);else
element.attachEvent("on"+actualEventName,responder);}
return element;}
function stopObserving(element,eventName,handler){element=$(element);var registry=Element.retrieve(element,'prototype_event_registry');if(!registry)return element;if(!eventName){registry.each(function(pair){var eventName=pair.key;stopObserving(element,eventName);});return element;}
var responders=registry.get(eventName);if(!responders)return element;if(!handler){responders.each(function(r){stopObserving(element,eventName,r.handler);});return element;}
var i=responders.length,responder;while(i--){if(responders[i].handler===handler){responder=responders[i];break;}}
if(!responder)return element;if(eventName.include(':')){if(element.removeEventListener)
element.removeEventListener("dataavailable",responder,false);else{element.detachEvent("ondataavailable",responder);element.detachEvent("onlosecapture",responder);}}else{var actualEventName=_getDOMEventName(eventName);if(element.removeEventListener)
element.removeEventListener(actualEventName,responder,false);else
element.detachEvent('on'+actualEventName,responder);}
registry.set(eventName,responders.without(responder));return element;}
function fire(element,eventName,memo,bubble){element=$(element);if(Object.isUndefined(bubble))
bubble=true;if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent('HTMLEvents');event.initEvent('dataavailable',bubble,true);}else{event=document.createEventObject();event.eventType=bubble?'ondataavailable':'onlosecapture';}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent)
element.dispatchEvent(event);else
element.fireEvent(event.eventType,event);return Event.extend(event);}
Event.Handler=Class.create({initialize:function(element,eventName,selector,callback){this.element=$(element);this.eventName=eventName;this.selector=selector;this.callback=callback;this.handler=this.handleEvent.bind(this);},start:function(){Event.observe(this.element,this.eventName,this.handler);return this;},stop:function(){Event.stopObserving(this.element,this.eventName,this.handler);return this;},handleEvent:function(event){var element=Event.findElement(event,this.selector);if(element)this.callback.call(this.element,event,element);}});function on(element,eventName,selector,callback){element=$(element);if(Object.isFunction(selector)&&Object.isUndefined(callback)){callback=selector,selector=null;}
return new Event.Handler(element,eventName,selector,callback).start();}
Object.extend(Event,Event.Methods);Object.extend(Event,{fire:fire,observe:observe,stopObserving:stopObserving,on:on});Element.addMethods({fire:fire,observe:observe,stopObserving:stopObserving,on:on});Object.extend(document,{fire:fire.methodize(),observe:observe.methodize(),stopObserving:stopObserving.methodize(),on:on.methodize(),loaded:false});if(window.Event)Object.extend(window.Event,Event);else window.Event=Event;})();(function(){var timer;function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearTimeout(timer);document.loaded=true;document.fire('dom:loaded');}
function checkReadyState(){if(document.readyState==='complete'){document.stopObserving('readystatechange',checkReadyState);fireContentLoadedEvent();}}
function pollDoScroll(){try{document.documentElement.doScroll('left');}
catch(e){timer=pollDoScroll.defer();return;}
fireContentLoadedEvent();}
if(document.addEventListener){document.addEventListener('DOMContentLoaded',fireContentLoadedEvent,false);}else{document.observe('readystatechange',checkReadyState);if(window==top)
timer=pollDoScroll.defer();}
Event.observe(window,'load',fireContentLoadedEvent);})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,content){return Element.insert(element,{bottom:content});},After:function(element,content){return Element.insert(element,{after:content});}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},within:function(element,x,y){if(this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";}
instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))
elements.push(Element.extend(child));}
return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(expression){this.expression=expression.strip();},findElements:function(rootElement){return Prototype.Selector.select(this.expression,rootElement);},match:function(element){return Prototype.Selector.match(element,this.expression);},toString:function(){return this.expression;},inspect:function(){return"#<Selector: "+this.expression+">";}});Object.extend(Selector,{matchElements:function(elements,expression){var match=Prototype.Selector.match,results=[];for(var i=0,length=elements.length;i<length;i++){var element=elements[i];if(match(element,expression)){results.push(Element.extend(element));}}
return results;},findElement:function(elements,expression,index){index=index||0;var matchIndex=0,element;for(var i=0,length=elements.length;i<length;i++){element=elements[i];if(Prototype.Selector.match(element,expression)&&index===matchIndex++){return Element.extend(element);}}},findChildElements:function(element,expressions){var selector=expressions.toArray().join(', ');return Prototype.Selector.select(selector,element||document);}});})();

var Scriptaculous={Version:"1.8.1",require:function(_1){document.write("<script type=\"text/javascript\" src=\""+_1+"\"></script>");},REQUIRED_PROTOTYPE:"1.6.0",load:function(){function _2(_3){var r=_3.split(".");return parseInt(r[0])*100000+parseInt(r[1])*1000+parseInt(r[2]);};if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||(_2(Prototype.Version)<_2(Scriptaculous.REQUIRED_PROTOTYPE))){throw("script.aculo.us requires the Prototype JavaScript framework >= "+Scriptaculous.REQUIRED_PROTOTYPE);}$A(document.getElementsByTagName("script")).findAll(function(s){return(s.src&&s.src.match(/scriptaculous\.js(\?.*)?$/));}).each(function(s){var _4=s.src.replace(/scriptaculous\.js(\?.*)?$/,"");var _5=s.src.match(/\?.*load=([a-z,]*)/);(_5?_5[1]:"builder,effects,dragdrop,controls").split(",").each(function(_6){Scriptaculous.require(_4+_6+".js");});});}};Scriptaculous.load();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(_1){_1=_1.toUpperCase();var _2=this.NODEMAP[_1]||"div";var _3=document.createElement(_2);try{_3.innerHTML="<"+_1+"></"+_1+">";}catch(e){}var _4=_3.firstChild||null;if(_4&&(_4.tagName.toUpperCase()!=_1)){_4=_4.getElementsByTagName(_1)[0];}if(!_4){_4=document.createElement(_1);}if(!_4){return;}if(arguments[1]){if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)||arguments[1].tagName){this._children(_4,arguments[1]);}else{var _5=this._attributes(arguments[1]);if(_5.length){try{_3.innerHTML="<"+_1+" "+_5+"></"+_1+">";}catch(e){}_4=_3.firstChild||null;if(!_4){_4=document.createElement(_1);for(attr in arguments[1]){_4[attr=="class"?"className":attr]=arguments[1][attr];}}if(_4.tagName.toUpperCase()!=_1){_4=_3.getElementsByTagName(_1)[0];}}}}if(arguments[2]){this._children(_4,arguments[2]);}return _4;},_text:function(_6){return document.createTextNode(_6);},ATTR_MAP:{"className":"class","htmlFor":"for"},_attributes:function(_7){var _8=[];for(attribute in _7){_8.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+"=\""+_7[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+"\"");}return _8.join(" ");},_children:function(_9,_a){if(_a.tagName){_9.appendChild(_a);return;}if(typeof _a=="object"){_a.flatten().each(function(e){if(typeof e=="object"){_9.appendChild(e);}else{if(Builder._isStringOrNumber(e)){_9.appendChild(Builder._text(e));}}});}else{if(Builder._isStringOrNumber(_a)){_9.appendChild(Builder._text(_a));}}},_isStringOrNumber:function(_b){return(typeof _b=="string"||typeof _b=="number");},build:function(_c){var _d=this.node("div");$(_d).update(_c.strip());return _d.down();},dump:function(_e){if(typeof _e!="object"&&typeof _e!="function"){_e=window;}var _f=("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+/);_f.each(function(tag){_e[tag]=function(){return Builder.node.apply(Builder,[tag].concat($A(arguments)));};});}};String.prototype.parseColor=function(){var _1="#";if(this.slice(0,4)=="rgb("){var _2=this.slice(4,this.length-1).split(",");var i=0;do{_1+=parseInt(_2[i]).toColorPart();}while(++i<3);}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var i=1;i<4;i++){_1+=(this.charAt(i)+this.charAt(i)).toLowerCase();}}if(this.length==7){_1=this.toLowerCase();}}}return(_1.length==7?_1:(arguments[0]||this));};Element.collectTextNodes=function(_3){return $A($(_3).childNodes).collect(function(_4){return(_4.nodeType==3?_4.nodeValue:(_4.hasChildNodes()?Element.collectTextNodes(_4):""));}).flatten().join("");};Element.collectTextNodesIgnoreClass=function(_5,_6){return $A($(_5).childNodes).collect(function(_7){return(_7.nodeType==3?_7.nodeValue:((_7.hasChildNodes()&&!Element.hasClassName(_7,_6))?Element.collectTextNodesIgnoreClass(_7,_6):""));}).flatten().join("");};Element.setContentZoom=function(_8,_9){_8=$(_8);_8.setStyle({fontSize:(_9/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0);}return _8;};Element.getInlineOpacity=function(_a){return $(_a).style.opacity||"";};Element.forceRerendering=function(_b){try{_b=$(_b);var n=document.createTextNode(" ");_b.appendChild(n);_b.removeChild(n);}catch(e){}};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(_c){return(-Math.cos(_c*Math.PI)/2)+0.5;},reverse:function(_d){return 1-_d;},flicker:function(_e){var _e=((-Math.cos(_e*Math.PI)/4)+0.75)+Math.random()/4;return _e>1?1:_e;},wobble:function(_f){return(-Math.cos(_f*Math.PI*(9*_f))/2)+0.5;},pulse:function(pos,_10){_10=_10||5;return(((pos%(1/_10))*_10).round()==0?((pos*_10*2)-(pos*_10*2).floor()):1-((pos*_10*2)-(pos*_10*2).floor()));},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(_11){var _12="position:relative";if(Prototype.Browser.IE){_12+=";zoom:1";}_11=$(_11);$A(_11.childNodes).each(function(_13){if(_13.nodeType==3){_13.nodeValue.toArray().each(function(_14){_11.insertBefore(new Element("span",{style:_12}).update(_14==" "?String.fromCharCode(160):_14),_13);});Element.remove(_13);}});},multiple:function(_15,_16){var _17;if(((typeof _15=="object")||Object.isFunction(_15))&&(_15.length)){_17=_15;}else{_17=$(_15).childNodes;}var _18=Object.extend({speed:0.1,delay:0},arguments[2]||{});var _19=_18.delay;$A(_17).each(function(_1a,_1b){new _16(_1a,Object.extend(_18,{delay:_1b*_18.speed+_19}));});},PAIRS:{"slide":["SlideDown","SlideUp"],"blind":["BlindDown","BlindUp"],"appear":["Appear","Fade"]},toggle:function(_1c,_1d){_1c=$(_1c);_1d=(_1d||"appear").toLowerCase();var _1e=Object.extend({queue:{position:"end",scope:(_1c.id||"global"),limit:1}},arguments[2]||{});Effect[_1c.visible()?Effect.PAIRS[_1d][1]:Effect.PAIRS[_1d][0]](_1c,_1e);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(_1f){this.effects._each(_1f);},add:function(_20){var _21=new Date().getTime();var _22=Object.isString(_20.options.queue)?_20.options.queue:_20.options.queue.position;switch(_22){case"front":this.effects.findAll(function(e){return e.state=="idle";}).each(function(e){e.startOn+=_20.finishOn;e.finishOn+=_20.finishOn;});break;case"with-last":_21=this.effects.pluck("startOn").max()||_21;break;case"end":_21=this.effects.pluck("finishOn").max()||_21;break;}_20.startOn+=_21;_20.finishOn+=_21;if(!_20.options.queue.limit||(this.effects.length<_20.options.queue.limit)){this.effects.push(_20);}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15);}},remove:function(_23){this.effects=this.effects.reject(function(e){return e==_23;});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var _24=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++){this.effects[i]&&this.effects[i].loop(_24);}}});Effect.Queues={instances:$H(),get:function(_25){if(!Object.isString(_25)){return _25;}return this.instances.get(_25)||this.instances.set(_25,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(_26){function _27(_28,_29){return((_28[_29+"Internal"]?"this.options."+_29+"Internal(this);":"")+(_28[_29]?"this.options."+_29+"(this);":""));};if(_26&&_26.transition===false){_26.transition=Effect.Transitions.linear;}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),_26||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval("this.render = function(pos){ "+"if (this.state==\"idle\"){this.state=\"running\";"+_27(this.options,"beforeSetup")+(this.setup?"this.setup();":"")+_27(this.options,"afterSetup")+"};if (this.state==\"running\"){"+"pos=this.options.transition(pos)*"+this.fromToDelta+"+"+this.options.from+";"+"this.position=pos;"+_27(this.options,"beforeUpdate")+(this.update?"this.update(pos);":"")+_27(this.options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this);}},loop:function(_2a){if(_2a>=this.startOn){if(_2a>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish();}this.event("afterFinish");return;}var pos=(_2a-this.startOn)/this.totalTime,_2b=(pos*this.totalFrames).round();if(_2b>this.currentFrame){this.render(pos);this.currentFrame=_2b;}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this);}this.state="finished";},event:function(_2c){if(this.options[_2c+"Internal"]){this.options[_2c+"Internal"](this);}if(this.options[_2c]){this.options[_2c](this);}},inspect:function(){var _2d=$H();for(property in this){if(!Object.isFunction(this[property])){_2d.set(property,this[property]);}}return"#<Effect:"+_2d.inspect()+",options:"+$H(this.options).inspect()+">";}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(_2e){this.effects=_2e||[];this.start(arguments[1]);},update:function(_2f){this.effects.invoke("render",_2f);},finish:function(_30){this.effects.each(function(_31){_31.render(1);_31.cancel();_31.event("beforeFinish");if(_31.finish){_31.finish(_30);}_31.event("afterFinish");});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(_32,_33,to){_32=Object.isString(_32)?$(_32):_32;var _34=$A(arguments),_35=_34.last(),_36=_34.length==5?_34[3]:null;this.method=Object.isFunction(_35)?_35.bind(_32):Object.isFunction(_32[_35])?_32[_35].bind(_32):function(_37){_32[_35]=_37;};this.start(Object.extend({from:_33,to:to},_36||{}));},update:function(_38){this.method(_38);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(_39){this.element=$(_39);if(!this.element){throw(Effect._elementDoesNotExistError);}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1});}var _3a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(_3a);},update:function(_3b){this.element.setOpacity(_3b);}});Effect.Move=Class.create(Effect.Base,{initialize:function(_3c){this.element=$(_3c);if(!this.element){throw(Effect._elementDoesNotExistError);}var _3d=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(_3d);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(_3e){this.element.setStyle({left:(this.options.x*_3e+this.originalLeft).round()+"px",top:(this.options.y*_3e+this.originalTop).round()+"px"});}});Effect.MoveBy=function(_3f,_40,_41){return new Effect.Move(_3f,Object.extend({x:_41,y:_40},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(_42,_43){this.element=$(_42);if(!this.element){throw(Effect._elementDoesNotExistError);}var _44=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_43},arguments[2]||{});this.start(_44);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var _45=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(_46){if(_45.indexOf(_46)>0){this.fontSize=parseFloat(_45);this.fontSizeType=_46;}}.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(_47){var _48=(this.options.scaleFrom/100)+(this.factor*_47);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*_48+this.fontSizeType});}this.setDimensions(this.dims[0]*_48,this.dims[1]*_48);},finish:function(_49){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle);}},setDimensions:function(_4a,_4b){var d={};if(this.options.scaleX){d.width=_4b.round()+"px";}if(this.options.scaleY){d.height=_4a.round()+"px";}if(this.options.scaleFromCenter){var _4c=(_4a-this.dims[0])/2;var _4d=(_4b-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){d.top=this.originalTop-_4c+"px";}if(this.options.scaleX){d.left=this.originalLeft-_4d+"px";}}else{if(this.options.scaleY){d.top=-_4c+"px";}if(this.options.scaleX){d.left=-_4d+"px";}}}this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(_4e){this.element=$(_4e);if(!this.element){throw(Effect._elementDoesNotExistError);}var _4f=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(_4f);},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return;}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"});}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff");}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color");}this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16);}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i];}.bind(this));},update:function(_50){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(m,v,i){return m+((this._base[i]+(this._delta[i]*_50)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(_51){var _52=arguments[1]||{},_53=document.viewport.getScrollOffsets(),_54=$(_51).cumulativeOffset(),max=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(_52.offset){_54[1]+=_52.offset;}return new Effect.Tween(null,_53.top,_54[1]>max?max:_54[1],_52,function(p){scrollTo(_53.left,p.round());});};Effect.Fade=function(_55){_55=$(_55);var _56=_55.getInlineOpacity();var _57=Object.extend({from:_55.getOpacity()||1,to:0,afterFinishInternal:function(_58){if(_58.options.to!=0){return;}_58.element.hide().setStyle({opacity:_56});}},arguments[1]||{});return new Effect.Opacity(_55,_57);};Effect.Appear=function(_59){_59=$(_59);var _5a=Object.extend({from:(_59.getStyle("display")=="none"?0:_59.getOpacity()||0),to:1,afterFinishInternal:function(_5b){_5b.element.forceRerendering();},beforeSetup:function(_5c){_5c.element.setOpacity(_5c.options.from).show();}},arguments[1]||{});return new Effect.Opacity(_59,_5a);};Effect.Puff=function(_5d){_5d=$(_5d);var _5e={opacity:_5d.getInlineOpacity(),position:_5d.getStyle("position"),top:_5d.style.top,left:_5d.style.left,width:_5d.style.width,height:_5d.style.height};return new Effect.Parallel([new Effect.Scale(_5d,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(_5d,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(_5f){Position.absolutize(_5f.effects[0].element);},afterFinishInternal:function(_60){_60.effects[0].element.hide().setStyle(_5e);}},arguments[1]||{}));};Effect.BlindUp=function(_61){_61=$(_61);_61.makeClipping();return new Effect.Scale(_61,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_62){_62.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(_63){_63=$(_63);var _64=_63.getDimensions();return new Effect.Scale(_63,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_64.height,originalWidth:_64.width},restoreAfterFinish:true,afterSetup:function(_65){_65.element.makeClipping().setStyle({height:"0px"}).show();},afterFinishInternal:function(_66){_66.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(_67){_67=$(_67);var _68=_67.getInlineOpacity();return new Effect.Appear(_67,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(_69){new Effect.Scale(_69.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(_6a){_6a.element.makePositioned().makeClipping();},afterFinishInternal:function(_6b){_6b.element.hide().undoClipping().undoPositioned().setStyle({opacity:_68});}});}},arguments[1]||{}));};Effect.DropOut=function(_6c){_6c=$(_6c);var _6d={top:_6c.getStyle("top"),left:_6c.getStyle("left"),opacity:_6c.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(_6c,{x:0,y:100,sync:true}),new Effect.Opacity(_6c,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(_6e){_6e.effects[0].element.makePositioned();},afterFinishInternal:function(_6f){_6f.effects[0].element.hide().undoPositioned().setStyle(_6d);}},arguments[1]||{}));};Effect.Shake=function(_70){_70=$(_70);var _71=Object.extend({distance:20,duration:0.5},arguments[1]||{});var _72=parseFloat(_71.distance);var _73=parseFloat(_71.duration)/10;var _74={top:_70.getStyle("top"),left:_70.getStyle("left")};return new Effect.Move(_70,{x:_72,y:0,duration:_73,afterFinishInternal:function(_75){new Effect.Move(_75.element,{x:-_72*2,y:0,duration:_73*2,afterFinishInternal:function(_76){new Effect.Move(_76.element,{x:_72*2,y:0,duration:_73*2,afterFinishInternal:function(_77){new Effect.Move(_77.element,{x:-_72*2,y:0,duration:_73*2,afterFinishInternal:function(_78){new Effect.Move(_78.element,{x:_72*2,y:0,duration:_73*2,afterFinishInternal:function(_79){new Effect.Move(_79.element,{x:-_72,y:0,duration:_73,afterFinishInternal:function(_7a){_7a.element.undoPositioned().setStyle(_74);}});}});}});}});}});}});};Effect.SlideDown=function(_7b){_7b=$(_7b).cleanWhitespace();var _7c=_7b.down().getStyle("bottom");var _7d=_7b.getDimensions();return new Effect.Scale(_7b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:_7d.height,originalWidth:_7d.width},restoreAfterFinish:true,afterSetup:function(_7e){_7e.element.makePositioned();_7e.element.down().makePositioned();if(window.opera){_7e.element.setStyle({top:""});}_7e.element.makeClipping().setStyle({height:"0px"}).show();},afterUpdateInternal:function(_7f){_7f.element.down().setStyle({bottom:(_7f.dims[0]-_7f.element.clientHeight)+"px"});},afterFinishInternal:function(_80){_80.element.undoClipping().undoPositioned();_80.element.down().undoPositioned().setStyle({bottom:_7c});}},arguments[1]||{}));};Effect.SlideUp=function(_81){_81=$(_81).cleanWhitespace();var _82=_81.down().getStyle("bottom");var _83=_81.getDimensions();return new Effect.Scale(_81,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:_83.height,originalWidth:_83.width},restoreAfterFinish:true,afterSetup:function(_84){_84.element.makePositioned();_84.element.down().makePositioned();if(window.opera){_84.element.setStyle({top:""});}_84.element.makeClipping().show();},afterUpdateInternal:function(_85){_85.element.down().setStyle({bottom:(_85.dims[0]-_85.element.clientHeight)+"px"});},afterFinishInternal:function(_86){_86.element.hide().undoClipping().undoPositioned();_86.element.down().undoPositioned().setStyle({bottom:_82});}},arguments[1]||{}));};Effect.Squish=function(_87){return new Effect.Scale(_87,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(_88){_88.element.makeClipping();},afterFinishInternal:function(_89){_89.element.hide().undoClipping();}});};Effect.Grow=function(_8a){_8a=$(_8a);var _8b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var _8c={top:_8a.style.top,left:_8a.style.left,height:_8a.style.height,width:_8a.style.width,opacity:_8a.getInlineOpacity()};var _8d=_8a.getDimensions();var _8e,_8f;var _90,_91;switch(_8b.direction){case"top-left":_8e=_8f=_90=_91=0;break;case"top-right":_8e=_8d.width;_8f=_91=0;_90=-_8d.width;break;case"bottom-left":_8e=_90=0;_8f=_8d.height;_91=-_8d.height;break;case"bottom-right":_8e=_8d.width;_8f=_8d.height;_90=-_8d.width;_91=-_8d.height;break;case"center":_8e=_8d.width/2;_8f=_8d.height/2;_90=-_8d.width/2;_91=-_8d.height/2;break;}return new Effect.Move(_8a,{x:_8e,y:_8f,duration:0.01,beforeSetup:function(_92){_92.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(_93){new Effect.Parallel([new Effect.Opacity(_93.element,{sync:true,to:1,from:0,transition:_8b.opacityTransition}),new Effect.Move(_93.element,{x:_90,y:_91,sync:true,transition:_8b.moveTransition}),new Effect.Scale(_93.element,100,{scaleMode:{originalHeight:_8d.height,originalWidth:_8d.width},sync:true,scaleFrom:window.opera?1:0,transition:_8b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(_94){_94.effects[0].element.setStyle({height:"0px"}).show();},afterFinishInternal:function(_95){_95.effects[0].element.undoClipping().undoPositioned().setStyle(_8c);}},_8b));}});};Effect.Shrink=function(_96){_96=$(_96);var _97=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var _98={top:_96.style.top,left:_96.style.left,height:_96.style.height,width:_96.style.width,opacity:_96.getInlineOpacity()};var _99=_96.getDimensions();var _9a,_9b;switch(_97.direction){case"top-left":_9a=_9b=0;break;case"top-right":_9a=_99.width;_9b=0;break;case"bottom-left":_9a=0;_9b=_99.height;break;case"bottom-right":_9a=_99.width;_9b=_99.height;break;case"center":_9a=_99.width/2;_9b=_99.height/2;break;}return new Effect.Parallel([new Effect.Opacity(_96,{sync:true,to:0,from:1,transition:_97.opacityTransition}),new Effect.Scale(_96,window.opera?1:0,{sync:true,transition:_97.scaleTransition,restoreAfterFinish:true}),new Effect.Move(_96,{x:_9a,y:_9b,sync:true,transition:_97.moveTransition})],Object.extend({beforeStartInternal:function(_9c){_9c.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(_9d){_9d.effects[0].element.hide().undoClipping().undoPositioned().setStyle(_98);}},_97));};Effect.Pulsate=function(_9e){_9e=$(_9e);var _9f=arguments[1]||{};var _a0=_9e.getInlineOpacity();var _a1=_9f.transition||Effect.Transitions.sinoidal;var _a2=function(pos){return _a1(1-Effect.Transitions.pulse(pos,_9f.pulses));};_a2.bind(_a1);return new Effect.Opacity(_9e,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(_a3){_a3.element.setStyle({opacity:_a0});}},_9f),{transition:_a2}));};Effect.Fold=function(_a4){_a4=$(_a4);var _a5={top:_a4.style.top,left:_a4.style.left,width:_a4.style.width,height:_a4.style.height};_a4.makeClipping();return new Effect.Scale(_a4,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(_a6){new Effect.Scale(_a4,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_a7){_a7.element.hide().undoClipping().setStyle(_a5);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(_a8){this.element=$(_a8);if(!this.element){throw(Effect._elementDoesNotExistError);}var _a9=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(_a9.style)){this.style=$H(_a9.style);}else{if(_a9.style.include(":")){this.style=_a9.style.parseStyle();}else{this.element.addClassName(_a9.style);this.style=$H(this.element.getStyles());this.element.removeClassName(_a9.style);var css=this.element.getStyles();this.style=this.style.reject(function(_aa){return _aa.value==css[_aa.key];});_a9.afterFinishInternal=function(_ab){_ab.element.addClassName(_ab.options.style);_ab.transforms.each(function(_ac){_ab.element.style[_ac.style]="";});};}}this.start(_a9);},setup:function(){function _ad(_ae){if(!_ae||["rgba(0, 0, 0, 0)","transparent"].include(_ae)){_ae="#ffffff";}_ae=_ae.parseColor();return $R(0,2).map(function(i){return parseInt(_ae.slice(i*2+1,i*2+3),16);});};this.transforms=this.style.map(function(_af){var _b0=_af[0],_b1=_af[1],_b2=null;if(_b1.parseColor("#zzzzzz")!="#zzzzzz"){_b1=_b1.parseColor();_b2="color";}else{if(_b0=="opacity"){_b1=parseFloat(_b1);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1});}}else{if(Element.CSS_LENGTH.test(_b1)){var _b3=_b1.match(/^([\+\-]?[0-9\.]+)(.*)$/);_b1=parseFloat(_b3[1]);_b2=(_b3.length==3)?_b3[2]:null;}}}var _b4=this.element.getStyle(_b0);return{style:_b0.camelize(),originalValue:_b2=="color"?_ad(_b4):parseFloat(_b4||0),targetValue:_b2=="color"?_ad(_b1):_b1,unit:_b2};}.bind(this)).reject(function(_b5){return((_b5.originalValue==_b5.targetValue)||(_b5.unit!="color"&&(isNaN(_b5.originalValue)||isNaN(_b5.targetValue))));});},update:function(_b6){var _b7={},_b8,i=this.transforms.length;while(i--){_b7[(_b8=this.transforms[i]).style]=_b8.unit=="color"?"#"+(Math.round(_b8.originalValue[0]+(_b8.targetValue[0]-_b8.originalValue[0])*_b6)).toColorPart()+(Math.round(_b8.originalValue[1]+(_b8.targetValue[1]-_b8.originalValue[1])*_b6)).toColorPart()+(Math.round(_b8.originalValue[2]+(_b8.targetValue[2]-_b8.originalValue[2])*_b6)).toColorPart():(_b8.originalValue+(_b8.targetValue-_b8.originalValue)*_b6).toFixed(3)+(_b8.unit===null?"":_b8.unit);}this.element.setStyle(_b7,true);}});Effect.Transform=Class.create({initialize:function(_b9){this.tracks=[];this.options=arguments[1]||{};this.addTracks(_b9);},addTracks:function(_ba){_ba.each(function(_bb){_bb=$H(_bb);var _bc=_bb.values().first();this.tracks.push($H({ids:_bb.keys().first(),effect:Effect.Morph,options:{style:_bc}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(_bd){var ids=_bd.get("ids"),_be=_bd.get("effect"),_bf=_bd.get("options");var _c0=[$(ids)||$$(ids)].flatten();return _c0.map(function(e){return new _be(e,Object.extend({sync:true},_bf));});}).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 _c1,_c2=$H();if(Prototype.Browser.WebKit){_c1=new Element("div",{style:this}).style;}else{String.__parseStyleElement.innerHTML="<div style=\""+this+"\"></div>";_c1=String.__parseStyleElement.childNodes[0].style;}Element.CSS_PROPERTIES.each(function(_c3){if(_c1[_c3]){_c2.set(_c3,_c1[_c3]);}});if(Prototype.Browser.IE&&this.include("opacity")){_c2.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);}return _c2;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(_c4){var css=document.defaultView.getComputedStyle($(_c4),null);return Element.CSS_PROPERTIES.inject({},function(_c5,_c6){_c5[_c6]=css[_c6];return _c5;});};}else{Element.getStyles=function(_c7){_c7=$(_c7);var css=_c7.currentStyle,_c8;_c8=Element.CSS_PROPERTIES.inject({},function(_c9,_ca){_c9[_ca]=css[_ca];return _c9;});if(!_c8.opacity){_c8.opacity=_c7.getOpacity();}return _c8;};}Effect.Methods={morph:function(_cb,_cc){_cb=$(_cb);new Effect.Morph(_cb,Object.extend({style:_cc},arguments[2]||{}));return _cb;},visualEffect:function(_cd,_ce,_cf){_cd=$(_cd);var s=_ce.dasherize().camelize(),_d0=s.charAt(0).toUpperCase()+s.substring(1);new Effect[_d0](_cd,_cf);return _cd;},highlight:function(_d1,_d2){_d1=$(_d1);new Effect.Highlight(_d1,_d2);return _d1;}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown "+"pulsate shake puff squish switchOff dropOut").each(function(_d3){Effect.Methods[_d3]=function(_d4,_d5){_d4=$(_d4);Effect[_d3.charAt(0).toUpperCase()+_d3.substring(1)](_d4,_d5);return _d4;};});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);if(Object.isUndefined(Effect)){throw("dragdrop.js requires including script.aculo.us' effects.js library");}var Droppables={drops:[],remove:function(_1){this.drops=this.drops.reject(function(d){return d.element==$(_1);});},add:function(_2){_2=$(_2);var _3=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(_3.containment){_3._containers=[];var _4=_3.containment;if(Object.isArray(_4)){_4.each(function(c){_3._containers.push($(c));});}else{_3._containers.push($(_4));}}if(_3.accept){_3.accept=[_3.accept].flatten();}Element.makePositioned(_2);_3.element=_2;this.drops.push(_3);},findDeepestChild:function(_5){deepest=_5[0];for(i=1;i<_5.length;++i){if(Element.isParent(_5[i].element,deepest.element)){deepest=_5[i];}}return deepest;},isContained:function(_6,_7){var _8;if(_7.tree){_8=_6.treeNode;}else{_8=_6.parentNode;}return _7._containers.detect(function(c){return _8==c;});},isAffected:function(_9,_a,_b){return((_b.element!=_a)&&((!_b._containers)||this.isContained(_a,_b))&&((!_b.accept)||(Element.classNames(_a).detect(function(v){return _b.accept.include(v);})))&&Position.within(_b.element,_9[0],_9[1]));},deactivate:function(_c){if(_c.hoverclass){Element.removeClassName(_c.element,_c.hoverclass);}this.last_active=null;},activate:function(_d){if(_d.hoverclass){Element.addClassName(_d.element,_d.hoverclass);}this.last_active=_d;},show:function(_e,_f){if(!this.drops.length){return;}var _10,_11=[];this.drops.each(function(_12){if(Droppables.isAffected(_e,_f,_12)){_11.push(_12);}});if(_11.length>0){_10=Droppables.findDeepestChild(_11);}if(this.last_active&&this.last_active!=_10){this.deactivate(this.last_active);}if(_10){Position.within(_10.element,_e[0],_e[1]);if(_10.onHover){_10.onHover(_f,_10.element,Position.overlap(_10.overlap,_10.element));}if(_10!=this.last_active){Droppables.activate(_10);}}},fire:function(_13,_14){if(!this.last_active){return;}Position.prepare();if(this.isAffected([Event.pointerX(_13),Event.pointerY(_13)],_14,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(_14,this.last_active.element,_13);return true;}}},reset:function(){if(this.last_active){this.deactivate(this.last_active);}}};var Draggables={drags:[],observers:[],register:function(_15){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);}this.drags.push(_15);},unregister:function(_16){this.drags=this.drags.reject(function(d){return d==_16;});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);}},activate:function(_17){if(_17.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=_17;}.bind(this),_17.options.delay);}else{window.focus();this.activeDraggable=_17;}},deactivate:function(){this.activeDraggable=null;},updateDrag:function(_18){if(!this.activeDraggable){return;}var _19=[Event.pointerX(_18),Event.pointerY(_18)];if(this._lastPointer&&(this._lastPointer.inspect()==_19.inspect())){return;}this._lastPointer=_19;this.activeDraggable.updateDrag(_18,_19);},endDrag:function(_1a){if(this._timeout){clearTimeout(this._timeout);this._timeout=null;}if(!this.activeDraggable){return;}this._lastPointer=null;this.activeDraggable.endDrag(_1a);this.activeDraggable=null;},keyPress:function(_1b){if(this.activeDraggable){this.activeDraggable.keyPress(_1b);}},addObserver:function(_1c){this.observers.push(_1c);this._cacheObserverCallbacks();},removeObserver:function(_1d){this.observers=this.observers.reject(function(o){return o.element==_1d;});this._cacheObserverCallbacks();},notify:function(_1e,_1f,_20){if(this[_1e+"Count"]>0){this.observers.each(function(o){if(o[_1e]){o[_1e](_1e,_1f,_20);}});}if(_1f.options[_1e]){_1f.options[_1e](_1f,_20);}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(_21){Draggables[_21+"Count"]=Draggables.observers.select(function(o){return o[_21];}).length;});}};var Draggable=Class.create({initialize:function(_22){var _23={handle:false,reverteffect:function(_24,_25,_26){var dur=Math.sqrt(Math.abs(_25^2)+Math.abs(_26^2))*0.02;new Effect.Move(_24,{x:-_26,y:-_25,duration:dur,queue:{scope:"_draggable",position:"end"}});},endeffect:function(_27){var _28=Object.isNumber(_27._opacity)?_27._opacity:1;new Effect.Opacity(_27,{duration:0.2,from:0.7,to:_28,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[_27]=false;}});},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(_23,{starteffect:function(_29){_29._opacity=Element.getOpacity(_29);Draggable._dragging[_29]=true;new Effect.Opacity(_29,{duration:0.2,from:_29._opacity,to:0.7});}});}var _2a=Object.extend(_23,arguments[1]||{});this.element=$(_22);if(_2a.handle&&Object.isString(_2a.handle)){this.handle=this.element.down("."+_2a.handle,0);}if(!this.handle){this.handle=$(_2a.handle);}if(!this.handle){this.handle=this.element;}if(_2a.scroll&&!_2a.scroll.scrollTo&&!_2a.scroll.outerHTML){_2a.scroll=$(_2a.scroll);this._isScrollChild=Element.childOf(this.element,_2a.scroll);}Element.makePositioned(this.element);this.options=_2a;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this);},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")]);},initDrag:function(_2b){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return;}if(Event.isLeftClick(_2b)){var src=Event.element(_2b);if((tag_name=src.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return;}var _2c=[Event.pointerX(_2b),Event.pointerY(_2b)];var pos=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(_2c[i]-pos[i]);});Draggables.activate(this);Event.stop(_2b);}},startDrag:function(_2d){this.dragging=true;if(!this.delta){this.delta=this.currentDelta();}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex;}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this.element._originallyAbsolute){Position.absolutize(this.element);}this.element.parentNode.insertBefore(this._clone,this.element);}if(this.options.scroll){if(this.options.scroll==window){var _2e=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=_2e.left;this.originalScrollTop=_2e.top;}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop;}}Draggables.notify("onStart",this,_2d);if(this.options.starteffect){this.options.starteffect(this.element);}},updateDrag:function(_2f,_30){if(!this.dragging){this.startDrag(_2f);}if(!this.options.quiet){Position.prepare();Droppables.show(_30,this.element);}Draggables.notify("onDrag",this,_2f);this.draw(_30);if(this.options.change){this.options.change(this);}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height];}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight);}var _31=[0,0];if(_30[0]<(p[0]+this.options.scrollSensitivity)){_31[0]=_30[0]-(p[0]+this.options.scrollSensitivity);}if(_30[1]<(p[1]+this.options.scrollSensitivity)){_31[1]=_30[1]-(p[1]+this.options.scrollSensitivity);}if(_30[0]>(p[2]-this.options.scrollSensitivity)){_31[0]=_30[0]-(p[2]-this.options.scrollSensitivity);}if(_30[1]>(p[3]-this.options.scrollSensitivity)){_31[1]=_30[1]-(p[3]-this.options.scrollSensitivity);}this.startScrolling(_31);}if(Prototype.Browser.WebKit){window.scrollBy(0,0);}Event.stop(_2f);},finishDrag:function(_32,_33){this.dragging=false;if(this.options.quiet){Position.prepare();var _34=[Event.pointerX(_32),Event.pointerY(_32)];Droppables.show(_34,this.element);}if(this.options.ghosting){if(!this.element._originallyAbsolute){Position.relativize(this.element);}delete this.element._originallyAbsolute;Element.remove(this._clone);this._clone=null;}var _35=false;if(_33){_35=Droppables.fire(_32,this.element);if(!_35){_35=false;}}if(_35&&this.options.onDropped){this.options.onDropped(this.element);}Draggables.notify("onEnd",this,_32);var _36=this.options.revert;if(_36&&Object.isFunction(_36)){_36=_36(this.element);}var d=this.currentDelta();if(_36&&this.options.reverteffect){if(_35==0||_36!="failure"){this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);}}else{this.delta=d;}if(this.options.zindex){this.element.style.zIndex=this.originalZ;}if(this.options.endeffect){this.options.endeffect(this.element);}Draggables.deactivate(this);Droppables.reset();},keyPress:function(_37){if(_37.keyCode!=Event.KEY_ESC){return;}this.finishDrag(_37,false);Event.stop(_37);},endDrag:function(_38){if(!this.dragging){return;}this.stopScrolling();this.finishDrag(_38,true);Event.stop(_38);},draw:function(_39){var pos=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);pos[0]+=r[0]-Position.deltaX;pos[1]+=r[1]-Position.deltaY;}var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}var p=[0,1].map(function(i){return(_39[i]-pos[i]-this.offset[i]);}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){p=this.options.snap(p[0],p[1],this);}else{if(Object.isArray(this.options.snap)){p=p.map(function(v,i){return(v/this.options.snap[i]).round()*this.options.snap[i];}.bind(this));}else{p=p.map(function(v){return(v/this.options.snap).round()*this.options.snap;}.bind(this));}}}var _3a=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){_3a.left=p[0]+"px";}if((!this.options.constraint)||(this.options.constraint=="vertical")){_3a.top=p[1]+"px";}if(_3a.visibility=="hidden"){_3a.visibility="";}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null;}},startScrolling:function(_3b){if(!(_3b[0]||_3b[1])){return;}this.scrollSpeed=[_3b[0]*this.options.scrollSpeed,_3b[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10);},scroll:function(){var _3c=new Date();var _3d=_3c-this.lastScrolled;this.lastScrolled=_3c;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=_3d/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*_3d/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*_3d/1000;}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*_3d/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*_3d/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0;}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0;}this.draw(Draggables._lastScrollPointer);}if(this.options.change){this.options.change(this);}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight;}}}return{top:T,left:L,width:W,height:H};}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(_3e,_3f){this.element=$(_3e);this.observer=_3f;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element);}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(_40){while(_40.tagName.toUpperCase()!="BODY"){if(_40.id&&Sortable.sortables[_40.id]){return _40;}_40=_40.parentNode;}},options:function(_41){_41=Sortable._findRootElement($(_41));if(!_41){return;}return Sortable.sortables[_41.id];},destroy:function(_42){var s=Sortable.options(_42);if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d);});s.draggables.invoke("destroy");delete Sortable.sortables[s.element.id];}},create:function(_43){_43=$(_43);var _44=Object.extend({element:_43,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:_43,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(_43);var _45={revert:true,quiet:_44.quiet,scroll:_44.scroll,scrollSpeed:_44.scrollSpeed,scrollSensitivity:_44.scrollSensitivity,delay:_44.delay,ghosting:_44.ghosting,constraint:_44.constraint,handle:_44.handle};if(_44.starteffect){_45.starteffect=_44.starteffect;}if(_44.reverteffect){_45.reverteffect=_44.reverteffect;}else{if(_44.ghosting){_45.reverteffect=function(_46){_46.style.top=0;_46.style.left=0;};}}if(_44.endeffect){_45.endeffect=_44.endeffect;}if(_44.zindex){_45.zindex=_44.zindex;}var _47={overlap:_44.overlap,containment:_44.containment,tree:_44.tree,hoverclass:_44.hoverclass,onHover:Sortable.onHover};var _48={onHover:Sortable.onEmptyHover,overlap:_44.overlap,containment:_44.containment,hoverclass:_44.hoverclass};Element.cleanWhitespace(_43);_44.draggables=[];_44.droppables=[];if(_44.dropOnEmpty||_44.tree){Droppables.add(_43,_48);_44.droppables.push(_43);}(_44.elements||this.findElements(_43,_44)||[]).each(function(e,i){var _49=_44.handles?$(_44.handles[i]):(_44.handle?$(e).select("."+_44.handle)[0]:e);_44.draggables.push(new Draggable(e,Object.extend(_45,{handle:_49})));Droppables.add(e,_47);if(_44.tree){e.treeNode=_43;}_44.droppables.push(e);});if(_44.tree){(Sortable.findTreeElements(_43,_44)||[]).each(function(e){Droppables.add(e,_48);e.treeNode=_43;_44.droppables.push(e);});}this.sortables[_43.id]=_44;Draggables.addObserver(new SortableObserver(_43,_44.onUpdate));},findElements:function(_4a,_4b){return Element.findChildren(_4a,_4b.only,_4b.tree?true:false,_4b.tag);},findTreeElements:function(_4c,_4d){return Element.findChildren(_4c,_4d.only,_4d.tree?true:false,_4d.treeTag);},onHover:function(_4e,_4f,_50){if(Element.isParent(_4f,_4e)){return;}if(_50>0.33&&_50<0.66&&Sortable.options(_4f).tree){return;}else{if(_50>0.5){Sortable.mark(_4f,"before");if(_4f.previousSibling!=_4e){var _51=_4e.parentNode;_4e.style.visibility="hidden";_4f.parentNode.insertBefore(_4e,_4f);if(_4f.parentNode!=_51){Sortable.options(_51).onChange(_4e);}Sortable.options(_4f.parentNode).onChange(_4e);}}else{Sortable.mark(_4f,"after");var _52=_4f.nextSibling||null;if(_52!=_4e){var _51=_4e.parentNode;_4e.style.visibility="hidden";_4f.parentNode.insertBefore(_4e,_52);if(_4f.parentNode!=_51){Sortable.options(_51).onChange(_4e);}Sortable.options(_4f.parentNode).onChange(_4e);}}}},onEmptyHover:function(_53,_54,_55){var _56=_53.parentNode;var _57=Sortable.options(_54);if(!Element.isParent(_54,_53)){var _58;var _59=Sortable.findElements(_54,{tag:_57.tag,only:_57.only});var _5a=null;if(_59){var _5b=Element.offsetSize(_54,_57.overlap)*(1-_55);for(_58=0;_58<_59.length;_58+=1){if(_5b-Element.offsetSize(_59[_58],_57.overlap)>=0){_5b-=Element.offsetSize(_59[_58],_57.overlap);}else{if(_5b-(Element.offsetSize(_59[_58],_57.overlap)/2)>=0){_5a=_58+1<_59.length?_59[_58+1]:null;break;}else{_5a=_59[_58];break;}}}}_54.insertBefore(_53,_5a);Sortable.options(_56).onChange(_53);_57.onChange(_53);}},unmark:function(){if(Sortable._marker){Sortable._marker.hide();}},mark:function(_5c,_5d){var _5e=Sortable.options(_5c.parentNode);if(_5e&&!_5e.ghosting){return;}if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}var _5f=Position.cumulativeOffset(_5c);Sortable._marker.setStyle({left:_5f[0]+"px",top:_5f[1]+"px"});if(_5d=="after"){if(_5e.overlap=="horizontal"){Sortable._marker.setStyle({left:(_5f[0]+_5c.clientWidth)+"px"});}else{Sortable._marker.setStyle({top:(_5f[1]+_5c.clientHeight)+"px"});}}Sortable._marker.show();},_tree:function(_60,_61,_62){var _63=Sortable.findElements(_60,_61)||[];for(var i=0;i<_63.length;++i){var _64=_63[i].id.match(_61.format);if(!_64){continue;}var _65={id:encodeURIComponent(_64?_64[1]:null),element:_60,parent:_62,children:[],position:_62.children.length,container:$(_63[i]).down(_61.treeTag)};if(_65.container){this._tree(_65.container,_61,_65);}_62.children.push(_65);}return _62;},tree:function(_66){_66=$(_66);var _67=this.options(_66);var _68=Object.extend({tag:_67.tag,treeTag:_67.treeTag,only:_67.only,name:_66.id,format:_67.format},arguments[1]||{});var _69={id:null,parent:null,children:[],container:_66,position:0};return Sortable._tree(_66,_68,_69);},_constructIndex:function(_6a){var _6b="";do{if(_6a.id){_6b="["+_6a.position+"]"+_6b;}}while((_6a=_6a.parent)!=null);return _6b;},sequence:function(_6c){_6c=$(_6c);var _6d=Object.extend(this.options(_6c),arguments[1]||{});return $(this.findElements(_6c,_6d)||[]).map(function(_6e){return _6e.id.match(_6d.format)?_6e.id.match(_6d.format)[1]:"";});},setSequence:function(_6f,_70){_6f=$(_6f);var _71=Object.extend(this.options(_6f),arguments[2]||{});var _72={};this.findElements(_6f,_71).each(function(n){if(n.id.match(_71.format)){_72[n.id.match(_71.format)[1]]=[n,n.parentNode];}n.parentNode.removeChild(n);});_70.each(function(_73){var n=_72[_73];if(n){n[1].appendChild(n[0]);delete _72[_73];}});},serialize:function(_74){_74=$(_74);var _75=Object.extend(Sortable.options(_74),arguments[1]||{});var _76=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:_74.id);if(_75.tree){return Sortable.tree(_74,arguments[1]).children.map(function(_77){return[_76+Sortable._constructIndex(_77)+"[id]="+encodeURIComponent(_77.id)].concat(_77.children.map(arguments.callee));}).flatten().join("&");}else{return Sortable.sequence(_74,arguments[1]).map(function(_78){return _76+"[]="+encodeURIComponent(_78);}).join("&");}}};Element.isParent=function(_79,_7a){if(!_79.parentNode||_79==_7a){return false;}if(_79.parentNode==_7a){return true;}return Element.isParent(_79.parentNode,_7a);};Element.findChildren=function(_7b,_7c,_7d,_7e){if(!_7b.hasChildNodes()){return null;}_7e=_7e.toUpperCase();if(_7c){_7c=[_7c].flatten();}var _7f=[];$A(_7b.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==_7e&&(!_7c||(Element.classNames(e).detect(function(v){return _7c.include(v);})))){_7f.push(e);}if(_7d){var _80=Element.findChildren(e,_7c,_7d,_7e);if(_80){_7f.push(_80);}}});return(_7f.length>0?_7f.flatten():[]);};Element.offsetSize=function(_81,_82){return _81["offset"+((_82=="vertical"||_82=="height")?"Height":"Width")];};if(typeof Effect=="undefined"){throw("controls.js requires including script.aculo.us' effects.js library");}var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(_1,_2,_3){_1=$(_1);this.element=_1;this.update=$(_2);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions){this.setOptions(_3);}else{this.options=_3||{};}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(_4,_5){if(!_5.style.position||_5.style.position=="absolute"){_5.style.position="absolute";Position.clone(_4,_5,{setHeight:false,offsetTop:_4.offsetHeight});}Effect.Appear(_5,{duration:0.15});};this.options.onHide=this.options.onHide||function(_6,_7){new Effect.Fade(_7,{duration:0.15});};if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens);}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n");}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update);}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,"<iframe id=\""+this.update.id+"_iefix\" "+"style=\"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" "+"src=\"javascript:false;\" frameborder=\"0\" scrolling=\"no\"></iframe>");this.iefix=$(this.update.id+"_iefix");}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50);}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update);}if(this.iefix){Element.hide(this.iefix);}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator);}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator);}},onKeyPress:function(_8){if(this.active){switch(_8.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(_8);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(_8);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(_8);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(_8);return;}}else{if(_8.keyCode==Event.KEY_TAB||_8.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&_8.keyCode==0)){return;}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer);}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(_9){var _a=Event.findElement(_9,"LI");if(this.index!=_a.autocompleteIndex){this.index=_a.autocompleteIndex;this.render();}Event.stop(_9);},onClick:function(_b){var _c=Event.findElement(_b,"LI");this.index=_c.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(_d){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++){this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");}if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0){this.index--;}else{this.index=this.entryCount-1;}this.getEntry(this.index).scrollIntoView(true);},markNext:function(){if(this.index<this.entryCount-1){this.index++;}else{this.index=0;}this.getEntry(this.index).scrollIntoView(false);},getEntry:function(_e){return this.update.firstChild.childNodes[_e];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(_f){if(this.options.updateElement){this.options.updateElement(_f);return;}var _10="";if(this.options.select){var _11=$(_f).select("."+this.options.select)||[];if(_11.length>0){_10=Element.collectTextNodes(_11[0],this.options.select);}}else{_10=Element.collectTextNodesIgnoreClass(_f,"informal");}var _12=this.getTokenBounds();if(_12[0]!=-1){var _13=this.element.value.substr(0,_12[0]);var _14=this.element.value.substr(_12[0]).match(/^\s+/);if(_14){_13+=_14[0];}this.element.value=_13+_10+this.element.value.substr(_12[1]);}else{this.element.value=_10;}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,_f);}},updateChoices:function(_15){if(!this.changed&&this.hasFocus){this.update.innerHTML=_15;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var _16=this.getEntry(i);_16.autocompleteIndex=i;this.addObservers(_16);}}else{this.entryCount=0;}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}},addObservers:function(_17){Event.observe(_17,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(_17,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}this.oldElementValue=this.element.value;},getToken:function(){var _18=this.getTokenBounds();return this.element.value.substring(_18[0],_18[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds;}var _19=this.element.value;if(_19.strip().empty()){return[-1,0];}var _1a=arguments.callee.getFirstDifferencePos(_19,this.oldElementValue);var _1b=(_1a==this.oldElementValue.length?1:0);var _1c=-1,_1d=_19.length;var tp;for(var _1e=0,l=this.options.tokens.length;_1e<l;++_1e){tp=_19.lastIndexOf(this.options.tokens[_1e],_1a+_1b-1);if(tp>_1c){_1c=tp;}tp=_19.indexOf(this.options.tokens[_1e],_1a+_1b);if(-1!=tp&&tp<_1d){_1d=tp;}}return(this.tokenBounds=[_1c+1,_1d]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(_1f,_20){var _21=Math.min(_1f.length,_20.length);for(var _22=0;_22<_21;++_22){if(_1f[_22]!=_20[_22]){return _22;}}return _21;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(_23,_24,url,_25){this.baseInitialize(_23,_24,_25);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var _26=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,_26):_26;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams;}new Ajax.Request(this.url,this.options);},onComplete:function(_27){this.updateChoices(_27.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(_28,_29,_2a,_2b){this.baseInitialize(_28,_29,_2b);this.options.array=_2a;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(_2c){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(_2d){var ret=[];var _2e=[];var _2f=_2d.getToken();var _30=0;for(var i=0;i<_2d.options.array.length&&ret.length<_2d.options.choices;i++){var _31=_2d.options.array[i];var _32=_2d.options.ignoreCase?_31.toLowerCase().indexOf(_2f.toLowerCase()):_31.indexOf(_2f);while(_32!=-1){if(_32==0&&_31.length!=_2f.length){ret.push("<li><strong>"+_31.substr(0,_2f.length)+"</strong>"+_31.substr(_2f.length)+"</li>");break;}else{if(_2f.length>=_2d.options.partialChars&&_2d.options.partialSearch&&_32!=-1){if(_2d.options.fullSearch||/\s/.test(_31.substr(_32-1,1))){_2e.push("<li>"+_31.substr(0,_32)+"<strong>"+_31.substr(_32,_2f.length)+"</strong>"+_31.substr(_32+_2f.length)+"</li>");break;}}}_32=_2d.options.ignoreCase?_31.toLowerCase().indexOf(_2f.toLowerCase(),_32+1):_31.indexOf(_2f,_32+1);}}if(_2e.length){ret=ret.concat(_2e.slice(0,_2d.options.choices-ret.length));}return"<ul>"+ret.join("")+"</ul>";}},_2c||{});}});Field.scrollFreeActivate=function(_33){setTimeout(function(){Field.activate(_33);},1);};Ajax.InPlaceEditor=Class.create({initialize:function(_34,url,_35){this.url=url;this.element=_34=$(_34);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(_35);Object.extend(this.options,_35||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId="";}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl);}if(!this.options.externalControl){this.options.externalControlOnly=false;}this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey){return;}if(Event.KEY_ESC==e.keyCode){this.handleFormCancellation(e);}else{if(Event.KEY_RETURN==e.keyCode){this.handleFormSubmission(e);}}},createControl:function(_36,_37,_38){var _39=this.options[_36+"Control"];var _3a=this.options[_36+"Text"];if("button"==_39){var btn=document.createElement("input");btn.type="submit";btn.value=_3a;btn.className="editor_"+_36+"_button";if("cancel"==_36){btn.onclick=this._boundCancelHandler;}this._form.appendChild(btn);this._controls[_36]=btn;}else{if("link"==_39){var _3b=document.createElement("a");_3b.href="#";_3b.appendChild(document.createTextNode(_3a));_3b.onclick="cancel"==_36?this._boundCancelHandler:this._boundSubmitHandler;_3b.className="editor_"+_36+"_link";if(_38){_3b.className+=" "+_38;}this._form.appendChild(_3b);this._controls[_36]=_3b;}}},createEditField:function(){var _3c=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement("input");fld.type="text";var _3d=this.options.size||this.options.cols||0;if(0<_3d){fld.size=_3d;}}else{fld=document.createElement("textarea");fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}fld.name=this.options.paramName;fld.value=_3c;fld.className="editor_field";if(this.options.submitOnBlur){fld.onblur=this._boundSubmitHandler;}this._controls.editor=fld;if(this.options.loadTextURL){this.loadExternalText();}this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function _3e(_3f,_40){var _41=ipe.options["text"+_3f+"Controls"];if(!_41||_40===false){return;}ipe._form.appendChild(document.createTextNode(_41));};this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if("textarea"==this._controls.editor.tagName.toLowerCase()){this._form.appendChild(document.createElement("br"));}if(this.options.onFormCustomization){this.options.onFormCustomization(this,this._form);}_3e("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);_3e("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");_3e("After",this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;}this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing){return;}this._editing=true;this.triggerCallback("onEnterEditMode");if(this.options.externalControl){this.options.externalControl.hide();}this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL){this.postProcessEditField();}if(e){Event.stop(e);}},enterHover:function(e){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName);}if(this._saving){return;}this.triggerCallback("onEnterHover");},getText:function(){return this.element.innerHTML;},handleAJAXFailure:function(_42){this.triggerCallback("onFailure",_42);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e){Event.stop(e);}},handleFormSubmission:function(e){var _43=this._form;var _44=$F(this._controls.editor);this.prepareSubmission();var _45=this.options.callback(_43,_44)||"";if(Object.isString(_45)){_45=_45.toQueryParams();}_45.editorId=this.element.id;if(this.options.htmlResponse){var _46=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(_46,{parameters:_45,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,_46);}else{var _46=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(_46,{parameters:_45,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,_46);}if(e){Event.stop(e);}},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl){this.options.externalControl.show();}this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode");},leaveHover:function(e){if(this.options.hoverClassName){this.element.removeClassName(this.options.hoverClassName);}if(this._saving){return;}this.triggerCallback("onLeaveHover");},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var _47=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(_47,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(_48){this._form.removeClassName(this.options.loadingClassName);var _49=_48.responseText;if(this.options.stripLoadedTextTags){_49=_49.stripTags();}this._controls.editor.value=_49;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,_47);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc){$(this._controls.editor)["focus"==fpc?"focus":"activate"]();}},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(_4a){Object.extend(this.options,_4a);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var _4b;$H(Ajax.InPlaceEditor.Listeners).each(function(_4c){_4b=this[_4c.value].bind(this);this._listeners[_4c.key]=_4b;if(!this.options.externalControlOnly){this.element.observe(_4c.key,_4b);}if(this.options.externalControl){this.options.externalControl.observe(_4c.key,_4b);}}.bind(this));},removeForm:function(){if(!this._form){return;}this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(_4d,arg){if("function"==typeof this.options[_4d]){this.options[_4d](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(_4e){if(!this.options.externalControlOnly){this.element.stopObserving(_4e.key,_4e.value);}if(this.options.externalControl){this.options.externalControl.stopObserving(_4e.key,_4e.value);}}.bind(this));},wrapUp:function(_4f){this.leaveEditMode();this._boundComplete(_4f,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function(_50,_51,url,_52){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;_50(_51,url,_52);},createEditField:function(){var _53=document.createElement("select");_53.name=this.options.paramName;_53.size=1;this._controls.editor=_53;this._collection=this.options.collection||[];if(this.options.loadCollectionURL){this.loadCollection();}else{this.checkForExternalText();}this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var _54=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(_54,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(_55){var js=_55.responseText.strip();if(!/^\[.*\]$/.test(js)){throw"Server returned an invalid collection representation.";}this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,_54);},showLoadingText:function(_56){this._controls.editor.disabled=true;var _57=this._controls.editor.firstChild;if(!_57){_57=document.createElement("option");_57.value="";this._controls.editor.appendChild(_57);_57.selected=true;}_57.update((_56||"").stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL){this.loadExternalText();}else{this.buildOptionList();}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var _58=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(_58,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(_59){this._text=_59.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,_58);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(_5a){return 2===_5a.length?_5a:[_5a,_5a].flatten();});var _5b=("value"in this.options)?this.options.value:this._text;var _5c=this._collection.any(function(_5d){return _5d[0]==_5b;}.bind(this));this._controls.editor.update("");var _5e;this._collection.each(function(_5f,_60){_5e=document.createElement("option");_5e.value=_5f[0];_5e.selected=_5c?_5f[0]==_5b:0==_60;_5e.appendChild(document.createTextNode(_5f[1]));this._controls.editor.appendChild(_5e);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(_61){if(!_61){return;}function _62(_63,_64){if(_63 in _61||_64===undefined){return;}_61[_63]=_64;};_62("cancelControl",(_61.cancelLink?"link":(_61.cancelButton?"button":_61.cancelLink==_61.cancelButton==false?false:undefined)));_62("okControl",(_61.okLink?"link":(_61.okButton?"button":_61.okLink==_61.okButton==false?false:undefined)));_62("highlightColor",_61.highlightcolor);_62("highlightEndColor",_61.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(_65){return Form.serialize(_65);},onComplete:function(_66,_67){new Effect.Highlight(_67,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect){ipe._effect.cancel();}},onFailure:function(_68,ipe){alert("Error communication with the server: "+_68.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(_69,_6a,_6b){this.delay=_6a||0.5;this.element=$(_69);this.callback=_6b;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this));},delayedListener:function(_6c){if(this.lastValue==$F(this.element)){return;}if(this.timer){clearTimeout(this.timer);}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}});

(function(){var eventMatchers={'HTMLEvents':/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,'MouseEvents':/^(?:click|mouse(?:down|up|over|move|out))$/}
var defaultOptions={pointerX:0,pointerY:0,button:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,bubbles:true,cancelable:true}
Event.simulate=function(element,eventName){var options=Object.extend(Object.clone(defaultOptions),arguments[2]||{});var oEvent,eventType=null;element=$(element);for(var name in eventMatchers){if(eventMatchers[name].test(eventName)){eventType=name;break;}}
if(!eventType)
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');if(document.createEvent){oEvent=document.createEvent(eventType);if(eventType=='HTMLEvents'){oEvent.initEvent(eventName,options.bubbles,options.cancelable);}
else{oEvent.initMouseEvent(eventName,options.bubbles,options.cancelable,document.defaultView,options.button,options.pointerX,options.pointerY,options.pointerX,options.pointerY,options.ctrlKey,options.altKey,options.shiftKey,options.metaKey,options.button,element);}
element.dispatchEvent(oEvent);}
else{options.clientX=options.pointerX;options.clientY=options.pointerY;oEvent=Object.extend(document.createEventObject(),options);element.fireEvent('on'+eventName,oEvent);}
return element;}
Element.addMethods({simulate:Event.simulate});})()

var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

var AdManager=Class.create({initialize:function(){this.banner_placements=$$('.banner').reject(function(b){return b.readAttribute('id')=='banner_overlay'});this.banners=[];this.banner_placements.each(function(placement){var banner_tag=placement.down('script'),content_unit=(banner_tag?banner_tag.src.replace(/^.*\?cu\=([\d]+).*$/,"$1"):undefined),dimensions=this._get_dimensions_from(placement);if(content_unit){this.banners.push({id:content_unit,width:dimensions.width,height:dimensions.height,placement:placement});}},this);},reload_banners:function(){this.banners.each(function(banner){this._strip_tags_from(banner.placement);banner.placement.insert({top:'<iframe src="http://eas4.emediate.eu/eas?cu='+banner.id+';cre=mu;target=_blank'+'" width="'+banner.width+'" height="'+banner.height+'" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>'});},this);WhiteAlbum.pageviews.increment();},_strip_tags_from:function(placement){placement.childElements().reject(function(child){return child.hasClassName('banner')}).each(Element.remove);},_get_dimensions_from:function(placement){var width=0,height=0;if(placement.hasClassName('banner300')){width=300;height=(placement.down('img')?placement.down('img').getDimensions().height:250);}
else if(placement.readAttribute('id')=='topBanner'){width=960;height=180;}
else if(placement.hasClassName('adHorseShoe')){width=160;height=600;}
return{width:width,height:height};}});

Object.extend(String.prototype,{ensureEndsWith:function(str){return this.endsWith(str)?this:this+str;},px:function(){return this.ensureEndsWith('px');}});Object.extend(Number.prototype,{px:function(){return this.toString().px();}});var Window={size:function(){var width=window.innerWidth||(window.document.documentElement.clientWidth||window.document.body.clientWidth);var height=window.innerHeight||(window.document.documentElement.clientHeight||window.document.body.clientHeight);var x=window.pageXOffset||(window.document.documentElement.scrollLeft||window.document.body.scrollLeft);var y=window.pageYOffset||(window.document.documentElement.scrollTop||window.document.body.scrollTop);return{'width':width,'height':height,'x':x,'y':y}}}
var FancyZoomBox={directory:'/images/base/fancyzoom',zooming:false,setup:false,init:function(directory){if(FancyZoomBox.setup)return;FancyZoomBox.setup=true;var ie=navigator.userAgent.match(/MSIE\s(\d)+/);if(ie){var version=parseInt(ie[1]);Prototype.Browser['IE'+version.toString()]=true;Prototype.Browser.ltIE7=(version<7)?true:false;}
var html='<div id="zoom" style="display:none;"> \
                  <table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;"> \
                    <tbody> \
                      <tr> \
                        <td class="tl" style="background:url('+FancyZoomBox.directory+'/tl.png) 0 0 no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                        <td class="tm" style="background:url('+FancyZoomBox.directory+'/tm.png) 0 0 repeat-x; height:20px; overflow:hidden;" /> \
                        <td class="tr" style="background:url('+FancyZoomBox.directory+'/tr.png) 100% 0 no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                      </tr> \
                      <tr> \
                        <td class="ml" style="background:url('+FancyZoomBox.directory+'/ml.png) 0 0 repeat-y; width:20px; overflow:hidden;" /> \
                        <td class="mm" style="background:#fff; vertical-align:top; padding:10px;"> \
                          <div id="zoom_content"> \
                          </div> \
                        </td> \
                        <td class="mr" style="background:url('+FancyZoomBox.directory+'/mr.png) 100% 0 repeat-y;  width:20px; overflow:hidden;" /> \
                      </tr> \
                      <tr> \
                        <td class="bl" style="background:url('+FancyZoomBox.directory+'/bl.png) 0 100% no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                        <td class="bm" style="background:url('+FancyZoomBox.directory+'/bm.png) 0 100% repeat-x; height:20px; overflow:hidden;" /> \
                        <td class="br" style="background:url('+FancyZoomBox.directory+'/br.png) 100% 100% no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                      </tr> \
                    </tbody> \
                  </table> \
                  <a href="#" title="Close" id="zoom_close" style="position:absolute; top:0; left:0;"> \
                    <img src="'+FancyZoomBox.directory+'/closebox.png" alt="Close" style="border:none; margin:0; padding:0;" /> \
                  </a> \
                </div>';var body=$$('body').first();body.insert(html);FancyZoomBox.zoom=$('zoom');FancyZoomBox.zoom_table=$('zoom_table');FancyZoomBox.zoom_close=$('zoom_close');FancyZoomBox.zoom_content=$('zoom_content');FancyZoomBox.zoom_close.observe('click',FancyZoomBox.hide);FancyZoomBox.middle_row=$A([$$('td.ml'),$$('td.mm'),$$('td.mr')]).flatten();FancyZoomBox.cells=FancyZoomBox.zoom_table.select('td');$$('html').first().observe('click',function(e){var click_in_zoom=e.findElement('#zoom'),zoom_display=FancyZoomBox.zoom.getStyle('display');if(zoom_display=='block'&&!click_in_zoom){FancyZoomBox.hide(e);}});$(document).observe('keyup',function(e){var zoom_display=FancyZoomBox.zoom.getStyle('display');if(e.keyCode==Event.KEY_ESC&&zoom_display=='block'){FancyZoomBox.hide(e);}});if(Prototype.Browser.ltIE7){FancyZoomBox.switchBackgroundImagesTo('gif');}},show:function(e){e.stop();if(FancyZoomBox.zooming)return;FancyZoomBox.zooming=true;var element=e.findElement('a');var related_div=element.content_div;var width=(element.zoom_width||related_div.getWidth())+60;var height=(element.zoom_height||related_div.getHeight())+60;var d=Window.size();var yOffset=document.viewport.getScrollOffsets()[1];var newTop=Math.max((d.height/2)-(height/2)+yOffset,0);var newLeft=(d.width/2)-(width/2);FancyZoomBox.curTop=e.pointerY();FancyZoomBox.curLeft=e.pointerX();FancyZoomBox.moveX=-(FancyZoomBox.curLeft-newLeft);FancyZoomBox.moveY=-(FancyZoomBox.curTop-newTop);FancyZoomBox.zoom.hide().setStyle({position:'absolute',top:FancyZoomBox.curTop.px(),left:FancyZoomBox.curLeft.px()});new Effect.Parallel([new Effect.Appear(FancyZoomBox.zoom,{sync:true}),new Effect.Move(FancyZoomBox.zoom,{x:FancyZoomBox.moveX,y:FancyZoomBox.moveY,sync:true}),new Effect.Morph(FancyZoomBox.zoom,{style:{width:width.px(),height:height.px()},sync:true,beforeStart:function(effect){if(Prototype.Browser.IE){FancyZoomBox.middle_row.invoke('setStyle',{height:(height-40).px()});}
FancyZoomBox.fixBackgroundsForIE();},afterFinish:function(effect){FancyZoomBox.zoom_content.update(related_div);FancyZoomBox.zoom_content.setStyle({height:'100px'});related_div.show();FancyZoomBox.unfixBackgroundsForIE();FancyZoomBox.zoom_close.show();FancyZoomBox.zooming=false;}})],{duration:0.5});WhiteAlbum.media.toggle();},hide:function(e){if(e!=null)e.stop();if(FancyZoomBox.zooming)return;FancyZoomBox.zooming=true;new Effect.Parallel([new Effect.Move(FancyZoomBox.zoom,{x:FancyZoomBox.moveX*-1,y:FancyZoomBox.moveY*-1,sync:true}),new Effect.Morph(FancyZoomBox.zoom,{style:{width:'1'.px(),height:'1'.px()},sync:true,beforeStart:function(effect){FancyZoomBox.fixBackgroundsForIE();FancyZoomBox.zoom_content.innerHTML='';FancyZoomBox.zoom_close.hide();},afterFinish:function(effect){FancyZoomBox.unfixBackgroundsForIE();FancyZoomBox.zooming=false;}}),new Effect.Fade(FancyZoomBox.zoom,{sync:true})],{duration:0.5});WhiteAlbum.media.toggle();},switchBackgroundImagesTo:function(to){FancyZoomBox.cells.each(function(td){var bg=td.getStyle('background-image').gsub(/\.(png|gif|none)\)$/,'.'+to+')');td.setStyle('background-image: '+bg);});var close_img=FancyZoomBox.zoom_close.firstDescendant();var new_img=close_img.readAttribute('src').gsub(/\.(png|gif|none)$/,'.'+to);close_img.writeAttribute('src',new_img);},fixBackgroundsForIE:function(){if(Prototype.Browser.IE7){FancyZoomBox.switchBackgroundImagesTo('gif');}},unfixBackgroundsForIE:function(){if(Prototype.Browser.IE7){FancyZoomBox.switchBackgroundImagesTo('png');}}}
var FancyZoom=Class.create({initialize:function(element){this.options=arguments.length>1?arguments[1]:{};FancyZoomBox.init();this.element=$(element);if(this.element){this.element.content_div=$(this.element.readAttribute('href').gsub(/^#/,''));this.element.content_div.hide();this.element.zoom_width=this.options.width;this.element.zoom_height=this.options.height;this.element.observe('click',FancyZoomBox.show);}}});

function getPageContent(divId){var content="";try{content=document.getElementById(divId).innerHTML;}catch(E){;}
return content?content:false;}
function updatePageContent(divId,content){var success=false;try{document.getElementById(divId).innerHTML=content;success=true;}catch(E){;}
return success;}
function videoMagic(){var content=getPageContent('article'),is_iOS=!!navigator.userAgent.match(/Apple.*Mobile.*Safari/);if(content){var orig=content;var serial=0;content=content.replace(/<a[^>]*?vimeo\.com\/(\d+).*?<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____vimeo____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/(?:www\.)?vimeo\.com\/(\d+)/gi,"<div style=\"text-align: center;\" id=\"video____vimeo____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/<a[^>]*?videos\.streetfire\.net\/video\/([a-zA-Z0-9\-]+).htm.*?<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____streetfire____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/videos\.streetfire\.net\/video\/([a-z0-9\-]+).htm/gi,"<div style=\"text-align: center;\" id=\"video____streetfire____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/<a[^>]*?youtube\.com\/watch\?v=([a-zA-Z0-9\-\_]+).*?<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____youtube____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-\_]+)/gi,"<div style=\"text-align: center;\" id=\"video____youtube____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/<a[^>]*?video\.google\.com\/videoplay\?docid=(\d+).*?<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____google____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/video\.google\.com\/videoplay\?docid=(\d+)/gi,"<div style=\"text-align: center;\" id=\"video____google____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/<a[^>]*?soapbox\.msn\.com\/video\.aspx\?vid=([a-zA-Z0-9\-]+).*?<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____soapbox____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/soapbox\.msn\.com\/video\.aspx\?vid=([a-z0-9\-]+)/gi,"<div style=\"text-align: center;\" id=\"video____soapbox____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/<a[^>]*?video\.msn\.com\/video\.aspx\?vid=([a-zA-Z0-9\-]+).*?<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____msn____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/video\.msn\.com\/video\.aspx\?vid=([a-z0-9\-]+)/gi,"<div style=\"text-align: center;\" id=\"video____msn____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/<a[^>]*?www\.bilmagasinettv\.dk\/video\/(\d+)[\/a-zA-Z\-]*.*<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____23video____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/www\.bilmagasinettv\.dk\/video\/(\d+)[\/a-zA-Z\-]*/gi,"<div style=\"text-align: center;\" id=\"video____23video____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/<a[^>]*?bil-tv\.23video\.com\/video\/(\d+)[\/a-zA-Z\-]*.*<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____23video____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/bil-tv\.23video\.com\/video\/(\d+)[\/a-zA-Z\-]*/gi,"<div style=\"text-align: center;\" id=\"video____23video____$1"+"____"+serial+"\"></div>");serial++;if(orig!=content){updatePageContent('article',content);var divs=document.getElementsByTagName('DIV');if(document.getElementById('article')!=undefined&&document.getElementById('article').className.match(/video/)){width=620;height=375;}else if(is_iOS){width=300;height=200;}else{width=380;height=230;}
var videodivarray=new Array();for(var i=0;i<divs.length;i++){if(divs[i].id.indexOf('video____')!=-1){videodivarray[videodivarray.length]=divs[i].id;}}
for(var x=0;x<videodivarray.length;x++){var id=videodivarray[x];var params=id.split("____");var provider=params[1];var videoId=params[2];var flashvars={};var params={};params.scale="noscale";params.quality="high";params.menu="false";params.allowFullscreen="true";var attributes={};attributes.id=id;if(provider=='youtube'){if(is_iOS){document.getElementById(id).innerHTML='<embed src="http://www.youtube.com/v/'+videoId+'&hl=en&fs=1&rel=0&showinfo=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+width+'" height="'+height+'"></embed>';}else{swfobject.embedSWF('http://www.youtube.com/v/'+videoId+'?fs=1',id,width,height,'9.0.0',false,flashvars,params,attributes);}}
else if(provider=='google'){swfobject.embedSWF('http://video.google.com/googleplayer.swf?docId='+videoId+'&hl=en',id,width,height,'9.0.0',null,flashvars,params,attributes);}
else if(provider=='streetfire'){flashvars.video=videoId;swfobject.embedSWF('http://videos.streetfire.net/vidiac.swf',id,width,height,'9.0.0',null,flashvars,params,attributes);}
else if(provider=='vimeo'){swfobject.embedSWF('http://vimeo.com/moogaloop.swf?clip_id='+videoId+'&server=vimeo.com&show_title=1&show_byline=1',id,width,height,'9.0.0',null,flashvars,params,attributes);}
else if(provider=='soapbox'){flashvars.c=v;flashvars.v=videoId;swfobject.embedSWF('http://images.soapbox.msn.com/flash/soapbox1_1.swf',id,width,height,'9.0.0',null,flashvars,params,attributes);}
else if(provider=='msn'){flashvars.c=v;flashvars.v=videoId;swfobject.embedSWF('http://images.video.msn.com/flash/soapbox1_1.swf',id,width,height,'9.0.0',null,flashvars,params,attributes);}
else if(provider=='23video'){flashvars.photo_id=videoId;if(document.URL.match(/msn/)){swfobject.embedSWF('http://www.bilmagasinettv.dk/2958456.swf',id,width,height,'9.0.0',null,flashvars,params,attributes);}else{document.getElementById(id).innerHTML='<iframe src="http://www.bilmagasinettv.dk/v.ihtml?photo%5fid='+videoId+'" width="'+width+'" height="'+height+'" frameborder="0" border="0" scrolling="no"></iframe>'}}}}}}
if(window.addEventListener)
window.addEventListener("load",videoMagic,false);else if(window.attachEvent)
window.attachEvent("onload",videoMagic);else if(document.getElementById)
window.onload=videoMagic;

WhiteAlbum={media:{toggle:function(){var media_element_names='embed, object, video, audio, canvas, iframe, .banner',media=$$(media_element_names);if(media){media.each(function(medium){try{var visibility=medium.up(media_element_names)?medium.up(media_element_names).last().getStyle('visibility'):(medium.getStyle('visibility')=='hidden'?'visible':'hidden')
medium.setStyle({visibility:(visibility)});}catch(e){};});};}},ads:function(){if(!this._ads)this._ads=new AdManager();return this._ads;},pageviews:{increment:function(){try{this._increment_gemius();this._increment_google_analytics();}catch(e){};},_increment_gemius:function(){pp_gemius_hit(pp_gemius_identifier.gsub(/USED\_/,''));},_increment_google_analytics:function(){waTracker._trackPageview();}},popup:Class.create({initialize:function(campaign_url){this.page=$(document.body);this.iframe=this._build_iframe_with_offer(campaign_url);this.overlay=new Element('div',{'id':'mainContentOverlay'});this.placeholder=new Element('div',{'id':'subscriptionOfferWrapper'});this.wrapper=new Element('div');this.closebutton=new Element('a',{'href':'#'})
this.overlay.hide();this.placeholder.insert({top:this.closebutton,bottom:this.wrapper}).hide();this.page.insert({top:this.placeholder,bottom:this.overlay});this.overlay.observe('click',this.toggle.bind(this));this.closebutton.observe('click',function(event){this.toggle();event.stop();}.bind(this));},toggle:function(){WhiteAlbum.media.toggle();this.overlay.toggle('appear',{'duration':1});if(this.wrapper.empty())this.wrapper.update(this.iframe);this.placeholder.toggle('blind');},_build_iframe_with_offer:function(original_offer_url){var frame_src=this._build_campaign_url(original_offer_url);return'<iframe src="'+frame_src+'" frameborder="0" width="980" height="1000" scrolling="no"></iframe>';},_build_campaign_url:function(url){var campaign_url=url.replace(/\s+redir/,'');campaign_url=campaign_url.sub(/([\d]+)/,"#{0}/popup");campaign_url=campaign_url.sub(/medium=([^\&]*)/,"#{0}_popup");return campaign_url;}}),gallery:Class.create({next_url:null,previous_url:null,inputting:false,initialize:function(){this.retrieveNavigationURLs();document.observe('keydown',this.onKeyDown.bind(this));document.observe('keyup',this.onKeyUp.bind(this));$$('input,textarea,select').invoke('observe','focus',this.onFocus.bind(this));$$('input,textarea,select').invoke('observe','blur',this.onBlur.bind(this));},retrieveNavigationURLs:function(){this.next_url=$('next')?$('next').readAttribute('href'):null;this.previous_url=$('previous')?$('previous').readAttribute('href'):null;},onKeyDown:function(event){if(this.inputting||event.shiftKey||event.ctrlKey||event.altKey||event.metaKey){return false;}
if(this.previous_url&&[Event.KEY_LEFT].include(event.keyCode)){location.href=this.previous_url;}
if(this.next_url&&[Event.KEY_RIGHT].include(event.keyCode)){location.href=this.next_url;}},onKeyUp:function(event){this.onKeyDown(event);},onFocus:function(event){this.inputting=true;},onBlur:function(event){this.inputting=false;}}),content_tunnel:Class.create({initialize:function(options){this.image_ids=options.image_ids,this.image_data=options.image_data;this.rate_buttons=options.rate_buttons;this.current_item_wrapper=options.current_item_wrapper;this.current_item=options.current_item;this.next_item=options.next_item;this.rate_buttons.each(function(button){button.observe('click',this.rate.bindAsEventListener(this));}.bind(this));},rate:function(event){var button=Event.element(event);new Ajax.Request(button.readAttribute('href'),{method:'get',onSuccess:this.success.bind(this)});event.stop();},success:function(response){var current_image_id=this.image_ids[1],next_image_id=this.image_ids[2],current_image=this.image_data[current_image_id],next_image=this.image_data[next_image_id],current_image_path=this.current_item.readAttribute('src').gsub(/image\/\d+\//,'image/'+current_image.image_id+'/'),next_image_path=this.next_item.readAttribute('src').gsub(/image\/\d+\//,'image/'+next_image.image_id+'/');this.current_item.writeAttribute('src',current_image_path);this.next_item.writeAttribute('src',next_image_path);this.rate_buttons.each(function(button){var current_rate_path=button.readAttribute('href').gsub(/rate\/\d+\//,'rate/'+current_image_id+'/');button.writeAttribute('href',current_rate_path);});this.current_item_wrapper.select('.headerSecondary').first().update(current_image.name);this.current_item_wrapper.select('.copyProfile .imgLink').first().update(current_image.created_by.image);this.current_item_wrapper.select('.copyProfile strong a').first().writeAttribute('href',current_image.created_by.url);this.current_item_wrapper.select('.copyProfile strong a').first().update(current_image.created_by.name);this.current_item_wrapper.select('.copyProfile .metaInfo').first().update(current_image.created_by.status);this._remove_from_array(this.image_ids,0);},_remove_from_array:function(array,from,to){var rest=array.slice((to||from)+1||array.length);array.length=from<0?array.length+from:from;return array.push.apply(array,rest);}}),contest:Class.create({initialize:function(contest_type){switch(contest_type){case'default':new this.regular_contest;break;case'rated':new this.rated_contest;break;case'competition':new this.competition_contest;break;}
$('contest').observe('submit',function(event){var valid=new Validation('contest',{onSubmit:false,useTitles:true});result=valid.validate();if(!result)event.stop();});$$('.contestant_body_toggle').each(function(toggle){toggle.observe('click',function(event){var contestant=toggle.up('.contestant');contestant.down('.contestant_short_body').toggle();contestant.down('.contestant_full_body').toggle();event.stop();});});},regular_contest:Class.create({initialize:function(){this.radios=$$('#contest input.radio');this.labels=$$('#contest label');this.radios.each(function(radio){radio.hide();radio.observe('change',this.handleVote.bind(this));}.bind(this));this.labels.each(function(label){label.observe('click',function(event){var label=Event.element(event);if(label.nodeName!='LABEL'){label=label.up('label');}
var target=(label.readAttribute('for')===null?label.attributes['for'].nodeValue:label.readAttribute('for'));$(target).writeAttribute("checked","checked");$(target).fire('change');this.handleVote({element:$(target)});}.bind(this));}.bind(this));$('contestVoteButton').disabled=false;},handleVote:function(event){var element=event.element||Event.element(event),image_path=$('asset_host').innerHTML+'/image/',contestant_id=element.id.replace(/\D+/g,'');$$('#'+element.up('.region').id+' li.contestant').each(function(contestant){contestant.removeClassName('selected');contestant.addClassName('unselected');})
element.up('li.contestant').removeClassName('unselected');element.up('li.contestant').addClassName('selected');$('contestant_'+contestant_id+'_thumbnail').removeClassName('unselected');$('contestant_'+contestant_id+'_thumbnail').addClassName('selected');element.up('.region').down('.chosen img.chosen_image').src=(image_path+element.up('.contestant').down('img').id.replace(/\D+/g,'')+'/original/0/300');element.up('.region').down('.chosen img.chosen_image').show();element.up('.region').down('.chosen .name').innerHTML=element.up('.contestant').down('.name').innerHTML;if(element.up('.region').down('.chosen .progressCallout')){element.up('.region').down('.chosen .progressCallout').show();}
$(element.up('.region').id+'_chosen_thumbnail').down('img').src=(image_path+element.up('.contestant').down('img').id.replace(/\D+/g,'')+'/square/0/80');$(element.up('.region').id+'_chosen_thumbnail').down('.name').innerHTML=element.up('.contestant').down('.name').innerHTML;$(element.up('.region').id+'_chosen_thumbnail').show();element.up('.region').down('.chosen').scrollTo();element.up('.region').down('.chosen .contestantThumbnailList').blindUp();element.up('.region').down('.chosen .initialText').hide();element.up('.region').down('.chosen .chosenText').show();var regions_count=$$('.region').size(),selected_regions_count=$$('.region ul.contestantThumbnailList li.contestant.selected').size(),missing_regions_count=regions_count-$$('.region ul.contestantThumbnailList li.contestant.selected').size();$$('.chosen_region_count').each(function(element){element.innerHTML=selected_regions_count;})
$$('.missing_region_count').each(function(element){element.innerHTML=missing_regions_count;})
if(regions_count==selected_regions_count){$('done_text').show();$('not_done_text').hide();$('contestVoteButton').disabled=false;}else{$('contestVoteButton').disabled='disabled';}}}),rated_contest:Class.create({initialize:function(){this.ratings=$$('.contestant_rating span');this.rating_toggles=$$('input.toggle_rating');this.regions=$$('fieldset.region');this.tab_controls=$$('#contest .tabs a');this.region_tab_controls=$$('#contest .region .stay_right .button');this.random_region_index=Math.floor(Math.random()*(this.regions.size())+1);this.regions.each(function(region,index){if((index+1)==this.random_region_index){region.show();$(region.readAttribute('id')+'_tab').addClassName('currentTab');}}.bind(this));this.tab_controls.each(function(tab_link){tab_link.observe('click',this.changeTabs.bind(this));}.bind(this));this.region_tab_controls.each(function(region_link){region_link.observe('click',this.changeTabs.bind(this));}.bind(this));this.ratings.each(function(toggle){toggle.observe('click',this.setRating.bind(this));toggle.observe('mouseover',this.showRating.bind(this));toggle.observe('mouseout',this.hideRating.bind(this));}.bind(this));this.rating_toggles.each(function(toggle){toggle.observe('change',this.toggleRating.bind(this));}.bind(this));},setRating:function(event){var element=Event.element(event);this.showRating(event);element.up().select('input').each(function(radio){radio.writeAttribute('checked',false);});element.down('input').writeAttribute('checked',true);},showRating:function(event){var element=Event.element(event);element.addClassName('selected');element.previousSiblings().each(function(elm){elm.addClassName('selected');});element.nextSiblings().each(function(elm){elm.removeClassName('selected');});},hideRating:function(event){var element=Event.element(event),rating_selected=(element.up().down('input:checked')),ratings=element.up().select('span');if(rating_selected){rating_selected.up().addClassName('selected');rating_selected.up().previousSiblings().each(function(rating){rating.addClassName('selected');});rating_selected.up().nextSiblings().each(function(rating){rating.removeClassName('selected');});}else{ratings.each(function(rating){rating.removeClassName('selected');});}},toggleRating:function(event){var element=Event.element(event),contestant_id=element.readAttribute('value'),rating_wrapper=$$('.contestant_rating[data-contestant-id='+contestant_id+']').first(),ratings=rating_wrapper.select('span'),toggle=rating_wrapper.down('input:checked')!=='undefined'?true:false;ratings.each(function(rating){rating.removeClassName('selected');rating.down('input').writeAttribute('checked',false);rating.down('input').writeAttribute('disabled',toggle);});Effect.toggle(rating_wrapper.up('div'),'slide',{duration:0.5});},changeTabs:function(event){var element=Event.element(event),tab_target=element.readAttribute('href').replace('#','');this.regions.each(function(region){region.hide();$('contestVoteInfo').hide();if($$('li.currentTab').size()!=0){$$('li.currentTab').first().removeClassName('currentTab');}});if(tab_target!='contestVoteInfo'){$(tab_target+'_tab').addClassName('currentTab');}
$(tab_target).show();event.stop();}}),competition_contest:Class.create({initialize:function(){this.radios=$$('#contest input.radio');this.labels=$$('#contest label');this.radios.each(function(radio){radio.hide();radio.observe('change',this.handleVote.bind(this));}.bind(this));this.labels.each(function(label){label.observe('click',function(event){var label=Event.element(event);if(label.nodeName!='LABEL'){label=label.up('label');}
var target=(label.readAttribute('for')===null?label.attributes['for'].nodeValue:label.readAttribute('for'));$(target).writeAttribute("checked","checked");$(target).fire('change');this.handleVote({element:$(target)});}.bind(this));}.bind(this));$('contestVoteButton').disabled='disabled';if(window.location.search.toQueryParams()['page']){$('contestRegionHeader').scrollTo();}},handleVote:function(event){var element=event.element||Event.element(event),image_path=$('asset_host').innerHTML+'/image/',contestant_id=element.id.replace(/\D+/g,'');$('contestResult').show();Effect.ScrollTo('contestVoteTitle');$(element.up('.region').id+'_chosen_thumbnail').down('img').src=(image_path+element.up('.contestant').down('img').id.replace(/\D+/g,'')+'/square/0/100');$(element.up('.region').id+'_chosen_thumbnail').down('.name').innerHTML=element.up('.contestant').down('.name').innerHTML;$(element.up('.region').id+'_chosen_thumbnail').show();var regions_count=$$('.region').size(),selected_regions_count=$$('ul.contestantThumbnailList li.contestant.selected').size();if(regions_count==selected_regions_count){$('contestVoteButton').disabled=false;}else{$('contestVoteButton').disabled='disabled';}}})})};

var WhiteAlbum=window.WhiteAlbum||{};WhiteAlbum.cookie={create:function(name,value,days,domain){var expires='';if(days){var d=new Date();d.setTime(d.getTime()+(days*24*60*60*1000));expires='; expires='+d.toGMTString();}
path='; path=/';domain=domain?'; domain='+domain:'';document.cookie=name+'='+value+expires+path+domain;},read:function(name){var n=name+'=';var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var c=cookies[i].replace(/^\s+/,'');if(c.indexOf(n)==0){return c.substring(n.length);}}
return null;},destroy:function(name,domain){this.create(name,'',-1,domain);}};

var Fabtabs=Class.create({initialize:function(element,options){var parent=this.element=$(element);this.options=Object.extend({hover:true,remotehover:false,anchorpolicy:'allow-initial'},options||{});this.menu=this.element.select('a[href*="#"]');this.hrefs=this.menu.map(function(elm){return elm.href.match(/#(\w.+)/)?RegExp.$1:null;}).compact();this.on(this.getInitialTab());var onLocal=function(event){if(this.options.anchorpolicy!=='allow'){event.stop();}
var elm=event.findElement("a");if(elm.href.match(/#(\w.+)/)){this.activate(elm);if(this.options.anchorpolicy==='protect'){window.location.hash='.'+this.tabID(elm);}}else{document.location=elm.href;}};var onRemote=function(event){if(this.options.anchorpolicy!=='allow'){event.stop();}
var trig=event.findElement("a");if(elm.href.match(/#(\w.+)/)){this.activate(this.tabID(trig));if(this.options.anchorpolicy==='protect'){window.location.hash='.'+this.tabID(elm);}}else{document.location=elm.href;}}
this.element.observe('click',onLocal.bindAsEventListener(this));if(this.options.hover){this.menu.each(function(elm){elm.observe('mouseover',onLocal.bindAsEventListener(this))}.bind(this));}
var triggers=[];this.hrefs.each(function(id){$$('a[href="#'+id+'"]').reject(function(elm){return elm.descendantOf(parent)}).each(function(trig){triggers.push(trig);});})
triggers.each(function(elm){elm.observe('click',onRemote.bindAsEventListener(this));if(this.options.remotehover){elm.observe('mouseover',onRemote.bindAsEventListener(this));}}.bind(this));},activate:function(elm){if(typeof elm=='string'){elm=this.element.select('a[href="#'+elm+'"]')[0];}
this.on(elm);this.menu.without(elm).each(this.off.bind(this));},off:function(elm){$(elm).removeClassName('active-tab');$(this.tabID(elm)).removeClassName('active-tab-body');},on:function(elm){$(elm).addClassName('active-tab');$(this.tabID(elm)).addClassName('active-tab-body');},tabID:function(elm){return elm.href.match(this.re)[1];},getInitialTab:function(){if(this.options.anchorpolicy!=='disable'&&document.location.href.match(this.re)){var hash=RegExp.$1;if(hash.substring(0,1)=="."){hash=hash.substring(1);}
return this.element.select('a[href="#'+hash+'"]')[0];}else{return this.menu.first();}},re:/#(\.?\w.+)/});

document.observe('dom:loaded',function(){if($('widget_profile_login')){$('header').insert({bottom:$('widget_profile_login')});}
if($('searchQ')){var searchField=$('searchQ');searchField.defaultVal=searchField.title;searchField.value=searchField.defaultVal;searchField.onfocus=function(){this.value=(this.value==this.defaultVal?'':this.value)};searchField.onblur=function(){this.value=(this.value==''?this.defaultVal:this.value)};}
if($$('.widget_subscription_offer_text_popup').length>0){var subscription_links=$$('.widget_subscription_offer_text_popup')[0].down().childElements();if(subscription_links){var iframe_offer=new WhiteAlbum.popup(subscription_links[0].readAttribute('href'));subscription_links.each(function(elm){$(elm).observe('click',function(event){iframe_offer.toggle();event.stop();});});}}});Event.observe(window,'load',function(){if(window.location.pathname.include('gallery')){new WhiteAlbum.gallery();if($$('.tabs.contentNav')&&Tooltip){var tabs=$$('.tabs.contentNav')[0];var tool_tip_txt=tabs.hasAttribute('title')?tabs.readAttribute('title'):null;if(tool_tip_txt){tabs.immediateDescendants().each(function(tab){new Tooltip(tab,tool_tip_txt);});if($$('.galleryThumbnails')){$$('ul.galleryThumbnails li').each(function(thumb){new Tooltip(thumb,tool_tip_txt);});}
tabs.removeAttribute('title');}}}});

var fileLoadingImage="http://server0.static.wa.supportingservices.dk/images/base/lightbox/loading.gif";var fileBottomNavCloseImage="http://server0.static.wa.supportingservices.dk/images/base/lightbox/closelabel.gif";var overlayOpacity=0.8;var animate=true;var resizeSpeed=7;var borderSize=10;var imageArray=new Array;var activeImage;if(animate==true){overlayDuration=0.2;if(resizeSpeed>10){resizeSpeed=10;}
if(resizeSpeed<1){resizeSpeed=1;}
resizeDuration=(11-resizeSpeed)*0.15;}else{overlayDuration=0;resizeDuration=0;}
Object.extend(Element,{getWidth:function(element){element=$(element);return element.offsetWidth;},setWidth:function(element,w){element=$(element);element.style.width=w+"px";},setHeight:function(element,h){element=$(element);element.style.height=h+"px";},setTop:function(element,t){element=$(element);element.style.top=t+"px";},setLeft:function(element,l){element=$(element);element.style.left=l+"px";},setSrc:function(element,src){element=$(element);element.src=src;},setHref:function(element,href){element=$(element);element.href=href;},setInnerHTML:function(element,content){element=$(element);element.innerHTML=content;}});Array.prototype.removeDuplicates=function(){for(i=0;i<this.length;i++){for(j=this.length-1;j>i;j--){if(this[i][0]==this[j][0]){this.splice(j,1);}}}}
Array.prototype.empty=function(){for(i=0;i<=this.length;i++){this.shift();}}
var Lightbox=Class.create();Lightbox.prototype={initialize:function(){this.updateImageList();var objBody=document.getElementsByTagName("body").item(0);var objOverlay=document.createElement("div");objOverlay.setAttribute('id','overlay');objOverlay.style.display='none';objOverlay.onclick=function(){myLightbox.end();}
objBody.appendChild(objOverlay);var objLightbox=document.createElement("div");objLightbox.setAttribute('id','lightbox');objLightbox.style.display='none';objLightbox.onclick=function(e){if(!e)var e=window.event;var clickObj=Event.element(e).id;if(clickObj=='lightbox'){myLightbox.end();}};objBody.appendChild(objLightbox);var objOuterImageContainer=document.createElement("div");objOuterImageContainer.setAttribute('id','outerImageContainer');objLightbox.appendChild(objOuterImageContainer);if(animate){Element.setWidth('outerImageContainer',250);Element.setHeight('outerImageContainer',250);}else{Element.setWidth('outerImageContainer',1);Element.setHeight('outerImageContainer',1);}
var objImageContainer=document.createElement("div");objImageContainer.setAttribute('id','imageContainer');objOuterImageContainer.appendChild(objImageContainer);var objLightboxImage=document.createElement("img");objLightboxImage.setAttribute('id','lightboxImage');objImageContainer.appendChild(objLightboxImage);var objHoverNav=document.createElement("div");objHoverNav.setAttribute('id','hoverNav');objImageContainer.appendChild(objHoverNav);var objPrevLink=document.createElement("a");objPrevLink.setAttribute('id','prevLink');objPrevLink.setAttribute('href','#');objHoverNav.appendChild(objPrevLink);var objNextLink=document.createElement("a");objNextLink.setAttribute('id','nextLink');objNextLink.setAttribute('href','#');objHoverNav.appendChild(objNextLink);var objLoading=document.createElement("div");objLoading.setAttribute('id','loading');objImageContainer.appendChild(objLoading);var objLoadingLink=document.createElement("a");objLoadingLink.setAttribute('id','loadingLink');objLoadingLink.setAttribute('href','#');objLoadingLink.onclick=function(){myLightbox.end();return false;}
objLoading.appendChild(objLoadingLink);var objLoadingImage=document.createElement("img");objLoadingImage.setAttribute('src',fileLoadingImage);objLoadingLink.appendChild(objLoadingImage);var objImageDataContainer=document.createElement("div");objImageDataContainer.setAttribute('id','imageDataContainer');objLightbox.appendChild(objImageDataContainer);var objImageData=document.createElement("div");objImageData.setAttribute('id','imageData');objImageDataContainer.appendChild(objImageData);var objImageDetails=document.createElement("div");objImageDetails.setAttribute('id','imageDetails');objImageData.appendChild(objImageDetails);var objCaption=document.createElement("span");objCaption.setAttribute('id','caption');objImageDetails.appendChild(objCaption);var objNumberDisplay=document.createElement("span");objNumberDisplay.setAttribute('id','numberDisplay');objImageDetails.appendChild(objNumberDisplay);var objBottomNav=document.createElement("div");objBottomNav.setAttribute('id','bottomNav');objImageData.appendChild(objBottomNav);var objBottomNavCloseLink=document.createElement("a");objBottomNavCloseLink.setAttribute('id','bottomNavClose');objBottomNavCloseLink.setAttribute('href','#');objBottomNavCloseLink.onclick=function(){myLightbox.end();return false;}
objBottomNav.appendChild(objBottomNavCloseLink);var objBottomNavCloseImage=document.createElement("img");objBottomNavCloseImage.setAttribute('src',fileBottomNavCloseImage);objBottomNavCloseLink.appendChild(objBottomNavCloseImage);},updateImageList:function(){if(!document.getElementsByTagName){return;}
var anchors=document.getElementsByTagName('a');var areas=document.getElementsByTagName('area');for(var i=0;i<anchors.length;i++){var anchor=anchors[i];var relAttribute=String(anchor.getAttribute('rel'));if(anchor.getAttribute('href')&&(relAttribute.toLowerCase().match('lightbox'))){anchor.onclick=function(){myLightbox.start(this);return false;}}}
for(var i=0;i<areas.length;i++){var area=areas[i];var relAttribute=String(area.getAttribute('rel'));if(area.getAttribute('href')&&(relAttribute.toLowerCase().match('lightbox'))){area.onclick=function(){myLightbox.start(this);return false;}}}},start:function(imageLink){hideSelectBoxes();hideFlash();hideAdtech();var arrayPageSize=getPageSize();Element.setWidth('overlay',arrayPageSize[0]);Element.setHeight('overlay',arrayPageSize[1]);new Effect.Appear('overlay',{duration:overlayDuration,from:0.0,to:overlayOpacity});imageArray=[];imageNum=0;if(!document.getElementsByTagName){return;}
var anchors=document.getElementsByTagName(imageLink.tagName);if((imageLink.getAttribute('rel')=='lightbox')){imageArray.push(new Array(imageLink.getAttribute('href'),imageLink.getAttribute('title')));}else{for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){imageArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title')));}}
imageArray.removeDuplicates();while(imageArray[imageNum][0]!=imageLink.getAttribute('href')){imageNum++;}}
var arrayPageScroll=getPageScroll();var lightboxTop=arrayPageScroll[1]+(arrayPageSize[3]/10);var lightboxLeft=arrayPageScroll[0];Element.setTop('lightbox',lightboxTop);Element.setLeft('lightbox',lightboxLeft);Element.show('lightbox');this.changeImage(imageNum);},changeImage:function(imageNum){activeImage=imageNum;if(animate){Element.show('loading');}
Element.hide('lightboxImage');Element.hide('hoverNav');Element.hide('prevLink');Element.hide('nextLink');Element.hide('imageDataContainer');Element.hide('numberDisplay');imgPreloader=new Image();imgPreloader.onload=function(){Element.setSrc('lightboxImage',imageArray[activeImage][0]);myLightbox.resizeImageContainer(imgPreloader.width,imgPreloader.height);imgPreloader.onload=function(){};}
imgPreloader.src=imageArray[activeImage][0];},resizeImageContainer:function(imgWidth,imgHeight){this.widthCurrent=Element.getWidth('outerImageContainer');this.heightCurrent=Element.getHeight('outerImageContainer');var widthNew=(imgWidth+(borderSize*2));var heightNew=(imgHeight+(borderSize*2));this.xScale=(widthNew/this.widthCurrent)*100;this.yScale=(heightNew/this.heightCurrent)*100;wDiff=this.widthCurrent-widthNew;hDiff=this.heightCurrent-heightNew;if(!(hDiff==0)){new Effect.Scale('outerImageContainer',this.yScale,{scaleX:false,duration:resizeDuration,queue:'front'});}
if(!(wDiff==0)){new Effect.Scale('outerImageContainer',this.xScale,{scaleY:false,delay:resizeDuration,duration:resizeDuration});}
if((hDiff==0)&&(wDiff==0)){if(navigator.appVersion.indexOf("MSIE")!=-1){pause(250);}else{pause(100);}}
Element.setHeight('prevLink',imgHeight);Element.setHeight('nextLink',imgHeight);Element.setWidth('imageDataContainer',widthNew);this.showImage();},showImage:function(){Element.hide('loading');new Effect.Appear('lightboxImage',{duration:resizeDuration,queue:'end',afterFinish:function(){myLightbox.updateDetails();}});this.preloadNeighborImages();},updateDetails:function(){if(imageArray[activeImage][1]){Element.show('caption');Element.setInnerHTML('caption',imageArray[activeImage][1]);}
if(imageArray.length>1){Element.show('numberDisplay');Element.setInnerHTML('numberDisplay',"Image "+eval(activeImage+1)+" of "+imageArray.length);}
new Effect.Parallel([new Effect.SlideDown('imageDataContainer',{sync:true,duration:resizeDuration,from:0.0,to:1.0}),new Effect.Appear('imageDataContainer',{sync:true,duration:resizeDuration})],{duration:resizeDuration,afterFinish:function(){var arrayPageSize=getPageSize();Element.setHeight('overlay',arrayPageSize[1]);myLightbox.updateNav();}});},updateNav:function(){Element.show('hoverNav');if(activeImage!=0){Element.show('prevLink');document.getElementById('prevLink').onclick=function(){myLightbox.changeImage(activeImage-1);return false;}}
if(activeImage!=(imageArray.length-1)){Element.show('nextLink');document.getElementById('nextLink').onclick=function(){myLightbox.changeImage(activeImage+1);return false;}}
this.enableKeyboardNav();},enableKeyboardNav:function(){document.onkeydown=this.keyboardAction;},disableKeyboardNav:function(){document.onkeydown='';},keyboardAction:function(e){if(e==null){keycode=event.keyCode;escapeKey=27;}else{keycode=e.keyCode;escapeKey=e.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key=='x')||(key=='o')||(key=='c')||(keycode==escapeKey)){myLightbox.end();}else if((key=='p')||(keycode==37)){if(activeImage!=0){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage-1);}}else if((key=='n')||(keycode==39)){if(activeImage!=(imageArray.length-1)){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage+1);}}},preloadNeighborImages:function(){if((imageArray.length-1)>activeImage){preloadNextImage=new Image();preloadNextImage.src=imageArray[activeImage+1][0];}
if(activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=imageArray[activeImage-1][0];}},end:function(){this.disableKeyboardNav();Element.hide('lightbox');new Effect.Fade('overlay',{duration:overlayDuration});showSelectBoxes();showFlash();showAdtech();}}
function getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll)
return arrayPageScroll;}
function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;}
function getKey(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}
key=String.fromCharCode(keycode).toLowerCase();if(key=='x'){}}
function listenKey(){document.onkeypress=getKey;}
function showSelectBoxes(){var selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="visible";}}
function hideSelectBoxes(){var selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="hidden";}}
function showFlash(){var flashObjects=document.getElementsByTagName("object");for(i=0;i<flashObjects.length;i++){flashObjects[i].style.visibility="visible";}
var flashEmbeds=document.getElementsByTagName("embed");for(i=0;i<flashEmbeds.length;i++){flashEmbeds[i].style.visibility="visible";}}
function hideFlash(){var flashObjects=document.getElementsByTagName("object");for(i=0;i<flashObjects.length;i++){flashObjects[i].style.visibility="hidden";}
var flashEmbeds=document.getElementsByTagName("embed");for(i=0;i<flashEmbeds.length;i++){flashEmbeds[i].style.visibility="hidden";}}
function hideAdtech(){var banners=$$('.hideAdtech');if(banners){for(i=0;i<banners.length;i++){banners[i].style.visibility='hidden';}}else return;}
function showAdtech(){var banners=$$('.hideAdtech');if(banners){for(i=0;i<banners.length;i++){banners[i].style.visibility='visible';}}else return;}
function pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);}
function initLightbox(){myLightbox=new Lightbox();}
Event.observe(window,'load',initLightbox,false);

var Quiz=Class.create({initialize:function(container,data,options){this.options=Object.extend({},options||{});this.data=data;this.container=container;this.currentQuestionIndex=0;this.initializeImages();this.initializeTemplates();this.initializeHighscoreNameForm();this.initializeFirstQuestion();this.loadCurrentQuestion();},initializeTemplates:function(){this.templates={};this.templates['question']=new Template(this.options['question_template']);this.templates['questionOption']=new Template(this.options['question_option_template']);},initializeHighscoreNameForm:function(){$('quiz_highscore_name_form').observe('submit',this.onQuizHighscoreNameFormSubmit.bind(this));},initializeFirstQuestion:function(){if(/^#q\d+$/.test(window.location.hash))
this.currentQuestionIndex=parseInt(window.location.hash.replace(/^#q/,''))-1;},initializeImages:function(){var imageObj=new Image();var articleImageId=this.options['article_image_id']
var imageIds=this.data['questions'].collect(function(q){return(q['image']&&q['image']['id'])||articleImageId});imageIds.each(function(i){imageObj.src='http://server1.static.wa.supportingservices.dk/image/'+i+'/original/0/290'});},loadCurrentQuestion:function(){this.currentQuestion=this.data['questions'][this.currentQuestionIndex];this.renderQuestion();this.updateStepsLeft();},renderQuestion:function(){var callingClass=this;var question=this.currentQuestion;var optionsHtml=question['options'].collect(function(o){return callingClass.templates['questionOption'].evaluate({id:o['id'],title:o['title']});}).join('');var imageId=(question['image']&&question['image']['id'])||this.options['article_image_id']
var buttonText=(this.currentQuestionIndex<this.data['questions'].length-1)?'Næste':'Se Resultat';var questionHtml=this.templates['question'].evaluate({title:question['title'],image_id:imageId,options:optionsHtml,button_text:buttonText})
var questionElm=new Element('div',{id:'question'}).update(questionHtml);questionElm.down('form').observe('submit',this.onQuizFormSubmit.bind(this));$('quiz').setStyle({minHeight:$('quiz').getHeight()+'px'});this.container.update(questionElm);this.container.fade({from:0.1,to:1.0,duration:0.5});},updateStepsLeft:function(){$('stepsLeft').select('li').each(function(elm){elm.removeClassName('wayPoint');elm.removeClassName('presentStep');});$('stepsLeft').down('li',this.currentQuestionIndex).removeClassName('futureStep').addClassName('wayPoint').addClassName('presentStep');if(this.currentQuestionIndex>0){$R(0,this.currentQuestionIndex-1).each(function(value){$('stepsLeft').down('li',value).removeClassName('futureStep').addClassName('pastStep');});}},validateForm:function(){if($('quiz_form').select('input[type=radio]:checked').length==0){$('quiz_form').select('label').each(function(elm){elm.highlight();});return false;}
return true;},storeAnswer:function(){var quizId=this.data['id'];var questionId=this.currentQuestion['id'];var optionId=parseInt($$('input:checked[type="radio"][name="quiz_answer[quiz_question_option_id]"]').first().getValue());var data=WhiteAlbum.cookie.read('quiz'+quizId+'_answers')
data=data?data.evalJSON():{}
data['q'+questionId]={qid:questionId,oid:optionId};WhiteAlbum.cookie.create('quiz'+quizId+'_answers',Object.toJSON(data),3);},nextQuestion:function(){if(this.currentQuestionIndex<this.data['questions'].length-1){this.increment_article_hits();this.currentQuestionIndex++;window.location.hash='q'+(this.currentQuestionIndex+1);var that=this;this.container.fade({from:1.0,to:0.1,duration:0.2,afterFinish:function(){that.loadCurrentQuestion();WhiteAlbum.ads().reload_banners();}});}else{this.submitAnswers();}},submitAnswers:function(){if(this.highscoreName){var postBody='name='+this.highscoreName+'&answers='+WhiteAlbum.cookie.read('quiz'+this.data['id']+'_answers');if(this.options['referrer'])
postBody+='&referrer='+this.options['referrer'];this.showLoadingIndicator();new Ajax.Request('/quizzes/'+this.data['id']+'/results',{postBody:postBody,onSuccess:this.onSubmitAnswersComplete.bind(this)});}else{this.showHighscoreNameModal();}},showHighscoreNameModal:function(){$('quizContainer').fade({from:1.0,to:0.2,duration:0.3,afterFinish:function(){$('quizHighscoreName').appear({duration:0.1,afterFinish:function(){$('quiz_answer_highscore_name').highlight();$('quiz_answer_highscore_name').focus();}});}});},hideHighscoreNameModal:function(){$('quizHighscoreName').fade({duration:0.3});},showLoadingIndicator:function(){var quizContainer=$('quizContainer');var indicatorContainer=$('quizLoadingIndicator');indicatorContainer.clonePosition(quizContainer);quizContainer.fade({from:1.0,to:0.2,duration:0.3});indicatorContainer.appear();},increment_article_hits:function(){if(this.options['incrhit_article_path']){new Ajax.Request(this.options['incrhit_article_path'],{method:'get'});}},onQuizFormSubmit:function(event){event.stop();if(this.validateForm()){this.storeAnswer();this.nextQuestion();}},onQuizHighscoreNameFormSubmit:function(event){event.stop();if($F('quiz_answer_highscore_name').length>0){this.highscoreName=$F('quiz_answer_highscore_name');this.hideHighscoreNameModal();this.submitAnswers();}else{$('quiz_answer_highscore_name').shake();$('quiz_answer_highscore_name').focus();}},onSubmitAnswersComplete:function(response){document.location.href='/quizzes/'+this.data['id']+'/results/'+response.responseText;}});var QuizResult=Class.create({initialize:function(options){this.options=Object.extend({},options||{});this.initializeButtons();},initializeButtons:function(){var that=this;$$('a.fb_share_quiz_result_button').each(function(btn){btn.observe('click',that.onShareButtonClick.bind(that));})},onShareButtonClick:function(event){event.stop();console.log(this.options['quizUrl']);FB.ui({method:'feed',link:this.options['quizUrl'],name:this.options['quizTitle'],caption:this.options['solutionTitle'],description:this.options['solutionDescription'],picture:$('solutionImage').readAttribute('src')});}});

var Rotator=Class.create({currentIndex:0,timerId:null,listElements:null,listElementLis:null,currentElement:null,currentTab:null,mouseHovers:false,initialize:function(list_element){this.listElement=$(list_element);this.listElements=$$('ul#'+list_element+' li a');this.listElementLis=$$('ul#'+list_element+' li');this.listElements.each(function(element){Event.observe(element,'mouseover',this.selectTabWithMouse.bindAsEventListener(this,element.up('li'),element.up('li').getAttribute('rel')));Event.observe(element,'mouseout',this.unselectTabWithMouse.bindAsEventListener(this));element.onclick=function(){if(this.getAttribute('href')=="#"){return false}};}.bind(this));this.selectTabWithTimer();},selectTabWithMouse:function(e,element,tab){window.clearTimeout(this.timerId);this.mouseHovers=true;this.currentIndex=this.listElementLis.collect(function(o){return o.getAttribute('rel')}).indexOf(tab);this.selectTab(element);},unselectTabWithMouse:function(){this.mouseHovers=false;this.selectTabWithTimer();},selectTabWithTimer:function(){if(this.mouseHovers==false){element=this.listElementLis[this.currentIndex];this.selectTab(element);window.clearTimeout(this.timerId);this.timerId=window.setTimeout(function(){this.selectTabWithTimer();}.bind(this),6000);this.currentIndex=this.listElements.length>this.currentIndex+1?this.currentIndex+1:0;}},selectTab:function(element){this.currentElement=element;this.listElementLis.each(function(element){$(element.getAttribute('rel')).hide();element.removeClassName('selected');});this.currentTab=$(this.currentElement.getAttribute('rel'));this.currentTab.show();this.currentElement.addClassName('selected');if(this.currentElement.className.match("cokeAdElement")){this.currentElement.up('div').addClassName('cokeAd');}else{this.currentElement.up('div').removeClassName('cokeAd');}}});

var Validator=Class.create();Validator.prototype={initialize:function(className,error,test,options){if(typeof test=='function'){this.options=$H(options);this._test=test;}else{this.options=$H(test);this._test=function(){return true};}
this.error=error||'Validation failed.';this.className=className;},test:function(v,elm){return(this._test(v,elm)&&this.options.all(function(p){return Validator.methods[p.key]?Validator.methods[p.key](v,elm,p.value):true;}));}}
Validator.methods={pattern:function(v,elm,opt){return Validation.get('IsEmpty').test(v)||opt.test(v)},minLength:function(v,elm,opt){return v.length>=opt},maxLength:function(v,elm,opt){return v.length<=opt},min:function(v,elm,opt){return v>=parseFloat(opt)},max:function(v,elm,opt){return v<=parseFloat(opt)},notOneOf:function(v,elm,opt){return $A(opt).all(function(value){return v!=value;})},oneOf:function(v,elm,opt){return $A(opt).any(function(value){return v==value;})},is:function(v,elm,opt){return v==opt},isNot:function(v,elm,opt){return v!=opt},equalToField:function(v,elm,opt){return v==$F(opt)},notEqualToField:function(v,elm,opt){return v!=$F(opt)},include:function(v,elm,opt){return $A(opt).all(function(value){return Validation.get(value).test(v,elm);})}}
var Validation=Class.create();Validation.prototype={initialize:function(form,options){this.options=Object.extend({onSubmit:true,stopOnFirst:false,immediate:false,focusOnError:true,useTitles:false,onFormValidate:function(result,form){},onElementValidate:function(result,elm){}},options||{});this.form=$(form);if(this.options.onSubmit)Event.observe(this.form,'submit',this.onSubmit.bind(this),false);if(this.options.immediate){var useTitles=this.options.useTitles;var callback=this.options.onElementValidate;Form.getElements(this.form).each(function(input){Event.observe(input,'blur',function(ev){Validation.validate(Event.element(ev),{useTitle:useTitles,onElementValidate:callback});});});}},onSubmit:function(ev){if(!this.validate())Event.stop(ev);},validate:function(){var result=false;var useTitles=this.options.useTitles;var callback=this.options.onElementValidate;if(this.options.stopOnFirst){result=Form.getElements(this.form).all(function(elm){return Validation.validate(elm,{useTitle:useTitles,onElementValidate:callback});});}else{result=Form.getElements(this.form).collect(function(elm){return Validation.validate(elm,{useTitle:useTitles,onElementValidate:callback});}).all();}
if(!result&&this.options.focusOnError){Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()}
this.options.onFormValidate(result,this.form);return result;},reset:function(){Form.getElements(this.form).each(Validation.reset);}}
Object.extend(Validation,{validate:function(elm,options){options=Object.extend({useTitle:false,onElementValidate:function(result,elm){}},options||{});elm=$(elm);var cn=elm.classNames();return result=cn.all(function(value){var test=Validation.test(value,elm,options.useTitle);options.onElementValidate(test,elm);return test;});},test:function(name,elm,useTitle){var v=Validation.get(name);var prop='__advice'+name.camelize();try{if(Validation.isVisible(elm)&&!v.test($F(elm),elm)){if(!elm[prop]){var advice=Validation.getAdvice(name,elm);if(advice==null){var errorMsg=useTitle?((elm&&elm.title)?elm.title:v.error):v.error;advice='<div class="validation-advice" id="advice-'+name+'-'+Validation.getElmID(elm)+'" style="display:none">'+errorMsg+'</div>'
switch(elm.type.toLowerCase()){case'checkbox':case'radio':var p=elm.parentNode;if(p){new Insertion.Bottom(p,advice);}else{new Insertion.After(elm,advice);}
break;default:new Insertion.After(elm,advice);}
advice=Validation.getAdvice(name,elm);}
if(typeof Effect=='undefined'){advice.style.display='block';}else{new Effect.Appear(advice,{duration:1});}}
elm[prop]=true;elm.removeClassName('validation-passed');elm.addClassName('validation-failed');return false;}else{var advice=Validation.getAdvice(name,elm);if(advice!=null)advice.hide();elm[prop]='';elm.removeClassName('validation-failed');elm.addClassName('validation-passed');return true;}}catch(e){throw(e)}},isVisible:function(elm){while(elm.tagName!='BODY'){if(!$(elm).visible())return false;elm=elm.parentNode;}
return true;},getAdvice:function(name,elm){return $('advice-'+name+'-'+Validation.getElmID(elm))||$('advice-'+Validation.getElmID(elm));},getElmID:function(elm){return elm.id?elm.id:elm.name;},reset:function(elm){elm=$(elm);var cn=elm.classNames();cn.each(function(value){var prop='__advice'+value.camelize();if(elm[prop]){var advice=Validation.getAdvice(value,elm);advice.hide();elm[prop]='';}
elm.removeClassName('validation-failed');elm.removeClassName('validation-passed');});},add:function(className,error,test,options){var nv={};nv[className]=new Validator(className,error,test,options);Object.extend(Validation.methods,nv);},addAllThese:function(validators){var nv={};$A(validators).each(function(value){nv[value[0]]=new Validator(value[0],value[1],value[2],(value.length>3?value[3]:{}));});Object.extend(Validation.methods,nv);},get:function(name){return Validation.methods[name]?Validation.methods[name]:Validation.methods['_LikeNoIDIEverSaw_'];},methods:{'_LikeNoIDIEverSaw_':new Validator('_LikeNoIDIEverSaw_','',{})}});Validation.add('IsEmpty','',function(v){return((v==null)||(v.length==0));});Validation.addAllThese([['required','Dette felt felt skal udfyldes!.',function(v){return!Validation.get('IsEmpty').test(v);}],['validate-number','Please enter a valid number in this field.',function(v){return Validation.get('IsEmpty').test(v)||(!isNaN(v)&&!/^\s+$/.test(v));}],['validate-digits','Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.',function(v){return Validation.get('IsEmpty').test(v)||!/[^\d]/.test(v);}],['validate-alpha','Please use letters only (a-z) in this field.',function(v){return Validation.get('IsEmpty').test(v)||/^[a-zA-Z]+$/.test(v)}],['validate-alphanum','Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.',function(v){return Validation.get('IsEmpty').test(v)||!/\W/.test(v)}],['validate-date','Please enter a valid date.',function(v){var test=new Date(v);return Validation.get('IsEmpty').test(v)||!isNaN(test);}],['validate-email','Please enter a valid email address. For example fred@domain.com .',function(v){return Validation.get('IsEmpty').test(v)||/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)}],['validate-url','Please enter a valid URL.',function(v){return Validation.get('IsEmpty').test(v)||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)}],['validate-date-au','Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.',function(v){if(Validation.get('IsEmpty').test(v))return true;var regex=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!regex.test(v))return false;var d=new Date(v.replace(regex,'$2/$1/$3'));return(parseInt(RegExp.$2,10)==(1+d.getMonth()))&&(parseInt(RegExp.$1,10)==d.getDate())&&(parseInt(RegExp.$3,10)==d.getFullYear());}],['validate-currency-dollar','Please enter a valid $ amount. For example $100.00 .',function(v){return Validation.get('IsEmpty').test(v)||/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)}],['validate-selection','Please make a selection',function(v,elm){return elm.options?elm.selectedIndex>0:!Validation.get('IsEmpty').test(v);}],['validate-one-required','Please select one of the above options.',function(v,elm){var p=elm.parentNode;var options=p.getElementsByTagName('INPUT');return $A(options).any(function(elm){return $F(elm);});}]]);

function formatText(id,tagstart,tagend){el=$(id);if(el.setSelectionRange){el.value=el.value.substring(0,el.selectionStart)+tagstart+el.value.substring(el.selectionStart,el.selectionEnd)+tagend+el.value.substring(el.selectionEnd,el.value.length);}
else{var selectedText=document.selection.createRange().text;if(selectedText!=""){var newText=tagstart+selectedText+tagend;document.selection.createRange().text=newText;}}};function initMiniedit(){me=$$(".miniedit textarea");target=me[0];quotes=$$(".miniedit ul li a.quote");quotes.each(function(w){w.onclick=function(){formatText(target,"[quote]","[/quote]");return false;};});links=$$(".miniedit ul li a.link");links.each(function(w){w.onclick=function(){formatText(target,"[link]","[/link]");return false;};});underlines=$$(".miniedit ul li a.underline");underlines.each(function(w){w.onclick=function(){formatText(target,"[u]","[/u]");return false;};});italic=$$(".miniedit ul li a.italic");italic.each(function(w){w.onclick=function(){formatText(target,"[i]","[/i]");return false;};});bolds=$$(".miniedit ul li a.bold");bolds.each(function(w){w.onclick=function(){formatText(target,"[b]","[/b]");return false;};});initSmileys(target);}
function insertSmiley(target,tag){el=$(target);if(document.selection){target.focus();selection=document.selection.createRange();selection.text=tag;}
if(el.setSelectionRange){el.value=el.value.substring(0,el.selectionStart)+tag+el.value.substring(el.selectionStart,el.selectionEnd)+el.value.substring(el.selectionEnd,el.value.length);}
else{var selectedText=document.selection.createRange().text;if(selectedText!=""){var newText=tag+selectedText;document.selection.createRange().text=newText;}}}
function initSmileys(target){buttons=$$(".smileyContainer a");try{buttons.each(function(w){w.onclick=function(){insertSmiley(target,w.firstChild.alt);return false;};});$$(".smileyContainer")[0].appear();}catch(e){};}
Event.observe(window,'load',initMiniedit);function initSubscriptionHelp(){if($('topicSubscription')!=undefined){var helpTxtShow=($('helpTxtShow')?$('helpTxtShow').innerHTML:'');var helpTxtHide=($('helpTxtHide')?$('helpTxtHide').innerHTML:'');var helpToggle=document.createElement('a');helpToggle.innerHTML=helpTxtShow;helpToggle.rel=helpTxtHide;helpToggle.id='helpToggle';helpToggle.href='#';helpToggle.onclick=function(){Effect.toggle('topicSubscriptionHelp','blind',{onComplete:this.innerHTML=flipTxt()});return false;}
$('topicSubscription').appendChild(helpToggle);function flipTxt(){var txt=$('helpToggle').innerHTML==helpTxtShow?helpTxtHide:helpTxtShow;return txt;};}}
document.observe('dom:loaded',initSubscriptionHelp);

if(!window.Modalbox)
var Modalbox=new Object();Modalbox.Methods={overrideAlert:false,focusableElements:new Array,currFocused:0,initialized:false,active:true,options:{title:"ModalBox Window",overlayClose:true,width:500,height:90,overlayOpacity:.65,overlayDuration:.25,slideDownDuration:.5,slideUpDuration:.5,resizeDuration:.25,inactiveFade:true,transitions:true,loadingString:"Please wait. Loading...",closeString:"Close window",closeValue:"&times;",params:{},method:'get',autoFocusing:true,aspnet:false},_options:new Object,setOptions:function(options){Object.extend(this.options,options||{});},_init:function(options){Object.extend(this._options,this.options);this.setOptions(options);this.MBoverlay=new Element("div",{id:"MB_overlay",opacity:"0"});this.MBwindow=new Element("div",{id:"MB_window",style:"display: none"}).update(this.MBframe=new Element("div",{id:"MB_frame"}).update(this.MBheader=new Element("div",{id:"MB_header"}).update(this.MBcaption=new Element("div",{id:"MB_caption"}))));this.MBclose=new Element("a",{id:"MB_close",title:this.options.closeString,href:"#"}).update("<span>"+this.options.closeValue+"</span>");this.MBheader.insert({'bottom':this.MBclose});this.MBcontent=new Element("div",{id:"MB_content"}).update(this.MBloading=new Element("div",{id:"MB_loading"}).update(this.options.loadingString));this.MBframe.insert({'bottom':this.MBcontent});var injectToEl=this.options.aspnet?$(document.body).down('form'):$(document.body);injectToEl.insert({'top':this.MBwindow});injectToEl.insert({'top':this.MBoverlay});this.initScrollX=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft;this.initScrollY=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;this.hideObserver=this._hide.bindAsEventListener(this);this.kbdObserver=this._kbdHandler.bindAsEventListener(this);this._initObservers();this.initialized=true;this.hideAdtech();},hideAdtech:function(){$$('.hideAdtech').each(function(banner){banner.style.visibility=banner.style.visibility!='hidden'?'hidden':'visible';})},show:function(content,options){if(!this.initialized)this._init(options);this.content=content;this.setOptions(options);if(this.options.title)
$(this.MBcaption).update(this.options.title);else{$(this.MBheader).hide();$(this.MBcaption).hide();}
if(this.MBwindow.style.display=="none"){this._appear();this.event("onShow");}
else{this._update();this.event("onUpdate");}},hide:function(options){if(this.initialized){if(options&&typeof options.element!='function')Object.extend(this.options,options);this.event("beforeHide");if(this.options.transitions)
Effect.SlideUp(this.MBwindow,{duration:this.options.slideUpDuration,transition:Effect.Transitions.sinoidal,afterFinish:this._deinit.bind(this)});else{$(this.MBwindow).hide();this._deinit();}
this.hideAdtech();}else throw("Modalbox is not initialized.");},_hide:function(event){event.stop();if(event.element().id=='MB_overlay'&&!this.options.overlayClose)return false;this.hide();},alert:function(message){var html='<div class="MB_alert"><p>'+message+'</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';Modalbox.show(html,{title:'Alert: '+document.title,width:300});},_appear:function(){if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){window.scrollTo(0,0);this._prepareIE("100%","hidden");}
this._setWidth();this._setPosition();if(this.options.transitions){$(this.MBoverlay).setStyle({opacity:0});new Effect.Fade(this.MBoverlay,{from:0,to:this.options.overlayOpacity,duration:this.options.overlayDuration,afterFinish:function(){new Effect.SlideDown(this.MBwindow,{duration:this.options.slideDownDuration,transition:Effect.Transitions.sinoidal,afterFinish:function(){this._setPosition();this.loadContent();}.bind(this)});}.bind(this)});}else{$(this.MBoverlay).setStyle({opacity:this.options.overlayOpacity});$(this.MBwindow).show();this._setPosition();this.loadContent();}
this._setWidthAndPosition=this._setWidthAndPosition.bindAsEventListener(this);Event.observe(window,"resize",this._setWidthAndPosition);},resize:function(byWidth,byHeight,options){var wHeight=$(this.MBwindow).getHeight();var wWidth=$(this.MBwindow).getWidth();var hHeight=$(this.MBheader).getHeight();var cHeight=$(this.MBcontent).getHeight();var newHeight=((wHeight-hHeight+byHeight)<cHeight)?(cHeight+hHeight-wHeight):byHeight;if(options)this.setOptions(options);if(this.options.transitions){new Effect.ScaleBy(this.MBwindow,byWidth,newHeight,{duration:this.options.resizeDuration,afterFinish:function(){this.event("_afterResize");this.event("afterResize");}.bind(this)});}else{this.MBwindow.setStyle({width:wWidth+byWidth+"px",height:wHeight+newHeight+"px"});setTimeout(function(){this.event("_afterResize");this.event("afterResize");}.bind(this),1);}},resizeToContent:function(options){var byHeight=this.options.height-this.MBwindow.offsetHeight;if(byHeight!=0){if(options)this.setOptions(options);Modalbox.resize(0,byHeight);}},resizeToInclude:function(element,options){var el=$(element);var elHeight=el.getHeight()+parseInt(el.getStyle('margin-top'))+parseInt(el.getStyle('margin-bottom'))+parseInt(el.getStyle('border-top-width'))+parseInt(el.getStyle('border-bottom-width'));if(elHeight>0){if(options)this.setOptions(options);Modalbox.resize(0,elHeight);}},_update:function(){$(this.MBcontent).update("");this.MBcontent.appendChild(this.MBloading);$(this.MBloading).update(this.options.loadingString);this.currentDims=[this.MBwindow.offsetWidth,this.MBwindow.offsetHeight];Modalbox.resize((this.options.width-this.currentDims[0]),(this.options.height-this.currentDims[1]),{_afterResize:this._loadAfterResize.bind(this)});},loadContent:function(){if(this.event("beforeLoad")!=false){if(typeof this.content=='string'){var htmlRegExp=new RegExp(/<\/?[^>]+>/gi);if(htmlRegExp.test(this.content)){this._insertContent(this.content.stripScripts());this._putContent(function(){this.content.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));}.bind(this));}else
new Ajax.Request(this.content,{method:this.options.method.toLowerCase(),parameters:this.options.params,onSuccess:function(transport){var response=new String(transport.responseText);this._insertContent(transport.responseText.stripScripts());this._putContent(function(){response.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));});}.bind(this),onException:function(instance,exception){Modalbox.hide();throw('Modalbox Loading Error: '+exception);}});}else if(typeof this.content=='object'){this._insertContent(this.content);this._putContent();}else{Modalbox.hide();throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)');}}},_insertContent:function(content){$(this.MBcontent).hide().update("");if(typeof content=='string'){setTimeout(function(){this.MBcontent.update(content);}.bind(this),1);}else if(typeof content=='object'){var _htmlObj=content.cloneNode(true);if(content.id)content.id="MB_"+content.id;$(content).select('*[id]').each(function(el){el.id="MB_"+el.id;});this.MBcontent.appendChild(_htmlObj);this.MBcontent.down().show();if(Prototype.Browser.IE)
$$("#MB_content select").invoke('setStyle',{'visibility':''});}},_putContent:function(callback){if(this.options.height==this._options.height){setTimeout(function(){Modalbox.resize(0,$(this.MBcontent).getHeight()-$(this.MBwindow).getHeight()+$(this.MBheader).getHeight(),{afterResize:function(){this.MBcontent.show().makePositioned();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}.bind(this)});}.bind(this),1);}else{this._setWidth();this.MBcontent.setStyle({overflow:'auto',height:$(this.MBwindow).getHeight()-$(this.MBheader).getHeight()-13+'px'});this.MBcontent.show();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}},activate:function(options){this.setOptions(options);this.active=true;$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);$(this.MBclose).show();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Appear(this.MBwindow,{duration:this.options.slideUpDuration});},deactivate:function(options){this.setOptions(options);this.active=false;$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);$(this.MBclose).hide();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Fade(this.MBwindow,{duration:this.options.slideUpDuration,to:.75});},_initObservers:function(){$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);if(Prototype.Browser.IE)
Event.observe(document,"keydown",this.kbdObserver);else
Event.observe(document,"keypress",this.kbdObserver);},_removeObservers:function(){$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);if(Prototype.Browser.IE)
Event.stopObserving(document,"keydown",this.kbdObserver);else
Event.stopObserving(document,"keypress",this.kbdObserver);},_loadAfterResize:function(){this._setWidth();this._setPosition();this.loadContent();},_setFocus:function(){if(this.focusableElements.length>0&&this.options.autoFocusing==true){var firstEl=this.focusableElements.find(function(el){return el.tabIndex==1;})||this.focusableElements.first();this.currFocused=this.focusableElements.toArray().indexOf(firstEl);firstEl.focus();}else if($(this.MBclose).visible())
$(this.MBclose).focus();},_findFocusableElements:function(){this.MBcontent.select('input:not([type~=hidden]), select, textarea, button, a[href]').invoke('addClassName','MB_focusable');return this.MBcontent.select('.MB_focusable');},_kbdHandler:function(event){var node=event.element();switch(event.keyCode){case Event.KEY_TAB:event.stop();if(node!=this.focusableElements[this.currFocused])
this.currFocused=this.focusableElements.toArray().indexOf(node);if(!event.shiftKey){if(this.currFocused==this.focusableElements.length-1){this.focusableElements.first().focus();this.currFocused=0;}else{this.currFocused++;this.focusableElements[this.currFocused].focus();}}else{if(this.currFocused==0){this.focusableElements.last().focus();this.currFocused=this.focusableElements.length-1;}else{this.currFocused--;this.focusableElements[this.currFocused].focus();}}
break;case Event.KEY_ESC:if(this.active)this._hide(event);break;case 32:this._preventScroll(event);break;case 0:if(event.which==32)this._preventScroll(event);break;case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_PAGEDOWN:case Event.KEY_PAGEUP:case Event.KEY_HOME:case Event.KEY_END:if(Prototype.Browser.WebKit&&!["textarea","select"].include(node.tagName.toLowerCase()))
event.stop();else if((node.tagName.toLowerCase()=="input"&&["submit","button"].include(node.type))||(node.tagName.toLowerCase()=="a"))
event.stop();break;}},_preventScroll:function(event){if(!["input","textarea","select","button"].include(event.element().tagName.toLowerCase()))
event.stop();},_deinit:function()
{this._removeObservers();Event.stopObserving(window,"resize",this._setWidthAndPosition);if(this.options.transitions){Effect.toggle(this.MBoverlay,'appear',{duration:this.options.overlayDuration,afterFinish:this._removeElements.bind(this)});}else{this.MBoverlay.hide();this._removeElements();}
$(this.MBcontent).setStyle({overflow:'',height:''});},_removeElements:function(){$(this.MBoverlay).remove();$(this.MBwindow).remove();if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){this._prepareIE("","");window.scrollTo(this.initScrollX,this.initScrollY);}
if(typeof this.content=='object'){if(this.content.id&&this.content.id.match(/MB_/)){this.content.id=this.content.id.replace(/MB_/,"");}
this.content.select('*[id]').each(function(el){el.id=el.id.replace(/MB_/,"");});}
this.initialized=false;this.event("afterHide");this.setOptions(this._options);},_setWidth:function(){$(this.MBwindow).setStyle({width:this.options.width+"px",height:this.options.height+"px"});},_setPosition:function(){$(this.MBwindow).setStyle({left:Math.round((Element.getWidth(document.body)-Element.getWidth(this.MBwindow))/2)+"px"});},_setWidthAndPosition:function(){$(this.MBwindow).setStyle({width:this.options.width+"px"});this._setPosition();},_getScrollTop:function(){var theTop;if(document.documentElement&&document.documentElement.scrollTop)
theTop=document.documentElement.scrollTop;else if(document.body)
theTop=document.body.scrollTop;return theTop;},_prepareIE:function(height,overflow){$$('html, body').invoke('setStyle',{width:height,height:height,overflow:overflow});$$("select").invoke('setStyle',{'visibility':overflow});},event:function(eventName){if(this.options[eventName]){var returnValue=this.options[eventName]();this.options[eventName]=null;if(returnValue!=undefined)
return returnValue;else
return true;}
return true;}};Object.extend(Modalbox,Modalbox.Methods);if(Modalbox.overrideAlert)window.alert=Modalbox.alert;Effect.ScaleBy=Class.create();Object.extend(Object.extend(Effect.ScaleBy.prototype,Effect.Base.prototype),{initialize:function(element,byWidth,byHeight,options){this.element=$(element)
var options=Object.extend({scaleFromTop:true,scaleMode:'box',scaleByWidth:byWidth,scaleByHeight:byHeight},arguments[3]||{});this.start(options);},setup:function(){this.elementPositioning=this.element.getStyle('position');this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;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];this.deltaY=this.options.scaleByHeight;this.deltaX=this.options.scaleByWidth;},update:function(position){var currentHeight=this.dims[0]+(this.deltaY*position);var currentWidth=this.dims[1]+(this.deltaX*position);currentHeight=(currentHeight>0)?currentHeight:0;currentWidth=(currentWidth>0)?currentWidth:0;this.setDimensions(currentHeight,currentWidth);},setDimensions:function(height,width){var d={};d.width=width+'px';d.height=height+'px';var topd=Math.round((height-this.dims[0])/2);var leftd=Math.round((width-this.dims[1])/2);if(this.elementPositioning=='absolute'||this.elementPositioning=='fixed'){if(!this.options.scaleFromTop)d.top=this.originalTop-topd+'px';d.left=this.originalLeft-leftd+'px';}else{if(!this.options.scaleFromTop)d.top=-topd+'px';d.left=-leftd+'px';}
this.element.setStyle(d);}});

var Tooltip=Class.create();Tooltip.prototype={initialize:function(element,tool_tip){var options=Object.extend({default_css:false,margin:"0px",padding:"5px",backgroundColor:"#d6d6fc",min_distance_x:5,min_distance_y:5,delta_x:0,delta_y:0,zindex:1000},arguments[2]||{});this.element=$(element);this.options=options;if($(tool_tip)){this.tool_tip=$(tool_tip);}else{this.tool_tip=$(document.createElement("div"));document.body.appendChild(this.tool_tip);this.tool_tip.addClassName("tooltip");this.tool_tip.appendChild(document.createTextNode(tool_tip));}
this.tool_tip.hide();this.eventMouseOver=this.showTooltip.bindAsEventListener(this);this.eventMouseOut=this.hideTooltip.bindAsEventListener(this);this.eventMouseMove=this.moveTooltip.bindAsEventListener(this);this.registerEvents();},destroy:function(){Event.stopObserving(this.element,"mouseover",this.eventMouseOver);Event.stopObserving(this.element,"mouseout",this.eventMouseOut);Event.stopObserving(this.element,"mousemove",this.eventMouseMove);},registerEvents:function(){Event.observe(this.element,"mouseover",this.eventMouseOver);Event.observe(this.element,"mouseout",this.eventMouseOut);Event.observe(this.element,"mousemove",this.eventMouseMove);},moveTooltip:function(event){Event.stop(event);var mouse_x=Event.pointerX(event);var mouse_y=Event.pointerY(event);var dimensions=Element.getDimensions(this.tool_tip);var element_width=dimensions.width;var element_height=dimensions.height;if((element_width+mouse_x)>=(this.getWindowWidth()-this.options.min_distance_x)){mouse_x=mouse_x-element_width;mouse_x=mouse_x-this.options.min_distance_x;}else{mouse_x=mouse_x+this.options.min_distance_x;}
if((element_height+mouse_y)>=(this.getWindowHeight()-this.options.min_distance_y)){mouse_y=mouse_y-element_height;mouse_y=mouse_y-this.options.min_distance_y;}else{mouse_y=mouse_y+this.options.min_distance_y;}
this.setStyles(mouse_x,mouse_y);},showTooltip:function(event){Event.stop(event);this.moveTooltip(event);new Element.show(this.tool_tip);},setStyles:function(x,y){Element.setStyle(this.tool_tip,{position:'absolute',top:y+this.options.delta_y+"px",left:x+this.options.delta_x+"px",zindex:this.options.zindex});if(this.options.default_css){Element.setStyle(this.tool_tip,{margin:this.options.margin,padding:this.options.padding,backgroundColor:this.options.backgroundColor,zindex:this.options.zindex});}},hideTooltip:function(event){new Element.hide(this.tool_tip);},getWindowHeight:function(){var innerHeight;if(navigator.appVersion.indexOf('MSIE')>0){innerHeight=document.body.clientHeight;}else{innerHeight=window.innerHeight;}
return innerHeight;},getWindowWidth:function(){var innerWidth;if(navigator.appVersion.indexOf('MSIE')>0){innerWidth=document.body.clientWidth;}else{innerWidth=window.innerWidth;}
return innerWidth;}}

var lazierLoadAutoHook=true;var lazierLoadDefaultOptions={treshold:100,replaceImage:"/images/base/blank.gif",loadingImage:"/images/base/load_indicator_in_white.gif",minWidth:30,minHeight:30}
if(!JS_BRAMUS){var JS_BRAMUS=new Object();}
JS_BRAMUS.lazierLoad=Class.create();JS_BRAMUS.lazierLoad.prototype={initialize:function(options){var imagecount=0
$$('img').each(function(image){new JS_BRAMUS.lazierLoadImage(image,options);});}}
JS_BRAMUS.lazierLoadImage=Class.create();JS_BRAMUS.lazierLoadImage.prototype={options:null,element:null,loading:false,loaded:false,position:null,viewportHeight:0,lazyScroller:null,initialize:function(image,options){this.options=Object.clone(lazierLoadDefaultOptions);Object.extend(this.options,options||{});this.element=image;this.position=Position.page(this.element);this.viewportHeight=document.viewport.getHeight();if(this.position[1]<(this.viewportHeight+this.options.treshold)){this.loading=true;this.loaded=true;}else{this.element.origSrc=this.element.src;this.element.fileName=this.element.origSrc.substring(this.element.origSrc.lastIndexOf('/')+1,this.element.origSrc.length);this.element.fileType=this.element.fileName.substring(this.element.fileName.lastIndexOf('.')+1,this.element.fileName.length);if((this.element.width<=parseInt(this.options.minWidth))&&(this.element.height<=parseInt(this.options.minHeight))){return;}
this.element.src=this.options.replaceImage;this.element.setStyle({backgroundImage:'url('+this.options.loadingImage+')',backgroundPosition:'50% 50%',backgroundRepeat:'no-repeat'});this.lazyScroller=this.lazyScroll.bindAsEventListener(this);Event.observe(window,'scroll',this.lazyScroller.bind(this),false);}},lazyScroll:function(){if((this.loaded==false)&&(this.loading!=true)){if((document.viewport.getScrollOffsets()[1]+document.viewport.getHeight()+parseInt(this.options.treshold))>this.position[1]){this.loading=true;var newImage=null;newImage=new Image();newImage.src=this.element.origSrc;if(newImage.complete){this.element.src=newImage.src;this.loaded=true;}else{newImage.onload=function(){this.element.src=newImage.src;this.loaded=true;}.bind(this);}
this.element.setStyle({backgroundImage:'none'});Event.stopObserving(window,'scroll',this.lazyScroller);}}}}
if(lazierLoadAutoHook==true){function initLazierLoad(){myLL=new JS_BRAMUS.lazierLoad();}
Event.observe(window,'load',initLazierLoad,false);}

var CommentsManager=Class.create({initialize:function(container_element_id,options){this.options=Object.extend({something:'default'},options||{});this.container_el=$(container_element_id);this.initializePaging();this.initializeElements();this.initializeData();this.initializeAuthentication();this.initializeSubmission();this.initializeNewProfileForm();this.initializeFacebookShare();this.readSavedComment();this.parseComments();this.findLeadImage();},initializeElements:function(){this.comment_form=$('commentForm');this.comment_body_f=$('comment_body');this.comment_name_f=$('comment_name');this.comment_email_f=$('comment_email');this.comment_url_f=$('comment_url');this.comment_errors_el=$('comment_body_errors');this.comment_notice_el=$('comment_notice');this.comment_submit_button_el=$('comment_submit_button');this.comment_spinner_el=$('comment_spinner');this.auth_button_el=$('comment_auth_button');this.comment_auth_popup_tabs_el=$('comment_auth_popup_tabs');this.guest_submit_button_el=$('comment_auth_guest_submit');this.guest_email_errors_el=$('comment_auth_guest_email_errors')
this.guest_name_errors_el=$('comment_auth_guest_name_errors')
this.guest_email_f=$('comment_auth_guest_email');this.guest_name_f=$('comment_auth_guest_name');this.create_profile_link_el=$('create_profile_link');this.profile_submit_button_el=$('comment_auth_profile_submit');this.profile_errors_el=$('comment_auth_profile_errors');this.profile_username_errors_el=$('comment_auth_profile_username_errors');this.profile_password_errors_el=$('comment_auth_profile_password_errors');this.profile_spinner_el=$('comment_auth_profile_spinner');this.profile_username_f=$('comment_auth_profile_username');this.profile_password_f=$('comment_auth_profile_password');this.new_prfile_form=$('new_profile');this.new_profile_submit_button_el=$('profile_submit');this.new_profile_spinner_el=$('profile_spinner');this.facebook_submit_button_el=$('comment_auth_facebook_submit');this.facebook_spinner_el=$('comment_auth_facebook_spinner');this.facebook_share_el=$('fb_share_comment');this.facebook_share_button_el=$('fb_share_comment_button');},initializeData:function(){this.needs_auth=this.comment_submit_button_el.readAttribute('data-commentable-auth');this.commentable_type=this.container_el.readAttribute('data-commentable-type');this.commentable_id=this.container_el.readAttribute('data-commentable-id');},initializeSubmission:function(){if(this.needs_auth=='false'){this.comment_submit_button_el.observe('click',this.onSubmitButtonClick.bind(this));this.comment_submit_button_el.appear();}},onSubmitButtonClick:function(e){this.submitComment();e.stop();},initializeAuthentication:function(){if(this.needs_auth=='true'){new Fabtabs('comment_auth_popup_tabs',{hover:false});new FancyZoom('comment_submit_button',{width:570,height:450});this.initializeGuestAuthentication();this.initializeProfileAuthentication();this.initializeFacebookAuthentication();this.comment_submit_button_el.appear();}},initializeProfileAuthentication:function(){if(this.profile_submit_button_el){this.profile_submit_button_el.observe('click',this.onProfileSubmitButtonClick.bind(this));}
if(this.create_profile_link_el){new FancyZoom(this.create_profile_link_el,{width:960,height:350});}},initializeGuestAuthentication:function(){this.guest_submit_button_el.observe('click',this.onGuestSubmitButtonClick.bind(this));},initializeFacebookAuthentication:function(){if(this.facebook_submit_button_el){this.facebook_submit_button_el.observe('click',this.onFacebookSubmitButtonClick.bind(this));}},initializeNewProfileForm:function(){if(this.new_profile_submit_button_el){this.new_profile_submit_button_el.observe('click',this.onNewProfileSubmitButtonClick.bind(this));}},initializePaging:function(){var container=$(document.body)
if(container){container.observe('click',this.onDocumentClick.bind(this));}},initializeFacebookShare:function(){if(this.facebook_share_button_el)
this.facebook_share_button_el.observe('click',this.onFacebookShareButtonClick.bind(this));},onFacebookShareButtonClick:function(e){e.stop();this.shareComment();},onDocumentClick:function(e){var img=new Image;img.src='/images/base/spinner.gif';function createSpinner(){return new Element('img',{src:img.src,'class':'spinner'});}
var el=e.element()
if(el.match('#comments .pagination a')){e.stop();el.up('.pagination').insert(createSpinner());new Ajax.Request(el.href.gsub(/\?component_path=.+&ssi=1/,''),{method:'get',onComplete:this.onPagingComplete.bind(this)});}},onPagingComplete:function(){this.parseComments();},onNewProfileSubmitButtonClick:function(e){e.stop();this.showNewProfileSpinner();this.hideNewProfileValidationErrors();this.new_prfile_form.request({onComplete:this.onNewProfileFormSubmitComplete.bind(this)});},onNewProfileFormSubmitComplete:function(response){var json=response.responseText.evalJSON();if(json['errors']&&json['errors'].length>0){this.displayNewProfileValidationErrors(json['errors']);}else{this.submitComment();}
this.hideNewProfileSpinner();},displayNewProfileValidationErrors:function(errors){errors.each(function(error){var error_field=error[0];var error_message=error[1].gsub(/\^/,'');var input_field=$('profile_'+error_field);if(input_field){var error_el=new Element('span',{'class':'ajax-validation-error'});error_el.update(error_message);input_field.insert({before:error_el});}else{}});},hideNewProfileValidationErrors:function(){this.new_prfile_form.select('.ajax-validation-error').each(function(error_el){error_el.remove();});},onFacebookSubmitButtonClick:function(){this.showFacebookSpinner();FB.login(this.onFBLoginComplete.bind(this),{scope:'read_stream,publish_stream,offline_access,email'});},onFBLoginComplete:function(response){if(response.status=="connected"){this.authenticateFacebook(response.authResponse.accessToken);}else{this.hideFacebookSpinner();}},authenticateFacebook:function(token){new Ajax.Request('/auth/facebook/create',{parameters:{token:token},method:'get',onSuccess:this.onAuthenticateFacebookComplete.bind(this)});},onAuthenticateFacebookComplete:function(response){this.hideFacebookSpinner();var success=false;if(response.responseText=="0"){success=true;}
if(success)
this.submitComment();},onProfileSubmitButtonClick:function(e){if(this.validateProfileCredentials()){this.showProfileSpinner();this.authenticateProfile();}
e.stop();},validateProfileCredentials:function(){var valid=true;var username=this.profile_username_f.getValue();var password=this.profile_password_f.getValue();if(username.length==0){valid=false;this.showValidationError(this.profile_username_errors_el,this.options['translations']['you_must_fill_out_your_username']);}else{this.hideValidationError(this.profile_username_errors_el);}
if(password.length==0){valid=false;this.showValidationError(this.profile_password_errors_el,this.options['translations']['you_must_fill_out_your_password']);}else{this.hideValidationError(this.profile_password_errors_el);}
return valid;},authenticateProfile:function(){this.hideProfileError();var username=this.profile_username_f.getValue();var password=this.profile_password_f.getValue();new Ajax.Request('/profile/authenticate',{method:'post',parameters:{'profile[name]':username,'profile[password]':password},onSuccess:this.onAuthenticateProfileComplete.bind(this)});},onAuthenticateProfileComplete:function(response){this.hideProfileSpinner();var success=false;if(response.responseText=='-1'){this.showProfileError(this.options['translations']['wrong_username_or_password']);}else if(response.responseText=='-2'){this.showProfileError(this.options['translations']['you_are_banned']);}else if(response.responseText=="0"){success=true;}
if(success)
this.submitComment();},onGuestSubmitButtonClick:function(e){if(this.validateGuestCredentials()){this.comment_email_f.setValue(this.guest_email_f.getValue());this.comment_name_f.setValue(this.guest_name_f.getValue());this.submitComment();}
e.stop();},validateGuestCredentials:function(){var valid=true;var email=this.guest_email_f.getValue();var name=this.guest_name_f.getValue();if(email.length==0){valid=false;this.showValidationError(this.guest_email_errors_el,this.options['translations']['you_must_fill_out_your_email']);}else if(email.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)==null){valid=false;this.showValidationError(this.guest_email_errors_el,this.options['translations']['invalid_email']);}else{this.hideValidationError(this.guest_email_errors_el);}
if(name.length==0){valid=false;this.showValidationError(this.guest_name_errors_el,this.options['translations']['you_must_fill_out_your_name']);}else{this.hideValidationError(this.guest_name_errors_el);}
return valid;},showValidationError:function(container_el,message){container_el.update(message);container_el.appear();},hideValidationError:function(container_el){container_el.hide();},validateComment:function(){var valid=true;var comment=this.comment_body_f.getValue();if(comment.length==0){valid=false
this.showCommentError(this.options['translations']['you_must_write_a_comment']);}
return valid;},submitComment:function(){this.hideCommentError();this.hideCommentNotice();this.facebook_share_el.hide();if(this.validateComment()){this.showCommentSpinner();this.comment_url_f.setValue(window.location);this.comment_form.request({onComplete:this.onSubmitCommentComplete.bind(this)});}
if(this.needs_auth=='true')
FancyZoomBox.hide(null);},onSubmitCommentComplete:function(response){this.hideCommentSpinner();var success=false;console.log(response);if(response.statusText=="Forbidden"){this.showCommentError(this.options['translations']['flood_protection_warning']);}else if(response.responseText=='-1'){this.showCommentError(this.options['translations']['you_must_write_a_comment']);}else if(response.responseText=="-2"){success=true;this.showCommentNotice(this.options['translations']['comment_saved_but_needs_confirmation']);}else if(response.responseText=="-3"){success=true;this.showCommentNotice(this.options['translations']['comment_saved_but_needs_admin_confirmation']);}else{success=true;this.showCommentNotice(this.options['translations']['comment_saved']);this.loadLatestComments(response.responseText);this.facebook_share_el.appear();}
if(success){this.last_comment=$('comment_body').getValue();$('comment_body').setValue('');}},getPageDescription:function(){var m=document.getElementsByTagName('meta');for(var i in m){if(m[i].name=='description')
return m[i].content;}
return null;},shareComment:function(comment){var title=document.title;var url=window.location.href;var description=this.getPageDescription();var image=this.findLeadImage();FB.ui({method:'feed',display:'popup',name:this.options['fb_share_name_prefix']+' "'+title+'"',picture:image,link:url,description:'"'+description+'"',message:this.last_comment},this.onShareCommentComplete.bind(this));},onShareCommentComplete:function(response){if(response&&response.post_id){this.facebook_share_el.hide();}else{}},loadLatestComments:function(commentId){new Ajax.Request('/comments/index/'+this.commentable_type+'/'+this.commentable_id+'/last',{method:'get',onComplete:this.onLoadLatestCommentsComplete.bind(this,commentId)});},onLoadLatestCommentsComplete:function(commentId,response){if(commentId){el=$('comment_'+commentId);}
this.parseComments();},showCommentError:function(message){this.comment_errors_el.update(message);this.comment_errors_el.appear();this.comment_errors_el.shake();},hideCommentError:function(){this.comment_errors_el.hide();},showProfileError:function(message){this.profile_errors_el.update(message)
this.profile_errors_el.appear();},hideProfileError:function(){this.profile_errors_el.hide();},showCommentNotice:function(message){this.comment_notice_el.update(message);this.comment_notice_el.appear();},hideCommentNotice:function(){this.comment_notice_el.hide();},showProfileSpinner:function(){this.profile_submit_button_el.hide();this.profile_spinner_el.show();},hideProfileSpinner:function(){this.profile_submit_button_el.show();this.profile_spinner_el.hide();},showFacebookSpinner:function(){this.facebook_submit_button_el.hide();this.facebook_spinner_el.show();},hideFacebookSpinner:function(){this.facebook_submit_button_el.show();this.facebook_spinner_el.hide();},showCommentSpinner:function(){this.comment_submit_button_el.hide();this.comment_spinner_el.show();},hideCommentSpinner:function(){this.comment_submit_button_el.show();this.comment_spinner_el.hide();},showNewProfileSpinner:function(){this.new_profile_submit_button_el.hide();this.new_profile_spinner_el.show();},hideNewProfileSpinner:function(){this.new_profile_submit_button_el.show();this.new_profile_spinner_el.hide();},parseComments:function(){$('comments').select('li').each(this.commentIterator.bind(this));},commentIterator:function(comment){profileId=parseInt(comment.readAttribute('data-comment-profile-id'));isDeleted=comment.readAttribute('data-comment-is-deleted');if(this.options['admin']||(isDeleted=='false'&&profileId==this.options['currentProfileId'])){comment.addClassName('editable');userEditControls=comment.select('.commentFunctions').first();if(userEditControls)
userEditControls.show();}},onCreateProfileLinkClick:function(e){e.stop();var comment=this.comment_body_f.getValue();this.createCookie('comment_body',comment,30);},createCookie:function(name,value,minutes){if(minutes){var date=new Date();date.setTime(date.getTime()+(minutes*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";},readCookie:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;},eraseCookie:function(name){this.createCookie(name,"",-1);},readSavedComment:function(){var comment=this.readCookie('comment_body');if(comment){this.comment_body_f.setValue(comment);this.eraseCookie('comment_body');}},findLeadImage:function(){var images=$$('img');var biggestImage=null;images.each(function(image){if(biggestImage==null||(image.width*image.height>biggestImage.width*biggestImage.height)){biggestImage=image;}});return biggestImage?biggestImage.src:null;},});

