var Prototype={Version:'1.6.0.2',Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement('div').__proto__&&document.createElement('div').__proto__!==document.createElement('form').__proto__},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)
Prototype.BrowserFeatures.SpecificElementExtensions=false;var Class={create:function(){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){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
for(var i=0;i<properties.length;i++)
klass.addMethods(properties[i]);if(!klass.prototype.initialize)
klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}};Class.Methods={addMethods:function(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)
properties.push("toString","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().first()=="$super"){var method=value,value=Object.extend((function(m){return function(){return ancestor[m].apply(this,arguments)};})(property).wrap(method),{valueOf:function(){return method},toString:function(){return method.toString()}});}
this.prototype[property]=value;}
return this;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)
destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(Object.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;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}
if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(!Object.isUndefined(value))
results.push(property.toJSON()+': '+value);}
return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)
keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return object&&object.nodeType==1;},isArray:function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});Function.prototype.defer=Function.prototype.delay.curry(0.01);Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+
(this.getUTCMonth()+1).toPaddedString(2)+'-'+
this.getUTCDate().toPaddedString(2)+'T'+
this.getUTCHours().toPaddedString(2)+':'+
this.getUTCMinutes().toPaddedString(2)+':'+
this.getUTCSeconds().toPaddedString(2)+'Z"';};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}};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();}finally{this.currentlyExecuting=false;}}}});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,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(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;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return String(this);},truncate:function(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var self=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';},toQueryParams:function(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());var 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;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();},underscore:function(){return this.gsub(/::/,'/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},dasherize:function(){return this.gsub(/_/,'-');},inspect:function(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'";},toJSON:function(){return this.inspect(true);},unfilterJSON:function(filter){return this.sub(filter||Prototype.JSONFilter,'#{1}');},isJSON:function(){var str=this;if(str.blank())return false;str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},blank:function(){return/^\s*$/.test(this);},interpolate:function(object,pattern){return new Template(this,pattern).evaluate(object);}});if(Prototype.Browser.WebKit||Prototype.Browser.IE)Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},unescapeHTML:function(){return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});with(String.prototype.escapeHTML)div.appendChild(text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))
object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):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={each:function(iterator,context){var index=0;iterator=iterator.bind(context);try{this._each(function(value){iterator(value,index++);});}catch(e){if(e!=$break)throw e;}
return this;},eachSlice:function(number,iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var index=-number,slices=[],array=this.toArray();while((index+=number)<array.length)
slices.push(array.slice(index,index+number));return slices.collect(iterator,context);},all:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator(value,index);if(!result)throw $break;});return result;},any:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator(value,index))
throw $break;});return result;},collect:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var results=[];this.each(function(value,index){results.push(iterator(value,index));});return results;},detect:function(iterator,context){iterator=iterator.bind(context);var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){iterator=iterator.bind(context);var results=[];this.each(function(value,index){if(iterator(value,index))
results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var results=[];if(Object.isString(filter))
filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))
results.push(iterator(value,index));});return results;},include:function(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;},inGroupsOf:function(number,fillWith){fillWith=Object.isUndefined(fillWith)?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice;});},inject:function(memo,iterator,context){iterator=iterator.bind(context);this.each(function(value,index){memo=iterator(memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result;this.each(function(value,index){value=iterator(value,index);if(result==null||value>=result)
result=value;});return result;},min:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result;this.each(function(value,index){value=iterator(value,index);if(result==null||value<result)
result=value;});return result;},partition:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator(value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){iterator=iterator.bind(context);var results=[];this.each(function(value,index){if(!iterator(value,index))
results.push(value);});return results;},sortBy:function(iterator,context){iterator=iterator.bind(context);return this.map(function(value,index){return{value:value,criteria:iterator(value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.map();},zip:function(){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));});},size:function(){return this.toArray().length;},inspect:function(){return'#<Enumerable:'+this.toArray().inspect()+'>';}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(iterable){if(!iterable)return[];if(iterable.toArray)return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
if(Prototype.Browser.WebKit){$A=function(iterable){if(!iterable)return[];if(!(Object.isFunction(iterable)&&iterable=='[object NodeList]')&&iterable.toArray)return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;};}
Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0,length=this.length;i<length;i++)
iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(sorted){return this.inject([],function(array,value,index){if(0==index||(sorted?array.last()!=value:!array.include(value)))
array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))
Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(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;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(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;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)
array.push(arguments[i][j]);}else{array.push(arguments[i]);}}
return array;};}
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator){$R(0,this,true).each(iterator);return this;},toPaddedString:function(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string;},toJSON:function(){return isFinite(this)?this.toString():'null';}});$w('abs round ceil floor').each(function(method){Number.prototype[method]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:function(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},set:function(key,value){return this._object[key]=value;},get:function(key){return this._object[key];},unset:function(key){var value=this._object[key];delete this._object[key];return value;},toObject:function(){return Object.clone(this._object);},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},index:function(value){var match=this.detect(function(pair){return pair.value===value;});return match&&match.key;},merge:function(object){return this.clone().update(object);},update:function(object){return new Hash(object).inject(this,function(result,pair){result.set(pair.key,pair.value);return result;});},toQueryString:function(){return this.map(function(pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))
return values.map(toQueryPair.curry(key)).join('&');}
return toQueryPair(key,values);}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';},toJSON:function(){return Object.toJSON(this.toObject());},clone:function(){return new Hash(this);}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};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.isString(this.options.parameters))
this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))
this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,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.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}
this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')
this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
params+='&_=';}
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);},getStatus:function(){try{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(!window.Node)var Node={};if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});}
(function(){var element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&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));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});}).call(window);Element.cache={};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).style.display='none';return element;},show:function(element){$(element).style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},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();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
if(element.nodeType==1)
elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $(element).select("*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;if(element)return[element].concat($(element).nextSiblings());return[];},previousSiblings:function(element){return $(element).recursivelyCollect('previousSibling');},nextSiblings:function(element){return $(element).recursivelyCollect('nextSibling');},siblings:function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))
selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:element.select(expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('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().height;},getWidth:function(element){return $(element).getDimensions().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(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(className)?'removeClassName':'addClassName'](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);var originalAncestor=ancestor;if(element.compareDocumentPosition)
return(element.compareDocumentPosition(ancestor)&8)===8;if(element.sourceIndex&&!Prototype.Browser.Opera){var e=element.sourceIndex,a=ancestor.sourceIndex,nextAncestor=ancestor.nextSibling;if(!nextAncestor){do{ancestor=ancestor.parentNode;}
while(!(nextAncestor=ancestor.nextSibling)&&ancestor.parentNode);}
if(nextAncestor&&nextAncestor.sourceIndex)
return(e>a&&e<nextAncestor.sourceIndex);}
while(element=element.parentNode)
if(element==originalAncestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();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){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;},getDimensions:function(element){element=$(element);var display=$(element).getStyle('display');if(display!='none'&&display!=null)
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(window.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;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body)
if(Element.getStyle(element,'position')!='static')
return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||element.tagName=='BODY'){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},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=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}
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;}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;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.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);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;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed')
offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});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={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){attribute=element.getAttribute(attribute);return attribute?attribute.toString().slice(23,-2):null;},_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').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr;});(function(v){Object.extend(v,{href:v._getAttr,src:v._getAttr,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);}
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=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}
return element;};Element.Methods.cumulativeOffset=function(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 Element._returnOffset(valueL,valueT);};}
if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);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 in Element._insertionTranslations.tags){$A(element.childNodes).each(function(node){element.removeChild(node)});Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)});}
else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
if('outerHTML'in document.createElement('div')){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();var 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){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){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(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD});}).call(Element._insertionTranslations);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);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement('div').__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement('div').__proto__;Prototype.BrowserFeatures.ElementExtensions=true;}
Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)
return Prototype.K;var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName,property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))
element[property]=value.methodize();}
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;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};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)});}
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];window[klass]={};window[klass].prototype=document.createElement(tagName).__proto__;return window[klass];}
if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,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(){var dimensions={};var B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();dimensions[d]=(B.WebKit&&!document.evaluate)?self['inner'+D]:(B.Opera)?document.body['client'+D]:document.documentElement['client'+D];});return dimensions;},getWidth:function(){return this.getDimensions().width;},getHeight:function(){return this.getDimensions().height;},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);}};var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();this.compileMatcher();},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty")))
return false;if((/(\[[\w-]*?:|:checked)/).test(this.expression))
return false;return true;},compileMatcher:function(){if(this.shouldUseXPath())
return this.compileXPathMatcher();var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return;}
this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=this.expression,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return;}
this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},findElements:function(root){root=root||document;if(this.xpath)return document._getElementsByXPath(this.xpath,root);return this.matcher(root);},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'');}else{return this.findElements(document).include(element);}}}}
var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
return match;},toString:function(){return this.expression;},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=Selector.xpath.pseudos[m[1]];if(!h)return'';if(Object.isFunction(h))return h(m);return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);},operators:{'=':"[@#{1}='#{3}']",'!=':"[@#{1}!='#{3}']",'^=':"[starts-with(@#{1}, '#{3}')]",'$=':"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",'|=':"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{'first-child':'[not(preceding-sibling::*)]','last-child':'[not(following-sibling::*)]','only-child':'[not(preceding-sibling::* or following-sibling::*)]','empty':"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",'checked':"[@checked]",'disabled':"[@disabled]",'enabled':"[not(@disabled)]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}
return"[not("+exclusion.join(" and ")+")]";},'nth-child':function(m){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",m);},'nth-last-child':function(m){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",m);},'nth-of-type':function(m){return Selector.xpath.pseudos.nth("position() ",m);},'nth-last-of-type':function(m){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",m);},'first-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nth:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))
return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)
a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)
if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)
if(!(n=nodes[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;results.push(Element.extend(n));}
return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){for(var j=0,child;child=node.childNodes[j];j++)
if(child.nodeType==1&&child.tagName!='!')results.push(child);}
return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}
return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)
if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)
if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}
for(var i=0,node;node=nodes[i];i++)
if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)
if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)
if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)
if(Selector.handlers.previousElementSibling(targetNode)==node)
return[targetNode];}else nodes=h[combinator](nodes);}
for(var i=0,node;node=nodes[i];i++)
if(node==targetNode)return[targetNode];return[];}
return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))
results.push(node);}
return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}
return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}
return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}
return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))
results.push(node);return results;},'nth-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root);},'nth-last-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true);},'nth-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,false,true);},'nth-last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true,true);},'first-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,false,true);},'last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,true,true);},'only-of-type':function(nodes,formula,root){var p=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}
if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)
if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)
if(node.nodeIndex==indices[j])results.push(node);}}
h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||(node.firstChild&&!node.innerHTML.match(/^\s*$/)))continue;results.push(node);}
return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(!node.disabled)results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(node.checked)results.push(node);return results;}},operators:{'=':function(nv,v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv.startsWith(v);},'$=':function(nv,v){return nv.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+nv.toUpperCase()+'-').include('-'+v.toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}
return(l>1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++)
if(node.tagName!=="!")a.push(node);return a;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
node.removeAttribute('_countedByPrototype');return nodes;}});}
function $$(){return Selector.findChildElements(document,$A(arguments));}
var Form={reset:function(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;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}
else result[key]=value;}}
return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={serialize:function(form,options){return Form.serializeElements(Form.getElements(form),options);},getElements:function(form){return $A($(form).getElementsByTagName('*')).inject([],function(elements,child){if(Form.Element.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'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().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'].include(element.type)))
element.select();}catch(e){}
return element;},disable:function(element){element=$(element);element.blur();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={input:function(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element,value);default:return Form.Element.Serializers.textarea(element,value);}},inputSelector:function(element,value){if(Object.isUndefined(value))return element.checked?element.value:null;else element.checked=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,index){if(Object.isUndefined(index))
return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,value,single=!Object.isArray(index);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];value=this.optionValue(opt);if(single){if(value==index){opt.selected=true;return;}}
else opt.selected=index.include(value);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):null;},selectMany:function(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(this.optionValue(opt));}
return values;},optionValue:function(opt){return Element.extend(opt).hasAttribute('value')?opt.value:opt.text;}};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);}});if(!window.Event)var Event={};Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(event){var element;switch(event.type){case'mouseover':element=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}
return{isLeftClick:function(event){return isButton(event,0)},isMiddleClick:function(event){return isButton(event,1)},isRightClick:function(event){return isButton(event,2)},element:function(event){var node=Event.extend(event).target;return Element.extend(node.nodeType==Node.TEXT_NODE?node.parentNode:node);},findElement:function(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);},pointer:function(event){return{x:event.pageX||(event.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft)),y:event.pageY||(event.clientY+
(document.documentElement.scrollTop||document.body.scrollTop))};},pointerX:function(event){return Event.pointer(event).x},pointerY:function(event){return Event.pointer(event).y},stop:function(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true;}};})();Event.extend=(function(){var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(event){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement,relatedTarget:Event.relatedTarget(event),pageX:pointer.x,pageY:pointer.y});return Object.extend(event,methods);};}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,methods);return Prototype.K;}})();Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var timer;function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearInterval(timer);document.fire("dom:loaded");document.loaded=true;}
if(document.addEventListener){if(Prototype.Browser.WebKit){timer=window.setInterval(function(){if(/loaded|complete/.test(document.readyState))
fireContentLoadedEvent();},0);Event.observe(window,"load",fireContentLoadedEvent);}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent();}};}})();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);Element.addMethods();

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));}});

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}}}}();

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');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[^>]*?bil-tv\.23video\.com\/video\/([a-zA-Z0-9\-]+)<\/a>/gi,"<div style=\"text-align: center;\" id=\"video____bil-tv____$1"+"____"+serial+"\"></div>");serial++;content=content.replace(/http:\/\/bil-tv\.23video\.com\/video\/([a-z0-9\-]+)/gi,"<div style=\"text-align: center;\" id=\"video____bil-tv____$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{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'){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=='bil-tv'){flashvars.FlashVars="token=ba782b21c7383c58642da5cb695c2dee&photo%5fid="+videoId;swfobject.embedSWF('http://bil-tv.23video.com/544837.swf',id,width,height,'9.0.0',null,flashvars,params,attributes);}}}}}
if(window.addEventListener)
window.addEventListener("load",videoMagic,false);else if(window.attachEvent)
window.attachEvent("onload",videoMagic);else if(document.getElementById)
window.onload=videoMagic;

WhiteAlbum={banners:{toggle:function(){var banners=$$('.banner');if(banners){banners.each(function(banner){banner.setStyle({visibility:(banner.getStyle('visibility')=='hidden'?'visible':'hidden')});});};}},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.banners.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,74,106].include(event.keyCode)){location.href=this.previous_url;}
if(this.next_url&&[Event.KEY_RIGHT,75,107].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;}})};

document.observe('dom:loaded',function(){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 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");buttons.each(function(w){w.onclick=function(){insertSmiley(target,w.firstChild.alt);return false;};});}
Event.observe(window,'load',initMiniedit);function initProfileOptions(){widgets=$$(".profileOptions li a");widgets.each(function(w){w.onmouseover=function(){w.firstChild.style.display='block';};w.onmouseout=function(){w.firstChild.style.display='none';};});}
Event.observe(window,'load',initProfileOptions);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;}}
