var Prototype={Version:'1.6.1',Browser:(function(){var ua=navigator.userAgent,isOpera=Object.prototype.toString.call(window.opera)=='[object Opera]';return{IE:!!window.attachEvent&&!isOpera,Opera:isOpera,WebKit:ua.indexOf('AppleWebKit/')>-1,Gecko:ua.indexOf('Gecko')>-1&&ua.indexOf('KHTML')===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(ua)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var constructor=window.Element||window.HTMLElement;return !!(constructor&&constructor.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=='undefined')return true;var div=document.createElement('div'),form=document.createElement('form'),isSupported=false;if(div.__proto__&&(div.__proto__!==form.__proto__))isSupported=true;div=form=null;return isSupported})()},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;var Abstract={},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}},Class=(function(){function subclass(){}
function create(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))parent=properties.shift()
function klass(){this.initialize.apply(this,arguments)};Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){subclass.prototype=parent.prototype;klass.prototype=new subclass();parent.subclasses.push(klass)};for(var i=0;i<properties.length;i++)klass.addMethods(properties[i]);if(!klass.prototype.initialize)klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass}
function addMethods(source){var ancestor=this.superclass&&this.superclass.prototype,properties=Object.keys(source);if(!Object.keys({toString:true}).length){if(source.toString!=Object.prototype.toString)properties.push("toString");if(source.valueOf!=Object.prototype.valueOf)properties.push("valueOf")};for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments)}})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method)};this.prototype[property]=value};return this};return{create:create,Methods:{addMethods:addMethods}}})();(function(){var _toString=Object.prototype.toString
function extend(destination,source){for(var property in source)destination[property]=source[property];return destination}
function inspect(object){try{if(isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object)}catch(e){if(e instanceof RangeError)return'...';throw e}}
function toJSON(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(isElement(object))return;var results=[];for(var property in object){var value=toJSON(object[property]);if(!isUndefined(value))results.push(property.toJSON()+': '+value)};return'{'+results.join(', ')+'}'}
function toQueryString(object){return $H(object).toQueryString()}
function toHTML(object){return object&&object.toHTML?object.toHTML():String.interpret(object)}
function keys(object){var results=[];for(var property in object)results.push(property);return results}
function values(object){var results=[];for(var property in object)results.push(object[property]);return results}
function clone(object){return extend({},object)}
function isElement(object){return !!(object&&object.nodeType==1)}
function isArray(object){return _toString.call(object)=="[object Array]"}
function isHash(object){return object instanceof Hash}
function isFunction(object){return typeof object==="function"}
function isString(object){return _toString.call(object)=="[object String]"}
function isNumber(object){return _toString.call(object)=="[object Number]"}
function isUndefined(object){return typeof object==="undefined"};extend(Object,{extend:extend,inspect:inspect,toJSON:toJSON,toQueryString:toQueryString,toHTML:toHTML,keys:keys,values:values,clone:clone,isElement:isElement,isArray:isArray,isHash:isHash,isFunction:isFunction,isString:isString,isNumber:isNumber,isUndefined:isUndefined})})();Object.extend(Function.prototype,(function(){var slice=Array.prototype.slice
function update(array,args){var arrayLength=array.length,length=args.length;while(length--)array[arrayLength+length]=args[length];return array}
function merge(array,args){array=slice.call(array,0);return update(array,args)}
function argumentNames(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,'').replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names}
function bind(context){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=slice.call(arguments,1);return function(){var a=merge(args,arguments);return __method.apply(context,a)}}
function bindAsEventListener(context){var __method=this,args=slice.call(arguments,1);return function(event){var a=update([event||window.event],args);return __method.apply(context,a)}}
function curry(){if(!arguments.length)return this;var __method=this,args=slice.call(arguments,0);return function(){var a=merge(args,arguments);return __method.apply(this,a)}}
function delay(timeout){var __method=this,args=slice.call(arguments,1);timeout=timeout*1000;return window.setTimeout(function(){return __method.apply(__method,args)},timeout)}
function defer(){var args=update([0.01],arguments);return this.delay.apply(this,args)}
function wrap(wrapper){var __method=this;return function(){var a=update([__method.bind(this)],arguments);return wrapper.apply(this,a)}}
function methodize(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){var a=update([this],arguments);return __method.apply(null,a)}};return{argumentNames:argumentNames,bind:bind,bindAsEventListener:bindAsEventListener,curry:curry,delay:delay,defer:defer,wrap:wrap,methodize:methodize}})());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"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1')};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(e){this.currentlyExecuting=false;throw e}}});Object.extend(String,{interpret:function(value){return value==null?'':String(value)},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)}}
function gsub(pattern,replacement){var result='',source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern))pattern=RegExp.escape(pattern);if(!(pattern.length||pattern.source)){replacement=replacement('');return replacement+source.split('').join(replacement)+replacement};while(source.length>0)if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else result+=source,source='';return result}
function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match)})}
function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}
function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}
function strip(){return this.replace(/^\s+/,'').replace(/\s+$/,'')}
function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,'')}
function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'')}
function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,'img'),matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1]})}
function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}
function escapeHTML(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;')}
function unescapeHTML(){return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&')}
function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value)}else hash[key]=value};return hash})}
function toArray(){return this.split('')}
function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}
function times(count){return count<1?'':new Array(count+1).join(this)}
function camelize(){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}
function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}
function underscore(){return this.replace(/::/g,'/').replace(/([A-Z]+)([A-Z][a-z])/g,'$1_$2').replace(/([a-z\d])([A-Z])/g,'$1_$2').replace(/-/g,'_').toLowerCase()}
function dasherize(){return this.replace(/_/g,'-')}
function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar)return String.specialChar[character];return'\\u00'+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'"}
function toJSON(){return this.inspect(true)}
function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,'$1')}
function isJSON(){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)}
function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')')}catch(e){};throw new SyntaxError('Badly formed JSON string: '+this.inspect())}
function include(pattern){return this.indexOf(pattern)>-1}
function startsWith(pattern){return this.indexOf(pattern)===0}
function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}
function empty(){return this==''}
function blank(){return/^\s*$/.test(this)}
function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)};return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern},evaluate:function(object){if(object&&Object.isFunction(object.toTemplateReplacements))object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return(match[1]+'');var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3],pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].replace(/\\\\]/g,']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr)};return before+String.interpret(ctx)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={},Enumerable=(function(){function each(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++)})}catch(e){if(e!=$break)throw e};return this}
function eachSlice(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)<array.length)slices.push(array.slice(index,index+number));return slices.collect(iterator,context)}
function all(iterator,context){iterator=iterator||Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result)throw $break});return result}
function any(iterator,context){iterator=iterator||Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index))throw $break});return result}
function collect(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index))});return results}
function detect(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break}});return result}
function findAll(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))results.push(value)});return results}
function grep(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))filter=new RegExp(RegExp.escape(filter));this.each(function(value,index){if(filter.match(value))results.push(iterator.call(context,value,index))});return results}
function include(object){if(Object.isFunction(this.indexOf))if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break}});return found}
function inGroupsOf(number,fillWith){fillWith=Object.isUndefined(fillWith)?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice})}
function inject(memo,iterator,context){this.each(function(value,index){memo=iterator.call(context,memo,value,index)});return memo}
function invoke(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args)})}
function max(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)result=value});return result}
function min(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result)result=value});return result}
function partition(iterator,context){iterator=iterator||Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value)});return[trues,falses]}
function pluck(property){var results=[];this.each(function(value){results.push(value[property])});return results}
function reject(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))results.push(value)});return results}
function sortBy(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)}}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0}).pluck('value')}
function toArray(){return this.map()}
function zip(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index))})}
function size(){return this.toArray().length}
function inspect(){return'#<Enumerable:'+this.toArray().inspect()+'>'};return{each:each,eachSlice:eachSlice,all:all,every:all,any:any,some:any,collect:collect,map:collect,detect:detect,findAll:findAll,select:findAll,filter:findAll,grep:grep,include:include,member:include,inGroupsOf:inGroupsOf,inject:inject,invoke:invoke,max:max,min:min,partition:partition,pluck:pluck,reject:reject,sortBy:sortBy,toArray:toArray,entries:toArray,zip:zip,size:size,inspect:inspect,find:detect}})()
function $A(iterable){if(!iterable)return[];if('toArray' in Object(iterable))return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results}
function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[]};Array.from=$A;(function(){var arrayProto=Array.prototype,slice=arrayProto.slice,_each=arrayProto.forEach
function each(iterator){for(var i=0,length=this.length;i<length;i++)iterator(this[i])};if(!_each)_each=each
function clear(){this.length=0;return this}
function first(){return this[0]}
function last(){return this[this.length-1]}
function compact(){return this.select(function(value){return value!=null})}
function flatten(){return this.inject([],function(array,value){if(Object.isArray(value))return array.concat(value.flatten());array.push(value);return array})}
function without(){var values=slice.call(arguments,0);return this.select(function(value){return !values.include(value)})}
function reverse(inline){return(inline!==false?this:this.toArray())._reverse()}
function uniq(sorted){return this.inject([],function(array,value,index){if(0==index||(sorted?array.last()!=value:!array.include(value)))array.push(value);return array})}
function intersect(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value})})}
function clone(){return slice.call(this,0)}
function size(){return this.length}
function inspect(){return'['+this.map(Object.inspect).join(', ')+']'}
function toJSON(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value)});return'['+results.join(', ')+']'}
function indexOf(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)if(this[i]===item)return i;return -1}
function lastIndexOf(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1}
function concat(){var array=slice.call(this,0),item;for(var i=0,length=arguments.length;i<length;i++){item=arguments[i];if(Object.isArray(item)&&!('callee' in item)){for(var j=0,arrayLength=item.length;j<arrayLength;j++)array.push(item[j])}else array.push(item)};return array};Object.extend(arrayProto,Enumerable);if(!arrayProto._reverse)arrayProto._reverse=arrayProto.reverse;Object.extend(arrayProto,{_each:_each,clear:clear,first:first,last:last,compact:compact,flatten:flatten,without:without,reverse:reverse,uniq:uniq,intersect:intersect,clone:clone,toArray:clone,size:size,inspect:inspect,toJSON:toJSON});var CONCAT_ARGUMENTS_BUGGY=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(CONCAT_ARGUMENTS_BUGGY)arrayProto.concat=concat;if(!arrayProto.indexOf)arrayProto.indexOf=indexOf;if(!arrayProto.lastIndexOf)arrayProto.lastIndexOf=lastIndexOf})()
function $H(object){return new Hash(object)};var Hash=Class.create(Enumerable,(function(){function initialize(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object)}
function _each(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair)}}
function set(key,value){return this._object[key]=value}
function get(key){if(this._object[key]!==Object.prototype[key])return this._object[key]}
function unset(key){var value=this._object[key];delete this._object[key];return value}
function toObject(){return Object.clone(this._object)}
function keys(){return this.pluck('key')}
function values(){return this.pluck('value')}
function index(value){var match=this.detect(function(pair){return pair.value===value});return match&&match.key}
function merge(object){return this.clone().update(object)}
function update(object){return new Hash(object).inject(this,function(result,pair){result.set(pair.key,pair.value);return result})}
function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value))}
function toQueryString(){return this.inject([],function(results,pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))return results.concat(values.map(toQueryPair.curry(key)))}else results.push(toQueryPair(key,values));return results}).join('&')}
function inspect(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ')}).join(', ')+'}>'}
function toJSON(){return Object.toJSON(this.toObject())}
function clone(){return new Hash(this)};return{initialize:initialize,_each:_each,set:set,get:get,unset:unset,toObject:toObject,toTemplateReplacements:toObject,keys:keys,values:values,index:index,merge:merge,update:update,toQueryString:toQueryString,inspect:inspect,toJSON:toJSON,clone:clone}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function toColorPart(){return this.toPaddedString(2,16)}
function succ(){return this+1}
function times(iterator,context){$R(0,this,true).each(iterator,context);return this}
function toPaddedString(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string}
function toJSON(){return isFinite(this)?this.toString():'null'}
function abs(){return Math.abs(this)}
function round(){return Math.round(this)}
function ceil(){return Math.ceil(this)}
function floor(){return Math.floor(this)};return{toColorPart:toColorPart,succ:succ,times:times,toPaddedString:toPaddedString,toJSON:toJSON,abs:abs,round:round,ceil:ceil,floor:floor}})())
function $R(start,end,exclusive){return new ObjectRange(start,end,exclusive)};var ObjectRange=Class.create(Enumerable,(function(){function initialize(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive}
function _each(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ()}}
function include(value){if(value<this.start)return false;if(this.exclusive)return value<this.end;return value<=this.end};return{initialize:initialize,_each:_each,include:include}})()),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=[],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(global){var SETATTRIBUTE_IGNORES_NAME=(function(){var elForm=document.createElement("form"),elInput=document.createElement("input"),root=document.documentElement;elInput.setAttribute("name","test");elForm.appendChild(elInput);root.appendChild(elForm);var isBuggy=elForm.elements?(typeof elForm.elements.test=="undefined"):null;root.removeChild(elForm);elForm=elInput=null;return isBuggy})(),element=global.Element;global.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(SETATTRIBUTE_IGNORES_NAME&&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(global.Element,element||{});if(element)global.Element.prototype=element.prototype})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(element){return $(element).style.display!='none'},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element},hide:function(element){element=$(element);element.style.display='none';return element},show:function(element){element=$(element);element.style.display='';return element},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element},update:(function(){var SELECT_ELEMENT_INNERHTML_BUGGY=(function(){var el=document.createElement("select"),isBuggy=true;el.innerHTML="<option value=\"test\">test</option>";if(el.options&&el.options[0])isBuggy=el.options[0].nodeName.toUpperCase()!=="OPTION";el=null;return isBuggy})(),TABLE_ELEMENT_INNERHTML_BUGGY=(function(){try{var el=document.createElement("table");if(el&&el.tBodies){el.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var isBuggy=typeof el.tBodies[0]=="undefined";el=null;return isBuggy}}catch(e){return true}})(),SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING=(function(){var s=document.createElement("script"),isBuggy=false;try{s.appendChild(document.createTextNode(""));isBuggy=!s.firstChild||s.firstChild&&s.firstChild.nodeType!==3}catch(e){isBuggy=true};s=null;return isBuggy})()
function update(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName==='SCRIPT'&&SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING){element.text=content;return element};if(SELECT_ELEMENT_INNERHTML_BUGGY||TABLE_ELEMENT_INNERHTML_BUGGY){if(tagName in Element._insertionTranslations.tags){while(element.firstChild)element.removeChild(element.firstChild);Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)})}else element.innerHTML=content.stripScripts()}else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element};return update})(),replace:function(element,content){element=$(element);if(content&&content.toElement){content=content.toElement()}else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts())};element.parentNode.replaceChild(content,element);return element},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue};content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer()};return element},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper)){$(wrapper).writeAttribute(attributes||{})}else if(Object.isString(wrapper)){wrapper=new Element(wrapper,attributes)}else wrapper=new Element('div',wrapper);if(element.parentNode)element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({id:'id',className:'class'}).each(function(pair){var property=pair.first(),attribute=pair.last(),value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true)});return result+'>'},recursivelyCollect:function(element,property){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(element,'parentNode')},descendants:function(element){return Element.select(element,"*")},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element)},immediateDescendants:function(element){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(element,'previousSibling')},nextSiblings:function(element){return Element.recursivelyCollect(element,'nextSibling')},siblings:function(element){element=$(element);return Element.previousSiblings(element).reverse().concat(Element.nextSiblings(element))},match:function(element,selector){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(element);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(element);return Object.isNumber(expression)?Element.descendants(element)[expression]:Element.select(element,expression)[index||0]},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=Element.previousSiblings(element);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(element);return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index)},select:function(element){var args=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(element,args)},adjacent:function(element){var args=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(element.parentNode,args).without(element)},identify:function(element){element=$(element);var id=Element.readAttribute(element,'id');if(id)return id;do{id='anonymous_element_'+ Element.idCounter++}while($(id));Element.writeAttribute(element,'id',id);return id},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':'))return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value};return element.getAttribute(name)},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object'){attributes=name}else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null){element.removeAttribute(name)}else if(value===true){element.setAttribute(name,name)}else element.setAttribute(name,value)};return element},getHeight:function(element){return Element.getDimensions(element).height},getWidth:function(element){return Element.getDimensions(element).width},classNames:function(element){return new Element.ClassNames(element)},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)))},addClassName:function(element,className){if(!(element=$(element)))return;if(!Element.hasClassName(element,className))element.className+=(element.className?' ':'')+className;return element},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element},toggleClassName:function(element,className){if(!(element=$(element)))return;return Element[Element.hasClassName(element,className)?'removeClassName':'addClassName'](element,className)},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))element.removeChild(node);node=nextNode};return element},empty:function(element){return $(element).innerHTML.blank()},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)if(element==ancestor)return true;return false},scrollTo:function(element){element=$(element);var pos=Element.cumulativeOffset(element);window.scrollTo(pos[0],pos[1]);return element},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null};if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value},getOpacity:function(element){return $(element).getStyle('opacity')},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element};for(var property in styles)if(property=='opacity'){element.setOpacity(styles[property])}else elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element},getDimensions:function(element){element=$(element);var display=Element.getStyle(element,'display');if(display!='none'&&display!=null)return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style,originalVisibility=els.visibility,originalPosition=els.position,originalDisplay=els.display;els.visibility='hidden';if(originalPosition!='fixed')els.position='absolute';els.display='block';var originalWidth=element.clientWidth,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(Prototype.Browser.Opera){element.style.top=0;element.style.left=0}};return element},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right=''};return element},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')element.style.overflow='hidden';return element},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element},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.toUpperCase()=='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(element,'position')=='absolute')return element;var offsets=Element.positionedOffset(element),top=offsets[1],left=offsets[0],width=element.clientWidth,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(element,'position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0),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,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&&(element.tagName.toUpperCase()=='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=Element.viewportOffset(source);element=$(element);var delta=[0,0],parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=Element.getOffsetParent(element);delta=Element.viewportOffset(parent)};if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop};if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'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);try{element.offsetParent}catch(e){return $(document.body)};var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);try{element.offsetParent}catch(e){return Element._returnOffset(0,0)};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.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent}catch(e){return Element._returnOffset(0,0)};return proceed(element)});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))if(value[1])return parseFloat(value[1])/100;return 1.0};if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))return element['offset'+style.capitalize()]+'px';return null};return value};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'')};element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element};Element._attributeTranslations=(function(){var classProp='className',forProp='for',el=document.createElement('div');el.setAttribute(classProp,'x');if(el.className!=='x'){el.setAttribute('class','x');if(el.className==='x')classProp='class'};el=null;el=document.createElement('label');el.setAttribute(forProp,'x');if(el.htmlFor!=='x'){el.setAttribute('htmlFor','x');if(el.htmlFor==='x')forProp='htmlFor'};el=null;return{read:{names:{'class':classProp,className:classProp,'for':forProp,htmlFor:forProp},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute)},_getAttr2:function(element,attribute){return element.getAttribute(attribute,2)},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:""},_getEv:(function(){var el=document.createElement('div');el.onclick=Prototype.emptyFunction;var value=el.getAttribute('onclick'),f;if(String(value).indexOf('{')>-1){f=function(element,attribute){attribute=element.getAttribute(attribute);if(!attribute)return null;attribute=attribute.toString();attribute=attribute.split('{')[1];attribute=attribute.split('}')[0];return attribute.strip()}}else if(value==='')f=function(element,attribute){attribute=element.getAttribute(attribute);if(!attribute)return null;return attribute.strip()};el=null;return f})(),_flag:function(element,attribute){return $(element).hasAttribute(attribute)?attribute:null},style:function(element){return element.style.cssText.toLowerCase()},title:function(element){return element.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value},style:function(element,value){element.style.cssText=value?value:''}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr});(function(v){Object.extend(v,{href:v._getAttr2,src:v._getAttr2,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v._getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions)(function(){function _descendants(element){var nodes=element.getElementsByTagName('*'),results=[];for(var i=0,node;node=nodes[i];i++)if(node.tagName!=="!")results.push(node);return results};Element.Methods.down=function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?_descendants(element)[expression]:Element.select(element,expression)[index||0]}})()}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element}}else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n)}catch(e){};return element};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('outerHTML' in document.documentElement)Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element};content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next(),fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling){fragments.each(function(node){parent.insertBefore(node,nextSibling)})}else fragments.each(function(node){parent.appendChild(node)})}else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element};Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result};Element._getContentFromAnonymousElement=function(tagName,html){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(){var tags=Element._insertionTranslations.tags;Object.extend(tags,{THEAD:tags.TBODY,TFOOT:tags.TBODY,TH:tags.TD})})();Element.Methods.Simulated={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return !!(node&&node.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(div){if(!Prototype.BrowserFeatures.ElementExtensions&&div.__proto__){window.HTMLElement={};window.HTMLElement.prototype=div.__proto__;Prototype.BrowserFeatures.ElementExtensions=true};div=null})(document.createElement('div'));Element.extend=(function(){function checkDeficiency(tagName){if(typeof window.Element!='undefined'){var proto=window.Element.prototype;if(proto){var id='_'+(Math.random()+'').slice(2),el=document.createElement(tagName);proto[id]='x';var isBuggy=(el[id]!=='x');delete proto[id];el=null;return isBuggy}};return false}
function extendElementWith(element,methods){for(var property in methods){var value=methods[property];if(Object.isFunction(value)&&!(property in element))element[property]=value.methodize()}};var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY=checkDeficiency('object');if(Prototype.BrowserFeatures.SpecificElementExtensions){if(HTMLOBJECTELEMENT_PROTOTYPE_BUGGY)return function(element){if(element&&typeof element._extendedByPrototype=='undefined'){var t=element.tagName;if(t&&(/^(?:object|applet|embed)$/i.test(t))){extendElementWith(element,Element.Methods);extendElementWith(element,Element.Methods.Simulated);extendElementWith(element,Element.Methods.ByTag[t.toUpperCase()])}};return element};return Prototype.K};var Methods={},ByTag=Element.Methods.ByTag,extend=Object.extend(function(element){if(!element||typeof element._extendedByPrototype!='undefined'||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase();if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);extendElementWith(element,methods);element._extendedByPrototype=Prototype.emptyFunction;return element},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated)}}});extend.refresh();return extend})();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,trans={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];var element=document.createElement(tagName),proto=element.__proto__||element.constructor.prototype;element=null;return proto};var elementPrototype=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(F.ElementExtensions){copy(Element.Methods,elementPrototype);copy(Element.Methods.Simulated,elementPrototype,true)};if(F.SpecificElementExtensions)for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype)};Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(viewport){var B=Prototype.Browser,doc=document,element,property={}
function getRootElement(){if(B.WebKit&&!doc.evaluate)return document;if(B.Opera&&window.parseFloat(window.opera.version())<9.5)return document.body;return document.documentElement}
function define(D){if(!element)element=getRootElement();property[D]='client'+D;viewport['get'+D]=function(){return element[property[D]]};return viewport['get'+D]()};viewport.getWidth=define.curry('Width');viewport.getHeight=define.curry('Height')})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(element){if(!(element=$(element)))return;var uid;if(element===window){uid=0}else{if(typeof element._prototypeUID==="undefined")element._prototypeUID=[Element.Storage.UID++];uid=element._prototypeUID[0]};if(!Element.Storage[uid])Element.Storage[uid]=$H();return Element.Storage[uid]},store:function(element,key,value){if(!(element=$(element)))return;if(arguments.length===2){Element.getStorage(element).update(key)}else Element.getStorage(element).set(key,value);return element},retrieve:function(element,key,defaultValue){if(!(element=$(element)))return;var hash=Element.getStorage(element),value=hash.get(key);if(Object.isUndefined(value)){hash.set(key,defaultValue);value=defaultValue};return value},clone:function(element,deep){if(!(element=$(element)))return;var clone=element.cloneNode(deep);clone._prototypeUID=void(0);if(deep){var descendants=Element.select(clone,'*'),i=descendants.length;while(i--)descendants[i]._prototypeUID=void(0)};return Element.extend(clone)}});var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI'}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}},shouldUseXPath:(function(){var IS_DESCENDANT_SELECTOR_BUGGY=(function(){var isBuggy=false;if(document.evaluate&&window.XPathResult){var el=document.createElement('div');el.innerHTML='<ul><li></li></ul><div><ul><li></li></ul></div>';var xpath=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']",result=document.evaluate(xpath,el,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);isBuggy=(result.snapshotLength!==2);el=null};return isBuggy})();return 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(e))return false;if(IS_DESCENDANT_SELECTOR_BUGGY)return false;return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(Selector.CASE_INSENSITIVE_CLASS_NAMES)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression)}catch(e){return false};return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;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=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).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,len=ps.length,name;if(Selector._cache[e]){this.xpath=Selector._cache[e];return};this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){name=ps[i].name;if(m=e.match(ps[i].re)){this.matcher.push(Object.isFunction(x[name])?x[name](m):new Template(x[name]).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;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();id=id.replace(/([\.:])/g,"\\$1");e="#"+id+" "+e};results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return results;case'xpath':return document._getElementsByXPath(this.xpath,root);default:return this.matcher(root)}},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions,le,p,m,len=ps.length,name;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p))if(as[name]){this.tokens.push([name,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()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==='BackCompat')Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var div=document.createElement('div'),span=document.createElement('span');div.id="prototype_test_id";span.className='Test';div.appendChild(span);var isIgnored=(div.querySelector('#prototype_test_id .test')!==null);div=span=null;return isIgnored})();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)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v,len=p.length,name,exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){name=p[i].name;if(m=e.match(p[i].re)){v=Object.isFunction(x[name])?x[name](m):new Template(x[name]).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,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:[{name:'laterSibling',re:/^\s*~\s*/},{name:'child',re:/^\s*>\s*/},{name:'adjacent',re:/^\s*\+\s*/},{name:'descendant',re:/^\s/},{name:'tagName',re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:'id',re:/^#([\w\-\*]+)(\b|$)/},{name:'className',re:/^\.([\w\-\*]+)(\b|$)/},{name:'pseudo',re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:'attrPresence',re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:'attr',re:/\[((?:[\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(){var PROPERTIES_ATTRIBUTES_MAP=(function(){var el=document.createElement('div'),isBuggy=false,propName='_countedByPrototype',value='x';el[propName]=value;isBuggy=(el.getAttribute(propName)===value);el=null;return isBuggy})();return PROPERTIES_ATTRIBUTES_MAP?function(nodes){for(var i=0,node;node=nodes[i];i++)node.removeAttribute('_countedByPrototype');return nodes}:function(nodes){for(var i=0,node;node=nodes[i];i++)node._countedByPrototype=void(0);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(typeof (n=nodes[i])._countedByPrototype=='undefined'){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(),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(root==document){if(!targetNode)return[];if(!nodes)return[targetNode]}else if(!root.sourceIndex||root.sourceIndex<1){var nodes=root.getElementsByTagName('*');for(var j=0,node;node=nodes[j];j++)if(node.id===id)return[node]};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,b=m[2]?Number(m[2]):0,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)continue;results.push(node)};return results},not:function(nodes,selector,root){var h=Selector.handlers,selectorType,m,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&&(!node.type||node.type!=='hidden'))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==v||nv&&nv.startsWith(v)},'$=':function(nv,v){return nv==v||nv&&nv.endsWith(v)},'*=':function(nv,v){return nv==v||nv&&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}})
function $$(){return Selector.findChildElements(document,$A(arguments))};var Form={reset:function(form){form=$(form);form.reset();return form},serializeElements:function(elements,options){if(typeof options!='object'){options={hash:!!options}}else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit,data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true))))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){var elements=$(form).getElementsByTagName('*'),element,arr=[],serializers=Form.Element.Serializers;for(var i=0;element=elements[i];i++)arr.push(element);return arr.inject([],function(elements,child){if(serializers[child.tagName.toLowerCase()])elements.push(Element.extend(child));return elements})},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))continue;matchingInputs.push(Element.extend(input))};return matchingInputs},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled}),firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return/^(?:input|select|textarea)$/i.test(element.tagName)})},focusFirstElement:function(form){form=$(form);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)$/i.test(element.type))))element.select()}catch(e){};return element},disable:function(element){element=$(element);element.disabled=true;return element},enable:function(element){element=$(element);element.disabled=false;return element}};var Field=Form.Element,$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,value){if(Object.isUndefined(value)){return this[element.type=='select-one'?'selectOne':'selectMany'](element)}else{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return}}else opt.selected=value.include(currentValue)}}},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)}});(function(){var Event={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}},docEl=document.documentElement,MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED='onmouseenter' in docEl&&'onmouseleave' in docEl,_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)}
function isLeftClick(event){return _isButton(event,0)}
function isMiddleClick(event){return _isButton(event,1)}
function isRightClick(event){return _isButton(event,2)}
function element(event){event=Event.extend(event);var node=event.target,type=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName)if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='input'&&currentTarget.type==='radio'))node=currentTarget;if(node.nodeType==Node.TEXT_NODE)node=node.parentNode;return Element.extend(node)}
function findElement(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0)}
function pointer(event){return{x:pointerX(event),y:pointerY(event)}}
function pointerX(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0};return event.pageX||(event.clientX+(docElement.scrollLeft||body.scrollLeft)-(docElement.clientLeft||0))}
function pointerY(event){var docElement=document.documentElement,body=document.body||{scrollTop:0};return event.pageY||(event.clientY+(docElement.scrollTop||body.scrollTop)-(docElement.clientTop||0))}
function stop(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true};Event.Methods={isLeftClick:isLeftClick,isMiddleClick:isMiddleClick,isRightClick:isRightClick,element:element,findElement:findElement,pointer:pointer,pointerX:pointerX,pointerY:pointerY,stop:stop};var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m});if(Prototype.Browser.IE){function _relatedTarget(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)};Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return'[object Event]'}});Event.extend=function(event,element){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement||element,relatedTarget:_relatedTarget(event),pageX:pointer.x,pageY:pointer.y});return Object.extend(event,methods)}}else{Event.prototype=window.Event.prototype||document.createEvent('HTMLEvents').__proto__;Object.extend(Event.prototype,methods);Event.extend=Prototype.K}
function _createResponder(element,eventName,handler){var registry=Element.retrieve(element,'prototype_event_registry');if(Object.isUndefined(registry)){CACHE.push(element);registry=Element.retrieve(element,'prototype_event_registry',$H())};var respondersForEvent=registry.get(eventName);if(Object.isUndefined(respondersForEvent)){respondersForEvent=[];registry.set(eventName,respondersForEvent)};if(respondersForEvent.pluck('handler').include(handler))return false;var responder;if(eventName.include(":")){responder=function(event){if(Object.isUndefined(event.eventName))return false;if(event.eventName!==eventName)return false;Event.extend(event,element);handler.call(element,event)}}else if(!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED&&(eventName==="mouseenter"||eventName==="mouseleave")){if(eventName==="mouseenter"||eventName==="mouseleave")responder=function(event){Event.extend(event,element);var parent=event.relatedTarget;while(parent&&parent!==element)try{parent=parent.parentNode}catch(e){parent=element};if(parent===element)return;handler.call(element,event)}}else responder=function(event){Event.extend(event,element);handler.call(element,event)};responder.handler=handler;respondersForEvent.push(responder);return responder}
function _destroyCache(){for(var i=0,length=CACHE.length;i<length;i++){Event.stopObserving(CACHE[i]);CACHE[i]=null}};var CACHE=[];if(Prototype.Browser.IE)window.attachEvent('onunload',_destroyCache);if(Prototype.Browser.WebKit)window.addEventListener('unload',Prototype.emptyFunction,false);var _getDOMEventName=Prototype.K;if(!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED)_getDOMEventName=function(eventName){var translations={mouseenter:"mouseover",mouseleave:"mouseout"};return eventName in translations?translations[eventName]:eventName}
function observe(element,eventName,handler){element=$(element);var responder=_createResponder(element,eventName,handler);if(!responder)return element;if(eventName.include(':')){if(element.addEventListener){element.addEventListener("dataavailable",responder,false)}else{element.attachEvent("ondataavailable",responder);element.attachEvent("onfilterchange",responder)}}else{var actualEventName=_getDOMEventName(eventName);if(element.addEventListener){element.addEventListener(actualEventName,responder,false)}else element.attachEvent("on"+actualEventName,responder)};return element}
function stopObserving(element,eventName,handler){element=$(element);var registry=Element.retrieve(element,'prototype_event_registry');if(Object.isUndefined(registry))return element;if(eventName&&!handler){var responders=registry.get(eventName);if(Object.isUndefined(responders))return element;responders.each(function(r){Element.stopObserving(element,eventName,r.handler)});return element}else if(!eventName){registry.each(function(pair){var eventName=pair.key,responders=pair.value;responders.each(function(r){Element.stopObserving(element,eventName,r.handler)})});return element};var responders=registry.get(eventName);if(!responders)return;var responder=responders.find(function(r){return r.handler===handler});if(!responder)return element;var actualEventName=_getDOMEventName(eventName);if(eventName.include(':')){if(element.removeEventListener){element.removeEventListener("dataavailable",responder,false)}else{element.detachEvent("ondataavailable",responder);element.detachEvent("onfilterchange",responder)}}else if(element.removeEventListener){element.removeEventListener(actualEventName,responder,false)}else element.detachEvent('on'+actualEventName,responder);registry.set(eventName,responders.without(responder));return element}
function fire(element,eventName,memo,bubble){element=$(element);if(Object.isUndefined(bubble))bubble=true;if(element==document&&document.createEvent&&!element.dispatchEvent)element=document.documentElement;var event;if(document.createEvent){event=document.createEvent('HTMLEvents');event.initEvent('dataavailable',true,true)}else{event=document.createEventObject();event.eventType=bubble?'ondataavailable':'onfilterchange'};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);Object.extend(Event,{fire:fire,observe:observe,stopObserving:stopObserving});Element.addMethods({fire:fire,observe:observe,stopObserving:stopObserving});Object.extend(document,{fire:fire.methodize(),observe:observe.methodize(),stopObserving:stopObserving.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,Event)}else window.Event=Event})();(function(){var timer
function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearTimeout(timer);document.loaded=true;document.fire('dom:loaded')}
function checkReadyState(){if(document.readyState==='complete'){document.stopObserving('readystatechange',checkReadyState);fireContentLoadedEvent()}}
function pollDoScroll(){try{document.documentElement.doScroll('left')}catch(e){timer=pollDoScroll.defer();return};fireContentLoadedEvent()};if(document.addEventListener){document.addEventListener('DOMContentLoaded',fireContentLoadedEvent,false)}else{document.observe('readystatechange',checkReadyState);if(window==top)timer=pollDoScroll.defer()};Event.observe(window,'load',fireContentLoadedEvent)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content})},Top:function(element,content){return Element.insert(element,{top:content})},Bottom:function(element,content){return Element.insert(element,{bottom:content})},After:function(element,content){return Element.insert(element,{after:content})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(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);var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!='undefined');Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var id,optionIndex=0;if(arguments.length>0)if(typeof arguments[0]=="string"){id=arguments[0];optionIndex=1}else id=arguments[0]?arguments[0].id:null;if(!id)id="window_"+new Date().getTime();if($(id))alert("Window "+id+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor");this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[optionIndex]||{});if(this.options.blurClassName)this.options.focusClassName=this.options.className;if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined")this.options.top=this._round(Math.random()*500,this.options.gridY);if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined")this.options.left=this._round(Math.random()*500,this.options.gridX);if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear)this.options.showEffectOptions.to=this.options.opacity};if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear)this.options.showEffectOptions.to=this.options.opacity;if(this.options.hideEffect==Effect.Fade)this.options.hideEffectOptions.from=this.options.opacity};if(this.options.hideEffect==Element.hide)this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose)this.destroy()}.bind(this);if(this.options.parent!=document.body)this.options.parent=$(this.options.parent);this.element=this._createWindow(id);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var that=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(element){element.observe("mousedown",that.eventMouseDown);element.addClassName("top_draggable")});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(element){element.observe("mousedown",that.eventMouseDown);element.addClassName("bottom_draggable")})};if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown)};this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+'px'});this.useLeft=true}else{this.element.setStyle({right:parseFloat(this.options.right)+'px'});this.useLeft=false};if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+'px'});this.useTop=true}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+'px'});this.useTop=false};this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex)this.setZIndex(this.options.zIndex);if(this.options.destroyOnClose)this.setDestroyOnClose(true);this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height)this.setSize(this.options.width,this.options.height);this.setTitle(this.options.title);Windows.register(this)},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var content=this.getContent(),originalContent=null;for(var i=0;i<content.childNodes.length;i++){originalContent=content.childNodes[i];if(originalContent.nodeType==1)break;originalContent=null};if(originalContent)this._oldParent.appendChild(originalContent);this._oldParent=null};if(this.sizer)Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown);if(this.options.url)this.content.src=null;if(this.iefix)Element.remove(this.iefix);Element.remove(this.element);Windows.unregister(this)},setCloseCallback:function(callback){this.options.closeCallback=callback},getContent:function(){return this.content},setContent:function(id,autoresize,autoposition){var element=$(id);if(null==element)throw "Unable to find element '"+id+"' in DOM";this._oldParent=element.parentNode;var d=null,p=null;if(autoresize)d=Element.getDimensions(element);if(autoposition)p=Position.cumulativeOffset(element);var content=this.getContent();this.setHTMLContent("");content=this.getContent();content.appendChild(element);element.show();if(autoresize)this.setSize(d.width,d.height);if(autoposition)this.setLocation(p[1]-this.heightN,p[0]-this.widthW)},setHTMLContent:function(html){if(this.options.url){this.content.src=null;this.options.url=null;var content="<div id=\""+this.getId()+"_content\" class=\""+this.options.className+"_content\"> </div>";$(this.getId()+"_table_content").innerHTML=content;this.content=$(this.element.id+"_content")};this.getContent().innerHTML=html},setAjaxContent:function(url,options,showCentered,showModal){this.showFunction=showCentered?"showCenter":"show";this.showModal=showModal||false;options=options||{};this.setHTMLContent("");this.onComplete=options.onComplete;if(!this._onCompleteHandler)this._onCompleteHandler=this._setAjaxContent.bind(this);options.onComplete=this._onCompleteHandler;new Ajax.Request(url,options);options.onComplete=this.onComplete},_setAjaxContent:function(originalRequest){Element.update(this.getContent(),originalRequest.responseText);if(this.onComplete)this.onComplete(originalRequest);this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(url){if(this.options.url)this.content.src=null;this.options.url=url;var content="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+url+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=content;this.content=$(this.element.id+"_content")},getURL:function(){return this.options.url?this.options.url:null},refresh:function(){if(this.options.url)$(this.element.getAttribute('id')+'_content').src=this.options.url},setCookie:function(name,expires,path,domain,secure){name=name||this.element.id;this.cookie=[name,expires,path,domain,secure];var value=WindowUtilities.getCookie(name);if(value){var values=value.split(','),x=values[0].split(':'),y=values[1].split(':'),w=parseFloat(values[2]),h=parseFloat(values[3]),mini=values[4],maxi=values[5];this.setSize(w,h);if(mini=="true"){this.doMinimize=true}else if(maxi=="true")this.doMaximize=true;this.useLeft=x[0]=="l";this.useTop=y[0]=="t";this.element.setStyle(this.useLeft?{left:x[1]}:{right:x[1]});this.element.setStyle(this.useTop?{top:y[1]}:{bottom:y[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){this.options.destroyOnClose=true},setConstraint:function(bool,padding){this.constraint=bool;this.constraintPad=Object.extend(this.constraintPad,padding||{});if(this.useTop&&this.useLeft)this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))},_initDrag:function(event){if(Event.element(event)==this.sizer&&this.isMinimized())return;if(Event.element(event)!=this.sizer&&this.isMaximized())return;if(Prototype.Browser.IE&&this.heightN==0)this._getWindowBorderSize();this.pointer=[this._round(Event.pointerX(event),this.options.gridX),this._round(Event.pointerY(event),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement()}else this.currentDrag=this.element;if(Event.element(event)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle('bottom'));this.rightOrg=parseFloat(this.element.getStyle('right'));this._notify("onStartResize")}else{this.doResize=false;var closeButton=$(this.getId()+'_close');if(closeButton&&Position.within(closeButton,this.pointer[0],this.pointer[1])){this.currentDrag=null;return};this.toFront();if(!this.options.draggable)return;this._notify("onStartMove")};Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen('__invisible__','__invisible__',this.overlayOpacity);document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(event)},_round:function(val,round){return round==1?val:val=Math.floor(val/round)*round},_updateDrag:function(event){var pointer=[this._round(Event.pointerX(event),this.options.gridX),this._round(Event.pointerY(event),this.options.gridY)],dx=pointer[0]-this.pointer[0],dy=pointer[1]-this.pointer[1];if(this.doResize){var w=this.widthOrg+dx,h=this.heightOrg+dy;dx=this.width-this.widthOrg;dy=this.height-this.heightOrg;if(this.useLeft){w=this._updateWidthConstraint(w)}else this.currentDrag.setStyle({right:(this.rightOrg-dx)+'px'});if(this.useTop){h=this._updateHeightConstraint(h)}else this.currentDrag.setStyle({bottom:(this.bottomOrg-dy)+'px'});this.setSize(w,h);this._notify("onResize")}else{this.pointer=pointer;if(this.useLeft){var left=parseFloat(this.currentDrag.getStyle('left'))+dx,newLeft=this._updateLeftConstraint(left);this.pointer[0]+=newLeft-left;this.currentDrag.setStyle({left:newLeft+'px'})}else this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle('right'))-dx+'px'});if(this.useTop){var top=parseFloat(this.currentDrag.getStyle('top'))+dy,newTop=this._updateTopConstraint(top);this.pointer[1]+=newTop-top;this.currentDrag.setStyle({top:newTop+'px'})}else this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle('bottom'))-dy+'px'});this._notify("onMove")};if(this.iefix)this._fixIEOverlapping();this._removeStoreLocation();Event.stop(event)},_endDrag:function(event){WindowUtilities.enableScreen('__invisible__');if(this.doResize){this._notify("onEndResize")}else this._notify("onEndMove");Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(event);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null},_updateLeftConstraint:function(left){if(this.constraint&&this.useLeft&&this.useTop){var width=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(left<this.constraintPad.left)left=this.constraintPad.left;if(left+this.width+this.widthE+this.widthW>width-this.constraintPad.right)left=width-this.constraintPad.right-this.width-this.widthE-this.widthW};return left},_updateTopConstraint:function(top){if(this.constraint&&this.useLeft&&this.useTop){var height=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height,h=this.height+this.heightN+this.heightS;if(top<this.constraintPad.top)top=this.constraintPad.top;if(top+h>height-this.constraintPad.bottom)top=height-this.constraintPad.bottom-h};return top},_updateWidthConstraint:function(w){if(this.constraint&&this.useLeft&&this.useTop){var width=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width,left=parseFloat(this.element.getStyle("left"));if(left+w+this.widthE+this.widthW>width-this.constraintPad.right)w=width-this.constraintPad.right-left-this.widthE-this.widthW};return w},_updateHeightConstraint:function(h){if(this.constraint&&this.useLeft&&this.useTop){var height=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height,top=parseFloat(this.element.getStyle("top"));if(top+h+this.heightN+this.heightS>height-this.constraintPad.bottom)h=height-this.constraintPad.bottom-top-this.heightN-this.heightS};return h},_createWindow:function(id){var className=this.options.className,win=document.createElement("div");win.setAttribute('id',id);win.className="dialog";var content;if(this.options.url){content="<iframe frameborder=\"0\" name=\""+id+"_content\"  id=\""+id+"_content\" src=\""+this.options.url+"\"> </iframe>"}else content="<div id=\""+id+"_content\" class=\""+className+"_content\"> </div>";var closeDiv=this.options.closable?"<div class='"+className+"_close' id='"+id+"_close' onclick='Windows.close(\""+id+"\", event)'> </div>":"",minDiv=this.options.minimizable?"<div class='"+className+"_minimize' id='"+id+"_minimize' onclick='Windows.minimize(\""+id+"\", event)'> </div>":"",maxDiv=this.options.maximizable?"<div class='"+className+"_maximize' id='"+id+"_maximize' onclick='Windows.maximize(\""+id+"\", event)'> </div>":"",seAttributes=this.options.resizable?"class='"+className+"_sizer' id='"+id+"_sizer'":"class='"+className+"_se'",blank="../themes/default/blank.gif";win.innerHTML=closeDiv+minDiv+maxDiv+"\
      <table id='"+id+"_row1' class=\"top table_window\">\
        <tr>\
          <td class='"+className+"_nw'></td>\
          <td class='"+className+"_n'><div id='"+id+"_top' class='"+className+"_title title_window'>"+this.options.title+"</div></td>\
          <td class='"+className+"_ne'></td>\
        </tr>\
      </table>\
      <table id='"+id+"_row2' class=\"mid table_window\">\
        <tr>\
          <td class='"+className+"_w'></td>\
            <td id='"+id+"_table_content' class='"+className+"_content' valign='top'>"+content+"</td>\
          <td class='"+className+"_e'></td>\
        </tr>\
      </table>\
        <table id='"+id+"_row3' class=\"bot table_window\">\
        <tr>\
          <td class='"+className+"_sw'></td>\
            <td class='"+className+"_s'><div id='"+id+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>\
            <td "+seAttributes+"></td>\
        </tr>\
      </table>\
    ";Element.hide(win);this.options.parent.insertBefore(win,this.options.parent.firstChild);Event.observe($(id+"_content"),"load",this.options.onload);return win},changeClassName:function(newClassName){var className=this.options.className,id=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(value){this._toggleClassName($(id+value),className+value,newClassName+value)}.bind(this));this._toggleClassName($(id+"_top"),className+"_title",newClassName+"_title");$$("#"+id+" td").each(function(td){td.className=td.className.sub(className,newClassName)});this.options.className=newClassName},_toggleClassName:function(element,oldClassName,newClassName){if(element){element.removeClassName(oldClassName);element.addClassName(newClassName)}},setLocation:function(top,left){top=this._updateTopConstraint(top);left=this._updateLeftConstraint(left);var e=this.currentDrag||this.element;e.setStyle({top:top+'px'});e.setStyle({left:left+'px'});this.useLeft=true;this.useTop=true},getLocation:function(){var location={};if(this.useTop){location=Object.extend(location,{top:this.element.getStyle("top")})}else location=Object.extend(location,{bottom:this.element.getStyle("bottom")});if(this.useLeft){location=Object.extend(location,{left:this.element.getStyle("left")})}else location=Object.extend(location,{right:this.element.getStyle("right")});return location},getSize:function(){return{width:this.width,height:this.height}},setSize:function(width,height,useEffect){width=parseFloat(width);height=parseFloat(height);if(!this.minimized&&width<this.options.minWidth)width=this.options.minWidth;if(!this.minimized&&height<this.options.minHeight)height=this.options.minHeight;if(this.options.maxHeight&&height>this.options.maxHeight)height=this.options.maxHeight;if(this.options.maxWidth&&width>this.options.maxWidth)width=this.options.maxWidth;if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&useEffect){new Effect.ResizeWindow(this,null,null,width,height,{duration:Window.resizeEffectDuration})}else{this.width=width;this.height=height;var e=this.currentDrag?this.currentDrag:this.element;e.setStyle({width:width+this.widthW+this.widthE+"px"});e.setStyle({height:height+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var content=$(this.element.id+'_content');content.setStyle({height:height+'px'});content.setStyle({width:width+'px'})}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true)},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex)this.setZIndex(Windows.maxZIndex+1);if(this.iefix)this._fixIEOverlapping()},getBounds:function(insideOnly){if(!this.width||!this.height||!this.visible)this.computeBounds();var w=this.width,h=this.height;if(!insideOnly){w+=this.widthW+this.widthE;h+=this.heightN+this.heightS};var bounds=Object.extend(this.getLocation(),{width:w+"px",height:h+"px"});return bounds},computeBounds:function(){if(!this.width||!this.height){var size=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=size+5}else this.height=size+5};this.setSize(this.width,this.height);if(this.centered)this._center(this.centerTop,this.centerLeft)},show:function(modal){this.visible=true;if(modal){if(typeof this.overlayOpacity=="undefined"){var that=this;setTimeout(function(){that.show(modal)},10);return};Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this)}else if(!this.element.style.zIndex)this.setZIndex(Windows.maxZIndex+1);if(this.oldStyle)this.getContent().setStyle({overflow:this.oldStyle});this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions){this.options.showEffect(this.element,this.options.showEffectOptions)}else this.options.showEffect(this.element);this._checkIEOverlapping();WindowUtilities.focusedWindow=this;this._notify("onShow")},showCenter:function(modal,top,left){this.centered=true;this.centerTop=top;this.centerLeft=left;this.show(modal)},isVisible:function(){return this.visible},_center:function(top,left){var windowScroll=WindowUtilities.getWindowScroll(this.options.parent),pageSize=WindowUtilities.getPageSize(this.options.parent);if(typeof top=="undefined")top=(pageSize.windowHeight-(this.height+this.heightN+this.heightS))/2;top+=windowScroll.top;if(typeof left=="undefined")left=(pageSize.windowWidth-(this.width+this.widthW+this.widthE))/2;left+=windowScroll.left;this.setLocation(top,left);this.toFront()},_recenter:function(event){if(this.centered){var pageSize=WindowUtilities.getPageSize(this.options.parent),windowScroll=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==pageSize.windowWidth&&this.pageSize.windowHeight==pageSize.windowHeight&&this.windowScroll.left==windowScroll.left&&this.windowScroll.top==windowScroll.top)return;this.pageSize=pageSize;this.windowScroll=windowScroll;if($('overlay_modal'))$('overlay_modal').setStyle({height:(pageSize.pageHeight+'px')});if(this.options.recenterAuto)this._center(this.centerTop,this.centerLeft)}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow()};this.oldStyle=this.getContent().getStyle('overflow')||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix)this.iefix.hide();if(!this.doNotNotifyHide)this._notify("onHide")},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this))return;if(this.options.destroyOnClose){var destroyFunc=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var func=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){func();destroyFunc()}}else this.options.hideEffectOptions.afterFinish=function(){destroyFunc()}};Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose")}},minimize:function(){if(this.resizing)return;var r2=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var dh=r2.getDimensions().height;this.r2Height=dh;var h=this.element.getHeight()-dh;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-dh,{duration:Window.resizeEffectDuration})}else{this.height-=dh;this.element.setStyle({height:h+"px"});r2.hide()};if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom+dh)+'px'})}}else{this.minimized=false;var dh=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+dh,{duration:Window.resizeEffectDuration})}else{var h=this.element.getHeight()+dh;this.height+=dh;this.element.setStyle({height:h+"px"});r2.show()};if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom-dh)+'px'})};this.toFront()};this._notify("onMinimize");this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing)return;if(Prototype.Browser.IE&&this.heightN==0)this._getWindowBorderSize();if(this.storedLocation!=null){this._restoreLocation();if(this.iefix)this.iefix.hide()}else{this._storeLocation();Windows.unsetOverflow(this);var windowScroll=WindowUtilities.getWindowScroll(this.options.parent),pageSize=WindowUtilities.getPageSize(this.options.parent),left=windowScroll.left,top=windowScroll.top;if(this.options.parent!=document.body){windowScroll={top:0,left:0,bottom:0,right:0};var dim=this.options.parent.getDimensions();pageSize.windowWidth=dim.width;pageSize.windowHeight=dim.height;top=0;left=0};if(this.constraint){pageSize.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);pageSize.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);left+=Math.max(0,this.constraintPad.left);top+=Math.max(0,this.constraintPad.top)};var width=pageSize.windowWidth-this.widthW-this.widthE,height=pageSize.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,top,left,width,height,{duration:Window.resizeEffectDuration})}else{this.setSize(width,height);this.element.setStyle(this.useLeft?{left:left}:{right:left});this.element.setStyle(this.useTop?{top:top}:{bottom:top})};this.toFront();if(this.iefix)this._fixIEOverlapping()};this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized},isMaximized:function(){return(this.storedLocation!=null)},setOpacity:function(opacity){if(Element.setOpacity)Element.setOpacity(this.element,opacity)},setZIndex:function(zindex){this.element.setStyle({zIndex:zindex});Windows.updateZindex(zindex,this)},setTitle:function(newTitle){if(!newTitle||newTitle=="")newTitle="&nbsp;";Element.update(this.element.id+'_top',newTitle)},getTitle:function(){return $(this.element.id+'_top').innerHTML},setStatusBar:function(element){var statusBar=$(this.getId()+"_bottom");if(typeof (element)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(element,this.bottombar.firstChild)}else this.bottombar.appendChild(element)}else this.bottombar.innerHTML=element},_checkIEOverlapping:function(){if(this.iefix)setTimeout(this._fixIEOverlapping.bind(this),50)},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show()},_getWindowBorderSize:function(event){var div=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(div).height;div.parentNode.removeChild(div);var div=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(div).height;div.parentNode.removeChild(div);var div=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(div).width;div.parentNode.removeChild(div);var div=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(div).width;div.parentNode.removeChild(div);var div=document.createElement("div");div.className="overlay_"+this.options.className;document.body.appendChild(div);var that=this;setTimeout(function(){that.overlayOpacity=($(div).getStyle("opacity"));div.parentNode.removeChild(div)},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height};if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420)this.setSize(this.width,this.height);if(this.doMaximize)this.maximize();if(this.doMinimize)this.minimize()},_createHiddenDiv:function(className){var objBody=document.body,win=document.createElement("div");win.setAttribute('id',this.element.id+"_tmp");win.className=className;win.style.display='none';win.innerHTML='';objBody.insertBefore(win,objBody.firstChild);return win},_storeLocation:function(){if(this.storedLocation==null)this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle('top'),bottom:this.element.getStyle('bottom'),left:this.element.getStyle('left'),right:this.element.getStyle('right'),width:this.width,height:this.height}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration})}else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height)};Windows.resetOverflow();this._removeStoreLocation()}},_removeStoreLocation:function(){this.storedLocation=null},_saveCookie:function(){if(this.cookie){var value="";if(this.useLeft){value+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle('left'))}else value+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle('right'));if(this.useTop){value+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle('top'))}else value+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle('bottom'));value+=","+(this.storedLocation?this.storedLocation.width:this.width);value+=","+(this.storedLocation?this.storedLocation.height:this.height);value+=","+this.isMinimized();value+=","+this.isMaximized();WindowUtilities.setCookie(value,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE)this._getWindowBorderSize();var div=document.createElement("div");div.className="wired_frame "+this.options.className+"_wired_frame";div.style.position='absolute';this.options.parent.insertBefore(div,this.options.parent.firstChild);this.wiredElement=$(div)};if(this.useLeft){this.wiredElement.setStyle({left:this.element.getStyle('left')})}else this.wiredElement.setStyle({right:this.element.getStyle('right')});if(this.useTop){this.wiredElement.setStyle({top:this.element.getStyle('top')})}else this.wiredElement.setStyle({bottom:this.element.getStyle('bottom')});var dim=this.element.getDimensions();this.wiredElement.setStyle({width:dim.width+"px",height:dim.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag)return;if(this.currentDrag==this.element){this.currentDrag=null}else{if(this.useLeft){this.element.setStyle({left:this.currentDrag.getStyle('left')})}else this.element.setStyle({right:this.currentDrag.getStyle('right')});if(this.useTop){this.element.setStyle({top:this.currentDrag.getStyle('top')})}else this.element.setStyle({bottom:this.currentDrag.getStyle('bottom')});this.currentDrag.hide();this.currentDrag=null;if(this.doResize)this.setSize(this.width,this.height)}},_notify:function(eventName){if(this.options[eventName]){this.options[eventName](this)}else Windows.notify(eventName,this)}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(observer){this.removeObserver(observer);this.observers.push(observer)},removeObserver:function(observer){this.observers=this.observers.reject(function(o){return o==observer})},notify:function(eventName,win){this.observers.each(function(o){if(o[eventName])o[eventName](eventName,win)})},getWindow:function(id){return this.windows.detect(function(d){return d.getId()==id})},getFocusedWindow:function(){return this.focusedWindow},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null},register:function(win){this.windows.push(win)},addModalWindow:function(win){if(this.modalWindows.length==0){WindowUtilities.disableScreen(win.options.className,'overlay_modal',win.overlayOpacity,win.getId(),win.options.parent)}else{if(Window.keepMultiModalWindow){$('overlay_modal').style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId())}else this.modalWindows.last().element.hide();WindowUtilities._showSelect(win.getId())};this.modalWindows.push(win)},removeModalWindow:function(win){this.modalWindows.pop();if(this.modalWindows.length==0){WindowUtilities.enableScreen()}else if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId())}else this.modalWindows.last().element.show()},register:function(win){this.windows.push(win)},unregister:function(win){this.windows=this.windows.reject(function(d){return d==win})},closeAll:function(){this.windows.each(function(w){Windows.close(w.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(win){if(win)win.close()})},minimize:function(id,event){var win=this.getWindow(id);if(win&&win.visible)win.minimize();Event.stop(event)},maximize:function(id,event){var win=this.getWindow(id);if(win&&win.visible)win.maximize();Event.stop(event)},close:function(id,event){var win=this.getWindow(id);if(win)win.close();if(event)Event.stop(event)},blur:function(id){var win=this.getWindow(id);if(!win)return;if(win.options.blurClassName)win.changeClassName(win.options.blurClassName);if(this.focusedWindow==win)this.focusedWindow=null;win._notify("onBlur")},focus:function(id){var win=this.getWindow(id);if(!win)return;if(this.focusedWindow)this.blur(this.focusedWindow.getId());if(win.options.focusClassName)win.changeClassName(win.options.focusClassName);this.focusedWindow=win;win._notify("onFocus")},unsetOverflow:function(except){this.windows.each(function(d){d.oldOverflow=d.getContent().getStyle("overflow")||"auto";d.getContent().setStyle({overflow:"hidden"})});if(except&&except.oldOverflow)except.getContent().setStyle({overflow:except.oldOverflow})},resetOverflow:function(){this.windows.each(function(d){if(d.oldOverflow)d.getContent().setStyle({overflow:d.oldOverflow})})},updateZindex:function(zindex,win){if(zindex>this.maxZIndex){this.maxZIndex=zindex;if(this.focusedWindow)this.blur(this.focusedWindow.getId())};this.focusedWindow=win;if(this.focusedWindow)this.focus(this.focusedWindow.getId())}},Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.confirm);return};content=content||"";parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok",cancelLabel=parameters.cancelLabel?parameters.cancelLabel:"Cancel";parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'",cancelButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" cancel_button'",content="\
      <div class='"+parameters.className+"_message'>"+content+"</div>\
        <div class='"+parameters.className+"_buttons'>\
          <input type='button' value='"+okLabel+"' onclick='Dialog.okCallback()' "+okButtonClass+"/>\
          <input type='button' value='"+cancelLabel+"' onclick='Dialog.cancelCallback()' "+cancelButtonClass+"/>\
        </div>\
    ";return this._openDialog(content,parameters)},alert:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.alert);return};content=content||"";parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok";parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'",content="\
      <div class='"+parameters.className+"_message'>"+content+"</div>\
        <div class='"+parameters.className+"_buttons'>\
          <input type='button' value='"+okLabel+"' onclick='Dialog.okCallback()' "+okButtonClass+"/>\
        </div>";return this._openDialog(content,parameters)},info:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.info);return};content=content||"";parameters=parameters||{};parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var content="<div id='modal_dialog_message' class='"+parameters.className+"_message'>"+content+"</div>";if(parameters.showProgress)content+="<div id='modal_dialog_progress' class='"+parameters.className+"_progress'>  </div>";parameters.ok=null;parameters.cancel=null;return this._openDialog(content,parameters)},setInfoMessage:function(message){$('modal_dialog_message').update(message)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(content,parameters){var className=parameters.className;if(!parameters.height&&!parameters.width)parameters.width=WindowUtilities.getPageSize(parameters.options.parent||document.body).pageWidth/2;if(parameters.id){this.dialogId=parameters.id}else{var t=new Date();this.dialogId='modal_dialog_'+t.getTime();parameters.id=this.dialogId};if(!parameters.height||!parameters.width){var size=WindowUtilities._computeSize(content,this.dialogId,parameters.width,parameters.height,5,className);if(parameters.height){parameters.width=size+5}else parameters.height=size+5};parameters.effectOptions=parameters.effectOptions;parameters.resizable=parameters.resizable||false;parameters.minimizable=parameters.minimizable||false;parameters.maximizable=parameters.maximizable||false;parameters.draggable=parameters.draggable||false;parameters.closable=parameters.closable||false;var win=new Window(parameters);win.getContent().innerHTML=content;win.showCenter(true,parameters.top,parameters.left);win.setDestroyOnClose();win.cancelCallback=parameters.onCancel||parameters.cancel;win.okCallback=parameters.onOk||parameters.ok;return win},_getAjaxContent:function(originalRequest){Dialog.callFunc(originalRequest.responseText,Dialog.parameters)},_runAjaxRequest:function(message,parameters,callFunc){if(message.options==null)message.options={};Dialog.onCompleteFunc=message.options.onComplete;Dialog.parameters=parameters;Dialog.callFunc=callFunc;message.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(message.url,message.options)},okCallback:function(){var win=Windows.focusedWindow;if(!win.okCallback||win.okCallback(win)){$$("#"+win.getId()+" input").each(function(element){element.onclick=null});win.close()}},cancelCallback:function(){var win=Windows.focusedWindow;$$("#"+win.getId()+" input").each(function(element){element.onclick=null});win.close();if(win.cancelCallback)win.cancelCallback(win)}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1])};var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight}else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft};if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}};return{top:T,left:L,width:W,height:H}},getPageSize:function(parent){parent=parent||document.body;var windowWidth,windowHeight,pageHeight,pageWidth;if(parent!=document.body){windowWidth=parent.getWidth();windowHeight=parent.getHeight();pageWidth=parent.scrollWidth;pageHeight=parent.scrollHeight}else{var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;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};if(self.innerHeight){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=windowWidth}else pageWidth=xScroll};return{pageWidth:pageWidth,pageHeight:pageHeight,windowWidth:windowWidth,windowHeight:windowHeight}},disableScreen:function(className,overlayId,overlayOpacity,contentId,parent){WindowUtilities.initLightbox(overlayId,className,function(){this._disableScreen(className,overlayId,overlayOpacity,contentId)}.bind(this),parent||document.body)},_disableScreen:function(className,overlayId,overlayOpacity,contentId){var objOverlay=$(overlayId),pageSize=WindowUtilities.getPageSize(objOverlay.parentNode);if(contentId&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(contentId)};objOverlay.style.height=(pageSize.pageHeight+'px');objOverlay.style.display='none';if(overlayId=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){objOverlay.overlayOpacity=overlayOpacity;new Effect.Appear(objOverlay,Object.extend({from:0,to:overlayOpacity},Windows.overlayShowEffectOptions))}else objOverlay.style.display="block"},enableScreen:function(id){id=id||'overlay_modal';var objOverlay=$(id);if(objOverlay){if(id=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(objOverlay,Object.extend({from:objOverlay.overlayOpacity,to:0},Windows.overlayHideEffectOptions))}else{objOverlay.style.display='none';objOverlay.parentNode.removeChild(objOverlay)};if(id!="__invisible__")WindowUtilities._showSelect()}},_hideSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+'show').each(function(element){if(!WindowUtilities.isDefined(element.oldVisibility)){element.oldVisibility=element.style.visibility?element.style.visibility:"visible";element.style.visibility="hidden"}})}},_showSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+'show').each(function(element){if(WindowUtilities.isDefined(element.oldVisibility)){try{element.style.visibility=element.oldVisibility}catch(e){element.style.visibility="visible"};element.oldVisibility=null}else if(element.style.visibility)element.style.visibility="visible"})}},isDefined:function(object){return typeof (object)!="undefined"&&object!=null},initLightbox:function(id,className,doneHandler,parent){if($(id)){Element.setStyle(id,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;doneHandler()}else{var objOverlay=document.createElement("div");objOverlay.setAttribute('id',id);objOverlay.className="overlay_"+className;objOverlay.style.display='none';objOverlay.style.position='absolute';objOverlay.style.top='0';objOverlay.style.left='0';objOverlay.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;objOverlay.style.width='100%';parent.insertBefore(objOverlay,parent.firstChild);if(Prototype.Browser.WebKit&&id=="overlay_modal"){setTimeout(function(){doneHandler()},10)}else doneHandler()}},setCookie:function(value,parameters){document.cookie=parameters[0]+"="+escape(value)+((parameters[1])?"; expires="+parameters[1].toGMTString():"")+((parameters[2])?"; path="+parameters[2]:"")+((parameters[3])?"; domain="+parameters[3]:"")+((parameters[4])?"; secure":"")},getCookie:function(name){var dc=document.cookie,prefix=name+"=",begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_computeSize:function(content,id,width,height,margin,className){var objBody=document.body,tmpObj=document.createElement("div");tmpObj.setAttribute('id',id);tmpObj.className=className+"_content";if(height){tmpObj.style.height=height+"px"}else tmpObj.style.width=width+"px";tmpObj.style.position='absolute';tmpObj.style.top='0';tmpObj.style.left='0';tmpObj.style.display='none';tmpObj.innerHTML=content;objBody.insertBefore(tmpObj,objBody.firstChild);var size;if(height){size=$(tmpObj).getDimensions().width+margin}else size=$(tmpObj).getDimensions().height+margin;objBody.removeChild(tmpObj);return size}}
function wHELPERS(){};wHELPERS.prototype.addEvent=function(obj,type,fn){if(!obj)return;if(obj.attachEvent){obj['e'+type+fn]=fn;obj[type+fn]=function(){obj['e'+type+fn](window.event)};obj.attachEvent('on'+type,obj[type+fn])}else if(obj.addEventListener){obj.addEventListener(type,fn,false)}else{var originalHandler=obj["on"+type];if(originalHandler){obj["on"+type]=function(e){originalHandler(e);fn(e)}}else obj["on"+type]=fn}};wHELPERS.prototype.removeEvent=function(obj,type,fn){if(obj.detachEvent){if(obj[type+fn]){obj.detachEvent('on'+type,obj[type+fn]);obj[type+fn]=null}}else if(obj.removeEventListener){obj.removeEventListener(type,fn,false)}else obj["on"+type]=null};wHELPERS.prototype.getSourceElement=function(e){if(!e)e=window.event;if(e.target){var srcE=e.target}else var srcE=e.srcElement;if(!srcE)return null;if(srcE.nodeType==3)srcE=srcE.parentNode;if(srcE.tagName.toUpperCase()=='LABEL'&&e.type=='click')if(srcE.getAttribute('for'))srcE=document.getElementById(srcE.getAttribute('for'));return srcE};wHELPERS.prototype.preventEvent=function(e){if(!e)e=window.event;if(e.preventDefault){e.preventDefault()}else e.returnValue=false;return false};wHELPERS.prototype.stopPropagation=function(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation()};wHELPERS.prototype.randomId=function(){var seed=(new Date()).getTime();seed=seed.toString().substr(6);for(var i=0;i<6;i++)seed+=String.fromCharCode(48+Math.floor((Math.random()*10)));return"id-"+seed};wHELPERS.prototype.activateStylesheet=function(sheetref){if(document.getElementsByTagName){var ss=document.getElementsByTagName('link')}else if(document.styleSheets)var ss=document.styleSheets;for(var i=0;ss[i];i++)if(ss[i].href.indexOf(sheetref)!=-1){ss[i].disabled=true;ss[i].disabled=false}};wHELPERS.prototype.hasClass=function(element,className){if(element&&element.className)if((' '+element.className+' ').indexOf(' '+className+' ')!=-1)return true;return false};wHELPERS.prototype.hasClassPrefix=function(element,className){if(element&&element.className)if((' '+element.className).indexOf(' '+className)!=-1)return true;return false};wHELPERS.prototype.hasIdPrefix=function(element,idPrefix){if(element&&element.id)if(element.id.indexOf(idPrefix)!=-1)return true;return false};wHELPERS.prototype.getTop=function(obj){var cur=0;if(obj.offsetParent)while(obj.offsetParent){if((new wHELPERS()).getComputedStyle(obj,'position')=='relative')return cur;cur+=obj.offsetTop;obj=obj.offsetParent};return cur};wHELPERS.prototype.getLeft=function(obj){var cur=0;if(obj.offsetParent)while(obj.offsetParent){if((new wHELPERS()).getComputedStyle(obj,'position')=='relative')return cur;if((new wHELPERS()).getComputedStyle(obj,'position')=='absolute')return cur;cur+=obj.offsetLeft;obj=obj.offsetParent};return cur};wHELPERS.prototype.getComputedStyle=function(element,styleName){if(window.getComputedStyle){return window.getComputedStyle(element,"").getPropertyValue(styleName)}else if(element.currentStyle)return element.currentStyle[styleName];return false};var wHelpers=wHELPERS;if(!Array.prototype.push)Array.prototype.push=function(){for(var i=0;i<arguments.length;++i)this[this.length]=arguments[i];return this.length};if(wHELPERS){var wFORMS={debugLevel:0,helpers:new wHELPERS(),behaviors:{},onLoadComplete:new Array(),processedForm:null,onLoadHandler:function(){for(var behaviorName in wFORMS.behaviors)wFORMS.debug('wForms/loaded behavior: '+behaviorName);for(var i=0;i<document.forms.length;i++){wFORMS.debug('wForms/initialize: '+(document.forms[i].name||document.forms[i].id));wFORMS.addBehaviors(document.forms[i])}},addBehaviors:function(node){if(!node)return;if(!node.nodeType)node=document.getElementById(node);if(!node||node.nodeType!=1)return;deep=(arguments.length>1)?arguments[1]:true;wFORMS._addBehaviors(node,deep)},_addBehaviors:function(node,deep){if(node.getAttribute('rel')=='no-behavior')return false;if(node.nodeType==1){if(node.tagName=='FORM')wFORMS.processedForm=node;for(var behaviorName in wFORMS.behaviors)wFORMS.behaviors[behaviorName].evaluate(node);if(deep)for(var i=0,cn=node.childNodes,l=cn.length;i<l;i++)if(cn[i].nodeType==1)wFORMS._addBehaviors(cn[i],deep);if(node.tagName=='FORM'){for(var i=0;i<wFORMS.onLoadComplete.length;i++)wFORMS.onLoadComplete[i].func(wFORMS.onLoadComplete[i].form);if(wFORMS.onLoadComplete.length>0)wFORMS.onLoadComplete=new Array()}}},hasBehavior:function(behaviorName){if(wFORMS.behaviors[behaviorName])return true;return false},debug:function(txt){msgLevel=arguments[1]||10;if(wFORMS.debugLevel>0&&msgLevel>=wFORMS.debugLevel){if(!wFORMS.debugOutput)wFORMS.initDebug();if(wFORMS.debugOutput)wFORMS.debugOutput.innerHTML+="<br />"+txt}},initDebug:function(){var output=document.getElementById('debugOutput');if(!output){output=document.createElement('div');output.id='debugOutput';output.style.position='absolute';output.style.right='10px';output.style.top='10px';output.style.zIndex='300';output.style.fontSize='x-small';output.style.fontFamily='courier';output.style.backgroundColor='#DDD';output.style.padding='5px';if(document.body)wFORMS.debugOutput=document.body.appendChild(output)};if(wFORMS.debugOutput)wFORMS.debugOutput.ondblclick=function(){this.innerHTML=''}}};wFORMS.NAME="wForms";wFORMS.VERSION="2.0";wFORMS.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};wFORMS.toString=function(){return this.__repr__()};wFORMS.utilities=wFORMS.helpers;var wf=wFORMS;wf.utilities.getSrcElement=wFORMS.helpers.getSourceElement;wf.utilities.XBrowserPreventEventDefault=wFORMS.helpers.preventEvent;wFORMS.helpers.activateStylesheet('wforms-jsonly.css');wFORMS.helpers.addEvent(window,'load',wFORMS.onLoadHandler)};if(wFORMS){wFORMS.idSuffix_fieldHint="-H";wFORMS.className_inactiveFieldHint="field-hint-inactive";wFORMS.className_activeFieldHint="field-hint";wFORMS.behaviors['hint']={name:'hint',evaluate:function(node){if(node.id){if(node.id.indexOf(wFORMS.idSuffix_fieldHint)>0){var id=node.id.replace(wFORMS.idSuffix_fieldHint,''),hinted=document.getElementById(id)||wFORMS.processedForm[id]};if(hinted){if(hinted.length>0&&hinted[0].type=='radio'){var hintedGroup=hinted;l=hinted.length}else{var hintedGroup=new Array(hinted);l=1};for(var i=0;i<l;i++){hinted=hintedGroup[i];wFORMS.debug('hint/evaluate: '+(node.id||node.name));switch(hinted.tagName.toUpperCase()){case'SELECT':case'TEXTAREA':case'INPUT':wFORMS.helpers.addEvent(hinted,'focus',wFORMS.behaviors['hint'].run);wFORMS.helpers.addEvent(hinted,'blur',wFORMS.behaviors['hint'].remove);break;default:wFORMS.helpers.addEvent(hinted,'mouseover',wFORMS.behaviors['hint'].run);wFORMS.helpers.addEvent(hinted,'mouseout',wFORMS.behaviors['hint'].remove);break}}}}},run:function(e){var element=wFORMS.helpers.getSourceElement(e),fieldHint=document.getElementById(element.id+wFORMS.idSuffix_fieldHint);if(!fieldHint)fieldHint=document.getElementById(element.name+wFORMS.idSuffix_fieldHint);if(fieldHint){fieldHint.className=fieldHint.className.replace(wFORMS.className_inactiveFieldHint,wFORMS.className_activeFieldHint);fieldHint.style.top=(wFORMS.helpers.getTop(element)+element.offsetHeight).toString()+"px";if(element.tagName.toUpperCase()=='SELECT'){fieldHint.style.left=(wFORMS.helpers.getLeft(element)+(element.offsetWidth-8)).toString()+"px"}else fieldHint.style.left=(wFORMS.helpers.getLeft(element)).toString()+"px"}},remove:function(e){var element=wFORMS.helpers.getSourceElement(e),fieldHint=document.getElementById(element.id+wFORMS.idSuffix_fieldHint);if(!fieldHint)fieldHint=document.getElementById(element.name+wFORMS.idSuffix_fieldHint);if(fieldHint)fieldHint.className=fieldHint.className.replace(wFORMS.className_activeFieldHint,wFORMS.className_inactiveFieldHint)}}};if(wFORMS){wFORMS.className_paging="wfPage";wFORMS.className_pagingCurrent="wfCurrentPage";wFORMS.className_pagingButtons="wfPageButton";wFORMS.className_hideSubmit="wfHideSubmit";wFORMS.idPrefix_pageIndex="wfPgIndex-";wFORMS.runValidationOnPageNext=true;if(!wFORMS.arrMsg)wFORMS.arrMsg=new Array();wFORMS.arrMsg[4]="Next Page";wFORMS.arrMsg[5]="Previous Page";wFORMS.behaviors['paging']={idSuffix_buttonsPlaceholder:"-buttons",className_pageNextButton:wFORMS.className_pagingButtons+" wfPageNextButton",className_pagePreviousButton:wFORMS.className_pagingButtons+" wfPagePreviousButton",behaviorInUse:false,allowNestedPages:false,onPageChange:null,evaluate:function(node){if(wFORMS.helpers.hasClass(node,wFORMS.className_paging)){if(!wFORMS.behaviors['paging'].allowNestedPages&&wFORMS.behaviors['paging'].getPageElement(node)){node.className=node.className.replace(wFORMS.className_paging,"");return};wFORMS.behaviors['paging'].behaviorInUse=true;var currentPageIndex=wFORMS.behaviors['paging'].getPageIndex(node);if(currentPageIndex>1){var placeholder=this.getButtonPlaceholder(node),button=placeholder.insertBefore(this.createPreviousPageButton(),placeholder.firstChild);wFORMS.helpers.addEvent(button,'click',wFORMS.behaviors['paging'].pagingPrevious)}else{node.className+=' '+wFORMS.className_pagingCurrent;var form=wFORMS.behaviors['paging'].getFormElement(node);wFORMS.helpers.addEvent(form,'submit',function(e){var element=wFORMS.helpers.getSourceElement(e);if(element.type&&element.type.toLowerCase()=='text')return wFORMS.preventEvent(e)});wFORMS.preventSubmissionOnEnter=true};if(document.getElementById(wFORMS.idPrefix_pageIndex+(currentPageIndex+1).toString())){var placeholder=this.getButtonPlaceholder(node),button=placeholder.appendChild(this.createNextPageButton());wFORMS.helpers.addEvent(button,'click',wFORMS.behaviors['paging'].pagingNext);if(currentPageIndex==1)wFORMS.behaviors['paging'].hideSubmitButton(form)}}},getButtonPlaceholder:function(page){var p=document.getElementById(page.id+this.idSuffix_buttonsPlaceholder);if(!p){var buttonPlaceholder=document.createElement("div");buttonPlaceholder=page.appendChild(buttonPlaceholder);buttonPlaceholder.className='actions';buttonPlaceholder.id=page.id+this.idSuffix_buttonsPlaceholder;return buttonPlaceholder};return p},createNextPageButton:function(){var button=document.createElement("input");button.setAttribute('value',wFORMS.arrMsg[4]);button.setAttribute('type',"button");button.className=this.className_pageNextButton;return button},createPreviousPageButton:function(){var button=document.createElement("input");button.setAttribute('value',wFORMS.arrMsg[5]);button.setAttribute('type',"button");button.className=this.className_pagePreviousButton;return button},pagingNext:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;var pageElement=wFORMS.behaviors['paging'].getPageElement(element),pageIndex=wFORMS.behaviors['paging'].getPageIndex(pageElement)+1,nextPageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());if(nextPageElement)if(!wFORMS.hasBehavior('validation')||(wFORMS.hasBehavior('validation')&&!wFORMS.runValidationOnPageNext)||(wFORMS.hasBehavior('validation')&&wFORMS.runValidationOnPageNext&&wFORMS.functionName_formValidation(e,true))){pageElement.className=pageElement.className.replace(new RegExp(wFORMS.className_pagingCurrent,"g"),"");nextPageElement.className+=' '+wFORMS.className_pagingCurrent;if(wFORMS.behaviors['paging'].isLastPage(pageIndex)){var form=wFORMS.behaviors['paging'].getFormElement(nextPageElement);wFORMS.behaviors['paging'].showSubmitButton(form)};if(wFORMS.behaviors['paging'].onPageChange)wFORMS.behaviors['paging'].onPageChange(nextPageElement);window.scroll(0,0)}},pagingPrevious:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;var pageElement=wFORMS.behaviors['paging'].getPageElement(element),pageIndex=wFORMS.behaviors['paging'].getPageIndex(pageElement)-1,previousPageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());if(previousPageElement){pageElement.className=pageElement.className.replace(new RegExp(wFORMS.className_pagingCurrent,"g"),"");previousPageElement.className+=' '+wFORMS.className_pagingCurrent;var form=wFORMS.behaviors['paging'].getFormElement(previousPageElement);wFORMS.behaviors['paging'].hideSubmitButton(form);if(wFORMS.behaviors['paging'].onPageChange)wFORMS.behaviors['paging'].onPageChange(previousPageElement);window.scroll(0,0)}},showSubmitButton:function(form){var buttons=form.getElementsByTagName('input');for(var i=0;i<buttons.length;i++)if(buttons[i].type&&buttons[i].type.toLowerCase()=='submit')buttons[i].className=buttons[i].className.replace(wFORMS.className_hideSubmit,"")},hideSubmitButton:function(form){var buttons=form.getElementsByTagName('input');for(var i=0;i<buttons.length;i++)if(buttons[i].type&&buttons[i].type.toLowerCase()=='submit'&&!wFORMS.helpers.hasClass(buttons[i],wFORMS.className_hideSubmit))buttons[i].className+=' '+wFORMS.className_hideSubmit},isLastPage:function(pageIndex){if(isNaN(pageIndex))pageIndex=parseInt(pageIndex.replace(/[\D]*/,""));pageIndex++;var furtherPageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());if(!furtherPageElement)return true;return false},gotoPage:function(pageIndex){if(isNaN(pageIndex)){var pageElement=document.getElementById(pageIndex)}else var pageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());if(!pageElement)return false;var form=wFORMS.behaviors['paging'].getFormElement(pageElement),allElements=form.getElementsByTagName("*");for(var i=0;i<allElements.length;i++){var n=allElements[i];if(wFORMS.helpers.hasClass(allElements[i],wFORMS.className_pagingCurrent)){n.className=n.className.replace(new RegExp(wFORMS.className_pagingCurrent,"g"),"");break}};if(wFORMS.behaviors['paging'].isLastPage(pageIndex)){wFORMS.behaviors['paging'].showSubmitButton(form)}else wFORMS.behaviors['paging'].hideSubmitButton(form);pageElement.className+=' '+wFORMS.className_pagingCurrent;if(wFORMS.behaviors['paging'].onPageChange)wFORMS.behaviors['paging'].onPageChange(pageElement)},getFormElement:function(element){var form=element.parentNode;while(form&&form.tagName!="FORM")form=form.parentNode;return form},getPageElement:function(element){var n=element.parentNode;while(n&&n.tagName!="FORM"&&(!n.className||!wFORMS.helpers.hasClass(n,wFORMS.className_paging)))n=n.parentNode;if(n&&wFORMS.helpers.hasClass(n,wFORMS.className_paging)){return n}else return null},getPageIndex:function(element){if(element&&element.id){return parseInt(element.id.replace(/[\D]*/,""))}else return null}}};if(wFORMS){wFORMS.className_repeat="repeat";wFORMS.className_delete="removeable";wFORMS.className_duplicateLink="duplicateLink";wFORMS.className_removeLink="removeLink";wFORMS.className_preserveRadioName="preserveRadioName";wFORMS.idSuffix_repeatCounter="-RC";wFORMS.idSuffix_duplicateLink="-wfDL";wFORMS.preserveRadioName=false;wFORMS.limitSwitchScope=true;if(!wFORMS.arrMsg)wFORMS.arrMsg=new Array();wFORMS.arrMsg[0]="Add another response";wFORMS.arrMsg[1]="Will duplicate this question or section.";wFORMS.arrMsg[2]="Remove";wFORMS.arrMsg[3]="Will remove this question or section.";wFORMS.behaviors['repeat']={onRepeat:null,onRemove:null,allowRepeat:null,evaluate:function(node){if(wFORMS.helpers.hasClass(node,wFORMS.className_repeat)){if(!node.id)node.id=wFORMS.helpers.randomId();var repeatLink=document.getElementById(node.id+wFORMS.idSuffix_duplicateLink);if(!repeatLink){repeatLink=wFORMS.behaviors['repeat'].createRepeatLink(node.id);if(node.tagName.toUpperCase()=="TR"){var n=node.lastChild;while(n&&n.nodeType!=1)n=n.previousSibling;if(n&&n.nodeType==1)n.appendChild(repeatLink)}else node.appendChild(repeatLink)};var counterField=document.getElementById(node.id+wFORMS.idSuffix_repeatCounter);if(!counterField){if(document.all&&!window.opera){var counterFieldId=node.id+wFORMS.idSuffix_repeatCounter;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")==-1){counterField=document.createElement("INPUT NAME=\""+counterFieldId+"\"")}else counterField=document.createElement("<INPUT NAME=\""+counterFieldId+"\"></INPUT>");counterField.type='hidden';counterField.id=counterFieldId;counterField.value="1"}else{counterField=document.createElement("INPUT");counterField.setAttribute('type','hidden');counterField.setAttribute('value','1');counterField.setAttribute('name',node.id+wFORMS.idSuffix_repeatCounter);counterField.setAttribute('id',node.id+wFORMS.idSuffix_repeatCounter)};var form=node.parentNode;while(form&&form.tagName.toUpperCase()!="FORM")form=form.parentNode;form.appendChild(counterField)};wFORMS.helpers.addEvent(repeatLink,'click',wFORMS.behaviors['repeat'].duplicateFieldGroup)};if(wFORMS.helpers.hasClass(node,wFORMS.className_delete)){var removeLink=wFORMS.behaviors['repeat'].createRemoveLink();if(node.tagName.toUpperCase()=="TR"){var n=node.lastChild;while(n&&n.nodeType!=1)n=n.previousSibling;if(n&&n.nodeType==1)n.appendChild(removeLink)}else node.appendChild(removeLink)}},createRepeatLink:function(id){var repeatLink=document.createElement("a"),spanNode=document.createElement("span"),textNode=document.createTextNode(wFORMS.arrMsg[0]);repeatLink.id=id+wFORMS.idSuffix_duplicateLink;repeatLink.setAttribute('href',"#");repeatLink.className=wFORMS.className_duplicateLink;repeatLink.setAttribute('title',wFORMS.arrMsg[1]);spanNode.appendChild(textNode);repeatLink.appendChild(spanNode);return repeatLink},createRemoveLink:function(){var removeLink=document.createElement("a"),spanNode=document.createElement("span"),textNode=document.createTextNode(wFORMS.arrMsg[2]);removeLink.setAttribute('href',"#");removeLink.className=wFORMS.className_removeLink;removeLink.setAttribute('title',wFORMS.arrMsg[3]);spanNode.appendChild(textNode);removeLink.appendChild(spanNode);wFORMS.helpers.addEvent(removeLink,'click',wFORMS.behaviors['repeat'].removeFieldGroup);return removeLink},duplicateFieldGroup:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;var preserveRadioName=wFORMS.helpers.hasClass(element,wFORMS.className_preserveRadioName)?true:wFORMS.preserveRadioName;while(element&&!wFORMS.helpers.hasClass(element,wFORMS.className_duplicateLink))element=element.parentNode;var idOfRepeatedSection=element.id.replace(wFORMS.idSuffix_duplicateLink,""),element=document.getElementById(idOfRepeatedSection);if(element){var wBehavior=wFORMS.behaviors['repeat'];if(wBehavior.allowRepeat)if(!wBehavior.allowRepeat(element))return false;counterField=document.getElementById(element.id+wFORMS.idSuffix_repeatCounter);if(!counterField)return;var rowCount=parseInt(counterField.value)+1,suffix="-"+rowCount.toString(),dupTree=wBehavior.replicateTree(element,null,suffix,preserveRadioName),insertNode=element.nextSibling;while(insertNode&&(insertNode.nodeType==3||wFORMS.helpers.hasClass(insertNode,wFORMS.className_delete)))insertNode=insertNode.nextSibling;element.parentNode.insertBefore(dupTree,insertNode);dupTree.className=element.className.replace(wFORMS.className_repeat,wFORMS.className_delete);document.getElementById(element.id+wFORMS.idSuffix_repeatCounter).value=rowCount;wFORMS.addBehaviors(dupTree);if(wBehavior.onRepeat)wBehavior.onRepeat(element,dupTree)};return wFORMS.helpers.preventEvent(e)},removeFieldGroup:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;var element=element.parentNode;while(element&&!wFORMS.helpers.hasClass(element,wFORMS.className_delete))element=element.parentNode;element.parentNode.removeChild(element);if(wFORMS.behaviors['repeat'].onRemove)wFORMS.behaviors['repeat'].onRemove(element);return wFORMS.helpers.preventEvent(e)},removeRepeatCountSuffix:function(str){return str.replace(/-\d+$/,'')},replicateTree:function(element,parentElement,idSuffix,preserveRadioName){if(element.nodeType==3){if(element.parentNode.tagName.toUpperCase()!='TEXTAREA')var newElement=document.createTextNode(element.data)}else if(element.nodeType==1){if(wFORMS.helpers.hasClass(element,wFORMS.className_duplicateLink)||wFORMS.helpers.hasClass(element,wFORMS.className_removeLink))return null;if(wFORMS.helpers.hasClass(element,wFORMS.className_delete))return null;if(wFORMS.helpers.hasClass(element,wFORMS.className_repeat)&&parentElement!=null)idSuffix=idSuffix.replace('-','__');if(!document.all||window.opera){var newElement=document.createElement(element.tagName)}else{var tagHtml=element.tagName;if(element.name)if(element.tagName.toUpperCase()=="INPUT"&&element.type.toLowerCase()=="radio"&&preserveRadioName){tagHtml+=" NAME='"+element.name+"' "}else tagHtml+=" NAME='"+wFORMS.behaviors['repeat'].removeRepeatCountSuffix(element.name)+idSuffix+"' ";if(element.type)tagHtml+=" TYPE='"+element.type+"' ";if(element.selected)tagHtml+=" SELECTED='SELECTED' ";if(element.checked)tagHtml+=" CHECKED='CHECKED' ";if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")==-1){var newElement=document.createElement(tagHtml)}else var newElement=document.createElement("<"+tagHtml+"></"+element.tagName+">");try{newElement.type=element.type}catch(e){}};for(var i=0;i<element.attributes.length;i++){var attribute=element.attributes[i];if(attribute.specified||attribute.nodeName.toLowerCase()=='value'){if(attribute.nodeName.toLowerCase()=="id"||attribute.nodeName.toLowerCase()=="name"||attribute.nodeName.toLowerCase()=="for"){if(wFORMS.hasBehavior('hint')&&attribute.nodeValue.indexOf(wFORMS.idSuffix_fieldHint)!=-1){var value=attribute.nodeValue;value=wFORMS.behaviors['repeat'].removeRepeatCountSuffix(value.substr(0,value.indexOf(wFORMS.idSuffix_fieldHint)))+idSuffix+wFORMS.idSuffix_fieldHint}else if(element.tagName.toUpperCase()=="INPUT"&&element.getAttribute('type',false).toLowerCase()=="radio"&&attribute.nodeName.toLowerCase()=="name"&&preserveRadioName){var value=attribute.nodeValue}else var value=attribute.nodeValue+idSuffix}else if(attribute.nodeName.toLowerCase()=="value"&&element.tagName.toUpperCase()=='INPUT'&&(element.type.toLowerCase()=='text'||element.type.toLowerCase()=='password'||element.type.toLowerCase()=='hidden'||element.type.toLowerCase()=='file')){var value=''}else if(attribute.nodeName.toLowerCase()=="rel"&&attribute.nodeValue.indexOf('wfHandled')!=-1){var value=attribute.nodeValue.replace('wfHandled','')}else var value=attribute.nodeValue;switch(attribute.nodeName.toLowerCase()){case"class":newElement.className=value;break;case"style":if(element.style&&element.style.cssText)newElement.style.cssText=element.style.cssText;break;case"onclick":newElement.onclick=element.onclick;break;case"onchange":newElement.onchange=element.onchange;break;case"onsubmit":newElement.onsubmit=element.onsubmit;break;case"onmouseover":newElement.onmouseover=element.onmouseover;break;case"onmouseout":newElement.onmouseout=element.onmouseout;break;case"onmousedown":newElement.onmousedown=element.onmousedown;break;case"onmouseup":newElement.onmouseup=element.onmouseup;break;case"ondblclick":newElement.ondblclick=element.ondblclick;break;case"onkeydown":newElement.onkeydown=element.onkeydown;break;case"onkeyup":newElement.onkeyup=element.onkeyup;break;case"onblur":newElement.onblur=element.onblur;break;case"onfocus":newElement.onfocus=element.onfocus;break;default:newElement.setAttribute(attribute.name,value,0)}}}};if(parentElement&&newElement)parentElement.appendChild(newElement);for(var i=0;i<element.childNodes.length;i++)wFORMS.behaviors['repeat'].replicateTree(element.childNodes[i],newElement,idSuffix,preserveRadioName);return newElement}}};if(wFORMS){wFORMS.classNamePrefix_switch="switch";wFORMS.className_switchIsOn="swtchIsOn";wFORMS.className_switchIsOff="swtchIsOff";wFORMS.classNamePrefix_offState="offstate";wFORMS.classNamePrefix_onState="onstate";wFORMS.switchScopeRootTag="";wFORMS.switchTriggers=[];wFORMS.switchTargets=[];wFORMS.behaviors['switch']={evaluate:function(node){if(wFORMS.helpers.hasClassPrefix(node,wFORMS.classNamePrefix_switch)){if(!node.id)node.id=wFORMS.helpers.randomId();if(!wFORMS.processedForm||!wFORMS.processedForm.id){var formId="undefined"}else var formId=wFORMS.processedForm.id;var switchNames=wFORMS.behaviors['switch'].getSwitchNames(node);for(var i=0;i<switchNames.length;i++){if(!wFORMS.switchTriggers[formId])wFORMS.switchTriggers[formId]=new Array();if(!wFORMS.switchTriggers[formId][switchNames[i]])wFORMS.switchTriggers[formId][switchNames[i]]=new Array();if(!wFORMS.switchTriggers[formId][switchNames[i]][node.id])wFORMS.switchTriggers[formId][switchNames[i]].push(node.id)};switch(node.tagName.toUpperCase()){case"OPTION":var selectNode=node.parentNode;while(selectNode&&selectNode.tagName.toUpperCase()!='SELECT')var selectNode=selectNode.parentNode;if(!selectNode){alert('Error: invalid markup in SELECT field ?');return false};if(!selectNode.id)selectNode.id=wFORMS.helpers.randomId();if(!selectNode.getAttribute('rel')||selectNode.getAttribute('rel').indexOf('wfHandled')==-1){selectNode.setAttribute('rel',(selectNode.getAttribute('rel')||"")+' wfHandled');wFORMS.helpers.addEvent(selectNode,'change',wFORMS.behaviors['switch'].run)};break;case"INPUT":if(node.type&&node.type.toLowerCase()=='radio'){var formElement=node.form;for(var j=0;j<formElement[node.name].length;j++){var radioNode=formElement[node.name][j];if(radioNode.type.toLowerCase()=='radio')if(!radioNode.getAttribute('rel')||radioNode.getAttribute('rel').indexOf('wfHandled')==-1){wFORMS.helpers.addEvent(radioNode,'click',wFORMS.behaviors['switch'].run);radioNode.setAttribute('rel',(radioNode.getAttribute('rel')||"")+' wfHandled')}}}else wFORMS.helpers.addEvent(node,'click',wFORMS.behaviors['switch'].run);break;default:wFORMS.helpers.addEvent(node,'click',wFORMS.behaviors['switch'].run);break}};if(wFORMS.helpers.hasClassPrefix(node,wFORMS.classNamePrefix_offState)||wFORMS.helpers.hasClassPrefix(node,wFORMS.classNamePrefix_onState)){if(!node.id)node.id=wFORMS.helpers.randomId();if(!wFORMS.processedForm||!wFORMS.processedForm.id){var formId="undefined"}else var formId=wFORMS.processedForm.id;var switchNames=wFORMS.behaviors['switch'].getSwitchNames(node);for(var i=0;i<switchNames.length;i++){if(!wFORMS.switchTargets[formId])wFORMS.switchTargets[formId]=new Array();if(!wFORMS.switchTargets[formId][switchNames[i]])wFORMS.switchTargets[formId][switchNames[i]]=new Array();if(!wFORMS.switchTargets[formId][switchNames[i]][node.id])wFORMS.switchTargets[formId][switchNames[i]].push(node.id)}};if(node.tagName&&node.tagName.toUpperCase()=='FORM'){wFORMS.onLoadComplete.push({form:node,func:wFORMS.behaviors['switch'].init});wFORMS.behaviors['switch'].clear(node.id)}},init:function(form){if(!form||!form.id){var formId="undefined"}else var formId=form.id;for(var switchName in wFORMS.switchTriggers[formId])for(var i=0;i<wFORMS.switchTriggers[formId][switchName].length;i++){var element=document.getElementById(wFORMS.switchTriggers[formId][switchName][i]);if(wFORMS.behaviors['switch'].isTriggerOn(element,switchName)){if(element.tagName.toUpperCase()=='OPTION'){var element=element.parentNode;while(element&&element.tagName.toUpperCase()!='SELECT')var element=element.parentNode};wFORMS.behaviors['switch'].run(element)}}},run:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;if(element.form){var form=element.form}else{var form=element.parentNode;while(form&&form.tagName!="FORM")form=form.parentNode};if(!form||!form.id){var formId="undefined"}else var formId=form.id;var switches_ON=new Array(),switches_OFF=new Array();switch(element.tagName.toUpperCase()){case'SELECT':for(var i=0;i<element.options.length;i++)if(i==element.selectedIndex){switches_ON=switches_ON.concat(wFORMS.behaviors['switch'].getSwitchNames(element.options[i]))}else switches_OFF=switches_OFF.concat(wFORMS.behaviors['switch'].getSwitchNames(element.options[i]));break;case'INPUT':if(element.type.toLowerCase()=='radio'){for(var i=0;i<element.form[element.name].length;i++){var radioElement=element.form[element.name][i];if(radioElement.checked){switches_ON=switches_ON.concat(wFORMS.behaviors['switch'].getSwitchNames(radioElement))}else switches_OFF=switches_OFF.concat(wFORMS.behaviors['switch'].getSwitchNames(radioElement))}}else if(element.checked||wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOn)){switches_ON=switches_ON.concat(wFORMS.behaviors['switch'].getSwitchNames(element))}else switches_OFF=switches_OFF.concat(wFORMS.behaviors['switch'].getSwitchNames(element));break;default:break};for(var i=0;i<switches_OFF.length;i++){var elements=wFORMS.behaviors['switch'].getElementsBySwitchName(switches_OFF[i],formId);for(var j=0;j<elements.length;j++){var triggers=wFORMS.switchTriggers[formId][switches_OFF[i]],doSwitch=true;for(var k=0;k<triggers.length;k++){var trigger=document.getElementById(triggers[k]);if(wFORMS.behaviors['switch'].isTriggerOn(trigger,switches_OFF[i]))if(wFORMS.behaviors['switch'].isWithinSwitchScope(trigger,elements[j]))doSwitch=false};if(doSwitch)wFORMS.behaviors['switch'].switchState(elements[j],wFORMS.classNamePrefix_onState,wFORMS.classNamePrefix_offState)}};for(var i=0;i<switches_ON.length;i++){var elements=wFORMS.behaviors['switch'].getElementsBySwitchName(switches_ON[i],formId);for(var j=0;j<elements.length;j++)if(wFORMS.behaviors['switch'].isWithinSwitchScope(element,elements[j]))wFORMS.behaviors['switch'].switchState(elements[j],wFORMS.classNamePrefix_offState,wFORMS.classNamePrefix_onState)}},clear:function(form){if(form){wFORMS.switchTriggers[form]=[];wFORMS.switchTargets[form]=[]}else{wFORMS.switchTriggers=[];wFORMS.switchTargets=[]}},getSwitchNames:function(element){var switchNames=new Array(),classNames=element.className.split(' ');for(var i=0;i<classNames.length;i++){if(classNames[i].indexOf(wFORMS.classNamePrefix_switch)==0)switchNames.push(classNames[i].substr(wFORMS.classNamePrefix_switch.length+1));if(classNames[i].indexOf(wFORMS.classNamePrefix_onState)==0){switchNames.push(classNames[i].substr(wFORMS.classNamePrefix_onState.length+1))}else if(classNames[i].indexOf(wFORMS.classNamePrefix_offState)==0)switchNames.push(classNames[i].substr(wFORMS.classNamePrefix_offState.length+1))};return switchNames},switchState:function(element,oldStateClass,newStateClass){if(!element||element.nodeType!=1)return;if(element.className)element.className=element.className.replace(oldStateClass,newStateClass);if(wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOff)){element.className=element.className.replace(wFORMS.className_switchIsOff,wFORMS.className_switchIsOn)}else if(wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOn))element.className=element.className.replace(wFORMS.className_switchIsOn,wFORMS.className_switchIsOff)},getElementsBySwitchName:function(switchName,formId){var elements=new Array();if(wFORMS.switchTargets[formId][switchName])for(var i=0;i<wFORMS.switchTargets[formId][switchName].length;i++){var element=document.getElementById(wFORMS.switchTargets[formId][switchName][i]);if(element)elements.push(element)};return elements},isTriggerOn:function(element,triggerName){if(!element)return false;if(element.tagName.toUpperCase()=='OPTION'){var selectElement=element.parentNode;while(selectElement&&selectElement.tagName.toUpperCase()!='SELECT')var selectElement=selectElement.parentNode;if(!selectElement)return false;if(selectElement.selectedIndex==-1)return false;if(wFORMS.helpers.hasClass(selectElement.options[selectElement.selectedIndex],wFORMS.classNamePrefix_switch+'-'+triggerName))return true}else if(element.checked||wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOn))return true;return false},isWithinSwitchScope:function(trigger,target){if(wFORMS.hasBehavior('repeat')&&wFORMS.limitSwitchScope==true){var scope=trigger;while(scope&&scope.tagName&&scope.tagName.toUpperCase()!='FORM'&&!wFORMS.helpers.hasClass(scope,wFORMS.className_repeat)&&!wFORMS.helpers.hasClass(scope,wFORMS.className_delete))scope=scope.parentNode;if(wFORMS.helpers.hasClass(scope,wFORMS.className_repeat)||wFORMS.helpers.hasClass(scope,wFORMS.className_delete)){var scope2=target;while(scope2&&scope2.tagName&&scope2.tagName.toUpperCase()!='FORM'&&!wFORMS.helpers.hasClass(scope2,wFORMS.className_repeat)&&!wFORMS.helpers.hasClass(scope2,wFORMS.className_delete))scope2=scope2.parentNode;if(scope==scope2){return true}else return false}else return true}else return true}}};if(wFORMS){wFORMS.preventSubmissionOnEnter=true;wFORMS.showAlertOnError=true;wFORMS.className_required="required";wFORMS.className_validationError_msg="errMsg";wFORMS.className_validationError_fld="errFld";wFORMS.classNamePrefix_validation="validate";wFORMS.idSuffix_fieldError="-E";wFORMS.behaviors['validation']={errMsg_required:"This field is required. ",errMsg_alpha:"The text must use alphabetic characters only (a-z, A-Z). Numbers are not allowed.",errMsg_email:"This does not appear to be a valid email address.",errMsg_integer:"Please enter an integer.",errMsg_float:"Please enter a number (ex. 1.9).",errMsg_password:"Unsafe password. Your password should be between 4 and 12 characters long and use a combinaison of upper-case and lower-case letters.",errMsg_alphanum:"Please use alpha-numeric characters only [a-z 0-9].",errMsg_date:"This does not appear to be a valid date.",errMsg_notification:"%% error(s) detected. Your form has not been submitted yet.\nPlease check the information you provided.",errMsg_custom:"Please enter a valid value.",className_allRequired:"allrequired",jumpToErrorOnPage:null,currentPageIndex:-1,submitSwitchedOffFields:false,switchedOffFields:[],evaluate:function(node){if(node.tagName=="FORM"){if(wFORMS.functionName_formValidation.toString()==wFORMS.functionName_formValidation)wFORMS.functionName_formValidation=eval(wFORMS.functionName_formValidation);wFORMS.helpers.addEvent(node,'submit',wFORMS.functionName_formValidation)};if(wFORMS.preventSubmissionOnEnter)if(node.tagName=='INPUT')if(!node.type||node.type.toLowerCase()=='text'||node.type.toLowerCase()=='password'||node.type.toLowerCase()=='file')wFORMS.helpers.addEvent(node,'keydown',function(e){var evt=(e)?e:window.event;if(evt.keyCode==13)return wFORMS.helpers.preventEvent(evt)})},init:function(){},run:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;var currentPageOnly=arguments.length>1?arguments[1]:false;wFORMS.behaviors['validation'].switchedOffFields=[];wFORMS.behaviors['validation'].jumpToErrorOnPage=null;while(element&&element.tagName!='FORM')element=element.parentNode;var nbErrors=wFORMS.behaviors['validation'].validateElement(element,currentPageOnly,true);wFORMS.behaviors['validation'].errorCount=nbErrors;if(nbErrors>0){if(wFORMS.behaviors['validation'].jumpToErrorOnPage)wFORMS.behaviors['paging'].gotoPage(wFORMS.behaviors['validation'].jumpToErrorOnPage);if(wFORMS.showAlertOnError)wFORMS.behaviors['validation'].showAlert(nbErrors);return wFORMS.helpers.preventEvent(e)};if(!wFORMS.behaviors['validation'].submitSwitchedOffFields&&!currentPageOnly)for(var i=0;i<wFORMS.behaviors['validation'].switchedOffFields.length;i++){var element=wFORMS.behaviors['validation'].switchedOffFields[i];while(element.childNodes[0])element.removeChild(element.childNodes[0])};return true},remove:function(){},validateElement:function(element){if(!element)return;var deep=arguments.length>2?arguments[2]:true,currentPageOnly=arguments[1]?arguments[1]:false,wBehavior=wFORMS.behaviors['validation'];if(wFORMS.hasBehavior('switch')&&wFORMS.helpers.hasClassPrefix(element,wFORMS.classNamePrefix_offState)){if(!wBehavior.submitSwitchedOffFields)wBehavior.switchedOffFields.push(element);return 0};if(wFORMS.hasBehavior('paging')&&wFORMS.helpers.hasClass(element,wFORMS.className_paging)){if(!wFORMS.helpers.hasClass(element,wFORMS.className_pagingCurrent)&&currentPageOnly)return 0;wBehavior.currentPageIndex=wFORMS.behaviors['paging'].getPageIndex(element)};var nbErrors=0;if(!wBehavior.checkRequired(element)){wBehavior.showError(element,wBehavior.errMsg_required);nbErrors++}else if(wFORMS.helpers.hasClassPrefix(element,wFORMS.classNamePrefix_validation)){var arrClasses=element.className.split(" ");for(j=0;j<arrClasses.length;j++)switch(arrClasses[j]){case"validate-alpha":if(!wBehavior.isAlpha(element.value)){wBehavior.showError(element,wBehavior.errMsg_alpha);nbErrors++};break;case"validate-alphanum":if(!wBehavior.isAlphaNum(element.value)){wBehavior.showError(element,wBehavior.errMsg_alphanum);nbErrors++};break;case"validate-date":if(!wBehavior.isDate(element.value)){wBehavior.showError(element,wBehavior.errMsg_date);nbErrors++};break;case"validate-time":break;case"validate-email":if(!wBehavior.isEmail(element.value)){wBehavior.showError(element,wBehavior.errMsg_email);nbErrors++};break;case"validate-integer":if(!wBehavior.isInteger(element.value)){wBehavior.showError(element,wBehavior.errMsg_integer);nbErrors++};break;case"validate-float":if(!wBehavior.isFloat(element.value)){wBehavior.showError(element,wBehavior.errMsg_float);nbErrors++};break;case"validate-strongpassword":if(!wBehavior.isPassword(element.value)){wBehavior.showError(element,wBehavior.errMsg_password);nbErrors++};break;case"validate-custom":var pattern=new RegExp("\/([^\/]*)\/([gi]*)"),matches=element.className.match(pattern);if(matches[0]){var validationPattern=new RegExp(matches[1],matches[2]);if(!element.value.match(validationPattern)){wBehavior.showError(element,wBehavior.errMsg_custom);nbErrors++}};break}};if(nbErrors==0){wBehavior.removeErrorMessage(element)}else if(wBehavior.currentPageIndex>0&&!wBehavior.jumpToErrorOnPage)wBehavior.jumpToErrorOnPage=wBehavior.currentPageIndex;if(deep)for(var i=0;i<element.childNodes.length;i++)if(element.childNodes[i].nodeType==1)nbErrors+=wBehavior.validateElement(element.childNodes[i],currentPageOnly,deep);return nbErrors},checkRequired:function(element){var wBehavior=wFORMS.behaviors['validation'];if(wFORMS.helpers.hasClass(element,wFORMS.className_required)){switch(element.tagName.toUpperCase()){case"INPUT":var inputType=element.getAttribute("type");if(!inputType)inputType='text';switch(inputType.toLowerCase()){case"checkbox":return element.checked;break;case"radio":return element.checked;break;default:return !wBehavior.isEmpty(element.value)};break;case"SELECT":if(element.selectedIndex==-1){return false}else return !wBehavior.isEmpty(element.options[element.selectedIndex].value);break;case"TEXTAREA":return !wBehavior.isEmpty(element.value);break;default:return wBehavior.checkOneRequired(element);break}}else if(wFORMS.helpers.hasClass(element,wBehavior.className_allRequired))return wBehavior.checkAllRequired(element);return true},checkOneRequired:function(element){if(element.nodeType!=1)return false;var tagName=element.tagName.toUpperCase(),wBehavior=wFORMS.behaviors['validation'];if(tagName=="INPUT"||tagName=="SELECT"||tagName=="TEXTAREA"){var value=wBehavior.getFieldValue(element);if(!wBehavior.isEmpty(value))return true};for(var i=0;i<element.childNodes.length;i++)if(wBehavior.checkOneRequired(element.childNodes[i]))return true;return false},checkAllRequired:function(element){if(element.nodeType!=1)return true;var tagName=element.tagName.toUpperCase(),wBehavior=wFORMS.behaviors['validation'];if(tagName=="INPUT"||tagName=="SELECT"||tagName=="TEXTAREA"){var value=wBehavior.getFieldValue(element);if(wBehavior.isEmpty(value))return false};for(var i=0;i<element.childNodes.length;i++)if(!wBehavior.checkAllRequired(element.childNodes[i]))return false;return true},getFieldValue:function(element){var value=null;if(element&&element.tagName)if(element.tagName.toUpperCase()=="INPUT"){var inputType=element.getAttribute("type");if(!inputType)inputType='text';switch(inputType.toLowerCase()){case"checkbox":value=element.checked?element.value:null;break;case"radio":var radioGroup=element.form[element.name];for(var i=0;i<radioGroup.length;i++)if(radioGroup[i].checked){if(!value)value=new Array();value[value.length]=radioGroup[i].value};break;default:value=element.value}}else if(element.tagName.toUpperCase()=="SELECT"){if(element.selectedIndex!=-1){value=element.options[element.selectedIndex].value}else value=null}else if(element.tagName.toUpperCase()=="TEXTAREA")value=element.value;return value},isEmpty:function(s){var regexpWhitespace=/^\s+$/;return((s==null)||(s.length==0)||regexpWhitespace.test(s))},isAlpha:function(s){var regexpAlphabetic=/^[a-zA-Z\s]+$/;return wFORMS.behaviors['validation'].isEmpty(s)||regexpAlphabetic.test(s)},isAlphaNum:function(s){var validChars=/^[\w\s]+$/;return wFORMS.behaviors['validation'].isEmpty(s)||validChars.test(s)},isDate:function(s){var testDate=new Date(s);return wFORMS.behaviors['validation'].isEmpty(s)||!isNaN(testDate)},isEmail:function(s){var regexpEmail=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;return wFORMS.behaviors['validation'].isEmpty(s)||regexpEmail.test(s)},isInteger:function(s){var regexp=/^[+]?\d+$/;return wFORMS.behaviors['validation'].isEmpty(s)||regexp.test(s)},isFloat:function(s){return wFORMS.behaviors['validation'].isEmpty(s)||!isNaN(parseFloat(s))},isPassword:function(s){return wFORMS.behaviors['validation'].isEmpty(s)},showError:function(element,errorMsg){wFORMS.behaviors['validation'].removeErrorMessage(element);if(!element.id)element.id=wFORMS.helpers.randomId();element.className+=" "+wFORMS.className_validationError_fld;var msgNode=document.createTextNode(" "+errorMsg),fe=document.getElementById(element.id+wFORMS.idSuffix_fieldError);if(!fe){fe=document.createElement("div");fe.setAttribute('id',element.id+wFORMS.idSuffix_fieldError);var fl=document.getElementById(element.id+wFORMS.idSuffix_fieldLabel);if(fl){fl.parentNode.insertBefore(fe,fl.nextSibling)}else element.parentNode.insertBefore(fe,element.nextSibling)};fe.appendChild(msgNode);fe.className+=" "+wFORMS.className_validationError_msg},showAlert:function(nbTotalErrors){alert(wFORMS.behaviors['validation'].errMsg_notification.replace('%%',nbTotalErrors))},removeErrorMessage:function(element){if(wFORMS.helpers.hasClass(element,wFORMS.className_validationError_fld)){var rErrClass=new RegExp(wFORMS.className_validationError_fld,"gi");element.className=element.className.replace(rErrClass,"");var errorMessage=document.getElementById(element.id+wFORMS.idSuffix_fieldError);if(errorMessage)errorMessage.innerHTML=""}}};wFORMS.functionName_formValidation=wFORMS.behaviors['validation'].run;wFORMS.formValidation=wFORMS.behaviors['validation'].run;wFORMS.arrErrorMsg=new Array();wFORMS.arrErrorMsg[0]=wFORMS.behaviors['validation'].errMsg_required;wFORMS.arrErrorMsg[1]=wFORMS.behaviors['validation'].errMsg_alpha;wFORMS.arrErrorMsg[2]=wFORMS.behaviors['validation'].errMsg_email;wFORMS.arrErrorMsg[3]=wFORMS.behaviors['validation'].errMsg_integer;wFORMS.arrErrorMsg[4]=wFORMS.behaviors['validation'].errMsg_float;wFORMS.arrErrorMsg[5]=wFORMS.behaviors['validation'].errMsg_password;wFORMS.arrErrorMsg[6]=wFORMS.behaviors['validation'].errMsg_alphanum;wFORMS.arrErrorMsg[7]=wFORMS.behaviors['validation'].errMsg_date;wFORMS.arrErrorMsg[8]=wFORMS.behaviors['validation'].errMsg_notification};DateFormat=Class.create();Object.extend(DateFormat,{MONTH_NAMES:['January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],DAY_NAMES:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat'],LZ:function(x){return(x<0||x>9?"":"0")+x},compareDates:function(date1,dateformat1,date2,dateformat2){var d1=DateFormat.parseFormat(date1,dateformat1),d2=DateFormat.parseFormat(date2,dateformat2);if(d1==0||d2==0){return -1}else if(d1>d2)return 1;return 0},format:function(date,format){format=format+"";var result="",i_format=0,c="",token="",y=date.getYear()+"",M=date.getMonth()+1,d=date.getDate(),E=date.getDay(),H=date.getHours(),m=date.getMinutes(),s=date.getSeconds(),yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k,value=new Object();if(y.length<4)y=""+(y-0+1900);value.y=""+y;value.yyyy=y;value.yy=y.substring(2,4);value.M=M;value.MM=DateFormat.LZ(M);value.MMM=DateFormat.MONTH_NAMES[M-1];value.NNN=DateFormat.MONTH_NAMES[M+11];value.d=d;value.dd=DateFormat.LZ(d);value.E=DateFormat.DAY_NAMES[E+7];value.EE=DateFormat.DAY_NAMES[E];value.H=H;value.HH=DateFormat.LZ(H);if(H==0){value.h=12}else if(H>12){value.h=H-12}else value.h=H;value.hh=DateFormat.LZ(value.h);if(H>11){value.K=H-12}else value.K=H;value.k=H+1;value.KK=DateFormat.LZ(value.K);value.kk=DateFormat.LZ(value.k);if(H>11){value.a="PM"}else value.a="AM";value.m=m;value.mm=DateFormat.LZ(m);value.s=s;value.ss=DateFormat.LZ(s);while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length))token+=format.charAt(i_format++);if(value[token]!=null){result+=value[token]}else result+=token};return result},_isInteger:function(val){var digits="1234567890";for(var i=0;i<val.length;i++)if(digits.indexOf(val.charAt(i))==-1)return false;return true},_getInt:function(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length<minlength)return null;if(DateFormat._isInteger(token))return token};return null},parseFormat:function(val,format){val=val+"";format=format+"";var i_val=0,i_format=0,c="",token="",token2="",x,y,now=new Date(),year=now.getYear(),month=now.getMonth()+1,date=1,hh=now.getHours(),mm=now.getMinutes(),ss=now.getSeconds(),ampm="";while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length))token+=format.charAt(i_format++);if(token=="yyyy"||token=="yy"||token=="y"){if(token=="yyyy")x=4;y=4;if(token=="yy")x=2;y=2;if(token=="y")x=2;y=4;year=DateFormat._getInt(val,i_val,x,y);if(year==null)return 0;i_val+=year.length;if(year.length==2)if(year>70){year=1900+(year-0)}else year=2000+(year-0)}else if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i<DateFormat.MONTH_NAMES.length;i++){var month_name=DateFormat.MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase())if(token=="MMM"||(token=="NNN"&&i>11)){month=i+1;if(month>12)month-=12;i_val+=month_name.length;break}};if((month<1)||(month>12))return 0}else if(token=="EE"||token=="E"){for(var i=0;i<DateFormat.DAY_NAMES.length;i++){var day_name=DateFormat.DAY_NAMES[i];if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){i_val+=day_name.length;break}}}else if(token=="MM"||token=="M"){month=DateFormat._getInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12))return 0;i_val+=month.length}else if(token=="dd"||token=="d"){date=DateFormat._getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31))return 0;i_val+=date.length}else if(token=="hh"||token=="h"){hh=DateFormat._getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12))return 0;i_val+=hh.length}else if(token=="HH"||token=="H"){hh=DateFormat._getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23))return 0;i_val+=hh.length}else if(token=="KK"||token=="K"){hh=DateFormat._getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11))return 0;i_val+=hh.length}else if(token=="kk"||token=="k"){hh=DateFormat._getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24))return 0;i_val+=hh.length;hh--}else if(token=="mm"||token=="m"){mm=DateFormat._getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59))return 0;i_val+=mm.length}else if(token=="ss"||token=="s"){ss=DateFormat._getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59))return 0;i_val+=ss.length}else if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM"}else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM"}else return 0;i_val+=2}else if(val.substring(i_val,i_val+token.length)!=token){return 0}else i_val+=token.length};if(i_val!=val.length)return 0;if(month==2)if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(date>29)return 0}else if(date>28)return 0;if((month==4)||(month==6)||(month==9)||(month==11))if(date>30)return 0;if(hh<12&&ampm=="PM"){hh=hh-0+12}else if(hh>11&&ampm=="AM")hh-=12;var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate},parse:function(val,format){if(format){return DateFormat.parseFormat(val,format)}else{var preferEuro=(arguments.length==2)?arguments[1]:false,generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d'),monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d'),dateFirst=new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M'),checkList=[generalFormats,preferEuro?dateFirst:monthFirst,preferEuro?monthFirst:dateFirst],d=null;for(var i=0;i<checkList.length;i++){var l=checkList[i];for(var j=0;j<l.length;j++){d=DateFormat.parseFormat(val,l[j]);if(d!=0)return new Date(d)}};return null}}});DateFormat.prototype={initialize:function(format){this.format=format},parse:function(value){return DateFormat.parseFormat(value,this.format)},format:function(value){return DateFormat.format(value,this.format)}};Date.prototype.format=function(format){return DateFormat.format(this,format)};DOM={};DOM.Builder={IE_TRANSLATIONS:{'class':'className','for':'htmlFor'},ieAttrSet:function(attrs,attr,el){var trans;if(trans=this.IE_TRANSLATIONS[attr]){el[trans]=attrs[attr]}else if(attr=='style'){el.style.cssText=attrs[attr]}else if(attr.match(/^on/)){el[attr]=new Function(attrs[attr])}else el.setAttribute(attr,attrs[attr])},tagFunc:function(tag){return function(){var attrs,children;if(arguments.length>0)if(arguments[0].nodeName||typeof arguments[0]=="string"){children=arguments}else{attrs=arguments[0];children=[].slice.call(arguments,1)};return DOM.Builder.create(tag,attrs,children)}},create:function(tag,attrs,children){attrs=attrs||{};children=children||[];var isIE=navigator.userAgent.match(/MSIE/),el=document.createElement((isIE&&attrs.name)?"<"+tag+" name="+attrs.name+">":tag);for(var attr in attrs)if(typeof attrs[attr]!='function')if(isIE){this.ieAttrSet(attrs,attr,el)}else el.setAttribute(attr,attrs[attr]);for(var i=0;i<children.length;i++){if(typeof children[i]=='string')children[i]=document.createTextNode(children[i]);try{el.appendChild(children[i])}catch(e){console.error(e)}};return $(el)}};(function(){var els=("p|div|span|strong|em|img|table|tr|td|th|thead|tbody|tfoot|pre|code|h1|h2|h3|h4|h5|h6|ul|ol|li|form|input|textarea|legend|fieldset|select|option|blockquote|cite|br|hr|dd|dl|dt|address|a|button|abbr|acronym|script|link|style|bdo|ins|del|object|param|col|colgroup|optgroup|caption|label|dfn|kbd|samp|var|small").split("|"),el,i=0;while(el=els[i++])window['$'+el]=DOM.Builder.tagFunc(el)})();if(window.Control==undefined)Control={};Control.DatePicker=Class.create();Control.DatePicker.activePicker=null;Control.DatePicker.prototype={initialize:function(element,options){this.element=$(element);this.i18n=new Control.DatePicker.i18n(options&&options.locale?options.locale:'en_US');options=this.i18n.inheritOptions(options);this.options=Object.extend({onClick:this.pickerClicked.bind(this),onHover:this.dateHover.bind(this),onSelect:this.datePicked.bind(this)},options||{});this.options.currentFormat=this.options.timePicker?this.options.dateTimeFormat:this.options.dateFormat;this.options.date=DateFormat.parseFormat(this.element.value,this.options.currentFormat);this.datepicker=null;this.originalValue=null;this.hideTimeout=null;if(this.options.icon){this.icon=document.createElement('img');this.icon.src=this.options.icon;this.icon.title=this.tr('Open calendar');this.icon.className='inputExtension';var topOffset=/MSIE/.test(navigator.userAgent)?'1px':'3px';Element.setStyle(this.icon,{'vertical-align':'middle',display:'inline'});Element.insert(this.element,{after:this.icon});Event.observe(this.icon,'click',this.togglePicker.bindAsEventListener(this))}else Event.observe(this.element,'click',this.togglePicker.bindAsEventListener(this));this.hidePickerListener=this.delayedHide.bindAsEventListener(this);Event.observe(this.element,'keydown',this.keyHandler.bindAsEventListener(this));Event.observe(document,'keydown',this.docKeyHandler.bindAsEventListener(this));this.pickerActive=false},tr:function(str){return this.i18n.tr(str)},delayedHide:function(e){this.hideTimeout=setTimeout(this.hide.bind(this),100)},pickerClicked:function(){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=null}},datePicked:function(date){this.element.value=DateFormat.format(date,this.options.currentFormat);this.element.focus();this.hide()},dateHover:function(date){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=null};if(this.pickerActive)this.element.value=DateFormat.format(date,this.options.currentFormat)},togglePicker:function(e){if(this.pickerActive){this.element.value=this.originalValue;this.hide()}else this.show();Event.stop(e);return false},docKeyHandler:function(e){if(e.keyCode==Event.KEY_ESC)if(this.pickerActive){this.element.value=this.originalValue;this.hide()}},keyHandler:function(e){switch(e.keyCode){case Event.KEY_ESC:if(this.pickerActive)this.element.value=this.originalValue;case Event.KEY_TAB:this.hide();return;case Event.KEY_DOWN:if(!this.pickerActive){this.show();Event.stop(e)}};if(this.pickerActive)return false},hide:function(){if(this.pickerActive){this.datepicker.releaseKeys();Element.remove(this.datepicker.element);Event.stopObserving(document,'click',this.hidePickerListener,true);this.pickerActive=false;Control.DatePicker.activePicker=null}},show:function(){if(!this.pickerActive){if(Control.DatePicker.activePicker)Control.DatePicker.activePicker.hide();this.element.focus();if(!this.datepicker)this.datepicker=new Control.DatePickerPanel(this.options);this.originalValue=this.element.value;var pos=Position.cumulativeOffset(this.element),dim=Element.getDimensions(this.element),pickerTop=/MSIE/.test(navigator.userAgent)?(pos[1]+dim.height)+'px':(pos[1]+dim.height-1)+'px';this.datepicker.element.style.top=pickerTop;this.datepicker.element.style.left=pos[0]+'px';this.datepicker.selectDate(DateFormat.parseFormat(this.element.value,this.options.currentFormat));this.datepicker.captureKeys();document.body.appendChild(this.datepicker.element);Event.observe(document,'click',this.hidePickerListener,true);this.pickerActive=true;Control.DatePicker.activePicker=this;this.pickerClicked()}}};Control.DatePicker.i18n=Class.create();Object.extend(Control.DatePicker.i18n,{baseLocales:{us:{dateTimeFormat:'MM-dd-yyyy HH:mm',dateFormat:'MM-dd-yyyy',firstWeekDay:0,weekend:[0,6]},eu:{dateTimeFormat:'dd-MM-yyyy HH:mm',dateFormat:'dd-MM-yyyy',firstWeekDay:1,weekend:[0,6]},iso8601:{dateTimeFormat:'yyyy-MM-dd HH:mm',dateFormat:'yyyy-MM-dd',firstWeekDay:1,weekend:[0,6]},be:{dateTimeFormat:'dd/MM/yyyy HH:mm',dateFormat:'dd/MM/yyyy',firstWeekDay:1,weekend:[0,6]}},createLocale:function(base,lang){return Object.extend(Object.clone(Control.DatePicker.i18n.baseLocales[base]),{language:lang})}});Control.DatePicker.i18n.prototype={initialize:function(code){var lang=code.charAt(2)=='_'?code.substring(0,2):code,locale=(Control.DatePicker.Locale[code]||Control.DatePicker.Locale[lang]);this.opts=Object.clone(locale||{});var language=locale?Control.DatePicker.Language[locale.language]:null;if(language)Object.extend(this.opts,language)},opts:null,inheritOptions:function(options){if(!this.opts)this.setLocale('en_US');return Object.extend(this.opts,options||{})},tr:function(str){return this.opts&&this.opts.strings?this.opts.strings[str]||str:str}};Control.DatePicker.Locale={};with(Control.DatePicker){Locale.es=i18n.createLocale('eu','es');Locale.en=i18n.createLocale('us','en');Locale.en_GB=i18n.createLocale('eu','en');Locale.en_AU=Locale.en_GB;Locale.nl_BE=i18n.createLocale('be','nl');Locale.de=i18n.createLocale('eu','de');Locale.es_iso8601=i18n.createLocale('iso8601','es');Locale.en_iso8601=i18n.createLocale('iso8601','en');Locale.de_iso8601=i18n.createLocale('iso8601','de')};Control.DatePicker.Language={es:{months:['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Augosto','Septiembre','Octubre','Novimbre','Diciembre'],days:['Do','Lu','Ma','Mi','Ju','Vi','Sa'],strings:{Now:'Ahora',Today:'Hoy',Time:'Hora','Exact minutes':'Minuto exacto','Select Date and Time':'Selecciona Dia y Hora','Open calendar':'Abre calendario'}},de:{months:['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],days:['So','Mo','Di','Mi','Do','Fr','Sa'],strings:{Now:'Jetzt',Today:'Heute',Time:'Zeit','Exact minutes':'Exakte minuten','Select Date and Time':'Zeit und Datum Auswählen','Open calendar':'Kalender öffnen'}},nl:{months:['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December'],days:['Z','M','D','W','D','V','Z'],strings:{Now:'Nu',Today:'Vandaag',Time:'Tijd','Exact minutes':'Exacte minuten','Select Date and Time':'Datum en tijd selecteren','Open calendar':'Kalender openen'}}};Control.DatePickerPanel=Class.create();Object.extend(Control.DatePickerPanel.prototype,{initialize:function(options){this.i18n=new Control.DatePicker.i18n(options&&options.locale?options.locale:'en_US');options=this.i18n.inheritOptions(options);this.options=Object.extend({className:'datepickerControl',closeOnToday:true,selectToday:true,showOnFocus:false,timePicker:false,firstWeekDay:0,weekend:[0,6],months:['January','February','March','April','May','June','July','August','September','October','November','December'],days:['Su','Mo','Tu','We','Th','Fr','Sa']},options||{});with(this.options)if(isNaN(firstWeekDay*1)){firstWeekDay=0}else firstWeekDay=firstWeekDay%7;this.keysCaptured=false;this.calendarCont=null;this.currentDate=this.options.date?this.options.date:new Date();this.dayOfWeek=0;this.minInterval=5;this.selectedDay=null;this.selectedHour=null;this.selectedMinute=null;this.selectedAmPm=null;this.currentDays=[];this.hourCells=[];this.minuteCells=[];this.otherMinutes=null;this.amCell=null;this.pmCell=null;this.element=this.createPicker();this.selectDate(this.currentDate)},createPicker:function(){var elt=document.createElement('div');elt.style.position='absolute';elt.className=this.options.className;this.calendarCont=this.drawCalendar(elt,this.currentDate);Event.observe(elt,'click',this.clickHandler.bindAsEventListener(this));Event.observe(elt,'dblclick',this.dblClickHandler.bindAsEventListener(this));this.documentKeyListener=this.keyHandler.bindAsEventListener(this);if(this.options.captureKeys)this.captureKeys();return elt},tr:function(str){return this.i18n.tr(str)},captureKeys:function(){Event.observe(document,'keydown',this.documentKeyListener,true);this.keysCaptured=true},releaseKeys:function(){Event.stopObserving(document,'keydown',this.documentKeyListener,true);this.keysCaptured=false},setDate:function(date){if(date){while(this.calendarCont.firstChild)this.calendarCont.removeChild(this.calendarCont.firstChild);this.calendarCont.appendChild(this.createCalendar(date))}},drawCalendar:function(container,date){var calCont=container,calTable=this.createCalendar(date);if(this.options.timePicker){var timeTable;if(this.options.timePickerAdjacent){var rows=0,adjTable=document.createElement('table');adjTable.cellSpacing=0;adjTable.cellPadding=0;adjTable.border=0;row=adjTable.insertRow(0);cell=row.insertCell(0);cell.vAlign='top';cell.appendChild(calTable);calCont=cell;cell=row.insertCell(1);cell.style.width='5px';cell=row.insertCell(2);cell.vAlign='top';timeTable=document.createElement('table');timeTable.cellSpacing=0;timeTable.cellPadding=0;timeTable.border=0;cell.appendChild(timeTable);container.appendChild(adjTable);row=timeTable.insertRow(rows++);row.className='monthLabel';cell=row.insertCell(0);cell.colSpan=7;cell.innerHTML=this.tr('Time');row=timeTable.insertRow(rows++);cell=row.insertCell(0);cell.colSpan=7;cell.style.height='1px'}else{container.appendChild(calTable);timeTable=calTable;var rows=calTable.rows.length;row=timeTable.insertRow(rows++);cell=row.insertCell(0);cell.colSpan=7;var hr=document.createElement('hr');Element.setStyle(hr,{color:'gray',backgroundColor:'gray',height:'1px',border:'0',marginTop:'3px',marginBottom:'3px',padding:'0'});cell.appendChild(hr)};for(var j=0;j<2;++j){row=timeTable.insertRow(rows++);for(var i=0;i<6;++i){cell=row.insertCell(i);cell.className='hour';cell.width='14%';cell.innerHTML=(j*6)+i+1;cell.onclick=this.hourClickedListener((j*6)+i+1);this.hourCells[(j*6)+i]=cell};cell=row.insertCell(i);cell.className='ampm';cell.width='14%';if(j){cell.innerHTML=this.tr('PM');cell.onclick=this.pmClickedListener();this.pmCell=cell}else{cell.innerHTML=this.tr('AM');cell.onclick=this.amClickedListener();this.amCell=cell}};row=timeTable.insertRow(rows++);cell=row.insertCell(0);cell.colSpan=6;var hr=document.createElement('hr');Element.setStyle(hr,{color:'#CCCCCC',backgroundColor:'#CCCCCC',height:'1px',border:'0',marginTop:'2px',marginBottom:'2px',padding:'0'});cell.appendChild(hr);cell=row.insertCell(1);for(var j=0;j<(10/this.minInterval);++j){row=timeTable.insertRow(rows++);for(var i=0;i<6;++i){cell=row.insertCell(i);cell.className='minute';cell.width='14%';var minval=((j*6+i)*this.minInterval);if(minval<10)minval='0'+minval;cell.innerHTML=':'+minval;cell.onclick=this.minuteClickedListener(minval);this.minuteCells[(j*6)+i]=cell};cell=row.insertCell(i);cell.width='14%'};row=timeTable.insertRow(rows++);cell=row.insertCell(0);cell.style.textAlign='right';cell.colSpan=5;cell.innerHTML='<i>'+this.tr('Exact minutes')+':</i>';cell=row.insertCell(1);cell.className='otherminute';var otherInput=document.createElement('input');otherInput.type='text';otherInput.maxLength=2;otherInput.style.width='2em';var inputTimeout=null;otherInput.onkeyup=function(e){if(!isNaN(otherInput.value)){clearTimeout(inputTimeout);inputTimeout=setTimeout(function(){this.currentDate.setMinutes(otherInput.value);this.dateClicked(this.currentDate)}.bind(this),500)}}.bindAsEventListener(this);otherInput.onkeydown=function(e){if(e.keyCode==Event.KEY_RETURN)if(this.options.onSelect)this.options.onSelect(this.currentDate)}.bindAsEventListener(this);otherInput.onfocus=this.releaseKeys.bindAsEventListener(this);otherInput.onblur=this.captureKeys.bindAsEventListener(this);this.otherMinutes=otherInput;cell.appendChild(otherInput);cell=row.insertCell(2);row=timeTable.insertRow(rows++);cell=row.insertCell(0);cell.colSpan=7;hr=document.createElement('hr');Element.setStyle(hr,{color:'gray',backgroundColor:'gray',height:'1px',border:'0',marginTop:'3px',marginBottom:'3px',padding:'0'});cell.appendChild(hr);row=timeTable.insertRow(rows++);cell=row.insertCell(0);cell.colSpan=7;selectButton=document.createElement('input');selectButton.type='button';selectButton.value=this.tr('Select Date and Time');selectButton.onclick=function(e){this.options.onSelect&&this.options.onSelect(this.currentDate)}.bindAsEventListener(this);cell.appendChild(selectButton)}else calCont.appendChild(calTable);return calCont},createCalendar:function(date){this.currentDate=date;this.currentDays=[];var today=new Date(),previousYear=new Date(date.getFullYear()-1,date.getMonth(),1),previousMonth=new Date(date.getFullYear(),date.getMonth()-1,1),nextMonth=new Date(date.getFullYear(),date.getMonth()+1,1),nextYear=new Date(date.getFullYear()+1,date.getMonth(),1),row,cell,rows=0,calTable=document.createElement('table');calTable.cellSpacing=0;calTable.cellPadding=0;calTable.border=0;row=calTable.insertRow(rows++);row.className='monthLabel';cell=row.insertCell(0);cell.colSpan=7;cell.innerHTML=this.monthName(date.getMonth())+' '+date.getFullYear();row=calTable.insertRow(rows++);row.className='navigation';cell=row.insertCell(0);cell.className='navbutton';cell.title=this.monthName(previousYear.getMonth())+' '+previousYear.getFullYear();cell.onclick=this.movePreviousYearListener();cell.innerHTML='&lt;&lt;';cell=row.insertCell(1);cell.className='navbutton';cell.title=this.monthName(previousMonth.getMonth())+' '+previousMonth.getFullYear();cell.onclick=this.movePreviousMonthListener();cell.innerHTML='&lt;';cell=row.insertCell(2);cell.colSpan=3;cell.className='navbutton';cell.title=today.getDate()+' '+this.monthName(today.getMonth())+' '+today.getFullYear();cell.onclick=this.dateClickedListener(today,true);if(this.options.timePicker){cell.innerHTML=this.tr('Now')}else cell.innerHTML=this.tr('Today');cell=row.insertCell(3);cell.className='navbutton';cell.title=this.monthName(nextMonth.getMonth())+' '+nextMonth.getFullYear();cell.onclick=this.moveNextMonthListener();cell.innerHTML='&gt;';cell=row.insertCell(4);cell.className='navbutton';cell.title=this.monthName(nextYear.getMonth())+' '+nextYear.getFullYear();cell.onclick=this.moveNextYearListener();cell.innerHTML='&gt;&gt;';row=calTable.insertRow(rows++);row.className='dayLabel';for(var i=0;i<7;++i){cell=row.insertCell(i);cell.width='14%';cell.innerHTML=this.dayName((this.options.firstWeekDay+i)%7)};row=null;var workDate=new Date(date.getFullYear(),date.getMonth(),1),day=workDate.getDay(),j=0;if(day!=this.options.firstWeekDay){row=calTable.insertRow(rows++);row.className='calendarRow';workDate.setDate(workDate.getDate()-((day-this.options.firstWeekDay+7)%7));day=workDate.getDay();while(workDate.getMonth()!=date.getMonth()){cell=row.insertCell(row.cells.length);this.assignDayClasses(cell,'dayothermonth',workDate);cell.innerHTML=workDate.getDate();cell.onclick=this.dateClickedListener(workDate);workDate.setDate(workDate.getDate()+1);day=workDate.getDay()}};while(workDate.getMonth()==date.getMonth()){if(day==this.options.firstWeekDay){row=calTable.insertRow(rows++);row.className='calendarRow'};cell=row.insertCell(row.cells.length);this.assignDayClasses(cell,'day',workDate);cell.innerHTML=workDate.getDate();cell.onclick=this.dateClickedListener(workDate);this.currentDays[workDate.getDate()]=cell;workDate.setDate(workDate.getDate()+1);day=workDate.getDay()};if(day!=this.options.firstWeekDay)do{cell=row.insertCell(row.cells.length);this.assignDayClasses(cell,'dayothermonth',workDate);cell.innerHTML=workDate.getDate();var thisDate=new Date(workDate.getTime());cell.onclick=this.dateClickedListener(workDate);workDate.setDate(workDate.getDate()+1);day=workDate.getDay()}while(workDate.getDay()!=this.options.firstWeekDay);return calTable},movePreviousMonthListener:function(){return function(e){var prevMonth=new Date(this.currentDate.getFullYear(),this.currentDate.getMonth()-1,this.currentDate.getDate(),this.currentDate.getHours(),this.currentDate.getMinutes());if(prevMonth.getMonth()!=(this.currentDate.getMonth()+11)%12)prevMonth.setDate(0);this.selectDate(prevMonth)}.bindAsEventListener(this)},moveNextMonthListener:function(){return function(e){var nextMonth=new Date(this.currentDate.getFullYear(),this.currentDate.getMonth()+1,this.currentDate.getDate(),this.currentDate.getHours(),this.currentDate.getMinutes());if(nextMonth.getMonth()!=(this.currentDate.getMonth()+1)%12)nextMonth.setDate(0);this.selectDate(nextMonth)}.bindAsEventListener(this)},moveNextYearListener:function(){return function(e){var nextYear=new Date(this.currentDate.getFullYear()+1,this.currentDate.getMonth(),this.currentDate.getDate(),this.currentDate.getHours(),this.currentDate.getMinutes());if(nextYear.getMonth()!=this.currentDate.getMonth())nextYear.setDate(0);this.selectDate(nextYear)}.bindAsEventListener(this)},movePreviousYearListener:function(){return function(e){var prevYear=new Date(this.currentDate.getFullYear()-1,this.currentDate.getMonth(),this.currentDate.getDate(),this.currentDate.getHours(),this.currentDate.getMinutes());if(prevYear.getMonth()!=this.currentDate.getMonth())prevYear.setDate(0);this.selectDate(prevYear)}.bindAsEventListener(this)},dateClickedListener:function(date,timeOverride){var dateCopy=new Date(date.getTime());return function(e){if(!timeOverride){dateCopy.setHours(this.currentDate.getHours());dateCopy.setMinutes(this.currentDate.getMinutes())};this.dateClicked(dateCopy)}.bindAsEventListener(this)},hourClickedListener:function(hour){return function(e){this.hourClicked(hour)}.bindAsEventListener(this)},minuteClickedListener:function(minutes){return function(e){this.currentDate.setMinutes(minutes);this.dateClicked(this.currentDate)}.bindAsEventListener(this)},amClickedListener:function(){return function(e){if(this.selectedAmPm==this.pmCell){this.currentDate.setHours(this.currentDate.getHours()-12);this.dateClicked(this.currentDate)}}.bindAsEventListener(this)},pmClickedListener:function(){return function(e){if(this.selectedAmPm==this.amCell){this.currentDate.setHours(this.currentDate.getHours()+12);this.dateClicked(this.currentDate)}}.bindAsEventListener(this)},assignDayClasses:function(cell,baseClass,date){var today=new Date();Element.addClassName(cell,baseClass);if(date.getFullYear()==today.getFullYear()&&date.getMonth()==today.getMonth()&&date.getDate()==today.getDate())Element.addClassName(cell,'today');if(this.options.weekend.include(date.getDay()))Element.addClassName(cell,'weekend')},monthName:function(month){return this.options.months[month]},dayName:function(day){return this.options.days[day]},dblClickHandler:function(e){if(this.options.onSelect)this.options.onSelect(this.currentDate);Event.stop(e)},clickHandler:function(e){if(this.options.onClick)this.options.onClick();Event.stop(e)},hoverHandler:function(e){if(this.options.onHover)this.options.onHover(date)},keyHandler:function(e){var days=0;switch(e.keyCode){case Event.KEY_RETURN:if(this.options.onSelect)this.options.onSelect(this.currentDate);break;case Event.KEY_LEFT:days=-1;break;case Event.KEY_UP:days=-7;break;case Event.KEY_RIGHT:days=1;break;case Event.KEY_DOWN:days=7;break;case 33:var lastMonth=new Date(this.currentDate.getFullYear(),this.currentDate.getMonth()-1,this.currentDate.getDate());days=-this.getDaysOfMonth(lastMonth);break;case 34:days=this.getDaysOfMonth(this.currentDate);break;case 13:this.dateClicked(this.currentDate);break;default:return};if(days!=0){var moveDate=new Date(this.currentDate.getFullYear(),this.currentDate.getMonth(),this.currentDate.getDate()+days);moveDate.setHours(this.currentDate.getHours());moveDate.setMinutes(this.currentDate.getMinutes());this.selectDate(moveDate)};Event.stop(e);return false},getDaysOfMonth:function(date){var lastDay=new Date(date.getFullYear(),date.getMonth()+1,0);return lastDay.getDate()},getNextMonth:function(month,year,increment){if(p_Month==11){return[0,year+1]}else return[month+1,year]},getPrevMonth:function(month,year,increment){if(p_Month==0){return[11,year-1]}else return[month-1,year]},dateClicked:function(date){if(date){if(!this.options.timePicker&&this.options.onSelect)this.options.onSelect(date);this.selectDate(date)}},hourClicked:function(hour){if(hour==12){if(this.selectedAmPm==this.amCell)hour=0}else if(this.selectedAmPm==this.pmCell)hour+=12;this.currentDate.setHours(hour);this.dateClicked(this.currentDate)},selectDate:function(date){if(date){if(date.getMonth()!=this.currentDate.getMonth()||date.getFullYear()!=this.currentDate.getFullYear()){this.setDate(date)}else this.currentDate=date;if(date.getDate()<this.currentDays.length){if(this.selectedDay)Element.removeClassName(this.selectedDay,'current');this.selectedDay=this.currentDays[date.getDate()];Element.addClassName(this.selectedDay,'current')};if(this.options.timePicker){var hours=date.getHours();if(this.selectedHour)Element.removeClassName(this.selectedHour,'current');this.selectedHour=this.hourCells[hours%12?(hours%12)-1:11];Element.addClassName(this.selectedHour,'current');if(this.selectedAmPm)Element.removeClassName(this.selectedAmPm,'current');this.selectedAmPm=(hours<12?this.amCell:this.pmCell);Element.addClassName(this.selectedAmPm,'current');var minutes=date.getMinutes();if(this.selectedMinute)Element.removeClassName(this.selectedMinute,'current');Element.removeClassName(this.otherMinutes,'current');if(minutes%this.minInterval==0){this.otherMinutes.value=null;this.selectedMinute=this.minuteCells[minutes/this.minInterval];Element.addClassName(this.selectedMinute,'current')}else{this.otherMinutes.value=minutes;Element.addClassName(this.otherMinutes,'current')}};if(this.options.onHover)this.options.onHover(date)}}});var DomLoaded={loaded:false,registered:[],execute:function(func){if(DomLoaded.loaded){func.call()}else DomLoaded.registered.push(func)},process:function(){DomLoaded.loaded=true;while(func=DomLoaded.registered.pop())func.call()}};Event.observe(document,'dom:loaded',function(){DomLoaded.process()})
function open_organisation_functions(id,name){var win=new Window('manageFunctions',{title:"Beheer Functies voor "+name,width:window.innerWidth-100,height:window.innerHeight-100,resizable:false,minimizable:false,maximizable:false,draggable:false,destroyOnClose:true});win.setAjaxContent(Constants.baseUrl+'/organisations/manageFunctions?organisation='+id,{evalJS:true},true,true)}
function add_row(table_id,create_function){var row=create_function.call(),parent=$(table_id);if(parent.lastChild.nodeName.toLowerCase()=="tbody")parent=parent.lastChild;parent.appendChild(row)}
function removeChildren(el){for(var i=el.childNodes.length-1;i>=0;i--)el.removeChild(el.childNodes[i])}
function removeRow(e){if(!e)e=window.event;var el=e.target?e.target:e.srcElement,tr=el.parentNode;while(tr.nodeName.toLowerCase()!='tr')tr=tr.parentNode;tr.parentNode.removeChild(tr)}
function cleanText(text){var result="";text=text.toLowerCase();for(var idx=0,len=text.length;idx<len;idx++){var kar=text.charAt(idx);if((kar>='0'&&kar<='9')||(kar>='a'&&kar<='z'))result+=kar};return result}
function multiToggleByCheckbox(id,toggleAll){if($(id)&&$(id+"_overview")){var checked=$(id).checked;$$('#'+id+'_overview div').each(function(div){if(checked){div.show()}else div.hide()});$$('#'+id+'_overview input').each(function(input){input.checked=checked&&toggleAll});if(checked){$(id+'_overview').show()}else $(id+'_overview').hide()}}
function toggleByCheckbox(id){if($(id))if($(id).checked){$(id+"_overview").show()}else $(id+"_overview").hide()}
function showInformationLabel(id){var label=$(id+"_info_label");if(label){var info=$(id+"_info");if(info){var offsets=label.positionedOffset();info.style.left=(offsets.left+label.getWidth()+15)+"px";info.style.top=(offsets.top+label.getHeight())+"px";info.show()}}}
function hideInformationLabel(id){$(id+"_info").hide()}
function erase_input(id,value){var el=$(id);if(el.value==value)el.value=''}
function restore_input(id,value){var el=$(id);if(el.value=='')el.value=value}
function validate_time(e){if(!e)var e=window.event;var el=e.target?e.target:e.srcElement,str=el.value;if(str.indexOf(':')==-1){alert('Geen geldige tijd ingegeven (formaat hh:mm)');el.value='0:00'}else{var parts=str.split(':'),h=parseInt(parts[0])%24,m=parseInt(parts[1])%60;if(h<0)h=0;if(m<0)m=0;var res=h+':'+pad(m,2,'0');if(res!=el.value){if(res=='NaN:NaN')res='0:00';el.value=res}}}
function pad(str,len,prefix){str=str+"";while(str.length<len)str=prefix+str;return str}
function printPage(){if($('content')){new Ajax.Request(Constants.baseUrl+"/util/savePrintData",{method:'post',postBody:'content='+escape($('content').innerHTML),onComplete:function(res){window.location=Constants.baseUrl+"/util/printPage"}})}else alert('Deze pagina kan niet geprint worden')};var DomUtil={toggle:function(id){var el=$(id),minus=$(id+'-minus'),plus=$(id+'-plus');if(el.visible()){el.hide();minus.hide();plus.show()}else{el.show();minus.show();plus.hide()}},switchElements:function(el1,el2){var parent=el1.parentNode,n1=el1.next(),n2=el2.next();if(n1&&n1.identify()==el2.identify()){el2.remove();parent.insertBefore(el2,el1);return};if(n2&&n2.identify()==el1.identify()){el1.remove();parent.insertBefore(el1,el2);return};el1.remove();el2.remove();if(n1){parent.insertBefore(el2,n1)}else parent.appendChild(el2);if(n2){parent.insertBefore(el1,n2)}else parent.appendChild(el1)}},Content={favorite:function(id,callback,folderNames){var elements={favorite:false,callback:callback},el=$('fav-'+id);if(el.hasClassName('favorited')){el.removeClassName('favorited');el.addClassName('favoritable')}else{el.addClassName('favorited');el.removeClassName('favoritable');elements.favorite=true;if(folderNames)if(folderNames.length>1){var options=$select({style:'width: 100%;'});$A(folderNames).each(function(obj){options.appendChild($option({value:obj.value},obj.key))});var panel=$div($div({style:'padding: 5px;'},'In welke map bewaren?'),$div({style:'margin: 5px auto;'},options));Popup._content(panel,function(){new Ajax.Request('/content/favorite?id='+id+(options.value==''?'':'&folder='+options.value),{onSuccess:function(){elements.callback(elements.favorite)}})},'ok','annuleren');return}};new Ajax.Request('/content/favorite?id='+id,{onSuccess:function(){elements.callback(elements.favorite)}})},favoriteMap:function(parentId){if(parentId==undefined)parentId="";Popup.prompt("Gelieve de naam van de map op te geven",function(name){window.location="/dev.php/content/favoriteMap?name="+escape(name)+"&parent="+parentId+"&redirect="+escape(window.location.href)},'','aanmaken','annuleren')}}
function showTab(id){if($(id)&&$(id+'-tab')){$$('.tabs a').each(function(a){a.removeClassName('active')});$(id+'-tab').addClassName('active');$$('.tab').each(function(el){el.hide()});$(id).show()}};var Popup={_INTERNAL_COUNTER:0,windows:[],show:function(id,content,classes){classes=classes||"";var block=$div({id:id,'class':'popup_content '+classes},content);if(Popup.windows.length>0)Popup.windows.last().addClassName('faded');Popup.windows.push(block);$('popups').style.display='block';document.body.style.overflow='hidden';document.body.appendChild(block);var view=document.viewport.getDimensions(),dim=content.getDimensions(),scroll=document.viewport.getScrollOffsets();$('popups').style.top=scroll[1]+"px";$('popups').style.width=view.width;$('popups').style.height=view.height;var w=dim.width,h=dim.height;if(w>940)w=940;if(h>view.height-40)h=view.height-40;var t=scroll[1]+Math.ceil((view.height-h)/2),l=Math.ceil((view.width-w)/2);block.style.top=t+"px";block.style.left=l+"px";block.style.width=w+"px";block.style.height=h+"px"},hide:function(id){var block=$(id);if(block){block.remove();Popup.windows.splice(Popup.windows.indexOf(block),1);if(Popup.windows.length==0){$('popups').hide();document.body.style.overflow=''}else{var newBlock=Popup.windows.last();newBlock.removeClassName('faded')}}},alert:function(info,okText){Popup._content($p(info),null,okText,'annuleren','alert')},confirm:function(info,callback,okText,cancelText){Popup._content($p(info),callback,okText,cancelText,'confirm')},prompt:function(info,callback,defaultText,okText,cancelText){if(defaultText==undefined)defaultText='';var elements={callback:callback};elements.block=$div($p(info),elements.text=$input({value:defaultText}));Popup._content(elements.block,function(){elements.callback(elements.text.value)},okText,cancelText,'prompt')},bigPrompt:function(info,callback,defaultText,okText,cancelText){if(defaultText==undefined)defaultText='';var elements={callback:callback};elements.block=$div($p(info),elements.text=$textarea(defaultText));Popup._content(elements.block,function(){elements.callback(elements.text.value)},okText,cancelText,'big_prompt')},iframe:function(url,width,height){width=width||800;height=height||600;var view=document.viewport.getDimensions();height=Math.min(height,view.height-120);var content=new Element('iframe',{src:url,style:"width: "+width+"px; height: "+height+"px;"});Popup.show(Popup._generateId(),content,'noscrollbars')},closeCurrent:function(){window.parent.Popup.windows.each(function(win){if(win.firstChild.nodeName.toLowerCase()=="iframe")if(win.firstChild.contentWindow==window)window.parent.Popup.hide(win.identify())})},_content:function(content,callback,okText,cancelText,className){if(callback==undefined)callback=null;if(okText==undefined)okText="ok";if(cancelText==undefined)cancelText="annuleren";var elements={id:Popup._generateId(),callback:callback};elements.ok=$button({'class':'halve'},okText);var buttons=$div(elements.ok);if(callback){elements.cancel=$button({'class':'halve'},cancelText);buttons.appendChild(elements.cancel);elements.cancel.observe('click',function(){Popup.hide(elements.id)})};elements.block=$div({'class':className},content,buttons);elements.ok.observe('click',function(){Popup.hide(elements.id);if(elements.callback)elements.callback()});Popup.show(elements.id,elements.block)},_generateId:function(){return"popup-"+ Popup._INTERNAL_COUNTER++},open:function(id,url,title){var t=document.viewport.getScrollOffsets().top,w=575,l=Math.round((document.viewport.getWidth()-w)/2),h=document.viewport.getHeight()-160,win=new Window(id,{className:"internalpopup",top:t+15,left:l,width:w,minWidth:w,destroyOnClose:true,height:h,maxHeight:h,draggable:false});if(title)win.setTitle(title);if(url.substring(0,7)!='http://')url=Constants.baseUrl+"/"+url;win.setHTMLContent('<div id="frame" style="width: 100%; height: 100%;"></div>');window.setTimeout(function(){var iframe=document.createElement('iframe');iframe.src=url;iframe.style.width='100%';iframe.style.height='100%';$('frame').appendChild(iframe)},500);win.show()},close:function(id){Windows.closeAll()}}
function showAlert(id,url,title){Popup.open(id,url,title)}
function closeAlert(id){Popup.close(id)}
function showMonth(month,year,workgroup){new Ajax.Updater('activities',Constants.baseUrl+"/activity/ajaxCalendarMonth?month="+month+"&year="+year+"&workgroup="+workgroup,{method:'get'})}
function showActivities(time){var div=$('locations-'+time);if(div)div.show()}
function hideActivities(time){var div=$('locations-'+time);if(div)div.hide()};var Cookies={create:function(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString()};document.cookie=name+"="+value+expires+"; path=/"},read:function(name){var nameEQ=name+"=",ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)};return null},erase:function(name){Cookies.create(name,"",-1)}},UserHelper={setParameter:function(name,value){new Ajax.Request(Constants.baseUrl+"/util/saveParameter?name="+escape(name)+"&value="+escape(value),{asynchronous:false})}},InputController={toggleCheckboxes:function(checked,className){$$('.'+className).each(function(input){input.checked=checked})}},DirtyManager={dirty:false,init:function(){var count=0;$$('form.dirtable').each(function(form){new Form.EventObserver(form,function(element,value){DirtyManager.setDirty()});Event.observe(form,'submit',DirtyManager.setClean);count++});if(count>0)Event.observe(window,'beforeunload',function(e){if(DirtyManager.dirty){var message='U hebt niet-opgeslagen wijzigingen aangebracht. Bent u zeker dat u deze niet wilt opslaan?';if(typeof e=='undefined')e=window.event;if(e)e.returnValue=message;return message}})},setClean:function(){DirtyManager.dirty=false},setDirty:function(){DirtyManager.dirty=true}};DomLoaded.execute(function(){DirtyManager.init()});var OrganisationTool={changeOwner:function(elId,organisationId){var email=prompt('Gelieve het e-mailadres van de nieuwe verantwoordelijke gebruiker in te geven.');if(email&&email!="")new Ajax.Request('/organisations/ajaxChangeResponsibleUser?id='+organisationId+'&mail='+escape(email),{method:'GET',onSuccess:function(res){var data=res.responseText.evalJSON();if(data)if(data.error){alert(data.error)}else if(data.success&&$(elId)){$(elId).innerHTML=data.success;alert('Verantwoordelijke gebruiker succesvol aangepast')}}})}},FormRepeater=Class.create({initialize:function(options){this.ID=0;this.count=0;this.prefix=options.prefix||"row_id";this.afterAdd=options.afterAdd||function(){};this.afterDelete=options.afterDelete||function(){};this.removeClass=options.removeClass||"delete";this.upClass=options.upClass||"up";this.downClass=options.downClass||"down";this.modelName=options.modelName;this.positionClass=options.positionClass||"position";this.minRows=options.minRows||0;this.maxRows=options.maxRows||-1;this.str=options.str||false;this.confirmDelete=options.confirmDelete||"";this.container=$(options.containerId);this.entry=this.container.immediateDescendants().first();this.entry.remove();$(options.addId).observe('click',function(){this.add()}.bind(this))},add:function(options){if(this.maxRows!=-1&&this.maxRows<=this.count)return;var rowId=this.ID++;this.count++;var entry=this.entry.cloneNode(true);entry.select('*').each(function(element){if(element.id)element.id=element.id.replace("#{"+this.prefix+"}",rowId);if(element.name)element.name=element.name.replace("#{"+this.prefix+"}",rowId);if(element.hasAttribute('for'))element.setAttribute('for',element.getAttribute('for').replace("#{"+this.prefix+"}",rowId));element.className=element.className.replace("#{"+this.prefix+"}",rowId)}.bind(this));entry.select('.'+this.positionClass).each(function(input){input.value=rowId});entry.select("."+this.removeClass).each(function(del){del.observe('click',function(){if(this.count>this.minRows)if(this.confirmDelete!=""){Popup.confirm(this.confirmDelete,function(){entry.remove();this.count--;this.afterDelete(rowId)}.bind(this),'verwijderen','annuleren')}else{entry.remove();this.count--;this.afterDelete(rowId)}}.bind(this))}.bind(this));entry.select('.'+this.upClass).each(function(up){up.observe('click',function(){var prev=entry.previous();if(prev){entry.parentNode.removeChild(entry);prev.parentNode.insertBefore(entry,prev);var prevId=-1,nextId=-1;prev.select("."+this.positionClass).each(function(input){prevId=input.value});entry.select("."+this.positionClass).each(function(input){nextId=input.value;input.value=prevId});prev.select("."+this.positionClass).each(function(input){input.value=nextId})}}.bind(this))}.bind(this));entry.select('.'+this.downClass).each(function(down){down.observe('click',function(){var next=entry.next();if(next){next.parentNode.removeChild(next);entry.parentNode.insertBefore(next,entry);var prevId=-1,nextId=-1;next.select("."+this.positionClass).each(function(input){nextId=input.value});entry.select("."+this.positionClass).each(function(input){prevId=input.value;input.value=nextId});next.select("."+this.positionClass).each(function(input){input.value=prevId})}}.bind(this))}.bind(this));if(options)if(this.str){entry.select('.attr').each(function(input){input.value=options})}else entry.select('.attr').each(function(input){if(input.name){var attr=input.name.substring(input.name.lastIndexOf('[')+1,input.name.length-1);if(typeof options[attr]!='undefined')if(input.type=='checkbox'){input.checked=options[attr]}else input.value=options[attr]}}.bind(this));this.container.appendChild(entry);this.afterAdd(entry,rowId,options)}}),Accordion=Class.create({initialize:function(container_id,options){if(options==undefined)options={};var content_class=options.content_class||"accordion_content",header_class=options.header_class||"accordion_header";this.active_header=options.active_header_class||"active_accordion_header";this.active_content=options.active_content_class||"active_accordion_content";this.vertical=options.vertical||true;var id=0;this.headers={};this.elements=[];var first=null;$$('#'+container_id+' .'+header_class).each(function(header){if(id==0)first=header;header.observe('click',function(){this.show(header)}.bind(this));var content=header.next("."+content_class);content.hide();this.headers[header.identify()]=id;this.elements[id]=content;id++}.bind(this));this.current_id=-1;this.current=null;this.current_header=null;this.show(first)},show:function(header){var id=header.identify();if(id==this.current_id)return;if(this.current){this.current.removeClassName(this.active_content);this.current_header.removeClassName(this.active_header);Effect.BlindUp(this.current,{duration:0.5})};this.current_id=id;this.current=this.elements[this.headers[id]];this.current_header=header;this.current.addClassName(this.active_content);this.current_header.addClassName(this.active_header);Effect.BlindDown(this.current,{restoreAfterFinish:false,duration:0.5})}}),CitiesData={zipMap:{},citiesMap:{},_listeners:{},addListener:function(prefix,func){if(CitiesData._listeners[prefix]==undefined)CitiesData._listeners[prefix]=[];CitiesData._listeners[prefix].push(func)},notifiyListeners:function(prefix,city,zipCode){if(CitiesData._listeners[prefix]!=undefined)$A(CitiesData._listeners[prefix]).each(function(f){f.call(city,zipCode)})}},CitySelector=Class.create({initialize:function(prefix){this.prefix=prefix;$(this.prefix+'_city').observe('blur',function(){setTimeout(function(){$(this.prefix+'_zipcode_multiple').hide()}.bind(this),300)}.bind(this));$(this.prefix+"_zipcode").observe("blur",function(){var input=$(this.prefix+'_zipcode');if(input.value.length>0&&(values=CitiesData.zipMap[cleanText(input.value)]))if(values.length==1){$(this.prefix+'_city').value=values[0]}else{var row=$(this.prefix+'_zipcode_multiple'),data=$(this.prefix+'_zipcode_multiple_data');data.innerHTML='';var index=0;values.each(function(value){if(index>0)data.appendChild($span(" of "));var anchor=$a({href:'javascript:void(0);'},value);data.appendChild(anchor);anchor.observe('click',function(){$(this.prefix+'_city').value=value;$(this.prefix+'_city').focus();$(this.prefix+'_zipcode_multiple').hide()}.bindAsEventListener(this));index++}.bindAsEventListener(this));row.show()}}.bind(this));$(this.prefix+'_city').observe('blur',function(){var input=$(this.prefix+'_city');if(input.value&&(values=CitiesData.citiesMap[cleanText(input.value)]))if(values.length==1){$(this.prefix+'_zipcode').value=values[0]}else{var row=$(this.prefix+'_city_multiple'),data=$(this.prefix+'_city_multiple_data');data.innerHTML='';var index=0;values.each(function(value){if(index>0)data.appendChild($span(" of "));var anchor=$a({href:'javascript:void(0);'},value);data.appendChild(anchor);Event.observe(anchor,'click',function(){$(this.prefix+'_zipcode').value=value;$(this.prefix+'_zipcode').focus();$(this.prefix+'_city_multiple').hide()}.bindAsEventListener(this));index++}.bind(this));row.show()}}.bind(this))}}),AddressSelector=Class.create({initialize:function(prefix,classPrefix){this.prefix=prefix;this.classPrefix=classPrefix;$(prefix+"_addstreet").observe('click',function(){this.addStreet()}.bind(this));$(prefix+"_confirm_city").observe('click',function(){this.confirmCity()}.bind(this))},loadStreets:function(func){if(func==undefined)func=function(){};var zipcodeField=$(this.prefix+'_zipcode'),cityField=$(this.prefix+'_city');if(zipcodeField.value!=''&&cityField.value!=''){var url=Constants.baseUrl+'/util/streets?zipcode='+zipcodeField.value+'&city='+cityField.value;new Ajax.Request(url,{method:'get',onSuccess:function(res){var data=res.responseText.evalJSON();if(data.error==undefined){var select=$(this.prefix+'_street_id');for(var i=select.childNodes.length-1;i>=0;i--)select.removeChild(select.childNodes[i]);for(var i=0,l=data.streets.length;i<l;i++)select.appendChild($option({value:data.streets[i].id},data.streets[i].name));func.call()}else alert(data.error)}.bind(this),onFailure:function(res){if(Constants.debug)alert('Er ging iets mis met de ajax request')}})}},addStreet:function(){var zipcode=$F(this.prefix+'_zipcode'),city=$F(this.prefix+'_city'),street=prompt('Gelieve uw straatnaam in te geven');if(street!=''&&street!=null)new Ajax.Request(Constants.baseUrl+'/util/createStreet?city='+city+'&zipcode='+zipcode+'&street='+street,{method:'get',onSuccess:function(res){try{var data=res.responseText.evalJSON();if(data.error==undefined){$(this.prefix+'_street_id').appendChild($option({value:data.id,selected:'selected'},data.name))}else alert(data.error)}catch(e){}}.bind(this),onFailure:function(res){if(Constants.debug)alert('Er ging iets mis met de ajax request')}});return false},confirmCity:function(){this.loadStreets(function(){var zipcodeField=$(this.prefix+'_zipcode'),cityField=$(this.prefix+'_city');zipcodeField.setAttribute('readonly','readonly');zipcodeField.addClassName('disabled');cityField.setAttribute('readonly','readonly');cityField.addClassName('disabled');$(this.prefix+'_confirm_city').hide();$$('.'+this.classPrefix+'address').each(function(el){el.show()});$$('.'+this.classPrefix+'address input').each(function(input){input.removeAttribute('readonly');input.removeAttribute('readOnly');input.removeClassName('disabled')});$$('.'+this.classPrefix+'address select').each(function(select){select.removeAttribute('readonly');select.removeAttribute('readOnly');select.removeClassName('disabled')})}.bind(this));return false}}),Autosave=Class.create({initialize:function(name,fieldId,timeout,saveUrl){this.name=name;this.fieldId=fieldId;this.timeout=timeout;this.saveUrl=saveUrl;setTimeout(this.save.bind(this),this.timeout);var restore=$('restore_'+fieldId+'_concept');if(restore){restore.show();$('restore_'+fieldId+'_concept_link').observe('click',this.restore.bind(this))}},save:function(){showAutoSave();new Ajax.Request(this.saveUrl,{method:'post',postBody:'text='+escape(CKEDITOR.instances[this.name].getData()),onSuccess:function(res){hideAutoSave()},onFailure:function(res){hideAutoSave()}});setTimeout(this.save.bind(this),this.timeout)},restore:function(){var text=$F("concept-"+this.fieldId);CKEDITOR.instances[this.name].setData(text);$('restore_'+this.fieldId+'_concept').hide()}}),WorkgroupManager={moveWorkgroupTop:function(el){var tr=Element.up(el,'tr'),prev=tr.parentNode.firstDescendant();if(prev!=tr){tr.remove();prev.parentNode.insertBefore(tr,prev);WorkgroupManager.saveWorkgroupOrder()}},moveWorkgroupBottom:function(el){var tr=Element.up(el,'tr'),next=tr.parentNode.immediateDescendants().last();if(tr!=next){tr.remove();next.parentNode.appendChild(tr);WorkgroupManager.saveWorkgroupOrder()}},moveWorkgroupUp:function(el){var tr=Element.up(el,'tr'),prev=tr.previous('tr');if(prev){DomUtil.switchElements(tr,prev);WorkgroupManager.saveWorkgroupOrder()}},moveWorkgroupDown:function(el){var tr=Element.up(el,'tr'),next=tr.next('tr');if(next){DomUtil.switchElements(tr,next);WorkgroupManager.saveWorkgroupOrder()}},saveWorkgroupOrder:function(){var wgs=$$('.wg'),result="";for(var i=0,l=wgs.length;i<l;i++){if(i>0)result+="|";result+=wgs[i].value};new Ajax.Request(Constants.baseUrl+"/workgroups/saveOrder?order="+result,{})}},PrivacyManager={NONE:0,EVERYBODY:1,REGISTERED:2,SPECIFIED:3,PRO_ALL:4,COLLEGUES:5,WORKGROUPS_ALL:6,showRule:function(el,label,type,option){var id=$(el).identify();Popup.iframe('/util/privacyRuleConfig?opener='+id+'&type='+type+'&option='+option+'&label='+label,350,500)},updateRule:function(id,label){if($(id))$(id).firstChild.data=label},evaluateTopRule:function(){var hide=$F('rule_top')!=PrivacyManager.SPECIFIED;$$('.sub').invoke(hide?'hide':'show')},evaluateProsToggleRule:function(){if($('rule_pros').checked){$('rule_pro_details').removeAttribute('disabled');$('pro-area').show()}else{$('rule_pro_details').setAttribute('disabled','disabled');$('pro-area').hide()}},evaluteProsSelectRule:function(){if($F('rule_pro_details')==PrivacyManager.SPECIFIED){$('privacy-organisations').show()}else $('privacy-organisations').hide()},evaluateWorkgroupsToggleRule:function(){if($('rule_workgroups').checked){$('rule_workgroup_details').removeAttribute('disabled');$('workgroup-area').show()}else{$('rule_workgroup_details').setAttribute('disabled','disabled');$('workgroup-area').show()}},evaluateWorkgroupsSelectRule:function(){if($F('rule_workgroup_details')==PrivacyManager.SPECIFIED){$('privacy-workgroups').show()}else $('privacy-workgroups').hide()}},persisteduls=new Object(),ddtreemenu=new Object();ddtreemenu.closefolder="images/filetypes/folder.png";ddtreemenu.openfolder="images/filetypes/folder.png";ddtreemenu.createTree=function(treeid,enablepersist,persistdays){var ultags=document.getElementById(treeid).getElementsByTagName("ul");if(typeof persisteduls[treeid]=="undefined")persisteduls[treeid]=(enablepersist==true&&ddtreemenu.getCookie(treeid)!="")?ddtreemenu.getCookie(treeid).split(","):"";for(var i=0;i<ultags.length;i++)ddtreemenu.buildSubTree(treeid,ultags[i],i);if(enablepersist==true){var durationdays=(typeof persistdays=="undefined")?1:parseInt(persistdays);ddtreemenu.dotask(window,function(){ddtreemenu.rememberstate(treeid,durationdays)},"unload")}};ddtreemenu.buildSubTree=function(treeid,ulelement,index){ulelement.parentNode.className="submenu";if(typeof persisteduls[treeid]=="object"){if(ddtreemenu.searcharray(persisteduls[treeid],index)){ulelement.setAttribute("rel","open");ulelement.style.display="block";ulelement.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")"}else ulelement.setAttribute("rel","closed")}else if(ulelement.getAttribute("rel")==null||ulelement.getAttribute("rel")==false){ulelement.setAttribute("rel","closed")}else if(ulelement.getAttribute("rel")=="open")ddtreemenu.expandSubTree(treeid,ulelement);ulelement.parentNode.onclick=function(e){var submenu=this.getElementsByTagName("ul")[0];if(submenu.getAttribute("rel")=="closed"){submenu.style.display="block";submenu.setAttribute("rel","open");ulelement.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")"}else if(submenu.getAttribute("rel")=="open"){submenu.style.display="none";submenu.setAttribute("rel","closed");ulelement.parentNode.style.backgroundImage="url("+ddtreemenu.closefolder+")"};ddtreemenu.preventpropagate(e)};ulelement.onclick=function(e){ddtreemenu.preventpropagate(e)}};ddtreemenu.expandSubTree=function(treeid,ulelement){var rootnode=document.getElementById(treeid),currentnode=ulelement;currentnode.style.display="block";currentnode.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")";while(currentnode!=rootnode){if(currentnode.tagName=="UL"){currentnode.style.display="block";currentnode.setAttribute("rel","open");currentnode.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")"};currentnode=currentnode.parentNode}};ddtreemenu.flatten=function(treeid,action){var ultags=document.getElementById(treeid).getElementsByTagName("ul");for(var i=0;i<ultags.length;i++){ultags[i].style.display=(action=="expand")?"block":"none";var relvalue=(action=="expand")?"open":"closed";ultags[i].setAttribute("rel",relvalue);ultags[i].parentNode.style.backgroundImage=(action=="expand")?"url("+ddtreemenu.openfolder+")":"url("+ddtreemenu.closefolder+")"}};ddtreemenu.rememberstate=function(treeid,durationdays){var ultags=document.getElementById(treeid).getElementsByTagName("ul"),openuls=new Array();for(var i=0;i<ultags.length;i++)if(ultags[i].getAttribute("rel")=="open")openuls[openuls.length]=i;if(openuls.length==0)openuls[0]="none open";ddtreemenu.setCookie(treeid,openuls.join(","),durationdays)};ddtreemenu.getCookie=function(Name){var re=new RegExp(Name+"=[^;]+","i");if(document.cookie.match(re))return document.cookie.match(re)[0].split("=")[1];return""};ddtreemenu.setCookie=function(name,value,days){var expireDate=new Date(),expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));document.cookie=name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/"};ddtreemenu.searcharray=function(thearray,value){var isfound=false;for(var i=0;i<thearray.length;i++)if(thearray[i]==value){isfound=true;thearray.shift();break};return isfound};ddtreemenu.preventpropagate=function(e){if(typeof e!="undefined"){e.stopPropagation()}else event.cancelBubble=true};ddtreemenu.dotask=function(target,functionref,tasktype){var tasktype=(window.addEventListener)?tasktype:"on"+tasktype;if(target.addEventListener){target.addEventListener(tasktype,functionref,false)}else if(target.attachEvent)target.attachEvent(tasktype,functionref)}
function analyseQueries(){var queries=new Hash();$$('p.sfWebDebugDatabaseQuery').each(function(res){var query=res.innerHTML.replace(/<.*?>/g,'');if(queries.include(query)){queries.set(query,queries.get(query)+1)}else queries.set(query,1)});console.log("Queries");queries.each(function(entry){console.log(entry.key)});console.log("Duplicatie Queries");queries.each(function(entry){if(entry.value>1)console.log(pad(entry.value,2,"0")+": "+entry.key)})}
function Prompt(){var _msie=(navigator.appVersion.indexOf('MSIE')!=-1)&&(navigator.userAgent.indexOf('Opera')==-1),_simulate=navigator.appVersion.match(/\bMSIE (\d+)/)&&(RegExp.$1>=7)&&window.showModalDialog,_script_uri_path=(function(basename){var tags=document.getElementsByTagName('script'),result='';for(var i=0;i<tags.length;i++){var src=tags[i].getAttribute('src');if(!src)continue;var x=src.lastIndexOf('/');if(x==src.length-1)continue;if(basename!=(x==-1?src:src.substr(x+1)))continue;result=(x==-1)?src:src.substr(0,x+1);break};return result})('Prompt.js'),_getTextExtent=function(txt,opts){var div=document.createElement('div');if(opts){if(opts.fontFamily)div.style.fontFamily='font-family: '+opts.fontFamily;if(opts.fontSize)div.style.fontSize=opts.fontSize};div.style.position='absolute';div.style.top=0;div.style.left=0;div.style.whiteSpace='nowrap';div.style.overflow='hidden';div.zIndex=6322;var lines;if(_msie){lines=[];while(txt.length&&txt.match(/^([^\r\n]*)(\r\n|\n\r|\r|\n)?/)){lines.push(RegExp.$1);txt=txt.substr(RegExp.$2?RegExp.$1.length+RegExp.$2.length:RegExp.$1.length)}}else lines=txt.split(/\r\n|\n\r|\r|\n/);for(var i=0;i<lines.length;i++){div.appendChild(document.createTextNode(lines[i]==' '?'':lines[i]));if(i<lines.length-1)div.appendChild(document.createElement('br'))};div.style.visibility='hidden';var container=document.body;if(container.firstChild){container.insertBefore(div,container.firstChild)}else container.appendChild(div);var dims=[div.offsetWidth,div.offsetHeight];container.removeChild(div);div=null;return dims};this.show=function(msg){var argv=arguments;if(msg&&(typeof (msg)=='string'))msg=msg.replace(/^\s+|\s+$/g,'');var input=argv.length<=1?'':argv[1],caption=argv.length<=2?'':argv[2],result;if(_simulate){var dims=_getTextExtent(msg,{fontFamily:'Arial, sans-serif',fontSize:'10pt'}),w=dims[0]+60;if(w<250)w=250;var h=dims[1]+115;result=window.showModalDialog('/prompt.html',{msg:msg,input:input,caption:caption},'dialogWidth: '+w+'px; dialogHeight: '+h+'px')}else result=prompt(msg,input);return result}};Prompt.show=function(msg){var argv=arguments,input=argv.length<=1?'':argv[1],caption=argv.length<=2?'':argv[2],p=new Prompt();return p.show(msg,input,caption)};var GlobalMenu={timer:null,show:function(name){GlobalMenu.hideAll();GlobalMenu.stopTimer();var menu=$(name);if(menu)menu.show()},hide:function(){GlobalMenu.timer=setTimeout(function(){GlobalMenu.hideAll()},300)},hideAll:function(){$$('.submenu').invoke('hide')},stopTimer:function(){if(GlobalMenu.timer!=null){clearTimeout(GlobalMenu.timer);GlobalMenu.timer=null}}};DomLoaded.execute(function(){$$('.submenu').each(function(el){var id=el.id,corr=$(id+'_menu').positionedOffset().left;el.style.left=corr+"px";$(id+'_menu').observe('mouseover',function(){GlobalMenu.show(id)});$(id+'_menu').observe('mouseout',function(e){GlobalMenu.hide()});el.observe('mouseover',GlobalMenu.stopTimer);el.observe('mouseout',function(e){GlobalMenu.hide()})})});DomLoaded.execute(function(){$$('table.grid').each(function(table){table.select('tr').each(function(tr,index){if(index%2==1){tr.addClassName('odd')}else tr.addClassName('even')})});$$('div.comment').each(function(el,index){el.addClassName(index%2==0?"even":"uneven")});var vaph=$('vaph');if(vaph){var h=Element.getHeight(vaph.parentNode);vaph.style.marginTop=(h-vaph.getHeight()-10)+'px'}})