var FastInit={onload:function(){if(FastInit.done){return;}
FastInit.done=true;for(var x=0,al=FastInit.f.length;x<al;x++){FastInit.f[x]();}},addOnLoad:function(){var a=arguments;for(var x=0,al=a.length;x<al;x++){if(typeof a[x]==='function'){if(FastInit.done){a[x]();}else{FastInit.f.push(a[x]);}}}},listen:function(){if(/WebKit|khtml/i.test(navigator.userAgent)){FastInit.timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(FastInit.timer);delete FastInit.timer;FastInit.onload();}},10);}else if(document.addEventListener){document.addEventListener('DOMContentLoaded',FastInit.onload,false);}else if(!FastInit.iew32){if(window.addEventListener){window.addEventListener('load',FastInit.onload,false);}else if(window.attachEvent){return window.attachEvent('onload',FastInit.onload);}}},f:[],done:false,timer:null,iew32:false};/*@cc_on @*//*@if (@_win32)
FastInit.iew32 = true;
document.write('<script id="__ie_onload" defer src="' + ((location.protocol == 'https:') ? '//0' : 'javascript:void(0)') + '"><\/script>');
document.getElementById('__ie_onload').onreadystatechange = function(){if (this.readyState == 'complete') { FastInit.onload(); }};
/*@end @*/FastInit.listen();var Prototype={Version:'1.6.0.3',Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf('Opera')===-1),Opera:navigator.userAgent.indexOf('Opera')>-1,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement('div')['__proto__']&&document.createElement('div')['__proto__']!==document.createElement('form')['__proto__']},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)
Prototype.BrowserFeatures.SpecificElementExtensions=false;var Class={create:function(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))
parent=properties.shift();function klass(){this.initialize.apply(this,arguments);}
Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}
for(var i=0;i<properties.length;i++)
klass.addMethods(properties[i]);if(!klass.prototype.initialize)
klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}};Class.Methods={addMethods:function(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)
properties.push("toString","valueOf");for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(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;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)
destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(Object.isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object);}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}
if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(!Object.isUndefined(value))
results.push(property.toJSON()+': '+value);}
return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)
keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return!!(object&&object.nodeType==1);},isArray:function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},defer:function(){var args=[0.01].concat($A(arguments));return this.delay.apply(this,args);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+
(this.getUTCMonth()+1).toPaddedString(2)+'-'+
this.getUTCDate().toPaddedString(2)+'T'+
this.getUTCHours().toPaddedString(2)+':'+
this.getUTCMinutes().toPaddedString(2)+':'+
this.getUTCSeconds().toPaddedString(2)+'Z"';};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:function(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();}finally{this.currentlyExecuting=false;}}}});Object.extend(String,{interpret:function(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return String(this);},truncate:function(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var self=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';},toQueryParams:function(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
else hash[key]=value;}
return hash;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();},underscore:function(){return this.gsub(/::/,'/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},dasherize:function(){return this.gsub(/_/,'-');},inspect:function(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'";},toJSON:function(){return this.inspect(true);},unfilterJSON:function(filter){return this.sub(filter||Prototype.JSONFilter,'#{1}');},isJSON:function(){var str=this;if(str.blank())return false;str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},blank:function(){return /^\s*$/.test(this);},interpolate:function(object,pattern){return new Template(this,pattern).evaluate(object);}});if(Prototype.Browser.WebKit||Prototype.Browser.IE)Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},unescapeHTML:function(){return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))
object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}
return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;}
return this;},eachSlice:function(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);},all:function(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;},any:function(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;},collect:function(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index));});return results;},detect:function(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))
results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))
filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))
results.push(iterator.call(context,value,index));});return results;},include:function(object){if(Object.isFunction(this.indexOf))
if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inGroupsOf:function(number,fillWith){fillWith=Object.isUndefined(fillWith)?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice;});},inject:function(memo,iterator,context){this.each(function(value,index){memo=iterator.call(context,memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
result=value;});return result;},min:function(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;},partition:function(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];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))
results.push(value);});return results;},sortBy:function(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');},toArray:function(){return this.map();},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});},size:function(){return this.toArray().length;},inspect:function(){return'#<Enumerable:'+this.toArray().inspect()+'>';}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(iterable){if(!iterable)return[];if(iterable.toArray)return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
if(Prototype.Browser.WebKit){$A=function(iterable){if(!iterable)return[];if(!(typeof iterable==='function'&&typeof iterable.length==='number'&&typeof iterable.item==='function')&&iterable.toArray)
return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;};}
Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0,length=this.length;i<length;i++)
iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(sorted){return this.inject([],function(array,value,index){if(0==index||(sorted?array.last()!=value:!array.include(value)))
array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))
Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)
if(this[i]===item)return i;return-1;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)
array.push(arguments[i][j]);}else{array.push(arguments[i]);}}
return array;};}
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator,context){$R(0,this,true).each(iterator,context);return this;},toPaddedString:function(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string;},toJSON:function(){return isFinite(this)?this.toString():'null';}});$w('abs round ceil floor').each(function(method){Number.prototype[method]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:function(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},set:function(key,value){return this._object[key]=value;},get:function(key){if(this._object[key]!==Object.prototype[key])
return this._object[key];},unset:function(key){var value=this._object[key];delete this._object[key];return value;},toObject:function(){return Object.clone(this._object);},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},index:function(value){var match=this.detect(function(pair){return pair.value===value;});return match&&match.key;},merge:function(object){return this.clone().update(object);},update:function(object){return new Hash(object).inject(this,function(result,pair){result.set(pair.key,pair.value);return result;});},toQueryString:function(){return this.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('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';},toJSON:function(){return Object.toJSON(this.toObject());},clone:function(){return new Hash(this);}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
this.responders.push(responder);},unregister:function(responder){this.responders=this.responders.without(responder);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(Object.isFunction(responder[callback])){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))
this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))
this.options.parameters=this.options.parameters.toObject();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}
this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')
this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
params+='&_=';}
try{var response=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(response);Ajax.Responders.dispatch('onCreate',this,response);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous)this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
this.onStateChange();}
catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))
this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['Content-type']=this.options.contentType+
(this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)
headers['Connection']='close';}
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))
for(var i=0,length=extras.length;i<length;i+=2)
headers[extras[i]]=extras[i+1];else
$H(extras).each(function(pair){headers[pair.key]=pair.value});}
for(var name in headers)
this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}
var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
this.evalResponse();}
try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{protocol}//#{domain}#{port}'.interpolate({protocol:location.protocol,domain:document.domain,port:location.port?':'+location.port:''}));},getHeader:function(name){try{return this.transport.getResponseHeader(name)||null;}catch(e){return null}},evalResponse:function(){try{return eval((this.transport.responseText||'').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;this.responseJSON=this._getResponseJSON();}},status:0,statusText:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return''}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders();}catch(e){return null}},getResponseHeader:function(name){return this.transport.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders();},_getHeaderJSON:function(){var json=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
else options.insertion(receiver,responseText);}
else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.responseText;}
this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
elements.push($(arguments[i]));return elements;}
if(Object.isString(element))
element=document.getElementById(element);return Element.extend(element);}
if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)
results.push(Element.extend(query.snapshotItem(i)));return results;};}
if(!window.Node)var Node={};if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});}
(function(){var element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});if(element)this.Element.prototype=element.prototype;}).call(window);Element.cache={};Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(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(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;}
content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
$(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
if(element.nodeType==1)
elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $(element).select("*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;if(element)return[element].concat($(element).nextSiblings());return[];},previousSiblings:function(element){return $(element).recursivelyCollect('previousSibling');},nextSiblings:function(element){return $(element).recursivelyCollect('nextSibling');},siblings:function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))
selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)
element.removeAttribute(name);else if(value===true)
element.setAttribute(name,name);else element.setAttribute(name,value);}
return element;},getHeight:function(element){return $(element).getDimensions().height;},getWidth:function(element){return $(element).getDimensions().width;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className))
element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
element.removeChild(node);node=nextNode;}
return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);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();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('display');if(display!='none'&&display!=null)
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(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('position')=='absolute')return element;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body)
if(Element.getStyle(element,'position')!='static')
return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(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=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});}
else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);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={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){attribute=element.getAttribute(attribute);return attribute?attribute.toString().slice(23,-2):null;},_flag:function(element,attribute){return $(element).hasAttribute(attribute)?attribute:null;},style:function(element){return element.style.cssText.toLowerCase();},title:function(element){return element.title;}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr;});(function(v){Object.extend(v,{href:v._getAttr,src:v._getAttr,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v._getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv});})(Element._attributeTranslations.read.values);}
else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)
if(element.tagName.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(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName in Element._insertionTranslations.tags){$A(element.childNodes).each(function(node){element.removeChild(node)});Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)});}
else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
if('outerHTML'in document.createElement('div')){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)
fragments.each(function(node){parent.insertBefore(node,nextSibling)});else
fragments.each(function(node){parent.appendChild(node)});}
else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={before:function(element,node){element.parentNode.insertBefore(node,element);},top:function(element,node){element.insertBefore(node,element.firstChild);},bottom:function(element,node){element.appendChild(node);},after:function(element,node){element.parentNode.insertBefore(node,element.nextSibling);},tags:{TABLE:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</select>',1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD});}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.specified);}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement('div')['__proto__']){window.HTMLElement={};window.HTMLElement.prototype=document.createElement('div')['__proto__'];Prototype.BrowserFeatures.ElementExtensions=true;}
Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)
return Prototype.K;var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase(),property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))
element[property]=value.methodize();}
element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!methods){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{"FORM":Object.clone(Form.Methods),"INPUT":Object.clone(Form.Element.Methods),"SELECT":Object.clone(Form.Element.Methods),"TEXTAREA":Object.clone(Form.Element.Methods)});}
if(arguments.length==2){var tagName=methods;methods=arguments[1];}
if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}
function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])
Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);}
function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))
destination[property]=value.methodize();}}
function findDOMClass(tagName){var klass;var trans={"OPTGROUP":"OptGroup","TEXTAREA":"TextArea","P":"Paragraph","FIELDSET":"FieldSet","UL":"UList","OL":"OList","DL":"DList","DIR":"Directory","H1":"Heading","H2":"Heading","H3":"Heading","H4":"Heading","H5":"Heading","H6":"Heading","Q":"Quote","INS":"Mod","DEL":"Mod","A":"Anchor","IMG":"Image","CAPTION":"TableCaption","COL":"TableCol","COLGROUP":"TableCol","THEAD":"TableSection","TFOOT":"TableSection","TBODY":"TableSection","TR":"TableRow","TH":"TableCell","TD":"TableCell","FRAMESET":"FrameSet","IFRAME":"IFrame"};if(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];window[klass]={};window[klass].prototype=document.createElement(tagName)['__proto__'];return window[klass];}
if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);}
if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}
Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){var dimensions={},B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();if(B.WebKit&&!document.evaluate){dimensions[d]=self['inner'+D];}else if(B.Opera&&parseFloat(window.opera.version())<9.5){dimensions[d]=document.body['client'+D]}else{dimensions[d]=document.documentElement['client'+D];}});return dimensions;},getWidth:function(){return this.getDimensions().width;},getHeight:function(){return this.getDimensions().height;},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);}};var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher();}else{this.mode="normal";this.compileMatcher();}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty")))
return false;if((/(\[[\w-]*?:|:checked)/).test(e))
return false;return true;},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;}
return true;},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return;}
this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=this.expression,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return;}
this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[0],'');break;}}}
this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},findElements:function(root){root=root||document;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();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;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'');}else{return this.findElements(document).include(element);}}}}
var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
return match;},toString:function(){return this.expression;},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m);},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=Selector.xpath.pseudos[m[1]];if(!h)return'';if(Object.isFunction(h))return h(m);return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);},operators:{'=':"[@#{1}='#{3}']",'!=':"[@#{1}!='#{3}']",'^=':"[starts-with(@#{1}, '#{3}')]",'$=':"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",'|=':"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{'first-child':'[not(preceding-sibling::*)]','last-child':'[not(following-sibling::*)]','only-child':'[not(preceding-sibling::* or following-sibling::*)]','empty':"[count(*) = 0 and (count(text()) = 0)]",'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;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}
return"[not("+exclusion.join(" and ")+")]";},'nth-child':function(m){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",m);},'nth-last-child':function(m){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",m);},'nth-of-type':function(m){return Selector.xpath.pseudos.nth("position() ",m);},'nth-last-of-type':function(m){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",m);},'first-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nth:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))
return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[((?:[\w]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)
a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)
if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)
if(!(n=nodes[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;results.push(Element.extend(n));}
return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){for(var j=0,child;child=node.childNodes[j];j++)
if(child.nodeType==1&&child.tagName!='!')results.push(child);}
return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}
return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)
if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)
if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}
for(var i=0,node;node=nodes[i];i++)
if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)
if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)
if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)
if(Selector.handlers.previousElementSibling(targetNode)==node)
return[targetNode];}else nodes=h[combinator](nodes);}
for(var i=0,node;node=nodes[i];i++)
if(node==targetNode)return[targetNode];return[];}
return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))
results.push(node);}
return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}
return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}
return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}
return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))
results.push(node);return results;},'nth-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root);},'nth-last-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true);},'nth-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,false,true);},'nth-last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true,true);},'first-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,false,true);},'last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,true,true);},'only-of-type':function(nodes,formula,root){var p=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}
if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)
if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)
if(node.nodeIndex==indices[j])results.push(node);}}
h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||node.firstChild)continue;results.push(node);}
return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(!node.disabled&&(!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.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+(nv||"").toUpperCase()+'-').include('-'+(v||"").toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}
return(l>1)?h.unique(results):results;}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++)
if(node.tagName!=="!")a.push(node);return a;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
node.removeAttribute('_countedByPrototype');return nodes;}});}
function $$(){return Selector.findChildElements(document,$A(arguments));}
var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='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){return $A($(form).getElementsByTagName('*')).inject([],function(elements,child){if(Form.Element.Serializers[child.tagName.toLowerCase()])
elements.push(Element.extend(child));return elements;});},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(Element.extend(input));}
return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}
if(form.hasAttribute('method')&&!options.method)
options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type)))
element.select();}catch(e){}
return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element,value);default:return Form.Element.Serializers.textarea(element,value);}},inputSelector:function(element,value){if(Object.isUndefined(value))return element.checked?element.value:null;else element.checked=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,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);}});if(!window.Event)var Event={};Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(event){var element;switch(event.type){case'mouseover':element=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}
return{isLeftClick:function(event){return isButton(event,0)},isMiddleClick:function(event){return isButton(event,1)},isRightClick:function(event){return isButton(event,2)},element:function(event){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);},findElement:function(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);},pointer:function(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0,scrollTop:0};return{x:event.pageX||(event.clientX+
(docElement.scrollLeft||body.scrollLeft)-
(docElement.clientLeft||0)),y:event.pageY||(event.clientY+
(docElement.scrollTop||body.scrollTop)-
(docElement.clientTop||0))};},pointerX:function(event){return Event.pointer(event).x},pointerY:function(event){return Event.pointer(event).y},stop:function(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true;}};})();Event.extend=(function(){var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(event){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement,relatedTarget:Event.relatedTarget(event),pageX:pointer.x,pageY:pointer.y});return Object.extend(event,methods);};}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents")['__proto__'];Object.extend(Event.prototype,methods);return Prototype.K;}})();Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
if(Prototype.Browser.WebKit){window.addEventListener('unload',Prototype.emptyFunction,false);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var timer;function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearInterval(timer);document.fire("dom:loaded");document.loaded=true;}
if(document.addEventListener){if(Prototype.Browser.WebKit){timer=window.setInterval(function(){if(/loaded|complete/.test(document.readyState))
fireContentLoadedEvent();},0);Event.observe(window,"load",fireContentLoadedEvent);}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent();}};}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,content){return Element.insert(element,{bottom:content});},After:function(element,content){return Element.insert(element,{after:content});}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},within:function(element,x,y){if(this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";}
instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))
elements.push(Element.extend(child));}
return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();var Timezone={"VA":["Europe\/Vatican"],"CC":["Indian\/Cocos"],"GT":["America\/Guatemala"],"JP":["Asia\/Tokyo"],"SE":["Europe\/Stockholm"],"TZ":["Africa\/Dar_es_Salaam"],"CD":["Africa\/Kinshasa","Africa\/Lubumbashi"],"GU":["Pacific\/Guam"],"MM":["Asia\/Rangoon"],"DZ":["Africa\/Algiers"],"MN":["Asia\/Ulaanbaatar","Asia\/Hovd","Asia\/Choibalsan"],"PK":["Asia\/Karachi"],"SG":["Asia\/Singapore"],"VC":["America\/St_Vincent"],"CF":["Africa\/Bangui"],"GW":["Africa\/Bissau"],"MO":["Asia\/Macau"],"PL":["Europe\/Warsaw"],"SH":["Atlantic\/St_Helena"],"CG":["Africa\/Brazzaville"],"MP":["Pacific\/Saipan"],"PM":["America\/Miquelon"],"SI":["Europe\/Ljubljana"],"VE":["America\/Caracas"],"ZW":["Africa\/Harare"],"CH":["Europe\/Zurich"],"GY":["America\/Guyana"],"MQ":["America\/Martinique"],"PN":["Pacific\/Pitcairn"],"SJ":["Arctic\/Longyearbyen"],"CI":["Africa\/Abidjan"],"MR":["Africa\/Nouakchott"],"SK":["Europe\/Bratislava"],"VG":["America\/Tortola"],"MS":["America\/Montserrat"],"SL":["Africa\/Freetown"],"CK":["Pacific\/Rarotonga"],"ID":["Asia\/Jakarta","Asia\/Pontianak","Asia\/Makassar","Asia\/Jayapura"],"MT":["Europe\/Malta"],"SM":["Europe\/San_Marino"],"VI":["America\/St_Thomas"],"YE":["Asia\/Aden"],"CL":["America\/Santiago","Pacific\/Easter"],"IE":["Europe\/Dublin"],"LA":["Asia\/Vientiane"],"MU":["Indian\/Mauritius"],"SN":["Africa\/Dakar"],"CM":["Africa\/Douala"],"FI":["Europe\/Helsinki"],"LB":["Asia\/Beirut"],"MV":["Indian\/Maldives"],"PR":["America\/Puerto_Rico"],"SO":["Africa\/Mogadishu"],"CN":["Asia\/Shanghai","Asia\/Harbin","Asia\/Chongqing","Asia\/Urumqi","Asia\/Kashgar"],"FJ":["Pacific\/Fiji"],"LC":["America\/St_Lucia"],"MW":["Africa\/Blantyre"],"PS":["Asia\/Gaza"],"CO":["America\/Bogota"],"FK":["Atlantic\/Stanley"],"MX":["America\/Mexico_City","America\/Cancun","America\/Merida","America\/Monterrey","America\/Mazatlan","America\/Chihuahua","America\/Hermosillo","America\/Tijuana"],"PT":["Europe\/Lisbon","Atlantic\/Madeira","Atlantic\/Azores"],"MY":["Asia\/Kuala_Lumpur","Asia\/Kuching"],"SR":["America\/Paramaribo"],"VN":["Asia\/Ho_Chi_Minh"],"FM":["Pacific\/Truk","Pacific\/Ponape","Pacific\/Kosrae"],"MZ":["Africa\/Maputo"],"CR":["America\/Costa_Rica"],"PW":["Pacific\/Palau"],"FO":["Atlantic\/Faroe"],"ST":["Africa\/Sao_Tome"],"IL":["Asia\/Jerusalem"],"LI":["Europe\/Vaduz"],"PY":["America\/Asuncion"],"BA":["Europe\/Sarajevo"],"CU":["America\/Havana"],"IM":["Europe\/Isle_of_Man"],"SV":["America\/El_Salvador"],"CV":["Atlantic\/Cape_Verde"],"FR":["Europe\/Paris"],"IN":["Asia\/Kolkata"],"LK":["Asia\/Colombo"],"BB":["America\/Barbados"],"IO":["Indian\/Chagos"],"VU":["Pacific\/Efate"],"CX":["Indian\/Christmas"],"RE":["Indian\/Reunion"],"UA":["Europe\/Kiev","Europe\/Uzhgorod","Europe\/Zaporozhye","Europe\/Simferopol"],"SY":["Asia\/Damascus"],"CY":["Asia\/Nicosia"],"IQ":["Asia\/Baghdad"],"SZ":["Africa\/Mbabane"],"BD":["Asia\/Dhaka"],"CZ":["Europe\/Prague"],"IR":["Asia\/Tehran"],"YT":["Indian\/Mayotte"],"BE":["Europe\/Brussels"],"IS":["Atlantic\/Reykjavik"],"BF":["Africa\/Ouagadougou"],"EC":["America\/Guayaquil","Pacific\/Galapagos"],"IT":["Europe\/Rome"],"OM":["Asia\/Muscat"],"BG":["Europe\/Sofia"],"BH":["Asia\/Bahrain"],"LR":["Africa\/Monrovia"],"UG":["Africa\/Kampala"],"BI":["Africa\/Bujumbura"],"EE":["Europe\/Tallinn"],"LS":["Africa\/Maseru"],"BJ":["Africa\/Porto-Novo"],"LT":["Europe\/Vilnius"],"EG":["Africa\/Cairo"],"BL":["America\/St_Barthelemy"],"EH":["Africa\/El_Aaiun"],"LU":["Europe\/Luxembourg"],"RO":["Europe\/Bucharest"],"BM":["Atlantic\/Bermuda"],"LV":["Europe\/Riga"],"BN":["Asia\/Brunei"],"UM":["Pacific\/Johnston","Pacific\/Midway","Pacific\/Wake"],"BO":["America\/La_Paz"],"KE":["Africa\/Nairobi"],"NA":["Africa\/Windhoek"],"LY":["Africa\/Tripoli"],"BR":["America\/Noronha","America\/Belem","America\/Fortaleza","America\/Recife","America\/Araguaina","America\/Maceio","America\/Bahia","America\/Sao_Paulo","America\/Campo_Grande","America\/Cuiaba","America\/Porto_Velho","America\/Boa_Vista","America\/Manaus","America\/Eirunepe","America\/Rio_Branco"],"KG":["Asia\/Bishkek"],"NC":["Pacific\/Noumea"],"RS":["Europe\/Belgrade"],"BS":["America\/Nassau"],"HK":["Asia\/Hong_Kong"],"KH":["Asia\/Phnom_Penh"],"BT":["Asia\/Thimphu"],"KI":["Pacific\/Tarawa","Pacific\/Enderbury","Pacific\/Kiritimati"],"NE":["Africa\/Niamey"],"QA":["Asia\/Qatar"],"RU":["Europe\/Kaliningrad","Europe\/Moscow","Europe\/Volgograd","Europe\/Samara","Asia\/Yekaterinburg","Asia\/Omsk","Asia\/Novosibirsk","Asia\/Krasnoyarsk","Asia\/Irkutsk","Asia\/Yakutsk","Asia\/Vladivostok","Asia\/Sakhalin","Asia\/Magadan","Asia\/Kamchatka","Asia\/Anadyr"],"HM":[],"NF":["Pacific\/Norfolk"],"US":["America\/New_York","America\/Detroit","America\/Kentucky\/Louisville","America\/Kentucky\/Monticello","America\/Indiana\/Indianapolis","America\/Indiana\/Vincennes","America\/Indiana\/Knox","America\/Indiana\/Winamac","America\/Indiana\/Marengo","America\/Indiana\/Vevay","America\/Chicago","America\/Indiana\/Tell_City","America\/Indiana\/Petersburg","America\/Menominee","America\/North_Dakota\/Center","America\/North_Dakota\/New_Salem","America\/Denver","America\/Boise","America\/Shiprock","America\/Phoenix","America\/Los_Angeles","America\/Anchorage","America\/Juneau","America\/Yakutat","America\/Nome","America\/Adak","Pacific\/Honolulu"],"BV":[],"ER":["Africa\/Asmara"],"HN":["America\/Tegucigalpa"],"NG":["Africa\/Lagos"],"RW":["Africa\/Kigali"],"BW":["Africa\/Gaborone"],"ES":["Europe\/Madrid","Africa\/Ceuta","Atlantic\/Canary"],"ET":["Africa\/Addis_Ababa"],"NI":["America\/Managua"],"AD":["Europe\/Andorra"],"BY":["Europe\/Minsk"],"KM":["Indian\/Comoro"],"AE":["Asia\/Dubai"],"BZ":["America\/Belize"],"HR":["Europe\/Zagreb"],"KN":["America\/St_Kitts"],"TC":["America\/Grand_Turk"],"AF":["Asia\/Kabul"],"NL":["Europe\/Amsterdam"],"TD":["Africa\/Ndjamena"],"AG":["America\/Antigua"],"HT":["America\/Port-au-Prince"],"KP":["Asia\/Pyongyang"],"UY":["America\/Montevideo"],"GA":["Africa\/Libreville"],"HU":["Europe\/Budapest"],"TF":["Indian\/Kerguelen"],"UZ":["Asia\/Samarkand","Asia\/Tashkent"],"AI":["America\/Anguilla"],"DE":["Europe\/Berlin"],"GB":["Europe\/London"],"KR":["Asia\/Seoul"],"TG":["Africa\/Lome"],"NO":["Europe\/Oslo"],"TH":["Asia\/Bangkok"],"GD":["America\/Grenada"],"NP":["Asia\/Katmandu"],"ZA":["Africa\/Johannesburg"],"AL":["Europe\/Tirane"],"GE":["Asia\/Tbilisi"],"TJ":["Asia\/Dushanbe"],"WF":["Pacific\/Wallis"],"AM":["Asia\/Yerevan"],"GF":["America\/Cayenne"],"NR":["Pacific\/Nauru"],"TK":["Pacific\/Fakaofo"],"AN":["America\/Curacao"],"DJ":["Africa\/Djibouti"],"KW":["Asia\/Kuwait"],"TL":["Asia\/Dili"],"AO":["Africa\/Luanda"],"DK":["Europe\/Copenhagen"],"GG":["Europe\/Guernsey"],"TM":["Asia\/Ashgabat"],"GH":["Africa\/Accra"],"JE":["Europe\/Jersey"],"MA":["Africa\/Casablanca"],"KY":["America\/Cayman"],"NU":["Pacific\/Niue"],"TN":["Africa\/Tunis"],"DM":["America\/Dominica"],"GI":["Europe\/Gibraltar"],"KZ":["Asia\/Almaty","Asia\/Qyzylorda","Asia\/Aqtobe","Asia\/Aqtau","Asia\/Oral"],"TO":["Pacific\/Tongatapu"],"AQ":["Antarctica\/McMurdo","Antarctica\/South_Pole","Antarctica\/Rothera","Antarctica\/Palmer","Antarctica\/Mawson","Antarctica\/Davis","Antarctica\/Casey","Antarctica\/Vostok","Antarctica\/DumontDUrville","Antarctica\/Syowa"],"MC":["Europe\/Monaco"],"AR":["America\/Argentina\/Buenos_Aires","America\/Argentina\/Cordoba","America\/Argentina\/San_Luis","America\/Argentina\/Jujuy","America\/Argentina\/Tucuman","America\/Argentina\/Catamarca","America\/Argentina\/La_Rioja","America\/Argentina\/San_Juan","America\/Argentina\/Mendoza","America\/Argentina\/Rio_Gallegos","America\/Argentina\/Ushuaia"],"MD":["Europe\/Chisinau"],"AS":["Pacific\/Pago_Pago"],"DO":["America\/Santo_Domingo"],"ME":["Europe\/Podgorica"],"PA":["America\/Panama"],"TR":["Europe\/Istanbul"],"AT":["Europe\/Vienna"],"GL":["America\/Godthab","America\/Danmarkshavn","America\/Scoresbysund","America\/Thule"],"MF":["America\/Marigot"],"NZ":["Pacific\/Auckland","Pacific\/Chatham"],"AU":["Australia\/Lord_Howe","Australia\/Hobart","Australia\/Currie","Australia\/Melbourne","Australia\/Sydney","Australia\/Broken_Hill","Australia\/Brisbane","Australia\/Lindeman","Australia\/Adelaide","Australia\/Darwin","Australia\/Perth","Australia\/Eucla"],"GM":["Africa\/Banjul"],"MG":["Indian\/Antananarivo"],"GN":["Africa\/Conakry"],"AW":["America\/Aruba"],"MH":["Pacific\/Majuro","Pacific\/Kwajalein"],"TT":["America\/Port_of_Spain"],"ZM":["Africa\/Lusaka"],"GP":["America\/Guadeloupe"],"AX":["Europe\/Mariehamn"],"SA":["Asia\/Riyadh"],"PE":["America\/Lima"],"JM":["America\/Jamaica"],"GQ":["Africa\/Malabo"],"CA":["America\/St_Johns","America\/Halifax","America\/Glace_Bay","America\/Moncton","America\/Goose_Bay","America\/Blanc-Sablon","America\/Montreal","America\/Toronto","America\/Nipigon","America\/Thunder_Bay","America\/Iqaluit","America\/Pangnirtung","America\/Resolute","America\/Atikokan","America\/Rankin_Inlet","America\/Winnipeg","America\/Rainy_River","America\/Regina","America\/Swift_Current","America\/Edmonton","America\/Cambridge_Bay","America\/Yellowknife","America\/Inuvik","America\/Dawson_Creek","America\/Vancouver","America\/Whitehorse","America\/Dawson"],"SB":["Pacific\/Guadalcanal"],"PF":["Pacific\/Tahiti","Pacific\/Marquesas","Pacific\/Gambier"],"TV":["Pacific\/Funafuti"],"WS":["Pacific\/Apia"],"PG":["Pacific\/Port_Moresby"],"MK":["Europe\/Skopje"],"GR":["Europe\/Athens"],"AZ":["Asia\/Baku"],"SC":["Indian\/Mahe"],"TW":["Asia\/Taipei"],"PH":["Asia\/Manila"],"ML":["Africa\/Bamako"],"JO":["Asia\/Amman"],"GS":["Atlantic\/South_Georgia"],"SD":["Africa\/Khartoum"]}
Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")
Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}
Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")
Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}
Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)
SL=el.scrollLeft;if(is_div&&el.scrollTop)
ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}
return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}
while(related){if(related==el){return true;}
related=related.parentNode;}
return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}
var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}
el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))
f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)
f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}
return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}
if(typeof parent!="undefined"){parent.appendChild(el);}
return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}
return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}
return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}
var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}
var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)
s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")
mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}
s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}
var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}
if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}
cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}
yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}
if(show){var s=yc.style;s.display="block";if(cd.navtype<0)
s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")
ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}
s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}
if(cal.timeout){clearTimeout(cal.timeout);}
var el=cal.activeDiv;if(!el){return false;}
var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}
var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}
with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}
var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))
Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}
ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else
dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)
if(range[i]==current)
break;while(count-->0)
if(decrease){if(--i<0)
i=range.length-1;}else if(++i>=range.length)
i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}
var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}
var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}
Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}
return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}
var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}
cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}
cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}
cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}
var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else
addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}
if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}
return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}
if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}
el.calendar.tooltips.innerHTML=el.ttip;}
if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}
return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)
return false;removeClass(el,"hilite");if(el.caldate)
removeClass(el.parentNode,"rowhilite");if(el.calendar)
el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}
cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)
cal._toggleMultipleDate(new Date(date));else
newdate=!el.disabled;if(other_month)
cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}
date=new Date(cal.date);if(el.navtype==0)
date.setDateOnly(new Date());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}
date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}
alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}
break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}
break;case 1:if(mon<11){setMonth(mon+1);}else if(year<cal.maxYear){date.setFullYear(year+1);setMonth(0);}
break;case 2:if(year<cal.maxYear){date.setFullYear(year+1);}
break;case 100:cal.setFirstDayOfWeek(el.fdow);return;case 50:var range=el._range;var current=el.innerHTML;for(var i=range.length;--i>=0;)
if(range[i]==current)
break;if(ev&&ev.shiftKey){if(--i<0)
i=range.length-1;}else if(++i>=range.length)
i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}
break;}
if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)
newdate=closing=true;}
if(newdate){ev&&cal.callHandler();}
if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}
this.date=this.dateStr?new Date(this.dateStr):new Date();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="popup-calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}
div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)
cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="<div unselectable='on'>"+text+"</div>";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("&#x00d7;",1,200).ttip=Calendar._TT["CLOSE"];}
row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}
for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}
this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}
for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}
if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||"&nbsp;";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")
part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}
Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)
AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else
cell.innerHTML="&nbsp;";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}
H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)
h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)
h=0;}
var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}
var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}
this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i<Calendar._MN.length;++i){var mn=Calendar.createElement("div");mn.className=Calendar.is_ie?"label-IEfix":"label";mn.month=i;mn.innerHTML=Calendar._SMN[i];div.appendChild(mn);}
div=Calendar.createElement("div",this.element);this.yearsCombo=div;div.className="combo";for(i=12;i>0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}
this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)
return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)
ne=cal.ar_days[y][x];else{x=6;K=38;continue;}
break;case 38:if(--y>=0)
ne=cal.ar_days[y][x];else{prevMonth();setVars();}
break;case 39:if(++x<7)
ne=cal.ar_days[y][x];else{x=0;K=40;continue;}
break;case 40:if(++y<cal.ar_days.length)
ne=cal.ar_days[y][x];else{nextMonth();setVars();}
break;}
break;}
if(ne){if(!ne.disabled)
Calendar.cellClick(ne);else if(prev)
prevMonth();else
nextMonth();}}
break;case 13:if(act)
Calendar.cellClick(cal.currentDateEl,ev);break;default:return false;}
return Calendar.stopEvent(ev);};Calendar.prototype._init=function(firstDayOfWeek,date){var today=new Date(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this.table.style.visibility="hidden";var year=date.getFullYear();if(year<this.minYear){year=this.minYear;date.setFullYear(year);}else if(year>this.maxYear){year=this.maxYear;date.setFullYear(year);}
this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)
day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}
row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML="&nbsp;";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}
cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)
dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)
cell.title=toolTip;}
if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))
cell.disabled=true;cell.className+=" "+status;}}
if(!cell.disabled){cell.caldate=new Date(date);cell.ttip="_";if(!this.multiple&&current_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}
if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}
if(weekend.indexOf(wday.toString())!=-1)
cell.className+=cell.otherMonth?" oweekend":" weekend";}}
if(!(hasdays||this.showsOtherMonths))
row.className="emptyrow";}
this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)
continue;if(cell)
cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}
this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}
var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}
this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}
this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}
this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}
function fixPosition(box){if(box.x<0)
box.x=0;if(box.y<0)
box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}
var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}
switch(valign){case"T":p.y-=h;break;case"B":p.y+=el.offsetHeight;break;case"C":p.y+=(el.offsetHeight-h)/2;break;case"t":p.y+=el.offsetHeight-h;break;case"b":break;}
switch(halign){case"L":p.x-=w;break;case"R":p.x+=el.offsetWidth;break;case"C":p.x+=(el.offsetWidth-w)/2;break;case"l":p.x+=el.offsetWidth-w;break;case"r":break;}
p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)
setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else
Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)
fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)
return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)
value=document.defaultView.getComputedStyle(obj,"").getPropertyValue("visibility");else
value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else
value='';}
return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2<EX1)||(CY1>EY2)||(CY2<EY1)){if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}
cc.style.visibility=cc.__msh_save_visibility;}else{if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}
cc.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var fdow=this.firstDayOfWeek;var cell=this.firstdayname;var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<7;++i){cell.className="day name";var realday=(i+fdow)%7;if(i){cell.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[realday]);cell.navtype=100;cell.calendar=this;cell.fdow=realday;Calendar._add_evs(cell);}
if(weekend.indexOf(realday.toString())!=-1){Calendar.addClass(cell,"weekend");}
cell.innerHTML=Calendar._SDN[(i+fdow)%7];cell=cell.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return;}
this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}
var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(str,fmt){var today=new Date();var y=0;var m=-1;var d=0;var a=str.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])
continue;switch(b[i]){case"%d":case"%e":d=parseInt(a[i],10);break;case"%m":m=parseInt(a[i],10)-1;break;case"%Y":case"%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case"%b":case"%B":for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}
break;case"%H":case"%I":case"%k":case"%l":hr=parseInt(a[i],10);break;case"%P":case"%p":if(/pm/i.test(a[i])&&hr<12)
hr+=12;else if(/am/i.test(a[i])&&hr>=12)
hr-=12;break;case"%M":min=parseInt(a[i],10);break;}}
if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)
return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}
if(t!=-1){if(m!=-1){d=m+1;}
m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}
if(y==0)
y=today.getFullYear();if(m!=-1&&d!=0)
return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}
if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)
ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)
return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}
return str;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new Date(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())
this.setDate(28);this.__msh_oldSetFullYear(y);};window._dynarch_popupCalendar=null;Calendar._DN=new Array
("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");Calendar._SDN=new Array
("S","M","T","W","T","F","S","S");Calendar._FD=0;Calendar._MN=new Array
("January","February","March","April","May","June","July","August","September","October","November","December");Calendar._SMN=new Array
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");Calendar._TT={};Calendar._TT["INFO"]="About the calendar";Calendar._TT["ABOUT"]="DHTML Date/Time Selector\n"+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n"+"For latest version visit: http://www.dynarch.com/projects/calendar/\n"+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details."+"\n\n"+"Date selection:\n"+"- Use the \xab, \xbb buttons to select year\n"+"- Use the "+String.fromCharCode(0x2039)+", "+String.fromCharCode(0x203a)+" buttons to select month\n"+"- Hold mouse button on any of the above buttons for faster selection.";Calendar._TT["ABOUT_TIME"]="\n\n"+"Time selection:\n"+"- Click on any of the time parts to increase it\n"+"- or Shift-click to decrease it\n"+"- or click and drag for faster selection.";Calendar._TT["PREV_YEAR"]="Prev. year (hold for menu)";Calendar._TT["PREV_MONTH"]="Prev. month (hold for menu)";Calendar._TT["GO_TODAY"]="Go Today";Calendar._TT["NEXT_MONTH"]="Next month (hold for menu)";Calendar._TT["NEXT_YEAR"]="Next year (hold for menu)";Calendar._TT["SEL_DATE"]="Select date";Calendar._TT["DRAG_TO_MOVE"]="Drag to move";Calendar._TT["PART_TODAY"]=" (today)";Calendar._TT["DAY_FIRST"]="Display %s first";Calendar._TT["WEEKEND"]="0,6";Calendar._TT["CLOSE"]="Close";Calendar._TT["TODAY"]="Today";Calendar._TT["TIME_PART"]="(Shift-)Click or drag to change value";Calendar._TT["DEF_DATE_FORMAT"]="%Y-%m-%d";Calendar._TT["TT_DATE_FORMAT"]="%a, %b %e";Calendar._TT["WK"]="wk";Calendar._TT["TIME"]="Time:";Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}
if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");return false;}
function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")
p.inputField.onchange();}
if(update&&p.displayArea)
p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")
p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")
p.flatCallback(cal);}
if(update&&p.singleClick&&cal.dateClicked)
cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")
params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n  Flat specified but can't find parent.");return false;}
var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}
if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}
cal.create(params.flat);cal.show();return false;}
var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)
params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)
cal.setDate(params.date);cal.hide();}
if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}
cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)
cal.create();cal.refresh();if(!params.position)
cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else
cal.showAt(params.position[0],params.position[1]);return false;};return cal;};var Scriptaculous={Version:'1.8.1',require:function(libraryName){document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');},REQUIRED_PROTOTYPE:'1.6.0',load:function(){function convertVersionString(versionString){var r=versionString.split('.');return parseInt(r[0])*100000+parseInt(r[1])*1000+parseInt(r[2]);}
if((typeof Prototype=='undefined')||(typeof Element=='undefined')||(typeof Element.Methods=='undefined')||(convertVersionString(Prototype.Version)<convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
throw("script.aculo.us requires the Prototype JavaScript framework >= "+
Scriptaculous.REQUIRED_PROTOTYPE);$A(document.getElementsByTagName("script")).findAll(function(s){return(s.src&&s.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(s){var path=s.src.replace(/scriptaculous\.js(\?.*)?$/,'');var includes=s.src.match(/\?.*load=([a-z,]*)/);(includes?includes[1]:'builder,effects,dragdrop,controls,slider,sound').split(',').each(function(include){Scriptaculous.require(path+include+'.js')});});}}
Scriptaculous.load();var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(elementName){elementName=elementName.toUpperCase();var parentTag=this.NODEMAP[elementName]||'div';var parentElement=document.createElement(parentTag);try{parentElement.innerHTML="<"+elementName+"></"+elementName+">";}catch(e){}
var element=parentElement.firstChild||null;if(element&&(element.tagName.toUpperCase()!=elementName))
element=element.getElementsByTagName(elementName)[0];if(!element)element=document.createElement(elementName);if(!element)return;if(arguments[1])
if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)||arguments[1].tagName){this._children(element,arguments[1]);}else{var attrs=this._attributes(arguments[1]);if(attrs.length){try{parentElement.innerHTML="<"+elementName+" "+
attrs+"></"+elementName+">";}catch(e){}
element=parentElement.firstChild||null;if(!element){element=document.createElement(elementName);for(attr in arguments[1])
element[attr=='class'?'className':attr]=arguments[1][attr];}
if(element.tagName.toUpperCase()!=elementName)
element=parentElement.getElementsByTagName(elementName)[0];}}
if(arguments[2])
this._children(element,arguments[2]);return element;},_text:function(text){return document.createTextNode(text);},ATTR_MAP:{'className':'class','htmlFor':'for'},_attributes:function(attributes){var attrs=[];for(attribute in attributes)
attrs.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;')+'"');return attrs.join(" ");},_children:function(element,children){if(children.tagName){element.appendChild(children);return;}
if(typeof children=='object'){children.flatten().each(function(e){if(typeof e=='object')
element.appendChild(e)
else
if(Builder._isStringOrNumber(e))
element.appendChild(Builder._text(e));});}else
if(Builder._isStringOrNumber(children))
element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');},build:function(html){var element=this.node('div');$(element).update(html.strip());return element.down();},dump:function(scope){if(typeof scope!='object'&&typeof scope!='function')scope=window;var tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);tags.each(function(tag){scope[tag]=function(){return Builder.node.apply(Builder,[tag].concat($A(arguments)));}});}}
String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;},pulse:function(pos,pulses){pulses=pulses||5;return(((pos%(1/pulses))*pulses).round()==0?((pos*pulses*2)-(pos*pulses*2).floor()):1-((pos*pulses*2)-(pos*pulses*2).floor()));},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
(options[eventName]?'this.options.'+eventName+'(this);':''));}
if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval('this.render = function(pos){ '+'if (this.state=="idle"){this.state="running";'+
codeForEvent(this.options,'beforeSetup')+
(this.setup?'this.setup();':'')+
codeForEvent(this.options,'afterSetup')+'};if (this.state=="running"){'+'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+'this.position=pos;'+
codeForEvent(this.options,'beforeUpdate')+
(this.update?'this.update(pos);':'')+
codeForEvent(this.options,'afterUpdate')+'}}');this.event('beforeStart');if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});}
if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset(),max=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1]>max?max:elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round())});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element)},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}})}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}})}})}})}})}})}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options))}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=element.getInlineOpacity();var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos,options.pulses))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});}}}
this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16)});}
this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))))});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
(transform.targetValue-transform.originalValue)*position).toFixed(3)+
(transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity();return styles;};};Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element)
var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;}});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);if(Object.isUndefined(Effect))
throw("dragdrop.js requires including script.aculo.us' effects.js library");var Droppables={drops:[],remove:function(element){this.drops=this.drops.reject(function(d){return d.element==$(element)});},add:function(element){element=$(element);var options=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(options.containment){options._containers=[];var containment=options.containment;if(Object.isArray(containment)){containment.each(function(c){options._containers.push($(c))});}else{options._containers.push($(containment));}}
if(options.accept)options.accept=[options.accept].flatten();Element.makePositioned(element);options.element=element;this.drops.push(options);},findDeepestChild:function(drops){deepest=drops[0];for(i=1;i<drops.length;++i)
if(Element.isParent(drops[i].element,deepest.element))
deepest=drops[i];return deepest;},isContained:function(element,drop){var containmentNode;if(drop.tree){containmentNode=element.treeNode;}else{containmentNode=element.parentNode;}
return drop._containers.detect(function(c){return containmentNode==c});},isAffected:function(point,element,drop){return((drop.element!=element)&&((!drop._containers)||this.isContained(element,drop))&&((!drop.accept)||(Element.classNames(element).detect(function(v){return drop.accept.include(v)})))&&Position.within(drop.element,point[0],point[1]));},deactivate:function(drop){if(drop.hoverclass)
Element.removeClassName(drop.element,drop.hoverclass);this.last_active=null;},activate:function(drop){if(drop.hoverclass)
Element.addClassName(drop.element,drop.hoverclass);this.last_active=drop;},show:function(point,element){if(!this.drops.length)return;var drop,affected=[];this.drops.each(function(drop){if(Droppables.isAffected(point,element,drop))
affected.push(drop);});if(affected.length>0)
drop=Droppables.findDeepestChild(affected);if(this.last_active&&this.last_active!=drop)this.deactivate(this.last_active);if(drop){Position.within(drop.element,point[0],point[1]);if(drop.onHover)
drop.onHover(element,drop.element,Position.overlap(drop.overlap,drop.element));if(drop!=this.last_active)Droppables.activate(drop);}},fire:function(event,element){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(event),Event.pointerY(event)],element,this.last_active))
if(this.last_active.onDrop){this.last_active.onDrop(element,this.last_active.element,event);return true;}},reset:function(){if(this.last_active)
this.deactivate(this.last_active);}}
var Draggables={drags:[],observers:[],register:function(draggable){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);}
this.drags.push(draggable);},unregister:function(draggable){this.drags=this.drags.reject(function(d){return d==draggable});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);}},activate:function(draggable){if(draggable.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=draggable;}.bind(this),draggable.options.delay);}else{window.focus();this.activeDraggable=draggable;}},deactivate:function(){this.activeDraggable=null;},updateDrag:function(event){if(!this.activeDraggable)return;var pointer=[Event.pointerX(event),Event.pointerY(event)];if(this._lastPointer&&(this._lastPointer.inspect()==pointer.inspect()))return;this._lastPointer=pointer;this.activeDraggable.updateDrag(event,pointer);},endDrag:function(event){if(this._timeout){clearTimeout(this._timeout);this._timeout=null;}
if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(event);this.activeDraggable=null;},keyPress:function(event){if(this.activeDraggable)
this.activeDraggable.keyPress(event);},addObserver:function(observer){this.observers.push(observer);this._cacheObserverCallbacks();},removeObserver:function(element){this.observers=this.observers.reject(function(o){return o.element==element});this._cacheObserverCallbacks();},notify:function(eventName,draggable,event){if(this[eventName+'Count']>0)
this.observers.each(function(o){if(o[eventName])o[eventName](eventName,draggable,event);});if(draggable.options[eventName])draggable.options[eventName](draggable,event);},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(eventName){Draggables[eventName+'Count']=Draggables.observers.select(function(o){return o[eventName];}).length;});}}
var Draggable=Class.create({initialize:function(element){var defaults={handle:false,reverteffect:function(element,top_offset,left_offset){var dur=Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;new Effect.Move(element,{x:-left_offset,y:-top_offset,duration:dur,queue:{scope:'_draggable',position:'end'}});},endeffect:function(element){var toOpacity=Object.isNumber(element._opacity)?element._opacity:1.0;new Effect.Opacity(element,{duration:0.2,from:0.7,to:toOpacity,queue:{scope:'_draggable',position:'end'},afterFinish:function(){Draggable._dragging[element]=false}});},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect))
Object.extend(defaults,{starteffect:function(element){element._opacity=Element.getOpacity(element);Draggable._dragging[element]=true;new Effect.Opacity(element,{duration:0.2,from:element._opacity,to:0.7});}});var options=Object.extend(defaults,arguments[1]||{});this.element=$(element);if(options.handle&&Object.isString(options.handle))
this.handle=this.element.down('.'+options.handle,0);if(!this.handle)this.handle=$(options.handle);if(!this.handle)this.handle=this.element;if(options.scroll&&!options.scroll.scrollTo&&!options.scroll.outerHTML){options.scroll=$(options.scroll);this._isScrollChild=Element.childOf(this.element,options.scroll);}
Element.makePositioned(this.element);this.options=options;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this);},currentDelta:function(){return([parseInt(Element.getStyle(this.element,'left')||'0'),parseInt(Element.getStyle(this.element,'top')||'0')]);},initDrag:function(event){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element])return;if(Event.isLeftClick(event)){var src=Event.element(event);if((tag_name=src.tagName.toUpperCase())&&(tag_name=='INPUT'||tag_name=='SELECT'||tag_name=='OPTION'||tag_name=='BUTTON'||tag_name=='TEXTAREA'))return;var pointer=[Event.pointerX(event),Event.pointerY(event)];var pos=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(pointer[i]-pos[i])});Draggables.activate(this);Event.stop(event);}},startDrag:function(event){this.dragging=true;if(!this.delta)
this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);this.element.style.zIndex=this.options.zindex;}
if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element._originallyAbsolute=(this.element.getStyle('position')=='absolute');if(!this.element._originallyAbsolute)
Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element);}
if(this.options.scroll){if(this.options.scroll==window){var where=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=where.left;this.originalScrollTop=where.top;}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop;}}
Draggables.notify('onStart',this,event);if(this.options.starteffect)this.options.starteffect(this.element);},updateDrag:function(event,pointer){if(!this.dragging)this.startDrag(event);if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element);}
Draggables.notify('onDrag',this,event);this.draw(pointer);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height];}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight);}
var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity))speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<(p[1]+this.options.scrollSensitivity))speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>(p[2]-this.options.scrollSensitivity))speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>(p[3]-this.options.scrollSensitivity))speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed);}
if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);},finishDrag:function(event,success){this.dragging=false;if(this.options.quiet){Position.prepare();var pointer=[Event.pointerX(event),Event.pointerY(event)];Droppables.show(pointer,this.element);}
if(this.options.ghosting){if(!this.element._originallyAbsolute)
Position.relativize(this.element);delete this.element._originallyAbsolute;Element.remove(this._clone);this._clone=null;}
var dropped=false;if(success){dropped=Droppables.fire(event,this.element);if(!dropped)dropped=false;}
if(dropped&&this.options.onDropped)this.options.onDropped(this.element);Draggables.notify('onEnd',this,event);var revert=this.options.revert;if(revert&&Object.isFunction(revert))revert=revert(this.element);var d=this.currentDelta();if(revert&&this.options.reverteffect){if(dropped==0||revert!='failure')
this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);}else{this.delta=d;}
if(this.options.zindex)
this.element.style.zIndex=this.originalZ;if(this.options.endeffect)
this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset();},keyPress:function(event){if(event.keyCode!=Event.KEY_ESC)return;this.finishDrag(event,false);Event.stop(event);},endDrag:function(event){if(!this.dragging)return;this.stopScrolling();this.finishDrag(event,true);Event.stop(event);},draw:function(point){var pos=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);pos[0]+=r[0]-Position.deltaX;pos[1]+=r[1]-Position.deltaY;}
var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}
var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){p=this.options.snap(p[0],p[1],this);}else{if(Object.isArray(this.options.snap)){p=p.map(function(v,i){return(v/this.options.snap[i]).round()*this.options.snap[i]}.bind(this))}else{p=p.map(function(v){return(v/this.options.snap).round()*this.options.snap}.bind(this))}}}
var style=this.element.style;if((!this.options.constraint)||(this.options.constraint=='horizontal'))
style.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
style.top=p[1]+"px";if(style.visibility=="hidden")style.visibility="";},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null;}},startScrolling:function(speed){if(!(speed[0]||speed[1]))return;this.scrollSpeed=[speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10);},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000;}
Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify('onDrag',this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0)
Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)
Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer);}
if(this.options.change)this.options.change(this);},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}
if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight}}
return{top:T,left:L,width:W,height:H};}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(element,observer){this.element=$(element);this.observer=observer;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))
this.observer(this.element)}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(element){while(element.tagName.toUpperCase()!="BODY"){if(element.id&&Sortable.sortables[element.id])return element;element=element.parentNode;}},options:function(element){element=Sortable._findRootElement($(element));if(!element)return;return Sortable.sortables[element.id];},destroy:function(element){var s=Sortable.options(element);if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');delete Sortable.sortables[s.element.id];}},create:function(element){element=$(element);var options=Object.extend({element:element,tag:'li',dropOnEmpty:false,tree:false,treeTag:'ul',overlap:'vertical',constraint:'vertical',containment:element,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(element);var options_for_draggable={revert:true,quiet:options.quiet,scroll:options.scroll,scrollSpeed:options.scrollSpeed,scrollSensitivity:options.scrollSensitivity,delay:options.delay,ghosting:options.ghosting,constraint:options.constraint,handle:options.handle};if(options.starteffect)
options_for_draggable.starteffect=options.starteffect;if(options.reverteffect)
options_for_draggable.reverteffect=options.reverteffect;else
if(options.ghosting)options_for_draggable.reverteffect=function(element){element.style.top=0;element.style.left=0;};if(options.endeffect)
options_for_draggable.endeffect=options.endeffect;if(options.zindex)
options_for_draggable.zindex=options.zindex;var options_for_droppable={overlap:options.overlap,containment:options.containment,tree:options.tree,hoverclass:options.hoverclass,onHover:Sortable.onHover}
var options_for_tree={onHover:Sortable.onEmptyHover,overlap:options.overlap,containment:options.containment,hoverclass:options.hoverclass}
Element.cleanWhitespace(element);options.draggables=[];options.droppables=[];if(options.dropOnEmpty||options.tree){Droppables.add(element,options_for_tree);options.droppables.push(element);}
(options.elements||this.findElements(element,options)||[]).each(function(e,i){var handle=options.handles?$(options.handles[i]):(options.handle?$(e).select('.'+options.handle)[0]:e);options.draggables.push(new Draggable(e,Object.extend(options_for_draggable,{handle:handle})));Droppables.add(e,options_for_droppable);if(options.tree)e.treeNode=element;options.droppables.push(e);});if(options.tree){(Sortable.findTreeElements(element,options)||[]).each(function(e){Droppables.add(e,options_for_tree);e.treeNode=element;options.droppables.push(e);});}
this.sortables[element.id]=options;Draggables.addObserver(new SortableObserver(element,options.onUpdate));},findElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.tag);},findTreeElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.treeTag);},onHover:function(element,dropon,overlap){if(Element.isParent(dropon,element))return;if(overlap>.33&&overlap<.66&&Sortable.options(dropon).tree){return;}else if(overlap>0.5){Sortable.mark(dropon,'before');if(dropon.previousSibling!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,dropon);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}else{Sortable.mark(dropon,'after');var nextElement=dropon.nextSibling||null;if(nextElement!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,nextElement);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}},onEmptyHover:function(element,dropon,overlap){var oldParentNode=element.parentNode;var droponOptions=Sortable.options(dropon);if(!Element.isParent(dropon,element)){var index;var children=Sortable.findElements(dropon,{tag:droponOptions.tag,only:droponOptions.only});var child=null;if(children){var offset=Element.offsetSize(dropon,droponOptions.overlap)*(1.0-overlap);for(index=0;index<children.length;index+=1){if(offset-Element.offsetSize(children[index],droponOptions.overlap)>=0){offset-=Element.offsetSize(children[index],droponOptions.overlap);}else if(offset-(Element.offsetSize(children[index],droponOptions.overlap)/2)>=0){child=index+1<children.length?children[index+1]:null;break;}else{child=children[index];break;}}}
dropon.insertBefore(element,child);Sortable.options(oldParentNode).onChange(element);droponOptions.onChange(element);}},unmark:function(){if(Sortable._marker)Sortable._marker.hide();},mark:function(dropon,position){var sortable=Sortable.options(dropon.parentNode);if(sortable&&!sortable.ghosting)return;if(!Sortable._marker){Sortable._marker=($('dropmarker')||Element.extend(document.createElement('DIV'))).hide().addClassName('dropmarker').setStyle({position:'absolute'});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}
var offsets=Position.cumulativeOffset(dropon);Sortable._marker.setStyle({left:offsets[0]+'px',top:offsets[1]+'px'});if(position=='after')
if(sortable.overlap=='horizontal')
Sortable._marker.setStyle({left:(offsets[0]+dropon.clientWidth)+'px'});else
Sortable._marker.setStyle({top:(offsets[1]+dropon.clientHeight)+'px'});Sortable._marker.show();},_tree:function(element,options,parent){var children=Sortable.findElements(element,options)||[];for(var i=0;i<children.length;++i){var match=children[i].id.match(options.format);if(!match)continue;var child={id:encodeURIComponent(match?match[1]:null),element:element,parent:parent,children:[],position:parent.children.length,container:$(children[i]).down(options.treeTag)}
if(child.container)
this._tree(child.container,options,child)
parent.children.push(child);}
return parent;},tree:function(element){element=$(element);var sortableOptions=this.options(element);var options=Object.extend({tag:sortableOptions.tag,treeTag:sortableOptions.treeTag,only:sortableOptions.only,name:element.id,format:sortableOptions.format},arguments[1]||{});var root={id:null,parent:null,children:[],container:element,position:0}
return Sortable._tree(element,options,root);},_constructIndex:function(node){var index='';do{if(node.id)index='['+node.position+']'+index;}while((node=node.parent)!=null);return index;},sequence:function(element){element=$(element);var options=Object.extend(this.options(element),arguments[1]||{});return $(this.findElements(element,options)||[]).map(function(item){return item.id.match(options.format)?item.id.match(options.format)[1]:'';});},setSequence:function(element,new_sequence){element=$(element);var options=Object.extend(this.options(element),arguments[2]||{});var nodeMap={};this.findElements(element,options).each(function(n){if(n.id.match(options.format))
nodeMap[n.id.match(options.format)[1]]=[n,n.parentNode];n.parentNode.removeChild(n);});new_sequence.each(function(ident){var n=nodeMap[ident];if(n){n[1].appendChild(n[0]);delete nodeMap[ident];}});},serialize:function(element){element=$(element);var options=Object.extend(Sortable.options(element),arguments[1]||{});var name=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:element.id);if(options.tree){return Sortable.tree(element,arguments[1]).children.map(function(item){return[name+Sortable._constructIndex(item)+"[id]="+
encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));}).flatten().join('&');}else{return Sortable.sequence(element,arguments[1]).map(function(item){return name+"[]="+encodeURIComponent(item);}).join('&');}}}
Element.isParent=function(child,element){if(!child.parentNode||child==element)return false;if(child.parentNode==element)return true;return Element.isParent(child.parentNode,element);}
Element.findChildren=function(element,only,recursive,tagName){if(!element.hasChildNodes())return null;tagName=tagName.toUpperCase();if(only)only=[only].flatten();var elements=[];$A(element.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==tagName&&(!only||(Element.classNames(e).detect(function(v){return only.include(v)}))))
elements.push(e);if(recursive){var grandchildren=Element.findChildren(e,only,recursive,tagName);if(grandchildren)elements.push(grandchildren);}});return(elements.length>0?elements.flatten():[]);}
Element.offsetSize=function(element,type){return element['offset'+((type=='vertical'||type=='height')?'Height':'Width')];}
if(typeof Effect=='undefined')
throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={}
Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element)
this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)
this.setOptions(options);else
this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n'))
this.options.tokens.push('\n');this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,'blur',this.onBlur.bindAsEventListener(this));Event.observe(this.element,'keydown',this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active)
switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(event);return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
{this.index=element.autocompleteIndex;this.render();}
Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index--
else this.index=this.entryCount-1;this.getEntry(this.index).scrollIntoView(true);},markNext:function(){if(this.index<this.entryCount-1)this.index++
else this.index=0;this.getEntry(this.index).scrollIntoView(false);},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}
this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
if(newS[index]!=oldS[index])
return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
if(partial.length)
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length))
return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);}
Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+'-inplaceeditor';if($(this.options.formId))
this.options.formId='';}
if(this.options.externalControl)
this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)
this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle('background-color')||'transparent';this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode)
this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode)
this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode)
btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_'+mode+'_link';if(extraClasses)
link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0<size)fld.size=size;}else{fld=document.createElement('textarea');fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}
fld.name=this.options.paramName;fld.value=text;fld.className='editor_field';if(this.options.submitOnBlur)
fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL)
this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};this._form=$(document.createElement('form'));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if('textarea'==this._controls.editor.tagName.toLowerCase())
this._form.appendChild(document.createElement('br'));if(this.options.onFormCustomization)
this.options.onFormCustomization(this,this._form);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML)
this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback('onEnterEditMode');if(this.options.externalControl)
this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL)
this.postProcessEditField();if(e)Event.stop(e);},enterHover:function(e){if(this.options.hoverClassName)
this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onEnterHover');},getText:function(){return this.element.innerHTML;},handleAJAXFailure:function(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params))
params=params.toQueryParams();params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);}
if(e)Event.stop(e);},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl)
this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback('onLeaveEditMode');},leaveHover:function(e){if(this.options.hoverClassName)
this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onLeaveHover');},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags)
text=text.stripTags();this._controls.editor.value=text;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc)
$(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly)
this.element.observe(pair.key,listener);if(this.options.externalControl)
this.options.externalControl.observe(pair.key,listener);}.bind(this));},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly)
this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl)
this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)
this.loadCollection();else
this.checkForExternalText();this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))
throw'Server returned an invalid collection representation.';this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options);},showLoadingText:function(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;}
tempOption.update((text||'').stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)
this.loadExternalText();else
this.buildOptionList();},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:'link',cancelText:'cancel',clickToEditText:'Click to edit',externalControl:null,externalControlOnly:false,fieldPostCreation:'activate',formClassName:'inplaceeditor-form',formId:null,highlightColor:'#ffff99',highlightEndColor:'#ffffff',hoverClassName:'',htmlResponse:true,loadingClassName:'inplaceeditor-loading',loadingText:'Loading...',okControl:'button',okText:'ok',paramName:'value',rows:1,savingClassName:'inplaceeditor-saving',savingText:'Saving...',size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:'',textBeforeControls:'',textBetweenControls:''},DefaultCallbacks:{callback:function(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect)
ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:'enterEditMode',keydown:'checkForEscapeOrReturn',mouseover:'enterHover',mouseout:'leaveHover'}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:'Loading options...'};Form.Element.DelayedObserver=Class.create({initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}});if(!Control)var Control={};Control.Slider=Class.create({initialize:function(handle,track,options){var slider=this;if(Object.isArray(handle)){this.handles=handle.collect(function(e){return $(e)});}else{this.handles=[$(handle)];}
this.track=$(track);this.options=options||{};this.axis=this.options.axis||'horizontal';this.increment=this.options.increment||1;this.step=parseInt(this.options.step||'1');this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(s){return $(s)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||'0');this.alignY=parseInt(this.options.alignY||'0');this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled)this.setDisabled();this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max();}
this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(h,i){i=slider.handles.length-1-i;slider.setValue(parseFloat((Object.isArray(slider.options.sliderValue)?slider.options.sliderValue[i]:slider.options.sliderValue)||slider.range.start),i);h.makePositioned().observe("mousedown",slider.eventMouseDown);});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true;},dispose:function(){var slider=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(h){Event.stopObserving(h,"mousedown",slider.eventMouseDown);});},setDisabled:function(){this.disabled=true;},setEnabled:function(){this.disabled=false;},getNearestValue:function(value){if(this.allowedValues){if(value>=this.allowedValues.max())return(this.allowedValues.max());if(value<=this.allowedValues.min())return(this.allowedValues.min());var offset=Math.abs(this.allowedValues[0]-value);var newValue=this.allowedValues[0];this.allowedValues.each(function(v){var currentOffset=Math.abs(v-value);if(currentOffset<=offset){newValue=v;offset=currentOffset;}});return newValue;}
if(value>this.range.end)return this.range.end;if(value<this.range.start)return this.range.start;return value;},setValue:function(sliderValue,handleIdx){if(!this.active){this.activeHandleIdx=handleIdx||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles();}
handleIdx=handleIdx||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((handleIdx>0)&&(sliderValue<this.values[handleIdx-1]))
sliderValue=this.values[handleIdx-1];if((handleIdx<(this.handles.length-1))&&(sliderValue>this.values[handleIdx+1]))
sliderValue=this.values[handleIdx+1];}
sliderValue=this.getNearestValue(sliderValue);this.values[handleIdx]=sliderValue;this.value=this.values[0];this.handles[handleIdx].style[this.isVertical()?'top':'left']=this.translateToPx(sliderValue);this.drawSpans();if(!this.dragging||!this.event)this.updateFinished();},setValueBy:function(delta,handleIdx){this.setValue(this.values[handleIdx||this.activeHandleIdx||0]+delta,handleIdx||this.activeHandleIdx||0);},translateToPx:function(value){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(value-this.range.start))+"px";},translateToValue:function(offset){return((offset/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start);},getRange:function(range){var v=this.values.sortBy(Prototype.K);range=range||0;return $R(v[range],v[range+1]);},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX);},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX);},isVertical:function(){return(this.axis=='vertical');},drawSpans:function(){var slider=this;if(this.spans)
$R(0,this.spans.length-1).each(function(r){slider.setSpan(slider.spans[r],slider.getRange(r))});if(this.options.startSpan)
this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value));if(this.options.endSpan)
this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum));},setSpan:function(span,range){if(this.isVertical()){span.style.top=this.translateToPx(range.start);span.style.height=this.translateToPx(range.end-range.start+this.range.start);}else{span.style.left=this.translateToPx(range.start);span.style.width=this.translateToPx(range.end-range.start+this.range.start);}},updateStyles:function(){this.handles.each(function(h){Element.removeClassName(h,'selected')});Element.addClassName(this.activeHandle,'selected');},startDrag:function(event){if(Event.isLeftClick(event)){if(!this.disabled){this.active=true;var handle=Event.element(event);var pointer=[Event.pointerX(event),Event.pointerY(event)];var track=handle;if(track==this.track){var offsets=Position.cumulativeOffset(this.track);this.event=event;this.setValue(this.translateToValue((this.isVertical()?pointer[1]-offsets[1]:pointer[0]-offsets[0])-(this.handleLength/2)));var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}else{while((this.handles.indexOf(handle)==-1)&&handle.parentNode)
handle=handle.parentNode;if(this.handles.indexOf(handle)!=-1){this.activeHandle=handle;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}}}
Event.stop(event);}},update:function(event){if(this.active){if(!this.dragging)this.dragging=true;this.draw(event);if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);}},draw:function(event){var pointer=[Event.pointerX(event),Event.pointerY(event)];var offsets=Position.cumulativeOffset(this.track);pointer[0]-=this.offsetX+offsets[0];pointer[1]-=this.offsetY+offsets[1];this.event=event;this.setValue(this.translateToValue(this.isVertical()?pointer[1]:pointer[0]));if(this.initialized&&this.options.onSlide)
this.options.onSlide(this.values.length>1?this.values:this.value,this);},endDrag:function(event){if(this.active&&this.dragging){this.finishDrag(event,true);Event.stop(event);}
this.active=false;this.dragging=false;},finishDrag:function(event,success){this.active=false;this.dragging=false;this.updateFinished();},updateFinished:function(){if(this.initialized&&this.options.onChange)
this.options.onChange(this.values.length>1?this.values:this.value,this);this.event=null;}});Sound={tracks:{},_enabled:true,template:new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),enable:function(){Sound._enabled=true;},disable:function(){Sound._enabled=false;},play:function(url){if(!Sound._enabled)return;var options=Object.extend({track:'global',url:url,replace:false},arguments[1]||{});if(options.replace&&this.tracks[options.track]){$R(0,this.tracks[options.track].id).each(function(id){var sound=$('sound_'+options.track+'_'+id);sound.Stop&&sound.Stop();sound.remove();})
this.tracks[options.track]=null;}
if(!this.tracks[options.track])
this.tracks[options.track]={id:0}
else
this.tracks[options.track].id++;options.id=this.tracks[options.track].id;$$('body')[0].insert(Prototype.Browser.IE?new Element('bgsound',{id:'sound_'+options.track+'_'+options.id,src:options.url,loop:1,autostart:true}):Sound.template.evaluate(options));}};if(Prototype.Browser.Gecko&&navigator.userAgent.indexOf("Win")>0){if(navigator.plugins&&$A(navigator.plugins).detect(function(p){return p.name.indexOf('QuickTime')!=-1}))
Sound.template=new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
else
Sound.play=function(){}}
Utilities=Class.create({});Utilities.TextFieldDefault=Class.create({element:null,defaultText:'',changed:false,options:{'defaultClassName':null},initialize:function(element,defaultText,options){this.element=$(element);this.defaultText=defaultText;this.options=Object.extend(this.options,options);if(this.element.value=="")
{this.element.value=this.defaultText;if(this.options['defaultClassName']!=null){this.element.addClassName(this.options['defaultClassName']);}}
Event.observe(this.element.up('form'),'submit',function(e){if(this.element.value==this.defaultText){if(!this.changed){this.element.value="";}}}.bindAsEventListener(this));Event.observe(this.element,'focus',function(event){if(this.element.value==this.defaultText){if(!this.changed){this.element.value="";if(this.options['defaultClassName']!=null){this.element.removeClassName(this.options['defaultClassName']);}}}}.bindAsEventListener(this));Event.observe(this.element,'blur',function(event){if(this.element.value==""){this.changed=false;this.element.value=this.defaultText;if(this.options['defaultClassName']!=null){this.element.addClassName(this.options['defaultClassName']);}}else{this.changed=true;}}.bindAsEventListener(this));}});Utilities.SelectDefault=Class.create({element:null,defaultText:'',changed:false,options:{'defaultClassName':null},initialize:function(element,defaultText,options){this.element=element;this.defaultText=defaultText;this.options=Object.extend(this.options,options);var selectedIndex=null;var options=this.element.getElementsByTagName('option');for(var i=0;i<options.length;i++){if(options[i].getAttribute('selected')!=null){selectedIndex=i;}}
if(selectedIndex==null){var defaultOption=document.createElement('option');defaultOption.value="";defaultOption.text=this.defaultText;defaultOption.selected="selected";if(this.element.childNodes.length==0){this.element.appendChild(defaultOption);}else{this.element.insertBefore(defaultOption,this.element.childNodes[0]);}
if(this.options['defaultClassName']!=null){this.element.addClassName(this.options['defaultClassName']);}}
Event.observe(this.element,'focus',function(event,defaultOption){if(!this.changed){this.element.removeChild(defaultOption);if(this.options['defaultClassName']!=null){this.element.removeClassName(this.options['defaultClassName']);}
this.changed=true;}}.bindAsEventListener(this,defaultOption));}});Utilities.Bubble=Class.create({element:null,container:null,options:{},initialize:function(element,x,y,html,options){this.element=element;options=Object.extend({id:null,className:'bubble',canvasContainerClassName:'canvas',htmlContainerClassName:'html',width:300,height:160,pointerLength:30,pointerBaseWidth:30,pointerBaseOffset:30,onClose:this.onClose},options);this.options=options;this.container=$(document.createElement('div'));this.container.id=options.id;this.container.className=options.className;var htmlContainer=$(document.createElement('div'));htmlContainer.className=options.htmlContainerClassName;htmlContainer.innerHTML=html;htmlContainer.setStyle("width: "+options.width+"px");htmlContainer.setStyle("height: "+(options.height-options.pointerLength)+"px");var closeLink=$(document.createElement('a'));closeLink.href="#";closeLink.className="close";var span=document.createElement('span');closeLink.appendChild(span);span.appendChild(document.createTextNode('Close'));closeLink.observe('click',function(e){e.stop();this.close();}.bindAsEventListener(this));Insertion.Top(htmlContainer,closeLink);this.container.appendChild(htmlContainer);var canvasContainer=$(document.createElement('div'));canvasContainer.setStyle("height: "+options.pointerLength+"px");canvasContainer.className=options.canvasContainerClassName;var canvas=Raphael(canvasContainer,options.width,options.pointerLength);var boundOffset=$(element).cumulativeOffset();var xBound=(element.getWidth()/2)+boundOffset.left;var yBound=(element.getHeight()/2)+boundOffset.top;if(x<=xBound&&y<=yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(0,0).lineTo(30,30).lineTo(60,30).lineTo(0,0);Insertion.Top(this.container,canvasContainer);}else if(x>xBound&&y<=yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(options.width,0).lineTo(options.width-30,30).lineTo(options.width-60,30).lineTo(options.width,0);Insertion.Top(this.container,canvasContainer);x-=(options.width);}else if(x<=xBound&&y>yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(0,30).lineTo(30,0).lineTo(60,0).lineTo(0,30);Insertion.Bottom(this.container,canvasContainer);y-=(options.height+options.pointerLength);}else if(x>xBound&&y>yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(options.width,30).lineTo(options.width-30,0).lineTo(options.width-60,0).lineTo(options.width,30);Insertion.Bottom(this.container,canvasContainer);y-=(options.height+options.pointerLength);x-=(options.width);}
this.move(x,y);element.appendChild(this.container);},move:function(x,y){this.container.setStyle("left: "+x+"px;");this.container.setStyle("top: "+y+"px;");},close:function(){this.options.onClose();this.container.parentNode.removeChild(this.container);},onClose:function(){}});Utilities.ChangeListener=Class.create({sourceInput:null,loop:null,originalValue:'',changed:false,initialize:function(sourceInput,options){options=Object.extend({onChange:function(value,changed){}},options);this.sourceInput=$(sourceInput);this.originalValue=this.sourceInput.value;this.onChange=options.onChange;if(this.originalValue!=''){this.changed=true;}
this.sourceInput.observe('focus',function(){this.loop=setInterval(this.checkChange.bindAsEventListener(this),50);}.bindAsEventListener(this));this.sourceInput.observe('blur',function(){clearInterval(this.loop);}.bindAsEventListener(this));},checkChange:function(){this.changed=(this.sourceInput.value!=this.originalValue);this.onChange(this.sourceInput.value,this.changed);},onChange:function(value,changed){}});Utilities.Dasherize=Class.create({sourceInput:null,targetInput:null,loop:null,change:true,initialize:function(sourceInput,targetInput){this.sourceInput=$(sourceInput);this.targetInput=$(targetInput);if(this.sourceInput.value==""){this.change=true;}
Event.observe(this.sourceInput,'focus',function(){this.loop=setInterval(function(){if(this.change){this.targetInput.value=this.sourceInput.value.toLowerCase().gsub(/[^a-z0-9_\- ]/,'').gsub(/[_ ]/,'-');}}.bindAsEventListener(this),50);}.bindAsEventListener(this));Event.observe(this.sourceInput,'blur',function(){clearInterval(this.loop);}.bindAsEventListener(this));Event.observe(this.targetInput,'focus',function(){this.change=false;}.bindAsEventListener(this));}});Overlay=Class.create({});Object.extend(Overlay,{overlay:null,loop:null,frames:[],getFrame:function(id){for(var i=0;i<this.frames.length;i++){if(this.frames[i].id==id){return this.frames[i];}}
return null;},show:function(id,content,options){if(!(frame=Overlay.getFrame(id))){frame=new Overlay.Frame(id,content,options);}else{this.frames=this.frames.without(frame);}
this.frames.push(frame);frame.setContent(content);this.render();if(id!="loader"){this.closeLoader();}},replace:function(id,content,options){frame=overlay.getFrame(id);frame.replace(content,options);},showLoader:function(){Overlay.show("loader","<img src=\"/images/cms/loading.gif\" alt=\"Loading. Please Wait.\" class=\"loading\" />");},closeLoader:function(){Overlay.closeFrame(Overlay.getFrame("loader"));},render:function(){if(this.overlay==null){this.overlay=$(document.createElement('div'));this.overlay.className="frontend overlay";this.overlay.setStyle("opacity: 0");Insertion.Top(document.body,this.overlay);this.loop=setInterval(function(){if(this.overlay){if(this.overlay.getStyle("opacity")>=0.5){clearInterval(this.loop);this.loop=null;for(var i=0;i<this.frames.length;i++){this.frames[i].frame.setStyle("z-index: "+(100+i));}
$A(this.frames).last().show();this.onRendered();return;}
this.overlay.setStyle("opacity: "+(this.overlay.getStyle("opacity")+0.1));}}.bindAsEventListener(this),1);}else{for(var i=0;i<this.frames.length;i++){this.frames[i].frame.setStyle("z-index: "+(100+i));}
$A(this.frames).last().show();this.onRendered();}},closeFrame:function(frame){if(frame){this.frames=this.frames.without(frame);frame.close();if(frame.id!="loader"&&this.frames.length==0)
{this.close();}}},closeFrames:function(){while(this.frames.length>0){var frame=this.frames.pop();frame.close();}},close:function(){this.closeFrames();this.loop=setInterval(function(){if(this.overlay){if(this.overlay.getStyle("opacity")<=0.01){clearInterval(this.loop);this.loop=null;Event.stopObserving(this.overlay);this.overlay.parentNode.removeChild(this.overlay);this.overlay=null;this.onClosed();return;}
o=Math.max(this.overlay.getStyle("opacity")-0.1,0.01);this.overlay.setStyle("opacity: "+o);}}.bindAsEventListener(this),1);},alert:function(text,options,buttons){options=Object.extend({ok:function(){},cancel:function(){},onClose:function(){}},options);var html='<div class="panel-content"><div class="inner">'+text+'</div></div>';if(buttons==undefined){html+='<div class="panel-related"><div class="inner"><div class="related-buttons"><button id="confirm_ok">Ok</button></span></div></div></div>';}else{html+='<div class="panel-related"><div class="inner"><div class="related-buttons">'+buttons+'</span></div></div></div>';}
Overlay.show('alert',html,{onLoad:function(){var ok=$('confirm_ok');if(ok){ok.observe('click',function(e){e.stop();options.ok();Overlay.closeFrame(Overlay.getFrame('alert'));});}}.bindAsEventListener(options),onClose:function(){options.onClose();}.bindAsEventListener(options),hide_close:options.hide_close});},confirm:function(text,options){options=Object.extend({ok:function(){},cancel:function(){}},options);var html='<div class="panel-content"><div class="inner">'+text+'</div></div>';html+='<div class="panel-related"><div class="inner"><div class="related-buttons"><button id="confirm_ok">Continue</button> <span class="or-cancel">or <a href="#" id="confirm_close">Cancel</a></span></div></div></div>';Overlay.show('confirm',html,{onLoad:function(){var ok=$('confirm_ok');if(ok){ok.observe('click',function(e){e.stop();options.ok();Overlay.closeFrame(Overlay.getFrame('confirm'));});}
var cancel=$('confirm_close');if(cancel){cancel.observe('click',function(e){e.stop();options.cancel();Overlay.closeFrame(Overlay.getFrame('confirm'));});}}.bindAsEventListener(options)});},onRendered:function(){},onClosed:function(){}});Overlay.Frame=Class.create({id:null,frame:null,content:null,options:null,moving:false,clickCoords:{x:null,y:null},origCoords:{x:null,y:null},title:null,width:null,height:null,initialize:function(id,content,options){this.id=id;this.content=content;this.setOptions(options);},render:function(overlay){if(this.frame==null){this.frame=$(document.createElement('div'));this.frame.className="frame";Insertion.Top(document.body,this.frame);this.center();}
this.frame.setStyle("display: none");var d=document.createElement('div');d.className="panel";var d1=document.createElement('div');d1.className="panel-head";d1.innerHTML=this.title?this.title:'';d.appendChild(d1);this.frame.appendChild(d);var d3=document.createElement('div');d3.className="panel-body";d3.innerHTML=this.content;d.appendChild(d3);var showclose=true;if(this.options){if(this.options.hide_close){if(this.options.hide_close==true){showclose=false;}}}
if(showclose==true){var close=$(document.createElement('a'));close.href="#";close.addClassName('close');close.appendChild(document.createTextNode('Close'));close.observe('click',function(e){e.stop();Overlay.closeFrame(this);}.bindAsEventListener(this));d1.appendChild(close);}
this.onLoad();},show:function(){if(this.frame!=null){this.frame.setStyle("display: block");if(this.width){this.frame.setStyle("width: "+this.width+"px");this.center();}else{while(this.hasScrollBar(this.frame,"x")){this.frame.setStyle("width: "+parseInt(this.frame.getWidth()+5)+"px");this.center();}}
if(this.height){this.frame.setStyle("height: "+this.height+"px");this.center();}else{while(this.hasScrollBar(this.frame,"y")){this.frame.setStyle("height: "+parseInt(this.frame.getHeight()+5)+"px");this.center();}}}
this.frame.id=this.id;},center:function(){var dimensions=Element.getDimensions(this.frame);this.frame.setStyle("left: "+((this.winWidth()/2)-dimensions.width/2)+'px');this.move((this.winWidth()/2-dimensions.width/2),this.getScrollTop()+((this.winHeight()-(dimensions.height/2))/2),true);},move:function(left,top,abs){if(top<10){top=10;}
if(abs){this.frame.setStyle("left: "+left+"px");this.frame.setStyle("top: "+top+"px");}else{this.frame.setStyle("left: "+(this.origCoords.x-left)+"px");this.frame.setStyle("top: "+(this.origCoords.y-top)+"px");}},hide:function(){if(this.frame!=null){this.frame.setStyle("display: none");}},close:function(){if(this.frame){this.frame.parentNode.removeChild(this.frame);this.onClose();}},setContent:function(content){this.content=content;this.render();},replace:function(content,options){this.content=content;this.frame.innerHTML=content;this.setOptions(options);var close=$(document.createElement('a'));close.href="#";close.addClassName('close');close.appendChild(document.createTextNode('Close'));close.observe('click',function(e){e.stop();Overlay.closeFrame(this);}.bindAsEventListener(this));Insertion.Top(this.frame,close);this.onLoad();},setOptions:function(options){this.onLoad=function(){}
this.onClose=function(){}
if(options!=null)
{this.options=options;if(this.options.onLoad){this.onLoad=this.options.onLoad;}
if(this.options.onClose){this.onClose=this.options.onClose;}
if(this.options.width){this.width=this.options.width;}
if(this.options.height){this.height=this.options.height;}
if(this.options.title){this.title=this.options.title;}}},onLoad:function(){},onClose:function(){},winWidth:function(){if(typeof window.innerWidth!='undefined')
return window.innerWidth;if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0)
return document.documentElement.clientWidth;return document.getElementsByTagName('body')[0].clientWidth},winHeight:function(){if(typeof window.innerHeight!='undefined')
return window.innerHeight
if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientHeight!='undefined'&&document.documentElement.clientHeight!=0)
return document.documentElement.clientHeight;return document.getElementsByTagName('body')[0].clientHeight;},getScrollTop:function(){return(window.pageYOffset)?window.pageYOffset:(document.documentElement&&document.documentElement.scrollTop)?document.documentElement.scrollTop:document.body.scrollTop;},hasXScrollBar:function(el){el=$(el);el.scrollLeft+=1;if(el.scrollLeft>0){el.scrollLeft-=1;return true;}else{return false;}},hasYScrollBar:function(el){el=$(el);el.scrollTop+=1;if(el.scrollTop>0){el.scrollTop-=1;return true;}else{return false;}},hasScrollBar:function(el,axis){{switch(axis)
{case'x':return this.hasXScrollBar(el);case'y':return this.hasYScrollBar(el);case'xy':return this.hasXScrollBar(el)&&this.hasYScrollBar(el);default:return this.hasXScrollBar(el)||this.hasYScrollBar(el);}}}});Utilities=Class.create({});Utilities.TextFieldDefault=Class.create({element:null,defaultText:'',changed:false,options:{'defaultClassName':null},initialize:function(element,defaultText,options){this.element=$(element);this.defaultText=defaultText;this.options=Object.extend(this.options,options);if(this.element.value=="")
{this.element.value=this.defaultText;if(this.options['defaultClassName']!=null){this.element.addClassName(this.options['defaultClassName']);}}
Event.observe(this.element.up('form'),'submit',function(e){if(this.element.value==this.defaultText){if(!this.changed){this.element.value="";}}}.bindAsEventListener(this));Event.observe(this.element,'focus',function(event){if(this.element.value==this.defaultText){if(!this.changed){this.element.value="";if(this.options['defaultClassName']!=null){this.element.removeClassName(this.options['defaultClassName']);}}}}.bindAsEventListener(this));Event.observe(this.element,'blur',function(event){if(this.element.value==""){this.changed=false;this.element.value=this.defaultText;if(this.options['defaultClassName']!=null){this.element.addClassName(this.options['defaultClassName']);}}else{this.changed=true;}}.bindAsEventListener(this));}});Utilities.SelectDefault=Class.create({element:null,defaultText:'',changed:false,options:{'defaultClassName':null},initialize:function(element,defaultText,options){this.element=element;this.defaultText=defaultText;this.options=Object.extend(this.options,options);var selectedIndex=null;var options=this.element.getElementsByTagName('option');for(var i=0;i<options.length;i++){if(options[i].getAttribute('selected')!=null){selectedIndex=i;}}
if(selectedIndex==null){var defaultOption=document.createElement('option');defaultOption.value="";defaultOption.text=this.defaultText;defaultOption.selected="selected";if(this.element.childNodes.length==0){this.element.appendChild(defaultOption);}else{this.element.insertBefore(defaultOption,this.element.childNodes[0]);}
if(this.options['defaultClassName']!=null){this.element.addClassName(this.options['defaultClassName']);}}
Event.observe(this.element,'focus',function(event,defaultOption){if(!this.changed){this.element.removeChild(defaultOption);if(this.options['defaultClassName']!=null){this.element.removeClassName(this.options['defaultClassName']);}
this.changed=true;}}.bindAsEventListener(this,defaultOption));}});Utilities.Bubble=Class.create({element:null,container:null,options:{},initialize:function(element,x,y,html,options){this.element=element;options=Object.extend({id:null,className:'bubble',canvasContainerClassName:'canvas',htmlContainerClassName:'html',width:300,height:160,pointerLength:30,pointerBaseWidth:30,pointerBaseOffset:30,onClose:this.onClose},options);this.options=options;this.container=$(document.createElement('div'));this.container.id=options.id;this.container.className=options.className;var htmlContainer=$(document.createElement('div'));htmlContainer.className=options.htmlContainerClassName;htmlContainer.innerHTML=html;htmlContainer.setStyle("width: "+options.width+"px");htmlContainer.setStyle("height: "+(options.height-options.pointerLength)+"px");var closeLink=$(document.createElement('a'));closeLink.href="#";closeLink.className="close";var span=document.createElement('span');closeLink.appendChild(span);span.appendChild(document.createTextNode('Close'));closeLink.observe('click',function(e){e.stop();this.close();}.bindAsEventListener(this));Insertion.Top(htmlContainer,closeLink);this.container.appendChild(htmlContainer);var canvasContainer=$(document.createElement('div'));canvasContainer.setStyle("height: "+options.pointerLength+"px");canvasContainer.className=options.canvasContainerClassName;var canvas=Raphael(canvasContainer,options.width,options.pointerLength);var boundOffset=$(element).cumulativeOffset();var xBound=(element.getWidth()/2)+boundOffset.left;var yBound=(element.getHeight()/2)+boundOffset.top;if(x<=xBound&&y<=yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(0,0).lineTo(30,30).lineTo(60,30).lineTo(0,0);Insertion.Top(this.container,canvasContainer);}else if(x>xBound&&y<=yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(options.width,0).lineTo(options.width-30,30).lineTo(options.width-60,30).lineTo(options.width,0);Insertion.Top(this.container,canvasContainer);x-=(options.width);}else if(x<=xBound&&y>yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(0,30).lineTo(30,0).lineTo(60,0).lineTo(0,30);Insertion.Bottom(this.container,canvasContainer);y-=(options.height+options.pointerLength);}else if(x>xBound&&y>yBound){canvas.path({stroke:'#fff',fill:'#fff'}).moveTo(options.width,30).lineTo(options.width-30,0).lineTo(options.width-60,0).lineTo(options.width,30);Insertion.Bottom(this.container,canvasContainer);y-=(options.height+options.pointerLength);x-=(options.width);}
this.move(x,y);element.appendChild(this.container);},move:function(x,y){this.container.setStyle("left: "+x+"px;");this.container.setStyle("top: "+y+"px;");},close:function(){this.options.onClose();this.container.parentNode.removeChild(this.container);},onClose:function(){}});Utilities.ChangeListener=Class.create({sourceInput:null,loop:null,originalValue:'',changed:false,initialize:function(sourceInput,options){options=Object.extend({onChange:function(value,changed){}},options);this.sourceInput=$(sourceInput);this.originalValue=this.sourceInput.value;this.onChange=options.onChange;if(this.originalValue!=''){this.changed=true;}
this.sourceInput.observe('focus',function(){this.loop=setInterval(this.checkChange.bindAsEventListener(this),50);}.bindAsEventListener(this));this.sourceInput.observe('blur',function(){clearInterval(this.loop);}.bindAsEventListener(this));},checkChange:function(){this.changed=(this.sourceInput.value!=this.originalValue);this.onChange(this.sourceInput.value,this.changed);},onChange:function(value,changed){}});Utilities.Dasherize=Class.create({sourceInput:null,targetInput:null,loop:null,change:true,initialize:function(sourceInput,targetInput){this.sourceInput=$(sourceInput);this.targetInput=$(targetInput);if(this.sourceInput.value==""){this.change=true;}
Event.observe(this.sourceInput,'focus',function(){this.loop=setInterval(function(){if(this.change){this.targetInput.value=this.sourceInput.value.toLowerCase().gsub(/[^a-z0-9_\- ]/,'').gsub(/[_ ]/,'-');}}.bindAsEventListener(this),50);}.bindAsEventListener(this));Event.observe(this.sourceInput,'blur',function(){clearInterval(this.loop);}.bindAsEventListener(this));Event.observe(this.targetInput,'focus',function(){this.change=false;}.bindAsEventListener(this));}});var WalkingWithAttitude=Class.create({});WalkingWithAttitude=Object.extend({setupCalendars:function(){var calendars=document.getElementsByClassName('modal-date-picker');for(var i=0;i<calendars.length;i++){calendars[i].disabled=true;var div=$(document.createElement('div'));div.id='calendar-modal-'+i;div.setStyle('display: inline');div.setStyle('z-index: 100');div.setStyle('cursor: pointer');var img=document.createElement('img');img.src='/images/calendar.gif';img.setAttribute('alt','Pick a date');div.appendChild(img);calendars[i].parentNode.appendChild(div);Element.clonePosition(div,calendars[i].parentNode);calendars[i].up('form').observe('submit',function(e){e.element().getElementsBySelector('input.modal-date-picker').each(function(i){i.disabled=false;});}.bindAsEventListener(this));Calendar.setup({showsTime:calendars[i].hasClassName('show-time'),inputField:calendars[i].id,ifFormat:'%b %d, %Y'+(calendars[i].hasClassName('show-time')?' %H:%M':''),button:'calendar-modal-'+i});}
var calendars=document.getElementsByClassName('date-picker');for(var i=0;i<calendars.length;i++){var img=document.createElement('img');img.id='calendar-trigger-'+i,img.src='/images/calendar.gif';img.setAttribute('alt','Pick a date');calendars[i].parentNode.appendChild(img);Calendar.setup({showsTime:calendars[i].hasClassName('show-time'),inputField:calendars[i].id,ifFormat:'%b %d, %Y'+(calendars[i].hasClassName('show-time')?' %H:%M':''),button:'calendar-trigger-'+i});}
if(navigator.appVersion.match(/\bMSIE\b/)){$$('ul.date-selector li.selector').each(function(li){li.observe('mouseover',function(e){if(e.element().tagName!="LI")
{el=e.element().up('li');}
else
{el=e.element();}
el.addClassName('hover');});li.observe('mouseout',function(e){if(e.element().tagName!="LI")
{el=e.element().up('li');}
else
{el=e.element();}
el.removeClassName('hover');});});}},findFunFact:function(){var moreFunFacts=$('more_fun_facts');var funFactContainer=$('fun_fact_container');if(moreFunFacts&&funFactContainer){moreFunFacts.observe('click',function(e){e.stop();Effect.Fade('fun_fact_container',{afterFinish:function()
{var div=$$('#fun_fact_container div');var except=null;if(div.length>0)
{except=div[0].id.substring("fun_fact_".length);}
var request=new Ajax.Request('/fun_facts/random.json'+(except!=null?"?except="+except:""),{method:'get',onSuccess:function(e){$('fun_fact_container').innerHTML="<div id=\"fun_fact_"+e.responseJSON.id+"\">"+e.responseJSON.text+"</div>";Effect.Appear('fun_fact_container');}.bindAsEventListener(this),onFailure:function(e){}});}.bindAsEventListener(this)});}.bindAsEventListener(this));}},rotateTestimonial:function(){var testimonialContainer=$('testimonials_container');var moreTestimonials=$('more_testimonials');if(testimonialContainer&&moreTestimonials)
{moreTestimonials.observe('click',function(e){e.stop();var bq=$$('#testimonials_container blockquote');var except=null;if(bq.length>0)
{except=bq[0].id.substring("testimonial_".length);}
var request=new Ajax.Request('/testimonials/random.json'+(except!=null?"?except="+except:""),{method:'get',onSuccess:function(e){testimonial=e.responseJSON;Effect.Fade('testimonials_container',{afterFinish:function(){$('testimonials_container').innerHTML="<blockquote id=\"testimonial_"+testimonial.id+"\">"+testimonial.message+"</blockquote><cite>"+testimonial.login+", "+testimonial.location+"</cite>";Effect.Appear('testimonials_container');}.bindAsEventListener(this)});}.bindAsEventListener(this)});}.bindAsEventListener(this));}},setupUserForm:function(){var change=function(e){var walkers=$$('.walker');var managers=$$('.manager');var administrators=$$('.administrator');var value=e.element().value;for(var i=0;i<walkers.length;i++){walkers[i].setStyle("display: "+(value=="Walker"?"block":"none"));}
for(var i=0;i<managers.length;i++){managers[i].setStyle("display: "+(value=="Manager"?"block":"none"));}
for(var i=0;i<administrators.length;i++){administrators[i].setStyle("display: "+(value=="Administrator"?"block":"none"));}}
var userType=$('user_type');if(userType){change({element:function(){return userType;}});userType.observe('change',change);}
var userLogin=$('user_login');if(userLogin){new Utilities.TextFieldDefault(userLogin,"6-15 characters – letters and numbers only",{defaultClassName:'default'});}
var userEmail=$('user_email');if(userEmail){new Utilities.TextFieldDefault(userEmail,"Must be a valid email address: ie joe_blogs@yahoo.com",{defaultClassName:'default'});}
var userPromotionalCode=$('user_promotional_code');if(userPromotionalCode){new Utilities.TextFieldDefault(userPromotionalCode,"Enter your promotional/gift voucher code here",{defaultClassName:'default'});}
var userSearch=$('user_search');if(userSearch&&$(document.body).hasClassName('buddies')){new Utilities.TextFieldDefault(userSearch,"Search by username",{defaultClassName:'default'});}
var inviteNewMember=$('invite_new_member');var buddySearchTip=$('buddy_search_tip');if(inviteNewMember&&buddySearchTip){buddySearchTip.hide();inviteNewMember.observe('click',function(e){e.stop();buddySearchTip.show();Element.scrollTo(buddySearchTip);});}
var buddyRemove=$$('a.buddy-remove');buddyRemove.each(function(r){r.observe('click',function(e){e.stop();var element=e.element();if(element.tagName!="A"){element=element.up('a');}
var login="";$A(element.up('tr').getElementsByTagName('td')).each(function(td){if($(td).hasClassName('col-username')){login=td.innerHTML;}})
Overlay.confirm("You no longer wish to be "+login+"'s walking buddy?",{ok:function(){window.location=element.href;}.bindAsEventListener(element)});});});var buddyRemove=$$('a.buddy-invite');buddyRemove.each(function(r){r.observe('click',function(e){e.stop();var element=e.element();if(element.tagName!="A"){element=element.up('a');}
var login="";$A(element.up('tr').getElementsByTagName('td')).each(function(td){if($(td).hasClassName('col-username')){login=td.innerHTML;}})
Overlay.confirm("You are inviting "+login+" to be your walking buddy?",{ok:function(){window.location=element.href;}.bindAsEventListener(element)});});});var userCountry=$('user_country');var userTimezone=$('user_timezone');if(userCountry&&userTimezone){var selected=userTimezone.value;if(userCountry.value=="")
{while(userTimezone.childNodes.length>0)
{userTimezone.removeChild(userTimezone.childNodes[0]);}
userTimezone.disabled=true;var option=document.createElement('option');option.value="";option.appendChild(document.createTextNode("Select your country first"));userTimezone.appendChild(option);var flag=$('country_flag');if(flag)
{flag.style.display='none';flag.src="/images/flags/blank.gif";}}
else
{var zones=Timezone[userCountry.value];var options="";var last=userTimezone.value;while(userTimezone.childNodes.length>0)
{userTimezone.removeChild(userTimezone.childNodes[0]);}
for(i=0;i<zones.length;i++)
{var option=document.createElement('option');option.value=zones[i];option.appendChild(document.createTextNode(zones[i].replace("_"," ")));if(selected==zones[i])
{option.setAttribute('selected','selected');}
userTimezone.appendChild(option);}
userTimezone.disabled=false;var flag=$('country_flag');if(flag)
{flag.style.display='inline';flag.src="/images/flags/"+userCountry.value.toLowerCase()+".gif";}}
userCountry.observe('change',function(e){var userCountry=$('user_country');var userTimezone=$('user_timezone');var selected=userTimezone.value;if(userCountry.value=="")
{while(userTimezone.childNodes.length>0)
{userTimezone.removeChild(userTimezone.childNodes[0]);}
var option=document.createElement('option');option.value="";option.appendChild(document.createTextNode("Select your country first"));userTimezone.appendChild(option);userTimezone.disabled=true;var flag=$('country_flag');if(flag)
{flag.style.display='none';flag.src="/images/flags/blank.gif";}}
else
{var zones=Timezone[userCountry.value];while(userTimezone.childNodes.length>0)
{userTimezone.removeChild(userTimezone.childNodes[0]);}
for(i=0;i<zones.length;i++)
{var option=document.createElement('option');option.value=zones[i];option.appendChild(document.createTextNode(zones[i].replace("_"," ")));if(selected==zones[i])
{option.setAttribute('selected','selected');}
userTimezone.appendChild(option);}
userTimezone.disabled=false;var flag=$('country_flag');if(flag)
{flag.style.display='inline';flag.src="/images/flags/"+userCountry.value.toLowerCase()+".gif";}}});var familyDiscount=$('family_discount');if(familyDiscount){familyDiscount.style.display='none';}
var userRegistrationTypeSingle=$('user_registration_type_single');var userRegistrationTypeFamily=$('user_registration_type_family');var userRegistrationTypePrepaid=$('user_registration_type_prepaid');if(userRegistrationTypeSingle){userRegistrationTypeSingle.observe('change',function(e){var familyDiscount=$('family_discount');if(familyDiscount){familyDiscount.style.display='none';}
var promotionalCode=$('promotional_code');if(promotionalCode){promotionalCode.style.display='block';}});}
if(userRegistrationTypeFamily){userRegistrationTypeFamily.observe('change',function(e){var familyDiscount=$('family_discount');if(familyDiscount){familyDiscount.style.display='none';}
var promotionalCode=$('promotional_code');if(promotionalCode){promotionalCode.style.display='none';}});}
if(userRegistrationTypePrepaid){userRegistrationTypePrepaid.observe('change',function(e){var familyDiscount=$('family_discount');if(familyDiscount){familyDiscount.style.display='block';}
var promotionalCode=$('promotional_code');if(promotionalCode){promotionalCode.style.display='none';}});}}},setLoginDefaults:function(){var quickLogin=$('quick-login');var quickPassword=$('quick-password');var quickSearch=$('quick-search');if(quickLogin){new Utilities.TextFieldDefault(quickLogin,"Username",{defaultClassName:'default'});}
if(quickPassword){new Utilities.TextFieldDefault(quickPassword,"Password",{defaultClassName:'default'});}
if(quickSearch){new Utilities.TextFieldDefault(quickSearch,"Search...",{defaultClassName:'default'});}},bindtoQuickLog:function(){var ql=new QuickLog();},bindToUserNameCheck:function(){loginField=$('user_login');if(loginField){loginField.setStyle("width: 20em");loginField.setStyle("display: inline");var button=$(document.createElement('button'));button.id="availability";button.appendChild(document.createTextNode('Check availability'));if(loginField.value==""){button.disabled=true;}
var loginChangeListener=new Utilities.ChangeListener(loginField);loginChangeListener.onChange=function(value,changed){button.disabled=(loginField.value=="");if(stat=$('status')){stat.parentNode.removeChild(stat);}}.bindAsEventListener(button,loginField);button.observe('click',function(e){e.stop();if(stat=$('status')){stat.parentNode.removeChild(stat);}
if(!$('spinner')){var img=document.createElement('img');img.src="/images/spinner.gif";img.alt="Please Wait...";img.id='spinner';}
Insertion.After(e.element(),img);button=e.element();var request=new Ajax.Request('/users/check_username',{method:'get',parameters:{username:loginField.value},onSuccess:function(e){if(!($('status'))){var img=document.createElement('img');img.id='status';if(e.responseJSON.available){img.alt="Available";img.src="/images/login_available.gif";}else{img.alt="Not Available";img.src="/images/login_not_available.gif";}
Insertion.After(button,img);}}.bindAsEventListener(button),onComplete:function(e){var spinner=$('spinner');if(spinner){spinner.parentNode.removeChild(spinner);}}});});Insertion.After(loginField,button);}},bindToUnitTypeChange:function(){var userUnitTypeImperial=$('user_unit_type_imperial');var userUnitTypeMetric=$('user_unit_type_metric');if(userUnitTypeImperial&&userUnitTypeMetric){userUnitTypeImperial.observe('change',function(e){var strideLength=$('stride_length_units');if(strideLength){strideLength.innerHTML=" inches ";}});userUnitTypeMetric.observe('change',function(e){var strideLength=$('stride_length_units');if(strideLength){strideLength.innerHTML=" cm ";}});}},bindToAdvancedFieldsets:function(){var fieldsets=$$('fieldset.advanced h4');for(i=0;i<fieldsets.length;i++){var fieldset=$(fieldsets[i]);fieldset.observe('click',function(e){if(e.element().up('fieldset').hasClassName('folded')){e.element().up('fieldset').removeClassName('folded');}else{e.element().up('fieldset').addClassName('folded');}});}},bindTabbedPanels:function(){var tabbedPanels=$$("div.tabbed-panels");for(var i=0;i<tabbedPanels.length;i++){var n=new Tabs(tabbedPanels[i]);}},bindSmartHelp:function(){var smartHelp=new SmartHelp();smartHelp.bind();},bindJoin:function(){var challenge=new Challenge();challenge.bind();},bindFaq:function(){var faq=new Faq();faq.bind();},bindFitnessTools:function(){var fitnesstools=new FitnessTools();fitnesstools.bind();},bindLink:function(){var link=new Link();link.bind();},bindUpDown:function(){var panels=$$('div.panel.expandable');panels.each(function(panel){panel.addClassName('collapsed');}.bindAsEventListener(this));var buttons=$$('div.panel.expandable a.updown');buttons.each(function(link){link.observe('click',function(e){var p=this.up('div.panel.expandable')
if(p.hasClassName('collapsed')){p.removeClassName('collapsed');}else{p.addClassName('collapsed');}
Event.stop(e);}.bindAsEventListener(link));});},bindUpDownOpen:function(){var panels=$$('div.panel.expanded');var buttons=$$('div.panel.expanded a.updown');buttons.each(function(link){link.observe('click',function(e){var p=this.up('div.panel.expanded')
if(p.hasClassName('collapsed')){p.removeClassName('collapsed');}else{p.addClassName('collapsed');}
Event.stop(e);}.bindAsEventListener(link));});},bindToPayment:function(){var payment=new Payment();payment.bind();},bindLeaderboards:function(){var leaderboard=new Leaderboard();leaderboard.bind();},bindEventCalendar:function(){var eventCalendar=new EventCalendar();eventCalendar.bind();},bindNewWindow:function(){var externals=document.getElementsByTagName('a');for(var i=0;i<externals.length;i++){if(externals[i].className.match(/new_window/)){externals[i].onclick=function(e){window.open(this,null);return false;}}}},bindChart:function(){var timescale=$('walkingchart-select-timescale');var month=$('walkingchart-select-date-month');var week=$('walkingchart-select-date-week');var year=$('walkingchart-select-date-year');if(timescale&&month&&week&&year){var setSelectors=function(timescale){switch(timescale.value){case"weekly":month.hide();week.show();break;case"monthly":month.hide();week.hide();break;default:month.show();week.hide();break;}}
setSelectors(timescale);timescale.observe('change',function(e){setSelectors(e.element());}.bindAsEventListener(this,setSelectors));}},bindPacer:function(){var pacer=$('toggle-pacer');if(pacer)
{pacer.observe('click',function(e){e.stop();var element=e.element();if(element.tagName!='A')
{element=element.up('a');}
var challenge_id=null;var participant_id=null;$A(element.className.split(' ')).each(function(className){if(className.match(/challenge_(\d+)/)){challenge_id=RegExp.$1;}else if(className.match(/participant_(\d+)/)){participant_id=RegExp.$1;}});if(challenge_id&&participant_id)
{var pacerURL='/challenges/'+challenge_id+'/set_pacer/'+participant_id;}
var challengeMap=$('challenge-map-flash');if(element.hasClassName('button-pacer-on'))
{element.removeClassName('button-pacer-on');element.addClassName('button-pacer-off');challengeMap.hidePacer();var request=new Ajax.Request(pacerURL,{parameters:'show_pacer=0'});}
else
{element.removeClassName('button-pacer-off');element.addClassName('button-pacer-on');challengeMap.showPacer();var request=new Ajax.Request(pacerURL,{parameters:'show_pacer=1'});}}.bindAsEventListener(this));}},bindQuitChallenge:function(){var quitChallenges=$$('a.button-quit');quitChallenges.each(function(quitChallenge){quitChallenge.observe('click',function(e){e.stop();Overlay.confirm('Are you sure you want to quit this challenge?',{ok:function(){window.location=e.element().href;}});});});},bindStrideLength:function(){var userStrideLengthAsString=$('user_stride_length_as_string');var userUnitTypeMetric=$('user_unit_type_metric');var userUnitTypeImperial=$('user_unit_type_imperial');if(userStrideLengthAsString&&userUnitTypeMetric&&userUnitTypeImperial){var switcharoo=function(){$$('span.metric').each(function(s){s.hide();});$$('span.imperial').each(function(s){s.hide();});if(userUnitTypeMetric.checked)
{$$('span.metric').each(function(s){s.show();});}else if(userUnitTypeImperial.checked){$$('span.imperial').each(function(s){s.show();});}}
switcharoo();userUnitTypeMetric.observe('click',function(){switcharoo();}.bindAsEventListener(this,switcharoo));userUnitTypeImperial.observe('click',function(){switcharoo();}.bindAsEventListener(this,switcharoo));}},bind:function(){WalkingWithAttitude.setLoginDefaults();WalkingWithAttitude.setupCalendars();WalkingWithAttitude.bindPacer();WalkingWithAttitude.bindQuitChallenge();WalkingWithAttitude.bindChart();WalkingWithAttitude.setupUserForm();WalkingWithAttitude.bindToPayment();WalkingWithAttitude.findFunFact();WalkingWithAttitude.bindtoQuickLog();WalkingWithAttitude.bindToUserNameCheck();WalkingWithAttitude.bindToUnitTypeChange();WalkingWithAttitude.bindToAdvancedFieldsets();WalkingWithAttitude.bindTabbedPanels();WalkingWithAttitude.bindSmartHelp();WalkingWithAttitude.bindJoin();WalkingWithAttitude.bindFaq();WalkingWithAttitude.bindFitnessTools();WalkingWithAttitude.bindLink();WalkingWithAttitude.bindUpDown();WalkingWithAttitude.bindUpDownOpen();WalkingWithAttitude.bindLeaderboards();WalkingWithAttitude.bindEventCalendar();WalkingWithAttitude.bindNewWindow();WalkingWithAttitude.bindStrideLength();Message.bind();if(typeof(CMS)!="undefined"){var cms=CMS.bind();if($(document.body).hasClassName('uploaded')){var upload=new CMS.Upload(cms);upload.bindForm();}}}});FastInit.addOnLoad(function(){WalkingWithAttitude.bind();});WalkingWithAttitude.UserForm=Class.create({});WalkingWithAttitude.UserForm=Object.extend({bindForm:function(){var familyPurchase=$('family_purchase');var familyDiscount=$('family_discount');if(familyPurchase){familyPurchase.style.display='none';}
if(familyDiscount){familyDiscount.style.display='none';}
var userRegistrationTypeSingle=$('user_registration_type_single');var userRegistrationTypeFamily=$('user_registration_type_family');var userRegistrationTypePrepaid=$('user_registration_type_prepaid');if(userRegistrationTypeSingle){userRegistrationTypeSingle.observe('change',function(e){var familyDiscount=$('family_discount');if(familyDiscount){familyDiscount.style.display='none';familyPurchase.style.display='none';}
var promotionalCode=$('promotional_code');if(promotionalCode){promotionalCode.style.display='block';}});}
if(userRegistrationTypeFamily){userRegistrationTypeFamily.observe('change',function(e){var familyDiscount=$('family_discount');if(familyDiscount){familyDiscount.style.display='none';familyPurchase.style.display='block';}
var promotionalCode=$('promotional_code');if(promotionalCode){promotionalCode.style.display='none';}});}
if(userRegistrationTypePrepaid){userRegistrationTypePrepaid.observe('change',function(e){var familyDiscount=$('family_discount');if(familyDiscount){familyDiscount.style.display='block';familyPurchase.style.display='none';}
var promotionalCode=$('promotional_code');if(promotionalCode){promotionalCode.style.display='none';}});}},bindButtons:function(){},bind:function(){WalkingWithAttitude.UserForm.bindForm();}});var QuickLog=Class.create({initialize:function(){this.bindForm();var qs=new QuickStepLog();var qm=new QuickMinuteLog();var lastButton="";var refocusField="";},bindForm:function(){var quickLog=$('quick-log-container');var quickLogToggle=$('quick-log-toggle');if(quickLog&&quickLogToggle){quickLogToggle.observe('click',function(e){e.stop();if(quickLog.hasClassName('collapsed')){quickLog.removeClassName('collapsed');}else{quickLog.addClassName('collapsed');}});}
var quickLogForms=$A([$$('#quick-log form'),$$('#walking-log form')]).flatten();$$('#quick-log form button').each(function(button){button.observe('click',function(e){QuickLog.lastButton=e.target.name;QuickLog.refocusField=e.target.getAttribute('rel');});});for(i=0;i<quickLogForms.length;i++){var quickLogForm=$(quickLogForms[i]);quickLogForm.observe('submit',function(e){e.stop();$$('#quick-log form button').each(function(button){button.addClassName('disabled');button.observe('click',function(e){e.stop();});});window.document.body.style.cursor='wait';var inputs=e.element().getElementsByTagName('input');var dateValue='';for(var i=0;i<inputs.length;i++){if(inputs[i].id=="quick_step_date_string"||inputs[i].id=="quick_minutes_date_string"){dateValue=inputs[i].value;break;}}
var returnURL='/virtual-map';if((returnElement=e.element().getElementsBySelector('input[name=return]')).length>0){returnURL=returnElement.first().value;}
var request=new Ajax.Request(e.element().action+".json",{method:'post',parameters:e.element().serialize()+"&walking_log[date_string]="+dateValue,onSuccess:function(e){var inputs=this.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type=="text"){inputs[i].value="";}}
var message=$("quick-log-form-message");if(!message){var message=document.createElement('div');message.id="quick-log-form-message";Insertion.Bottom(this,message);}else{Effect.Appear(message);}
message.className="flash message";message.innerHTML="Your walk has been logged!";Effect.Fade(message,{delay:3});var response=e.responseJSON;if(QuickLog.lastButton=="addmore"&&response.observer.buttons){response.observer.buttons=response.observer.buttons.replace('<a href="/virtual-map" class="button">Continue</a>','<button id="confirm_ok">Continue</button>');}
if(response.observer.message&&response.observer.buttons){Overlay.alert(response.observer.message,{onClose:function(){if(QuickLog.lastButton!="addmore")window.location=returnURL;},hide_close:response.observer.hide_close},response.observer.buttons);}else if(response.observer.message){Overlay.alert(response.observer.message,{onClose:function(){if(QuickLog.lastButton!="addmore")window.location=returnURL;},hide_close:response.observer.hide_close});}else{if(QuickLog.lastButton!="addmore")window.location=returnURL;}
$('quick_step_date_string').disabled="disabled";$('quick_minutes_date_string').disabled="disabled";$$('#quick-log form button').each(function(button){button.removeClassName('disabled');button.stopObserving('click');button.observe('click',function(e){QuickLog.lastButton=e.target.name;QuickLog.refocusField=e.target.getAttribute('rel');});});if(QuickLog.lastButton=="addmore"){var months=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var bits=dateValue.split(" ");var d=parseInt(bits[1],10);var y=parseInt(bits[2],10);var m=0;for(month in months){if(months[month]==bits[0]){m=month;}}
var dt=new Date(y,m,d);var now=new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate());if(dt<now){var nd=new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()+1);var newDateValue=months[nd.getMonth()]+" "+nd.getDate()+", "+nd.getFullYear();$('quick_step_date_string').value=newDateValue;$('quick_minutes_date_string').value=newDateValue;$(QuickLog.refocusField).focus();}}}.bindAsEventListener(e.element()),onFailure:function(e){$('quick_step_date_string').disabled="disabled";$('quick_minutes_date_string').disabled="disabled";$$('#quick-log form button').each(function(button){button.removeClassName('disabled');button.stopObserving('click');button.observe('click',function(e){QuickLog.lastButton=e.target.name;QuickLog.refocusField=e.target.getAttribute('rel');});});if(QuickLog.lastButton=="addmore"){QuickLog.getLogMultipleHelp();}else{if(!message){var message=document.createElement('div');message.id="quick-log-form-message";Insertion.Bottom(this,message);}else{Effect.Appear(message);}
message.className="flash error";m="<p>This walk couldn't be logged because:</p>";m+="<ul>";errors=Object.values(e.responseJSON)
for(var i=0;i<errors.length;i++){m+="<li>"+errors[i]+"</li>";}
m+="</ul>";message.innerHTML=m;Effect.Fade(message,{delay:3});}}.bindAsEventListener(e.element()),onComplete:function(e){window.document.body.style.cursor='auto';}.bindAsEventListener(e.element())});});}}});QuickLog.getLogMultipleHelp=function(){var message="<h3>Backdate steps for multiple days the easy way!</h3>";message+="<p>Here's how...</p>";message+="<ol><li> Simply select the first date that you wish to log steps from</li>";message+="<li> Enter your steps</li>";message+="<li> Now click the 'Log Multiple' button.</li>";message+="<li>We'll record your steps and update the date for you to enter the following days steps and so on.</li>";message+="<li>On you last entry - if you click on 'Log my steps' this will automatically refresh the page and take you to";message+="your virtual map.</li></ol>";message+="<p><strong>NOTE</strong>: If you click on the 'Log multiple' button on your last entry you will need to click through to your 'Virtual";message+="map' via the postcard or navigation bar to see your updated position.</p>";message+="<p><strong>WARNING:</strong> When logging multiple walks you will still be notified on screen when you reach a waypoint, you";message+="will need to click 'continue' if you want to continue logging walks</p>";Overlay.alert(message);}
var QuickStepLog=Class.create({stepsElement:null,unitsElement:null,initialize:function(){this.bindForm();},bindForm:function(){this.stepsElement=$('walking_log_steps');this.unitsElement=$('quick_step_walking_log_steps');if(this.stepsElement&&this.unitsElement){this.stepsElement.observe('change',function(e){this.unitsElement.value=this.stepsElement.value;}.bindAsEventListener(this));}}});var QuickMinuteLog=Class.create({activityElement:null,durationElement:null,intensityElement:null,walkingLogEquivalent:null,activities:[],initialize:function(){this.bindForm();},bindForm:function(){this.activityElement=$('walking_log_activity_id');this.durationElement=$('walking_log_units');this.intensityElement=$('walking_log_intensity_id');this.walkingLogEquivalent=$('walking_log_equivalent');if(this.activityElement&&this.intensityElement&&this.durationElement&&this.walkingLogEquivalent){this.durationElement.disabled=(this.activityElement.value=="");this.intensityElement.disabled=(this.activityElement.value=="");var minutesPanelButton=$$('#minutes_panel button');if(minutesPanelButton.length>0){minutesPanelButton.first().disabled=(this.activityElement.value=="");}
this.populateIntensity(this.activityElement.value);this.updateNotes();this.activityElement.observe('change',function(e){this.durationElement.disabled=(e.element().value=="");this.intensityElement.disabled=(e.element().value=="");var minutesPanelButton=$$('#minutes_panel button');if(minutesPanelButton.length>0){minutesPanelButton.first().disabled=(e.element().value=="");}
this.populateIntensity(e.element().value);this.calculateEquivalent();this.updateNotes();}.bindAsEventListener(this));this.intensityElement.observe('change',function(e){this.calculateEquivalent();this.updateNotes();}.bindAsEventListener(this));this.durationElement.observe('keyup',function(e){this.calculateEquivalent();}.bindAsEventListener(this));this.durationElement.observe('change',function(e){this.calculateEquivalent();}.bindAsEventListener(this));}},populateIntensity:function(id){if(!QuickMinuteLog.activities){return;}
var elements=$H(QuickMinuteLog.activities[id]);while(this.intensityElement.childNodes.length>0){this.intensityElement.removeChild(this.intensityElement.childNodes[0]);}
elements.each(function(pair){var option=document.createElement('option');option.value=pair.value.id;option.appendChild(document.createTextNode(pair.value.name));this.intensityElement.appendChild(option);}.bindAsEventListener(this))},updateNotes:function(){var intensityNotes=$('intensity_notes');if(intensityNotes){if(!QuickMinuteLog.activities){return;}
if(QuickMinuteLog.activities[this.activityElement.value]&&QuickMinuteLog.activities[this.activityElement.value][this.intensityElement.value]){var element=QuickMinuteLog.activities[this.activityElement.value][this.intensityElement.value];intensityNotes.innerHTML=element.notes;}}},calculateEquivalent:function(){if(this.activityElement.value&&this.intensityElement.value){var element=QuickMinuteLog.activities[this.activityElement.value][this.intensityElement.value];var minutes=parseInt(this.durationElement.value);}
var steps='';if(!isNaN(minutes)&&element){eval("var steps = "+element.formula+";");steps=Math.round(steps);}else{steps=0;}
if(quickMinutesWalkingLogSteps=$('quick_minutes_walking_log_steps')){quickMinutesWalkingLogSteps.value=steps;}
var p=steps.toString().split('');var s=[];var i=0;while(p.length>0){if(i!=0&&i%3==0){s.unshift(',');}
s.unshift(p.pop());i++;}
steps=s.join('');this.walkingLogEquivalent.innerHTML=steps;}});Object.extend(QuickMinuteLog,{activities:null});var Tabs=Class.create({element:null,panels:[],tabs:[],current:null,initialize:function(element){this.element=element;this.tabs=[];this.panels=[];var lis=element.getElementsBySelector('li.tab');var divs=element.getElementsBySelector('div.panel-inner');for(i=0;i<lis.length;i++){var li=$(lis[i]);if(li.hasClassName('current')){this.current=li;}
li.observe('click',this.onclick.bindAsEventListener(this));this.tabs.push(li);}
if(this.current==null&&this.tabs.length>0){this.current=this.tabs[0];this.tabs[0].addClassName('current');}
if(this.current){for(i=0;i<divs.length;i++){var div=$(divs[i]);if(this.current.id.replace("_tab","")+"_panel"==div.id){div.style.display='block';div.addClassName('current');}else{div.style.display='none';div.removeClassName('current');}
this.panels.push(div);}}},onclick:function(e){for(i=0;i<this.tabs.length;i++){if(this.tabs[i]==e.element()){if(!this.tabs[i].hasClassName('current')){this.tabs[i].addClassName('current');}
this.current=this.tabs[i];}else{this.tabs[i].removeClassName('current');}}
for(i=0;i<this.panels.length;i++){if(this.current.id.replace("_tab","")+"_panel"==this.panels[i].id){this.panels[i].style.display='block';this.panels[i].addClassName("current");}else{this.panels[i].style.display='none';this.panels[i].removeClassName("current");}}}});var SmartHelp=Class.create({bind:function(){var helpCopy=$('help_copy');if(helpCopy){initTinyMCE();tinyMCE.execCommand('mceAddControl',false,'help_copy');}
var smartHelps=$$('a.smart_help');smartHelps.each(function(help){if(help.hasClassName('smart_help_editable')){return false;}
help.observe('click',function(e){var id=e.element().id.replace('smart_help_','');this.loadHelp(id);}.bindAsEventListener(this));}.bindAsEventListener(this));},loadHelp:function(id){var help=$$('div#panel-smarthelp div.content');if(help.length>0){$('panel-smarthelp').removeClassName('collapsed');help[0].innerHTML="<p><img src=\"/images/spinner.gif\" alt=\"Loading help...\" /> Loading help. Please wait</p>";}
var request=new Ajax.Request('/helps/'+id,{method:'get',onSuccess:function(e){this.showHelp(e.responseJSON);}.bindAsEventListener(this)});},showHelp:function(help){var helpDiv=$$('div#panel-smarthelp div.content');if(helpDiv.length>0){helpDiv[0].innerHTML="<h3>"+help.title+"</h3>"+help.copy;}}});var sIFR=new function(){var O=this;var E={ACTIVE:"sIFR-active",REPLACED:"sIFR-replaced",IGNORE:"sIFR-ignore",ALTERNATE:"sIFR-alternate",CLASS:"sIFR-class",LAYOUT:"sIFR-layout",FLASH:"sIFR-flash",FIX_FOCUS:"sIFR-fixfocus",DUMMY:"sIFR-dummy"};E.IGNORE_CLASSES=[E.REPLACED,E.IGNORE,E.ALTERNATE];this.MIN_FONT_SIZE=6;this.MAX_FONT_SIZE=126;this.FLASH_PADDING_BOTTOM=5;this.VERSION="436";this.isActive=false;this.isEnabled=true;this.fixHover=true;this.autoInitialize=true;this.setPrefetchCookie=true;this.cookiePath="/";this.domains=[];this.forceWidth=true;this.fitExactly=false;this.forceTextTransform=true;this.useDomLoaded=true;this.useStyleCheck=false;this.hasFlashClassSet=false;this.repaintOnResize=true;this.replacements=[];var L=0;var R=false;function Y(){}function D(c){function d(e){return e.toLocaleUpperCase()}this.normalize=function(e){return e.replace(/\n|\r|\xA0/g,D.SINGLE_WHITESPACE).replace(/\s+/g,D.SINGLE_WHITESPACE)};this.textTransform=function(e,f){switch(e){case"uppercase":return f.toLocaleUpperCase();case"lowercase":return f.toLocaleLowerCase();case"capitalize":return f.replace(/^\w|\s\w/g,d)}return f};this.toHexString=function(e){if(e.charAt(0)!="#"||e.length!=4&&e.length!=7){return e}e=e.substring(1);return"0x"+(e.length==3?e.replace(/(.)(.)(.)/,"$1$1$2$2$3$3"):e)};this.toJson=function(g,f){var e="";switch(typeof(g)){case"string":e='"'+f(g)+'"';break;case"number":case"boolean":e=g.toString();break;case"object":e=[];for(var h in g){if(g[h]==Object.prototype[h]){continue}e.push('"'+h+'":'+this.toJson(g[h]))}e="{"+e.join(",")+"}";break}return e};this.convertCssArg=function(e){if(!e){return{}}if(typeof(e)=="object"){if(e.constructor==Array){e=e.join("")}else{return e}}var l={};var m=e.split("}");for(var h=0;h<m.length;h++){var k=m[h].match(/([^\s{]+)\s*\{(.+)\s*;?\s*/);if(!k||k.length!=3){continue}if(!l[k[1]]){l[k[1]]={}}var g=k[2].split(";");for(var f=0;f<g.length;f++){var n=g[f].match(/\s*([^:\s]+)\s*\:\s*([^;]+)/);if(!n||n.length!=3){continue}l[k[1]][n[1]]=n[2].replace(/\s+$/,"")}}return l};this.extractFromCss=function(g,f,i,e){var h=null;if(g&&g[f]&&g[f][i]){h=g[f][i];if(e){delete g[f][i]}}return h};this.cssToString=function(f){var g=[];for(var e in f){var j=f[e];if(j==Object.prototype[e]){continue}g.push(e,"{");for(var i in j){if(j[i]==Object.prototype[i]){continue}var h=j[i];if(D.UNIT_REMOVAL_PROPERTIES[i]){h=parseInt(h,10)}g.push(i,":",h,";")}g.push("}")}return g.join("")};this.escape=function(e){return escape(e).replace(/\+/g,"%2B")};this.encodeVars=function(e){return e.join("&").replace(/%/g,"%25")};this.copyProperties=function(g,f){for(var e in g){if(f[e]===undefined){f[e]=g[e]}}return f};this.domain=function(){var f="";try{f=document.domain}catch(g){}return f};this.domainMatches=function(h,g){if(g=="*"||g==h){return true}var f=g.lastIndexOf("*");if(f>-1){g=g.substr(f+1);var e=h.lastIndexOf(g);if(e>-1&&(e+g.length)==h.length){return true}}return false};this.uriEncode=function(e){return encodeURI(decodeURIComponent(e))};this.delay=function(f,h,g){var e=Array.prototype.slice.call(arguments,3);setTimeout(function(){h.apply(g,e)},f)}}D.UNIT_REMOVAL_PROPERTIES={leading:true,"margin-left":true,"margin-right":true,"text-indent":true};D.SINGLE_WHITESPACE=" ";function U(e){var d=this;function c(g,j,h){var k=d.getStyleAsInt(g,j,e.ua.ie);if(k==0){k=g[h];for(var f=3;f<arguments.length;f++){k-=d.getStyleAsInt(g,arguments[f],true)}}return k}this.getBody=function(){return document.getElementsByTagName("body")[0]||null};this.querySelectorAll=function(f){return window.parseSelector(f)};this.addClass=function(f,g){if(g){g.className=((g.className||"")==""?"":g.className+" ")+f}};this.removeClass=function(f,g){if(g){g.className=g.className.replace(new RegExp("(^|\\s)"+f+"(\\s|$)"),"").replace(/^\s+|(\s)\s+/g,"$1")}};this.hasClass=function(f,g){return new RegExp("(^|\\s)"+f+"(\\s|$)").test(g.className)};this.hasOneOfClassses=function(h,g){for(var f=0;f<h.length;f++){if(this.hasClass(h[f],g)){return true}}return false};this.ancestorHasClass=function(g,f){g=g.parentNode;while(g&&g.nodeType==1){if(this.hasClass(f,g)){return true}g=g.parentNode}return false};this.create=function(f,g){var h=document.createElementNS?document.createElementNS(U.XHTML_NS,f):document.createElement(f);if(g){h.className=g}return h};this.getComputedStyle=function(h,i){var f;if(document.defaultView&&document.defaultView.getComputedStyle){var g=document.defaultView.getComputedStyle(h,null);f=g?g[i]:null}else{if(h.currentStyle){f=h.currentStyle[i]}}return f||""};this.getStyleAsInt=function(g,i,f){var h=this.getComputedStyle(g,i);if(f&&!/px$/.test(h)){return 0}return parseInt(h)||0};this.getWidthFromStyle=function(f){return c(f,"width","offsetWidth","paddingRight","paddingLeft","borderRightWidth","borderLeftWidth")};this.getHeightFromStyle=function(f){return c(f,"height","offsetHeight","paddingTop","paddingBottom","borderTopWidth","borderBottomWidth")};this.getDimensions=function(j){var h=j.offsetWidth;var f=j.offsetHeight;if(h==0||f==0){for(var g=0;g<j.childNodes.length;g++){var k=j.childNodes[g];if(k.nodeType!=1){continue}h=Math.max(h,k.offsetWidth);f=Math.max(f,k.offsetHeight)}}return{width:h,height:f}};this.getViewport=function(){return{width:window.innerWidth||document.documentElement.clientWidth||this.getBody().clientWidth,height:window.innerHeight||document.documentElement.clientHeight||this.getBody().clientHeight}};this.blurElement=function(g){try{g.blur();return}catch(h){}var f=this.create("input");f.style.width="0px";f.style.height="0px";g.parentNode.appendChild(f);f.focus();f.blur();f.parentNode.removeChild(f)}}U.XHTML_NS="http://www.w3.org/1999/xhtml";function H(r){var g=navigator.userAgent.toLowerCase();var q=(navigator.product||"").toLowerCase();var h=navigator.platform.toLowerCase();this.parseVersion=H.parseVersion;this.macintosh=/^mac/.test(h);this.windows=/^win/.test(h);this.linux=/^linux/.test(h);this.quicktime=false;this.opera=/opera/.test(g);this.konqueror=/konqueror/.test(g);this.ie=false/*@cc_on||true@*/;this.ieSupported=this.ie&&!/ppc|smartphone|iemobile|msie\s5\.5/.test(g)/*@cc_on&&@_jscript_version>=5.5@*/;this.ieWin=this.ie&&this.windows/*@cc_on&&@_jscript_version>=5.1@*/;this.windows=this.windows&&(!this.ie||this.ieWin);this.ieMac=this.ie&&this.macintosh/*@cc_on&&@_jscript_version<5.1@*/;this.macintosh=this.macintosh&&(!this.ie||this.ieMac);this.safari=/safari/.test(g);this.webkit=!this.konqueror&&/applewebkit/.test(g);this.khtml=this.webkit||this.konqueror;this.gecko=!this.khtml&&q=="gecko";this.ieVersion=this.ie&&/.*msie\s(\d\.\d)/.exec(g)?this.parseVersion(RegExp.$1):"0";this.operaVersion=this.opera&&/.*opera(\s|\/)(\d+\.\d+)/.exec(g)?this.parseVersion(RegExp.$2):"0";this.webkitVersion=this.webkit&&/.*applewebkit\/(\d+).*/.exec(g)?this.parseVersion(RegExp.$1):"0";this.geckoVersion=this.gecko&&/.*rv:\s*([^\)]+)\)\s+gecko/.exec(g)?this.parseVersion(RegExp.$1):"0";this.konquerorVersion=this.konqueror&&/.*konqueror\/([\d\.]+).*/.exec(g)?this.parseVersion(RegExp.$1):"0";this.flashVersion=0;if(this.ieWin){var l;var o=false;try{l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(m){try{l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");this.flashVersion=this.parseVersion("6");l.AllowScriptAccess="always"}catch(m){o=this.flashVersion==this.parseVersion("6")}if(!o){try{l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(m){}}}if(!o&&l){this.flashVersion=this.parseVersion((l.GetVariable("$version")||"").replace(/^\D+(\d+)\D+(\d+)\D+(\d+).*/g,"$1.$2.$3"))}}else{if(navigator.plugins&&navigator.plugins["Shockwave Flash"]){var n=navigator.plugins["Shockwave Flash"].description.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var p=n.replace(/^\D*(\d+\.\d+).*$/,"$1");if(/r/.test(n)){p+=n.replace(/^.*r(\d*).*$/,".$1")}else{if(/d/.test(n)){p+=".0"}}this.flashVersion=this.parseVersion(p);var j=false;for(var k=0,c=this.flashVersion>=H.MIN_FLASH_VERSION;c&&k<navigator.mimeTypes.length;k++){var f=navigator.mimeTypes[k];if(f.type!="application/x-shockwave-flash"){continue}if(f.enabledPlugin){j=true;if(f.enabledPlugin.description.toLowerCase().indexOf("quicktime")>-1){c=false;this.quicktime=true}}}if(this.quicktime||!j){this.flashVersion=this.parseVersion("0")}}}this.flash=this.flashVersion>=H.MIN_FLASH_VERSION;this.transparencySupport=this.macintosh||this.windows||this.linux&&(this.flashVersion>=this.parseVersion("10")&&(this.gecko&&this.geckoVersion>=this.parseVersion("1.9")||this.opera));this.computedStyleSupport=this.ie||!!document.defaultView.getComputedStyle;this.fixFocus=this.gecko&&this.windows;this.nativeDomLoaded=this.gecko||this.webkit&&this.webkitVersion>=this.parseVersion("525")||this.konqueror&&this.konquerorMajor>this.parseVersion("03")||this.opera;this.mustCheckStyle=this.khtml||this.opera;this.forcePageLoad=this.webkit&&this.webkitVersion<this.parseVersion("523");this.properDocument=typeof(document.location)=="object";this.supported=this.flash&&this.properDocument&&(!this.ie||this.ieSupported)&&this.computedStyleSupport&&(!this.opera||this.operaVersion>=this.parseVersion("9.61"))&&(!this.webkit||this.webkitVersion>=this.parseVersion("412"))&&(!this.gecko||this.geckoVersion>=this.parseVersion("1.8.0.12"))&&(!this.konqueror)}H.parseVersion=function(c){return c.replace(/(^|\D)(\d+)(?=\D|$)/g,function(f,e,g){f=e;for(var d=4-g.length;d>=0;d--){f+="0"}return f+g})};H.MIN_FLASH_VERSION=H.parseVersion("8");function F(c){this.fix=c.ua.ieWin&&window.location.hash!="";var d;this.cache=function(){d=document.title};function e(){document.title=d}this.restore=function(){if(this.fix){setTimeout(e,0)}}}function S(l){var e=null;function c(){try{if(l.ua.ie||document.readyState!="loaded"&&document.readyState!="complete"){document.documentElement.doScroll("left")}}catch(n){return setTimeout(c,10)}i()}function i(){if(l.useStyleCheck){h()}else{if(!l.ua.mustCheckStyle){d(null,true)}}}function h(){e=l.dom.create("div",E.DUMMY);l.dom.getBody().appendChild(e);m()}function m(){if(l.dom.getComputedStyle(e,"marginLeft")=="42px"){g()}else{setTimeout(m,10)}}function g(){if(e&&e.parentNode){e.parentNode.removeChild(e)}e=null;d(null,true)}function d(n,o){l.initialize(o);if(n&&n.type=="load"){if(document.removeEventListener){document.removeEventListener("DOMContentLoaded",d,false)}if(window.removeEventListener){window.removeEventListener("load",d,false)}}}function j(){l.prepareClearReferences();if(document.readyState=="interactive"){document.attachEvent("onstop",f);setTimeout(function(){document.detachEvent("onstop",f)},0)}}function f(){document.detachEvent("onstop",f);k()}function k(){l.clearReferences()}this.attach=function(){if(window.addEventListener){window.addEventListener("load",d,false)}else{window.attachEvent("onload",d)}if(!l.useDomLoaded||l.ua.forcePageLoad||l.ua.ie&&window.top!=window){return}if(l.ua.nativeDomLoaded){document.addEventListener("DOMContentLoaded",i,false)}else{if(l.ua.ie||l.ua.khtml){c()}}};this.attachUnload=function(){if(!l.ua.ie){return}window.attachEvent("onbeforeunload",j);window.attachEvent("onunload",k)}}var Q="sifrFetch";function N(c){var e=false;this.fetchMovies=function(f){if(c.setPrefetchCookie&&new RegExp(";?"+Q+"=true;?").test(document.cookie)){return}try{e=true;d(f)}catch(g){}if(c.setPrefetchCookie){document.cookie=Q+"=true;path="+c.cookiePath}};this.clear=function(){if(!e){return}try{var f=document.getElementsByTagName("script");for(var g=f.length-1;g>=0;g--){var h=f[g];if(h.type=="sifr/prefetch"){h.parentNode.removeChild(h)}}}catch(j){}};function d(f){for(var g=0;g<f.length;g++){document.write('<script defer type="sifr/prefetch" src="'+f[g].src+'"><\/script>')}}}function b(e){var g=e.ua.ie;var f=g&&e.ua.flashVersion<e.ua.parseVersion("9.0.115");var d={};var c={};this.fixFlash=f;this.register=function(h){if(!g){return}var i=h.getAttribute("id");this.cleanup(i,false);c[i]=h;delete d[i];if(f){window[i]=h}};this.reset=function(){if(!g){return false}for(var j=0;j<e.replacements.length;j++){var h=e.replacements[j];var k=c[h.id];if(!d[h.id]&&(!k.parentNode||k.parentNode.nodeType==11)){h.resetMovie();d[h.id]=true}}return true};this.cleanup=function(l,h){var i=c[l];if(!i){return}for(var k in i){if(typeof(i[k])=="function"){i[k]=null}}c[l]=null;if(f){window[l]=null}if(i.parentNode){if(h&&i.parentNode.nodeType==1){var j=document.createElement("div");j.style.width=i.offsetWidth+"px";j.style.height=i.offsetHeight+"px";i.parentNode.replaceChild(j,i)}else{i.parentNode.removeChild(i)}}};this.prepareClearReferences=function(){if(!f){return}__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}};this.clearReferences=function(){if(f){var j=document.getElementsByTagName("object");for(var h=j.length-1;h>=0;h--){c[j[h].getAttribute("id")]=j[h]}}for(var k in c){if(Object.prototype[k]!=c[k]){this.cleanup(k,true)}}}}function K(d,g,f,c,e){this.sIFR=d;this.id=g;this.vars=f;this.movie=null;this.__forceWidth=c;this.__events=e;this.__resizing=0}K.prototype={getFlashElement:function(){return document.getElementById(this.id)},getAlternate:function(){return document.getElementById(this.id+"_alternate")},getAncestor:function(){var c=this.getFlashElement().parentNode;return!this.sIFR.dom.hasClass(E.FIX_FOCUS,c)?c:c.parentNode},available:function(){var c=this.getFlashElement();return c&&c.parentNode},call:function(c){var d=this.getFlashElement();if(!d[c]){return false}return Function.prototype.apply.call(d[c],d,Array.prototype.slice.call(arguments,1))},attempt:function(){if(!this.available()){return false}try{this.call.apply(this,arguments)}catch(c){if(this.sIFR.debug){throw c}return false}return true},updateVars:function(c,e){for(var d=0;d<this.vars.length;d++){if(this.vars[d].split("=")[0]==c){this.vars[d]=c+"="+e;break}}var f=this.sIFR.util.encodeVars(this.vars);this.movie.injectVars(this.getFlashElement(),f);this.movie.injectVars(this.movie.html,f)},storeSize:function(c,d){this.movie.setSize(c,d);this.updateVars(c,d)},fireEvent:function(c){if(this.available()&&this.__events[c]){this.sIFR.util.delay(0,this.__events[c],this,this)}},resizeFlashElement:function(c,d,e){if(!this.available()){return}this.__resizing++;var f=this.getFlashElement();f.setAttribute("height",c);this.getAncestor().style.minHeight="";this.updateVars("renderheight",c);this.storeSize("height",c);if(d!==null){f.setAttribute("width",d);this.movie.setSize("width",d)}if(this.__events.onReplacement){this.sIFR.util.delay(0,this.__events.onReplacement,this,this);delete this.__events.onReplacement}if(e){this.sIFR.util.delay(0,function(){this.attempt("scaleMovie");this.__resizing--},this)}else{this.__resizing--}},blurFlashElement:function(){if(this.available()){this.sIFR.dom.blurElement(this.getFlashElement())}},resetMovie:function(){this.sIFR.util.delay(0,this.movie.reset,this.movie,this.getFlashElement(),this.getAlternate())},resizeAfterScale:function(){if(this.available()&&this.__resizing==0){this.sIFR.util.delay(0,this.resize,this)}},resize:function(){if(!this.available()){return}this.__resizing++;var g=this.getFlashElement();var f=g.offsetWidth;if(f==0){return}var e=g.getAttribute("width");var l=g.getAttribute("height");var m=this.getAncestor();var o=this.sIFR.dom.getHeightFromStyle(m);g.style.width="1px";g.style.height="1px";m.style.minHeight=o+"px";var c=this.getAlternate().childNodes;var n=[];for(var k=0;k<c.length;k++){var h=c[k].cloneNode(true);n.push(h);m.appendChild(h)}var d=this.sIFR.dom.getWidthFromStyle(m);for(var k=0;k<n.length;k++){m.removeChild(n[k])}g.style.width=g.style.height=m.style.minHeight="";g.setAttribute("width",this.__forceWidth?d:e);g.setAttribute("height",l);if(sIFR.ua.ie){g.style.display="none";var j=g.offsetHeight;g.style.display=""}if(d!=f){if(this.__forceWidth){this.storeSize("width",d)}this.attempt("resize",d)}this.__resizing--},replaceText:function(g,j){var d=this.sIFR.util.escape(g);if(!this.attempt("replaceText",d)){return false}this.updateVars("content",d);var f=this.getAlternate();if(j){while(f.firstChild){f.removeChild(f.firstChild)}for(var c=0;c<j.length;c++){f.appendChild(j[c])}}else{try{f.innerHTML=g}catch(h){}}return true},changeCSS:function(c){c=this.sIFR.util.escape(this.sIFR.util.cssToString(this.sIFR.util.convertCssArg(c)));this.updateVars("css",c);return this.attempt("changeCSS",c)},remove:function(){if(this.movie&&this.available()){this.movie.remove(this.getFlashElement(),this.id)}}};var X=new function(){this.create=function(p,n,j,i,f,e,g,o,l,h,m){var k=p.ua.ie?d:c;return new k(p,n,j,i,f,e,g,o,["flashvars",l,"wmode",h,"bgcolor",m,"allowScriptAccess","always","quality","best"])};function c(s,q,l,h,f,e,g,r,n){var m=s.dom.create("object",E.FLASH);var p=["type","application/x-shockwave-flash","id",f,"name",f,"data",e,"width",g,"height",r];for(var o=0;o<p.length;o+=2){m.setAttribute(p[o],p[o+1])}var j=m;if(h){j=W.create("div",E.FIX_FOCUS);j.appendChild(m)}for(var o=0;o<n.length;o+=2){if(n[o]=="name"){continue}var k=W.create("param");k.setAttribute("name",n[o]);k.setAttribute("value",n[o+1]);m.appendChild(k)}l.style.minHeight=r+"px";while(l.firstChild){l.removeChild(l.firstChild)}l.appendChild(j);this.html=j.cloneNode(true)}c.prototype={reset:function(e,f){e.parentNode.replaceChild(this.html.cloneNode(true),e)},remove:function(e,f){e.parentNode.removeChild(e)},setSize:function(e,f){this.html.setAttribute(e,f)},injectVars:function(e,g){var h=e.getElementsByTagName("param");for(var f=0;f<h.length;f++){if(h[f].getAttribute("name")=="flashvars"){h[f].setAttribute("value",g);break}}}};function d(p,n,j,h,f,e,g,o,k){this.dom=p.dom;this.broken=n;this.html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+f+'" width="'+g+'" height="'+o+'" class="'+E.FLASH+'"><param name="movie" value="'+e+'"></param></object>';var m="";for(var l=0;l<k.length;l+=2){m+='<param name="'+k[l]+'" value="'+k[l+1]+'"></param>'}this.html=this.html.replace(/(<\/object>)/,m+"$1");j.style.minHeight=o+"px";j.innerHTML=this.html;this.broken.register(j.firstChild)}d.prototype={reset:function(f,g){g=g.cloneNode(true);var e=f.parentNode;e.innerHTML=this.html;this.broken.register(e.firstChild);e.appendChild(g)},remove:function(e,f){this.broken.cleanup(f)},setSize:function(e,f){this.html=this.html.replace(e=="height"?/(height)="\d+"/:/(width)="\d+"/,'$1="'+f+'"')},injectVars:function(e,f){if(e!=this.html){return}this.html=this.html.replace(/(flashvars(=|\"\svalue=)\")[^\"]+/,"$1"+f)}}};this.errors=new Y(O);var A=this.util=new D(O);var W=this.dom=new U(O);var T=this.ua=new H(O);var G={fragmentIdentifier:new F(O),pageLoad:new S(O),prefetch:new N(O),brokenFlashIE:new b(O)};this.__resetBrokenMovies=G.brokenFlashIE.reset;var J={kwargs:[],replaceAll:function(d){for(var c=0;c<this.kwargs.length;c++){O.replace(this.kwargs[c])}if(!d){this.kwargs=[]}}};this.activate=function(){if(!T.supported||!this.isEnabled||this.isActive||!C()||a()){return}G.prefetch.fetchMovies(arguments);this.isActive=true;this.setFlashClass();G.fragmentIdentifier.cache();G.pageLoad.attachUnload();if(!this.autoInitialize){return}G.pageLoad.attach()};this.setFlashClass=function(){if(this.hasFlashClassSet){return}W.addClass(E.ACTIVE,W.getBody()||document.documentElement);this.hasFlashClassSet=true};this.removeFlashClass=function(){if(!this.hasFlashClassSet){return}W.removeClass(E.ACTIVE,W.getBody());W.removeClass(E.ACTIVE,document.documentElement);this.hasFlashClassSet=false};this.initialize=function(c){if(!this.isActive||!this.isEnabled){return}if(R){if(!c){J.replaceAll(false)}return}R=true;J.replaceAll(c);if(O.repaintOnResize){if(window.addEventListener){window.addEventListener("resize",Z,false)}else{window.attachEvent("onresize",Z)}}G.prefetch.clear()};this.replace=function(x,u){if(!T.supported){return}if(u){x=A.copyProperties(x,u)}if(!R){return J.kwargs.push(x)}if(this.onReplacementStart){this.onReplacementStart(x)}var AM=x.elements||W.querySelectorAll(x.selector);if(AM.length==0){return}var w=M(x.src);var AR=A.convertCssArg(x.css);var v=B(x.filters);var AN=x.forceSingleLine===true;var AS=x.preventWrap===true&&!AN;var q=AN||(x.fitExactly==null?this.fitExactly:x.fitExactly)===true;var AD=q||(x.forceWidth==null?this.forceWidth:x.forceWidth)===true;var s=x.ratios||[];var AE=x.pixelFont===true;var r=parseInt(x.tuneHeight)||0;var z=!!x.onRelease||!!x.onRollOver||!!x.onRollOut;if(q){A.extractFromCss(AR,".sIFR-root","text-align",true)}var t=A.extractFromCss(AR,".sIFR-root","font-size",true)||"0";var e=A.extractFromCss(AR,".sIFR-root","background-color",true)||"#FFFFFF";var o=A.extractFromCss(AR,".sIFR-root","kerning",true)||"";var AW=A.extractFromCss(AR,".sIFR-root","opacity",true)||"100";var k=A.extractFromCss(AR,".sIFR-root","cursor",true)||"default";var AP=parseInt(A.extractFromCss(AR,".sIFR-root","leading"))||0;var AJ=x.gridFitType||(A.extractFromCss(AR,".sIFR-root","text-align")=="right")?"subpixel":"pixel";var h=this.forceTextTransform===false?"none":A.extractFromCss(AR,".sIFR-root","text-transform",true)||"none";t=/^\d+(px)?$/.test(t)?parseInt(t):0;AW=parseFloat(AW)<1?100*parseFloat(AW):AW;var AC=x.modifyCss?"":A.cssToString(AR);var AG=x.wmode||"";if(!AG){if(x.transparent){AG="transparent"}else{if(x.opaque){AG="opaque"}}}if(AG=="transparent"){if(!T.transparencySupport){AG="opaque"}else{e="transparent"}}else{if(e=="transparent"){e="#FFFFFF"}}for(var AV=0;AV<AM.length;AV++){var AF=AM[AV];if(W.hasOneOfClassses(E.IGNORE_CLASSES,AF)||W.ancestorHasClass(AF,E.ALTERNATE)){continue}var AO=W.getDimensions(AF);var f=AO.height;var c=AO.width;var AA=W.getComputedStyle(AF,"display");if(!f||!c||!AA||AA=="none"){continue}c=W.getWidthFromStyle(AF);var n,AH;if(!t){var AL=I(AF);n=Math.min(this.MAX_FONT_SIZE,Math.max(this.MIN_FONT_SIZE,AL.fontSize));if(AE){n=Math.max(8,8*Math.round(n/8))}AH=AL.lines}else{n=t;AH=1}var d=W.create("span",E.ALTERNATE);var AX=AF.cloneNode(true);AF.parentNode.appendChild(AX);for(var AU=0,AT=AX.childNodes.length;AU<AT;AU++){var m=AX.childNodes[AU];if(!/^(style|script)$/i.test(m.nodeName)){d.appendChild(m.cloneNode(true))}}if(x.modifyContent){x.modifyContent(AX,x.selector)}if(x.modifyCss){AC=x.modifyCss(AR,AX,x.selector)}var p=P(AX,h,x.uriEncode);AX.parentNode.removeChild(AX);if(x.modifyContentString){p.text=x.modifyContentString(p.text,x.selector)}if(p.text==""){continue}var AK=Math.round(AH*V(n,s)*n)+this.FLASH_PADDING_BOTTOM+r;if(AH>1&&AP){AK+=Math.round((AH-1)*AP)}var AB=AD?c:"100%";var AI="sIFR_replacement_"+L++;var AQ=["id="+AI,"content="+A.escape(p.text),"width="+c,"renderheight="+AK,"link="+A.escape(p.primaryLink.href||""),"target="+A.escape(p.primaryLink.target||""),"size="+n,"css="+A.escape(AC),"cursor="+k,"tunewidth="+(x.tuneWidth||0),"tuneheight="+r,"offsetleft="+(x.offsetLeft||""),"offsettop="+(x.offsetTop||""),"fitexactly="+q,"preventwrap="+AS,"forcesingleline="+AN,"antialiastype="+(x.antiAliasType||""),"thickness="+(x.thickness||""),"sharpness="+(x.sharpness||""),"kerning="+o,"gridfittype="+AJ,"flashfilters="+v,"opacity="+AW,"blendmode="+(x.blendMode||""),"selectable="+(x.selectable==null||AG!=""&&!sIFR.ua.macintosh&&sIFR.ua.gecko&&sIFR.ua.geckoVersion>=sIFR.ua.parseVersion("1.9")?"true":x.selectable===true),"fixhover="+(this.fixHover===true),"events="+z,"delayrun="+G.brokenFlashIE.fixFlash,"version="+this.VERSION];var y=A.encodeVars(AQ);var g=new K(O,AI,AQ,AD,{onReplacement:x.onReplacement,onRollOver:x.onRollOver,onRollOut:x.onRollOut,onRelease:x.onRelease});g.movie=X.create(sIFR,G.brokenFlashIE,AF,T.fixFocus&&x.fixFocus,AI,w,AB,AK,y,AG,e);this.replacements.push(g);this.replacements[AI]=g;if(x.selector){if(!this.replacements[x.selector]){this.replacements[x.selector]=[g]}else{this.replacements[x.selector].push(g)}}d.setAttribute("id",AI+"_alternate");AF.appendChild(d);W.addClass(E.REPLACED,AF)}G.fragmentIdentifier.restore()};this.getReplacementByFlashElement=function(d){for(var c=0;c<O.replacements.length;c++){if(O.replacements[c].id==d.getAttribute("id")){return O.replacements[c]}}};this.redraw=function(){for(var c=0;c<O.replacements.length;c++){O.replacements[c].resetMovie()}};this.prepareClearReferences=function(){G.brokenFlashIE.prepareClearReferences()};this.clearReferences=function(){G.brokenFlashIE.clearReferences();G=null;J=null;delete O.replacements};function C(){if(O.domains.length==0){return true}var d=A.domain();for(var c=0;c<O.domains.length;c++){if(A.domainMatches(d,O.domains[c])){return true}}return false}function a(){if(document.location.protocol=="file:"){if(O.debug){O.errors.fire("isFile")}return true}return false}function M(c){if(T.ie&&c.charAt(0)=="/"){c=window.location.toString().replace(/([^:]+)(:\/?\/?)([^\/]+).*/,"$1$2$3")+c}return c}function V(d,e){for(var c=0;c<e.length;c+=2){if(d<=e[c]){return e[c+1]}}return e[e.length-1]||1}function B(g){var e=[];for(var d in g){if(g[d]==Object.prototype[d]){continue}var c=g[d];d=[d.replace(/filter/i,"")+"Filter"];for(var f in c){if(c[f]==Object.prototype[f]){continue}d.push(f+":"+A.escape(A.toJson(c[f],A.toHexString)))}e.push(d.join(","))}return A.escape(e.join(";"))}function Z(d){var e=Z.viewport;var c=W.getViewport();if(e&&c.width==e.width&&c.height==e.height){return}Z.viewport=c;if(O.replacements.length==0){return}if(Z.timer){clearTimeout(Z.timer)}Z.timer=setTimeout(function(){delete Z.timer;for(var f=0;f<O.replacements.length;f++){O.replacements[f].resize()}},200)}function I(f){var g=W.getComputedStyle(f,"fontSize");var d=g.indexOf("px")==-1;var e=f.innerHTML;if(d){f.innerHTML="X"}f.style.paddingTop=f.style.paddingBottom=f.style.borderTopWidth=f.style.borderBottomWidth="0px";f.style.lineHeight="2em";f.style.display="block";g=d?f.offsetHeight/2:parseInt(g,10);if(d){f.innerHTML=e}var c=Math.round(f.offsetHeight/(2*g));f.style.paddingTop=f.style.paddingBottom=f.style.borderTopWidth=f.style.borderBottomWidth=f.style.lineHeight=f.style.display="";if(isNaN(c)||!isFinite(c)||c==0){c=1}return{fontSize:g,lines:c}}function P(c,g,s){s=s||A.uriEncode;var q=[],m=[];var k=null;var e=c.childNodes;var o=false,p=false;var j=0;while(j<e.length){var f=e[j];if(f.nodeType==3){var t=A.textTransform(g,A.normalize(f.nodeValue)).replace(/</g,"&lt;");if(o&&p){t=t.replace(/^\s+/,"")}m.push(t);o=/\s$/.test(t);p=false}if(f.nodeType==1&&!/^(style|script)$/i.test(f.nodeName)){var h=[];var r=f.nodeName.toLowerCase();var n=f.className||"";if(/\s+/.test(n)){if(n.indexOf(E.CLASS)>-1){n=n.match("(\\s|^)"+E.CLASS+"-([^\\s$]*)(\\s|$)")[2]}else{n=n.match(/^([^\s]+)/)[1]}}if(n!=""){h.push('class="'+n+'"')}if(r=="a"){var d=s(f.getAttribute("href")||"");var l=f.getAttribute("target")||"";h.push('href="'+d+'"','target="'+l+'"');if(!k){k={href:d,target:l}}}m.push("<"+r+(h.length>0?" ":"")+h.join(" ")+">");p=true;if(f.hasChildNodes()){q.push(j);j=0;e=f.childNodes;continue}else{if(!/^(br|img)$/i.test(f.nodeName)){m.push("</",f.nodeName.toLowerCase(),">")}}}if(q.length>0&&!f.nextSibling){do{j=q.pop();e=f.parentNode.parentNode.childNodes;f=e[j];if(f){m.push("</",f.nodeName.toLowerCase(),">")}}while(j==e.length-1&&q.length>0)}j++}return{text:m.join("").replace(/^\s+|\s+$|\s*(<br>)\s*/g,"$1"),primaryLink:k||{}}}};var parseSelector=(function(){var B=/\s*,\s*/;var A=/\s*([\s>+~(),]|^|$)\s*/g;var L=/([\s>+~,]|[^(]\+|^)([#.:@])/g;var F=/(^|\))[^\s>+~]/g;var M=/(\)|^)/;var K=/[\s#.:>+~()@]|[^\s#.:>+~()@]+/g;function H(R,P){P=P||document.documentElement;var S=R.split(B),X=[];for(var U=0;U<S.length;U++){var N=[P],W=G(S[U]);for(var T=0;T<W.length;){var Q=W[T++],O=W[T++],V="";if(W[T]=="("){while(W[T++]!=")"&&T<W.length){V+=W[T]}V=V.slice(0,-1)}N=I(N,Q,O,V)}X=X.concat(N)}return X}function G(N){var O=N.replace(A,"$1").replace(L,"$1*$2").replace(F,D);return O.match(K)||[]}function D(N){return N.replace(M,"$1 ")}function I(N,P,Q,O){return(H.selectors[P])?H.selectors[P](N,Q,O):[]}var E={toArray:function(O){var N=[];for(var P=0;P<O.length;P++){N.push(O[P])}return N}};var C={isTag:function(O,N){return(N=="*")||(N.toLowerCase()==O.nodeName.toLowerCase())},previousSiblingElement:function(N){do{N=N.previousSibling}while(N&&N.nodeType!=1);return N},nextSiblingElement:function(N){do{N=N.nextSibling}while(N&&N.nodeType!=1);return N},hasClass:function(N,O){return(O.className||"").match("(^|\\s)"+N+"(\\s|$)")},getByTag:function(N,O){return O.getElementsByTagName(N)}};var J={"#":function(N,P){for(var O=0;O<N.length;O++){if(N[O].getAttribute("id")==P){return[N[O]]}}return[]}," ":function(O,Q){var N=[];for(var P=0;P<O.length;P++){N=N.concat(E.toArray(C.getByTag(Q,O[P])))}return N},">":function(O,R){var N=[];for(var Q=0,S;Q<O.length;Q++){S=O[Q];for(var P=0,T;P<S.childNodes.length;P++){T=S.childNodes[P];if(T.nodeType==1&&C.isTag(T,R)){N.push(T)}}}return N},".":function(O,Q){var N=[];for(var P=0,R;P<O.length;P++){R=O[P];if(C.hasClass([Q],R)){N.push(R)}}return N},":":function(N,P,O){return(H.pseudoClasses[P])?H.pseudoClasses[P](N,O):[]}};H.selectors=J;H.pseudoClasses={};H.util=E;H.dom=C;return H})();var HelveticaCondensed={src:'/javascripts/HelveticaCondensed.swf'};sIFR.activate(HelveticaCondensed);var SegoePrint={src:'/javascripts/SegoePrint.swf'};sIFR.activate(SegoePrint);var defaultDropShadow={knockout:false,distance:1,angle:270,color:'#000000',strength:1,blurX:0,blurY:0,alpha:0.2,quality:3}
sIFR.replace(HelveticaCondensed,{selector:'.panel-head h2',css:['.sIFR-root { text-align: left; font-weight: normal; color: #ffffff; font-size: 18px; }','a { text-decoration: none; color: #ffffff }','a:hover { text-decoration: none; color: #ffffff }'],filters:{DropShadow:defaultDropShadow},wmode:'transparent',forceWidth:true,fitExactly:true,preventWrap:true,tuneWidth:10});sIFR.replace(HelveticaCondensed,{selector:'.panel-head h3, .panel-subhead h3, .panel-head-mini h3',css:['.sIFR-root { text-align: left; font-weight: normal; color: #ffffff; font-size: 16px; }','a { text-decoration: none; color: #ffffff }','a:hover { text-decoration: none; color: #ffffff }'],filters:{DropShadow:defaultDropShadow},wmode:'transparent',forceWidth:true,fitExactly:true,preventWrap:true,tuneHeight:-3,tuneWidth:10});sIFR.replace(HelveticaCondensed,{selector:'h3.sifr-blue',css:['.sIFR-root { text-align: left; font-weight: normal; color: #168aea; font-size: 18px; }','a { text-decoration: none; color: #0093D0; }','a:hover { text-decoration: none; color: #0066AA; }'],wmode:'transparent'});sIFR.replace(HelveticaCondensed,{selector:'h3.sifr-related',css:['.sIFR-root { text-align: left; font-weight: normal; color: #4f5f69; font-size: 18px; }','a { text-decoration: none; color: #0093D0; }','a:hover { text-decoration: none; color: #0066AA; }'],wmode:'transparent'});sIFR.replace(HelveticaCondensed,{selector:'h3.sifr-half, h3.sifr-third',css:['.sIFR-root { text-align: center; font-weight: normal; color: #4f5f69; font-size: 18px; }','a { text-decoration: none; color: #0093D0; }','a:hover { text-decoration: none; color: #0066AA; }'],wmode:'transparent'});sIFR.replace(HelveticaCondensed,{selector:'h2.forumtitle',css:['.sIFR-root { text-align: left; font-weight: normal; color: #4f5f69; font-size: 24px; }','a { text-decoration: none; color: #4f5f69 }','a:hover { text-decoration: none; color: #4f5f69 }'],wmode:'transparent',preventWrap:true});sIFR.replace(SegoePrint,{selector:'#waypoint-panel h3',css:['.sIFR-root { text-align: left; color: #331f0a; font-size: 22px; font-weight: bold; leading: -12; }','a { text-decoration: none; color: #331f0a }','a:hover { text-decoration: none; color: #331f0a }'],wmode:'transparent',tuneHeight:4});sIFR.replace(SegoePrint,{selector:'#waypoint-panel h4',css:['.sIFR-root { text-align: left; color: #331f0a; font-size: 18px; font-weight: bold; leading: -10; }','a { text-decoration: none; color: #331f0a }','a:hover { text-decoration: none; color: #331f0a }'],wmode:'transparent',tuneHeight:4});sIFR.replace(SegoePrint,{selector:'#waypoint-panel h5',css:['.sIFR-root { text-align: left; color: #331f0a; font-size: 14px; font-weight: bold; leading: -8; }','a { text-decoration: none; color: #331f0a }','a:hover { text-decoration: none; color: #331f0a }'],wmode:'transparent',tuneHeight:4});sIFR.replace(SegoePrint,{selector:'#fullstats-page .post-it .steps',css:['.sIFR-root { text-align: center; color: #222222; font-size: 18px; font-weight: bold; }','a { text-decoration: none; color: #222222 }','a:hover { text-decoration: none; color: #222222 }'],wmode:'transparent',tuneHeight:-6});sIFR.replace(SegoePrint,{selector:'#fullstats-page .post-it .distance',css:['.sIFR-root { text-align: center; color: #222222; font-size: 12px; font-weight: bold; }','a { text-decoration: none; color: #222222 }','a:hover { text-decoration: none; color: #222222 }'],wmode:'transparent',tuneHeight:-6});var Challenge=Class.create({capture:true,bind:function(){this.bindToJoinLevels();this.bindToToggler();this.bindToNotAllowed();},bindToToggler:function(){var turboButton=$('participant_turbo_boost_button');var turboField=$('participant_turbo_boost');if(turboButton&&turboField){turboButton.observe('click',function(e){e.stop();if(turboField.value=='1'){turboButton.removeClassName('turbobutton-active');turboButton.addClassName('turbobutton-normal');turboField.value='0';var normals=$$('label.trophy span.text_label.normal');var turbos=$$('label.trophy span.text_label.turbo_boost');if(normals.length>0&&turbos.length>0)
{for(i=0;i<normals.length;i++)
{normals[i].style.display='block';}
for(i=0;i<turbos.length;i++)
{turbos[i].style.display='none';}}}else{turboButton.addClassName('turbobutton-active');turboButton.removeClassName('turbobutton-normal');turboField.value='1';var normals=$$('label.trophy span.text_label.normal');var turbos=$$('label.trophy span.text_label.turbo_boost');if(normals.length>0&&turbos.length>0)
{for(i=0;i<normals.length;i++)
{normals[i].style.display='none';}
for(i=0;i<turbos.length;i++)
{turbos[i].style.display='block';}}}}.bindAsEventListener(this));}},bindToJoinLevels:function()
{var participantTargetCustom=$('participant_target_custom');var participantCustomTarget=$('participant_custom_target');if(participantTargetCustom&&participantCustomTarget){participantCustomTarget.disabled=!participantTargetCustom.checked;var radiosStandard=$$('#challenge_join_form input[type=radio]');radiosStandard.each(function(r){r.observe('change',function(e){participantCustomTarget.disabled=!participantTargetCustom.checked;}.bindAsEventListener(this,participantTargetCustom,participantCustomTarget));}.bindAsEventListener(this,participantTargetCustom,participantCustomTarget));}
var goalForm=$('challenge_join_form');if(goalForm){goalForm.observe('submit',function(e){if(!this.capture){return true;}
var lower=$('lower_message');var upper=$('upper_message');var multipler=1;try{var total=this.calculateTotal();if(lower){var classes=lower.className.split(" ");for(i=0;i<classes.length;i++){if(m=classes[i].match(/level_(\d+)/)){var lowerThreshold=m[1]*multipler;}}
if(lowerThreshold>total){e.stop();Overlay.confirm(lower.innerHTML,{ok:function(){this.capture=false;}.bindAsEventListener(this,goalForm)});}}
if(upper){var classes=upper.className.split(" ");for(i=0;i<classes.length;i++){if(m=classes[i].match(/level_(\d+)/)){var upperThreshold=m[1]*multipler;}}
if(upperThreshold<total){e.stop();Overlay.confirm(upper.innerHTML,{ok:function(){this.capture=false;}.bindAsEventListener(this,goalForm)});}}}catch(e){Overlay.show('error','<p>'+e+'</p>');}}.bindAsEventListener(this));}},calculateTotal:function(){var goalInputs=$$('#challenge_join_form input[type=radio]');for(i=0;i<goalInputs.length;i++){if(goalInputs[i].checked){if(goalInputs[i].id=="participant_target_custom"){return $('participant_custom_target').value;}
else
{return goalInputs[i].value;}}}
throw"Please select a goal";},bindToNotAllowed:function(){var elements=document.getElementsByClassName('not-allowed');for(i=0;i<elements.length;i++){$(elements[i]).observe('click',function(e){e.stop();Overlay.alert("Sorry! You need to be a member to view these guides!");});}},renderOverlay:function(text){Overlay.closeFrames();Overlay.close(Overlay.getFrame('message'));Overlay.show('message',text,{onLoad:function(){this.bind();}.bindAsEventListener(this)});}});var Payment=Class.create({bind:function(){var creditCard=$('method_credit_card');var creditCardContainer=$('pay_by_credit_card');if(creditCard&&creditCardContainer){if(creditCard.checked){this.show(creditCardContainer);}else{this.hide(creditCardContainer);}
creditCard.observe('click',function(e){$$('div.payment-type').each(function(d){this.hide(d);}.bindAsEventListener(this));if(creditCard.checked){this.show(creditCardContainer);}else{this.hide(creditCardContainer);}}.bindAsEventListener(this,creditCard,creditCardContainer));}
var paypal=$('method_paypal');var paypalContainer=$('pay_by_paypal');if(paypal&&paypalContainer){if(paypal.checked){this.show(paypalContainer);}else{this.hide(paypalContainer);}
paypal.observe('click',function(e){$$('div.payment-type').each(function(d){this.hide(d);}.bindAsEventListener(this));if(paypal.checked){this.show(paypalContainer);}else{this.hide(paypalContainer);}}.bindAsEventListener(this,paypal,paypalContainer));}
var direct=$('method_direct');var directContainer=$('pay_by_direct');if(direct&&directContainer){if(direct.checked){this.show(directContainer);}else{this.hide(directContainer);}
direct.observe('click',function(e){$$('div.payment-type').each(function(d){this.hide(d);}.bindAsEventListener(this));if(direct.checked){this.show(directContainer);}else{this.hide(directContainer);}}.bindAsEventListener(this,direct,directContainer));}
var cheque=$('method_cheque');var chequeContainer=$('pay_by_cheque');if(cheque&&chequeContainer){if(cheque.checked){this.show(chequeContainer);}else{this.hide(chequeContainer);}
cheque.observe('click',function(e){$$('div.payment-type').each(function(d){this.hide(d);}.bindAsEventListener(this));if(cheque.checked){this.show(chequeContainer);}else{this.hide(chequeContainer);}}.bindAsEventListener(this,cheque,chequeContainer));}
var payments=$('payments');if(payments){var rows=payments.getElementsBySelector('tr');for(i=0;i<rows.length;i++){var row=rows[i];var selects=row.getElementsBySelector('select');if(selects.length==1){selects.first().observe('change',function(e){e.element().up('tr').getElementsBySelector('input').first().checked=true;});}}}
var button=$('payment_select');if(button){button.style.display='none';}},show:function(element){if(!element.hasClassName('selected')){element.addClassName('selected');}},hide:function(element){if(element.hasClassName('selected')){element.removeClassName('selected');}}});var Faq=Class.create({bind:function(){var faqList=$('faqlist');if(faqList){answers=$A(faqList.getElementsBySelector('li div.answer'));answers.each(function(answer){Element.hide(answer);var questions=answer.up('li').getElementsBySelector('div.question');if(questions.length>0){question=questions[0];question.observe('click',function(e){e.stop();Effect.toggle(answer,'slide');}.bindAsEventListener(answer));}});}}});var Link=Class.create({bind:function(){var linkList=$('link_list');if(linkList){lis=$A(linkList.getElementsByTagName('li'));lis.each(function(li){var links=$$('#link_list li#'+li.id+' div.links');if(links.length>0){link=links[0];Element.hide(link);}
var categories=$$('#link_list li#'+li.id+' h3 a');if(categories.length>0){category=categories[0];category.observe('click',function(e){e.stop();var links=$$('#link_list li#'+this.id+' div.links');if(links.length>0){link=links[0];Effect.toggle(link,'slide');}}.bindAsEventListener(li));}});}}});var Leaderboard=Class.create({bind:function(){var dropdownTrigger=$('dropdown_trigger');var dropdown=$('dropdown');if(dropdownTrigger&&dropdown){dropdownTrigger.observe('click',function(e){var dropdownTrigger=$('dropdown_trigger');var dropdown=$('dropdown');if(dropdownTrigger.hasClassName('head-down'))
{dropdownTrigger.removeClassName('head-down');dropdown.removeClassName('drop-down-visible');}
else
{dropdownTrigger.addClassName('head-down');dropdown.addClassName('drop-down-visible');}}.bindAsEventListener(this));}}});var EventCalendar=Class.create({bind:function(){var calendarMonth=$('calendar_month');if(calendarMonth){calendarMonth.observe('change',function(e){e.element().up('form').submit();});}
var calendarYear=$('calendar_year');if(calendarYear){calendarYear.observe('change',function(e){e.element().up('form').submit();});}
var dropDowns=$$('.day-menu-drop');for(var i=0;i<dropDowns.length;i++){var dropDown=dropDowns[i];dropDown.observe('click',function(e){e.stop();this.toggle(e.element().up('div'));}.bindAsEventListener(this));}
var statusLinks=$$('.day-menu ul li a');for(var i=0;i<statusLinks.length;i++){var statusLink=statusLinks[i];statusLink.observe('click',function(e){e.stop();this.toggle(e.element().up('div'));this.update(e.element());}.bindAsEventListener(this));}
var calendarSmartHelp=$('calendar-smart-help');var smartHelp=$('smart-help');if(calendarSmartHelp&&smartHelp){smartHelp.hide();calendarSmartHelp.observe('click',function(e){e.stop();Effect.toggle(smartHelp,'slide');}.bindAsEventListener(this,smartHelp));}
var days=$$('.day-header');for(var i=0;i<days.length;i++){var day=days[i];day.observe('click',function(e){e.stop();var td=e.element().up('td');var id=td.id.substring('date_'.length);var title=td.title;Overlay.showLoader();var request=new Ajax.Request('/calendars/'+id,{method:'get',onSuccess:function(e){Overlay.closeLoader();Overlay.show('date',e.responseText,{width:500,title:"<div class=\"day-number\"><span class=\"num\">"+title+"</span></div>",onLoad:function(){this.bindForm();}.bindAsEventListener(this)});}.bindAsEventListener(this,id,title),onFailure:function(e){}.bindAsEventListener(this)});}.bindAsEventListener(this));}},toggle:function(element){if(element.hasClassName('day-menu-active')){element.removeClassName('day-menu-active');}else{element.addClassName('day-menu-active');}},update:function(element){var p=element.getAttribute('rel');if(re=p.match(/day=(\d+)/)){day=re[1];}
var request=new Ajax.Request('/calendars',{parameters:p,onSuccess:function(e){if(day&&(d=$('day_'+day)))
{if(e.responseJSON==null){d.innerHTML='<span class="num">'+day+'</span>';var td=d.up('td');td.className='day';}else{d.innerHTML='<span class="num">'+day+'</span><span class="status">'+e.responseJSON.label+'</span>';var td=d.up('td');td.className='day day-status-'+e.responseJSON.key;}}}.bindAsEventListener(this,day)});},bindForm:function()
{},renderStepAdd:function(id){},renderStepEditor:function(id){},renderStepDelete:function(id){}});var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return}f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return}if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return}}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return}var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return}var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return}AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();document.createElement("canvas").getContext||(function(){var s=Math,j=s.round,F=s.sin,G=s.cos,V=s.abs,W=s.sqrt,k=10,v=k/2;function X(){return this.context_||(this.context_=new H(this))}var L=Array.prototype.slice;function Y(b,a){var c=L.call(arguments,2);return function(){return b.apply(a,c.concat(L.call(arguments)))}}var M={init:function(b){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var a=b||document;a.createElement("canvas");a.attachEvent("onreadystatechange",Y(this.init_,this,a))}},init_:function(b){b.namespaces.g_vml_||b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!b.styleSheets.ex_canvas_){var a=b.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var c=b.getElementsByTagName("canvas"),d=0;for(;d<c.length;d++)this.initElement(c[d])},initElement:function(b){if(!b.getContext){b.getContext=X;b.innerHTML="";b.attachEvent("onpropertychange",Z);b.attachEvent("onresize",$);var a=b.attributes;if(a.width&&a.width.specified)b.style.width=a.width.nodeValue+"px";else b.width=b.clientWidth;if(a.height&&a.height.specified)b.style.height=a.height.nodeValue+"px";else b.height=b.clientHeight}return b}};function Z(b){var a=b.srcElement;switch(b.propertyName){case"width":a.style.width=a.attributes.width.nodeValue+"px";a.getContext().clearRect();break;case"height":a.style.height=a.attributes.height.nodeValue+"px";a.getContext().clearRect();break}}function $(b){var a=b.srcElement;if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}M.init();var N=[],B=0;for(;B<16;B++){var C=0;for(;C<16;C++)N[B*16+C]=B.toString(16)+C.toString(16)}function I(){return[[1,0,0],[0,1,0],[0,0,1]]}function y(b,a){var c=I(),d=0;for(;d<3;d++){var f=0;for(;f<3;f++){var h=0,g=0;for(;g<3;g++)h+=b[d][g]*a[g][f];c[d][f]=h}}return c}function O(b,a){a.fillStyle=b.fillStyle;a.lineCap=b.lineCap;a.lineJoin=b.lineJoin;a.lineWidth=b.lineWidth;a.miterLimit=b.miterLimit;a.shadowBlur=b.shadowBlur;a.shadowColor=b.shadowColor;a.shadowOffsetX=b.shadowOffsetX;a.shadowOffsetY=b.shadowOffsetY;a.strokeStyle=b.strokeStyle;a.globalAlpha=b.globalAlpha;a.arcScaleX_=b.arcScaleX_;a.arcScaleY_=b.arcScaleY_;a.lineScale_=b.lineScale_}function P(b){var a,c=1;b=String(b);if(b.substring(0,3)=="rgb"){var d=b.indexOf("(",3),f=b.indexOf(")",d+
1),h=b.substring(d+1,f).split(",");a="#";var g=0;for(;g<3;g++)a+=N[Number(h[g])];if(h.length==4&&b.substr(3,1)=="a")c=h[3]}else a=b;return{color:a,alpha:c}}function aa(b){switch(b){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function H(b){this.m_=I();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=k*1;this.globalAlpha=1;this.canvas=b;var a=b.ownerDocument.createElement("div");a.style.width=b.clientWidth+"px";a.style.height=b.clientHeight+"px";a.style.overflow="hidden";a.style.position="absolute";b.appendChild(a);this.element_=a;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}var i=H.prototype;i.clearRect=function(){this.element_.innerHTML=""};i.beginPath=function(){this.currentPath_=[]};i.moveTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};i.lineTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};i.bezierCurveTo=function(b,a,c,d,f,h){var g=this.getCoords_(f,h),l=this.getCoords_(b,a),e=this.getCoords_(c,d);Q(this,l,e,g)};function Q(b,a,c,d){b.currentPath_.push({type:"bezierCurveTo",cp1x:a.x,cp1y:a.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});b.currentX_=d.x;b.currentY_=d.y}i.quadraticCurveTo=function(b,a,c,d){var f=this.getCoords_(b,a),h=this.getCoords_(c,d),g={x:this.currentX_+
0.6666666666666666*(f.x-this.currentX_),y:this.currentY_+0.6666666666666666*(f.y-this.currentY_)};Q(this,g,{x:g.x+(h.x-this.currentX_)/3,y:g.y+(h.y-this.currentY_)/3},h)};i.arc=function(b,a,c,d,f,h){c*=k;var g=h?"at":"wa",l=b+G(d)*c-v,e=a+F(d)*c-v,m=b+G(f)*c-v,r=a+F(f)*c-v;if(l==m&&!h)l+=0.125;var n=this.getCoords_(b,a),o=this.getCoords_(l,e),q=this.getCoords_(m,r);this.currentPath_.push({type:g,x:n.x,y:n.y,radius:c,xStart:o.x,yStart:o.y,xEnd:q.x,yEnd:q.y})};i.rect=function(b,a,c,d){this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath()};i.strokeRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.stroke();this.currentPath_=f};i.fillRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.fill();this.currentPath_=f};i.createLinearGradient=function(b,a,c,d){var f=new D("gradient");f.x0_=b;f.y0_=a;f.x1_=c;f.y1_=d;return f};i.createRadialGradient=function(b,a,c,d,f,h){var g=new D("gradientradial");g.x0_=b;g.y0_=a;g.r0_=c;g.x1_=d;g.y1_=f;g.r1_=h;return g};i.drawImage=function(b){var a,c,d,f,h,g,l,e,m=b.runtimeStyle.width,r=b.runtimeStyle.height;b.runtimeStyle.width="auto";b.runtimeStyle.height="auto";var n=b.width,o=b.height;b.runtimeStyle.width=m;b.runtimeStyle.height=r;if(arguments.length==3){a=arguments[1];c=arguments[2];h=g=0;l=d=n;e=f=o}else if(arguments.length==5){a=arguments[1];c=arguments[2];d=arguments[3];f=arguments[4];h=g=0;l=n;e=o}else if(arguments.length==9){h=arguments[1];g=arguments[2];l=arguments[3];e=arguments[4];a=arguments[5];c=arguments[6];d=arguments[7];f=arguments[8]}else throw Error("Invalid number of arguments");var q=this.getCoords_(a,c),t=[];t.push(" <g_vml_:group",' coordsize="',k*10,",",k*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var E=[];E.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",j(q.x/k),",","Dy=",j(q.y/k),"");var p=q,z=this.getCoords_(a+d,c),w=this.getCoords_(a,c+f),x=this.getCoords_(a+d,c+f);p.x=s.max(p.x,z.x,w.x,x.x);p.y=s.max(p.y,z.y,w.y,x.y);t.push("padding:0 ",j(p.x/k),"px ",j(p.y/k),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",E.join(""),", sizingmethod='clip');")}else t.push("top:",j(q.y/k),"px;left:",j(q.x/k),"px;");t.push(' ">','<g_vml_:image src="',b.src,'"',' style="width:',k*d,"px;"," height:",k*f,'px;"',' cropleft="',h/n,'"',' croptop="',g/o,'"',' cropright="',(n-h-l)/n,'"',' cropbottom="',(o-g-e)/o,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};i.stroke=function(b){var a=[],c=P(b?this.fillStyle:this.strokeStyle),d=c.color,f=c.alpha*this.globalAlpha;a.push("<g_vml_:shape",' filled="',!!b,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0 0" coordsize="',k*10," ",k*10,'"',' stroked="',!b,'"',' path="');var h={x:null,y:null},g={x:null,y:null},l=0;for(;l<this.currentPath_.length;l++){var e=this.currentPath_[l];switch(e.type){case"moveTo":a.push(" m ",j(e.x),",",j(e.y));break;case"lineTo":a.push(" l ",j(e.x),",",j(e.y));break;case"close":a.push(" x ");e=null;break;case"bezierCurveTo":a.push(" c ",j(e.cp1x),",",j(e.cp1y),",",j(e.cp2x),",",j(e.cp2y),",",j(e.x),",",j(e.y));break;case"at":case"wa":a.push(" ",e.type," ",j(e.x-this.arcScaleX_*e.radius),",",j(e.y-this.arcScaleY_*e.radius)," ",j(e.x+this.arcScaleX_*e.radius),",",j(e.y+this.arcScaleY_*e.radius)," ",j(e.xStart),",",j(e.yStart)," ",j(e.xEnd),",",j(e.yEnd));break}if(e){if(h.x==null||e.x<h.x)h.x=e.x;if(g.x==null||e.x>g.x)g.x=e.x;if(h.y==null||e.y<h.y)h.y=e.y;if(g.y==null||e.y>g.y)g.y=e.y}}a.push(' ">');if(b)if(typeof this.fillStyle=="object"){var m=this.fillStyle,r=0,n={x:0,y:0},o=0,q=1;if(m.type_=="gradient"){var t=m.x1_/this.arcScaleX_,E=m.y1_/this.arcScaleY_,p=this.getCoords_(m.x0_/this.arcScaleX_,m.y0_/this.arcScaleY_),z=this.getCoords_(t,E);r=Math.atan2(z.x-p.x,z.y-p.y)*180/Math.PI;if(r<0)r+=360;if(r<1.0E-6)r=0}else{var p=this.getCoords_(m.x0_,m.y0_),w=g.x-h.x,x=g.y-h.y;n={x:(p.x-h.x)/w,y:(p.y-h.y)/x};w/=this.arcScaleX_*k;x/=this.arcScaleY_*k;var R=s.max(w,x);o=2*m.r0_/R;q=2*m.r1_/R-o}var u=m.colors_;u.sort(function(ba,ca){return ba.offset-ca.offset});var J=u.length,da=u[0].color,ea=u[J-1].color,fa=u[0].alpha*this.globalAlpha,ga=u[J-1].alpha*this.globalAlpha,S=[],l=0;for(;l<J;l++){var T=u[l];S.push(T.offset*q+
o+" "+T.color)}a.push('<g_vml_:fill type="',m.type_,'"',' method="none" focus="100%"',' color="',da,'"',' color2="',ea,'"',' colors="',S.join(","),'"',' opacity="',ga,'"',' g_o_:opacity2="',fa,'"',' angle="',r,'"',' focusposition="',n.x,",",n.y,'" />')}else a.push('<g_vml_:fill color="',d,'" opacity="',f,'" />');else{var K=this.lineScale_*this.lineWidth;if(K<1)f*=K;a.push("<g_vml_:stroke",' opacity="',f,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',aa(this.lineCap),'"',' weight="',K,'px"',' color="',d,'" />')}a.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",a.join(""))};i.fill=function(){this.stroke(true)};i.closePath=function(){this.currentPath_.push({type:"close"})};i.getCoords_=function(b,a){var c=this.m_;return{x:k*(b*c[0][0]+a*c[1][0]+c[2][0])-v,y:k*(b*c[0][1]+a*c[1][1]+c[2][1])-v}};i.save=function(){var b={};O(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=y(I(),this.m_)};i.restore=function(){O(this.aStack_.pop(),this);this.m_=this.mStack_.pop()};function ha(b){var a=0;for(;a<3;a++){var c=0;for(;c<2;c++)if(!isFinite(b[a][c])||isNaN(b[a][c]))return false}return true}function A(b,a,c){if(!!ha(a)){b.m_=a;if(c)b.lineScale_=W(V(a[0][0]*a[1][1]-a[0][1]*a[1][0]))}}i.translate=function(b,a){A(this,y([[1,0,0],[0,1,0],[b,a,1]],this.m_),false)};i.rotate=function(b){var a=G(b),c=F(b);A(this,y([[a,c,0],[-c,a,0],[0,0,1]],this.m_),false)};i.scale=function(b,a){this.arcScaleX_*=b;this.arcScaleY_*=a;A(this,y([[b,0,0],[0,a,0],[0,0,1]],this.m_),true)};i.transform=function(b,a,c,d,f,h){A(this,y([[b,a,0],[c,d,0],[f,h,1]],this.m_),true)};i.setTransform=function(b,a,c,d,f,h){A(this,[[b,a,0],[c,d,0],[f,h,1]],true)};i.clip=function(){};i.arcTo=function(){};i.createPattern=function(){return new U};function D(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}D.prototype.addColorStop=function(b,a){a=P(a);this.colors_.push({offset:b,color:a.color,alpha:a.alpha})};function U(){}G_vmlCanvasManager=M;CanvasRenderingContext2D=H;CanvasGradient=D;CanvasPattern=U})();JS={extend:function(a,b){b=b||{};for(var c in b){if(a[c]===b[c])continue;a[c]=b[c]}return a},makeFunction:function(){return function(){return this.initialize?(this.initialize.apply(this,arguments)||this):this}},makeBridge:function(a){var b=function(){};b.prototype=a.prototype;return new b},delegate:function(a,b){return function(){return this[a][b].apply(this[a],arguments)}},bind:function(){var a=JS.array(arguments),b=a.shift(),c=a.shift()||null;return function(){return b.apply(c,a.concat(JS.array(arguments)))}},callsSuper:function(a){return a.SUPER===undefined?a.SUPER=/\bcallSuper\b/.test(a.toString()):a.SUPER},mask:function(a){var b=a.toString().replace(/callSuper/g,'super');a.toString=function(){return b};return a},array:function(a){if(!a)return[];if(a.toArray)return a.toArray();var b=a.length,c=[];while(b--)c[b]=a[b];return c},indexOf:function(a,b){for(var c=0,d=a.length;c<d;c++){if(a[c]===b)return c}return-1},isFn:function(a){return a instanceof Function},ignore:function(a,b){return/^(include|extend)$/.test(a)&&typeof b==='object'}};JS.Module=JS.makeFunction();JS.extend(JS.Module.prototype,{initialize:function(a,b){b=b||{};this.__mod__=this;this.__inc__=[];this.__fns__={};this.__dep__=[];this.__res__=b._1||null;this.include(a||{})},define:function(a,b,c){c=c||{};this.__fns__[a]=b;if(JS.Module._0&&c._0&&JS.isFn(b))JS.Module._0(a,c._0);var d=this.__dep__.length;while(d--)this.__dep__[d].resolve()},instanceMethod:function(a){var b=this.lookup(a).pop();return JS.isFn(b)?b:null},include:function(a,b,c){if(!a)return c&&this.resolve();b=b||{};var d=a.include,f=a.extend,e,g,j,h,i=b._4||this;if(a.__inc__&&a.__fns__){this.__inc__.push(a);a.__dep__.push(this);if(b._2)a.extended&&a.extended(b._2);else a.included&&a.included(i)}else{if(b._5){for(h in a){if(JS.ignore(h,a[h]))continue;this.define(h,a[h],{_0:i||b._2||this})}}else{if(typeof d==='object'){e=[].concat(d);for(g=0,j=e.length;g<j;g++)i.include(e[g],b)}if(typeof f==='object'){e=[].concat(f);for(g=0,j=e.length;g<j;g++)i.extend(e[g],false);i.extend()}b._5=true;return i.include(a,b,c)}}c&&this.resolve()},includes:function(a){if(Object===a||this===a||this.__res__===a.prototype)return true;var b=this.__inc__.length;while(b--){if(this.__inc__[b].includes(a))return true}return false},ancestors:function(a){a=a||[];for(var b=0,c=this.__inc__.length;b<c;b++)this.__inc__[b].ancestors(a);var d=(this.__res__||{}).klass,f=(d&&this.__res__===d.prototype)?d:this;if(JS.indexOf(a,f)===-1)a.push(f);return a},lookup:function(a){var b=this.ancestors(),c=[],d,f,e;for(d=0,f=b.length;d<f;d++){e=b[d].__mod__.__fns__[a];if(e)c.push(e)}return c},make:function(a,b){if(!JS.isFn(b)||!JS.callsSuper(b))return b;var c=this;return function(){return c.chain(this,a,arguments)}},chain:JS.mask(function(c,d,f){var e=this.lookup(d),g=e.length-1,j=c.callSuper,h=JS.array(f),i;c.callSuper=function(){var a=arguments.length;while(a--)h[a]=arguments[a];g-=1;var b=e[g].apply(c,h);g+=1;return b};i=e.pop().apply(c,h);j?c.callSuper=j:delete c.callSuper;return i}),resolve:function(a){var a=a||this,b=a.__res__,c,d,f,e;if(a===this){c=this.__dep__.length;while(c--)this.__dep__[c].resolve()}if(!b)return;for(c=0,d=this.__inc__.length;c<d;c++)this.__inc__[c].resolve(a);for(f in this.__fns__){e=a.make(f,this.__fns__[f]);if(b[f]!==e)b[f]=e}}});JS.ObjectMethods=new JS.Module({__eigen__:function(){if(this.__meta__)return this.__meta__;var a=this.__meta__=new JS.Module({},{_1:this});a.include(this.klass.__mod__);return a},extend:function(a,b){return this.__eigen__().include(a,{_2:this},b!==false)},isA:function(a){return this.__eigen__().includes(a)},method:function(a){var b=this,c=b.__mcache__=b.__mcache__||{};if((c[a]||{}).fn===b[a])return c[a].bd;return(c[a]={fn:b[a],bd:JS.bind(b[a],b)}).bd}});JS.Class=JS.makeFunction();JS.extend(JS.Class.prototype=JS.makeBridge(JS.Module),{initialize:function(a,b){var c=JS.extend(JS.makeFunction(),this);c.klass=c.constructor=this.klass;if(!JS.isFn(a)){b=a;a=Object}c.inherit(a);c.include(b,null,false);c.resolve();do{a.inherited&&a.inherited(c)}while(a=a.superclass);return c},inherit:function(a){this.superclass=a;if(this.__eigen__){this.__eigen__().include(a.__eigen__?a.__eigen__():new JS.Module(a.prototype));this.__meta__.resolve()}this.subclasses=[];(a.subclasses||[]).push(this);var b=this.prototype=JS.makeBridge(a);b.klass=b.constructor=this;this.__mod__=new JS.Module({},{_1:this.prototype});this.include(JS.ObjectMethods,null,false);if(a!==Object)this.include(a.__mod__||new JS.Module(a.prototype,{_1:a.prototype}),null,false)},include:function(a,b,c){if(!a)return;var d=this.__mod__,b=b||{};b._4=this;return d.include(a,b,c!==false)},extend:function(a){if(!this.callSuper)return;this.callSuper();var b=this.subclasses.length;while(b--)this.subclasses[b].extend()},define:function(){var a=this.__mod__;a.define.apply(a,arguments);a.resolve()},includes:JS.delegate('__mod__','includes'),ancestors:JS.delegate('__mod__','ancestors'),resolve:JS.delegate('__mod__','resolve')});JS.Module=JS.extend(new JS.Class(JS.Module.prototype),JS.ObjectMethods.__fns__);JS.Module.include(JS.ObjectMethods);JS.Class=JS.extend(new JS.Class(JS.Module,JS.Class.prototype),JS.ObjectMethods.__fns__);JS.Module.klass=JS.Module.constructor=JS.Class.klass=JS.Class.constructor=JS.Class;JS.Module.extend({_3:[],methodAdded:function(a,b){this._3.push([a,b])},_0:function(a,b){var c=this._3,d=c.length;while(d--)c[d][0].call(c[d][1]||null,a,b)}});JS.extend(JS,{Interface:new JS.Class({initialize:function(d){this.test=function(a,b){var c=d.length;while(c--){if(!JS.isFn(a[d[c]]))return b?d[c]:false}return true}},extend:{ensure:function(){var a=JS.array(arguments),b=a.shift(),c,d;while(c=a.shift()){d=c.test(b,true);if(d!==true)throw new Error('object does not implement '+d+'()');}}}}),Singleton:new JS.Class({initialize:function(a,b){return new(new JS.Class(a,b))}})});Bluff={VERSION:'0.3.4',array:function(list){if(list.length===undefined)return[list];var ary=[],i=list.length;while(i--)ary[i]=list[i];return ary;},each:function(list,block,context){for(var i=0,n=list.length;i<n;i++){block.call(context||null,list[i],i);}},reverse_each:function(list,block,context){var i=list.length;while(i--)block.call(context||null,list[i],i);},sum:function(list){var sum=0,i=list.length;while(i--)sum+=list[i];return sum;},Mini:{}};Bluff.Base=new JS.Class({extend:{DEBUG:false,DATA_LABEL_INDEX:0,DATA_VALUES_INDEX:1,DATA_COLOR_INDEX:2,LEGEND_MARGIN:10,TITLE_MARGIN:10,LABEL_MARGIN:10,DEFAULT_TARGET_WIDTH:800},top_margin:null,bottom_margin:null,right_margin:null,left_margin:null,labels:null,center_labels_over_point:null,has_left_labels:null,x_axis_label:null,x_marker_count:null,y_axis_label:null,y_axis_increment:null,colors:null,goal_color:null,goal_label:"%d",title:null,font:null,font_color:null,hide_line_markers:null,hide_legend:null,hide_title:null,hide_line_numbers:null,no_data_message:null,title_font_size:null,legend_font_size:null,marker_font_size:null,marker_color:null,marker_count:null,minimum_value:null,maximum_value:null,sort:null,additional_line_values:null,stacked:null,legend_box_size:null,initialize:function(renderer,target_width){this._d=new Bluff.Renderer(renderer);target_width=target_width||this.klass.DEFAULT_TARGET_WIDTH;this.top_margin=this.bottom_margin=this.left_margin=this.right_margin=20;var geo;if(typeof target_width!='number'){geo=target_width.split('x');this._columns=parseFloat(geo[0]);this._rows=parseFloat(geo[1]);}else{this._columns=parseFloat(target_width);this._rows=this._columns*0.75;}
this.initialize_ivars();this._reset_themes();this.theme_keynote();},initialize_ivars:function(){this._raw_columns=800;this._raw_rows=800*(this._rows/this._columns);this._column_count=0;this.marker_count=null;this.maximum_value=this.minimum_value=null;this._has_data=false;this._data=[];this.labels={};this._labels_seen={};this.sort=true;this.title=null;this._scale=this._columns/this._raw_columns;this.marker_font_size=21.0;this.legend_font_size=20.0;this.title_font_size=36.0;this.legend_box_size=20.0;this.no_data_message="No Data";this.hide_line_markers=this.hide_legend=this.hide_title=this.hide_line_numbers=false;this.center_labels_over_point=true;this.has_left_labels=false;this.additional_line_values=[];this._additional_line_colors=[];this._theme_options={};this.x_axis_label=this.y_axis_label=null;this.y_axis_increment=null;this.stacked=null;this._norm_data=null;},set_margins:function(margin){this.top_margin=this.left_margin=this.right_margin=this.bottom_margin=margin;},set_font:function(font_path){this.font=font_path;this._d.font=this.font;},add_color:function(colorname){this.colors.push(colorname);},replace_colors:function(color_list){this.colors=color_list||[];},set_theme:function(options){this._reset_themes();this._theme_options={colors:['black','white'],goal_color:'red',additional_line_colors:[],marker_color:'white',font_color:'black',background_colors:null,background_image:null};for(var key in options)this._theme_options[key]=options[key];this.colors=this._theme_options.colors;this.goal_color=this._theme_options.goal_color;this.marker_color=this._theme_options.marker_color;this.font_color=this._theme_options.font_color||this.marker_color;this._additional_line_colors=this._theme_options.additional_line_colors;this._render_background();},theme_keynote:function(){this._blue='#6886B4';this._yellow='#FDD84E';this._green='#72AE6E';this._red='#D1695E';this._purple='#8A6EAF';this._orange='#EFAA43';this._white='white';this.colors=[this._yellow,this._blue,this._green,this._red,this._purple,this._orange,this._white];this.set_theme({colors:this.colors,marker_color:'white',font_color:'white',background_colors:['black','#4a465a']});},theme_37signals:function(){this._green='#339933';this._purple='#cc99cc';this._blue='#336699';this._yellow='#FFF804';this._red='#ff0000';this._orange='#cf5910';this._black='black';this.colors=[this._yellow,this._blue,this._green,this._red,this._purple,this._orange,this._black];this.set_theme({colors:this.colors,marker_color:'black',font_color:'black',background_colors:['#d1edf5','white']});},theme_rails_keynote:function(){this._green='#00ff00';this._grey='#333333';this._orange='#ff5d00';this._red='#f61100';this._white='white';this._light_grey='#999999';this._black='black';this.colors=[this._green,this._grey,this._orange,this._red,this._white,this._light_grey,this._black];this.set_theme({colors:this.colors,marker_color:'white',font_color:'white',background_colors:['#0083a3','#0083a3']});},theme_odeo:function(){this._grey='#202020';this._white='white';this._dark_pink='#a21764';this._green='#8ab438';this._light_grey='#999999';this._dark_blue='#3a5b87';this._black='black';this.colors=[this._grey,this._white,this._dark_blue,this._dark_pink,this._green,this._light_grey,this._black];this.set_theme({colors:this.colors,marker_color:'white',font_color:'white',background_colors:['#ff47a4','#ff1f81']});},theme_pastel:function(){this.colors=['#a9dada','#aedaa9','#daaea9','#dadaa9','#a9a9da','#daaeda','#dadada'];this.set_theme({colors:this.colors,marker_color:'#aea9a9',font_color:'black',background_colors:'white'});},theme_greyscale:function(){this.colors=['#282828','#383838','#686868','#989898','#c8c8c8','#e8e8e8'];this.set_theme({colors:this.colors,marker_color:'#aea9a9',font_color:'black',background_colors:'white'});},data:function(name,data_points,color){data_points=(data_points===undefined)?[]:data_points;color=color||null;data_points=Bluff.array(data_points);this._data.push([name,data_points,(color||this._increment_color())]);this._column_count=(data_points.length>this._column_count)?data_points.length:this._column_count;Bluff.each(data_points,function(data_point,index){if(data_point===undefined)return;if(this.maximum_value===null&&this.minimum_value===null)
this.maximum_value=this.minimum_value=data_point;this.maximum_value=this._larger_than_max(data_point)?data_point:this.maximum_value;if(this.maximum_value>0)this._has_data=true;this.minimum_value=this._less_than_min(data_point)?data_point:this.minimum_value;if(this.minimum_value<0)this._has_data=true;},this);},draw:function(){if(this.stacked)this._make_stacked();this._setup_drawing();this._debug(function(){this._d.rectangle(this.left_margin,this.top_margin,this._raw_columns-this.right_margin,this._raw_rows-this.bottom_margin);this._d.rectangle(this._graph_left,this._graph_top,this._graph_right,this._graph_bottom);});},drawGoalLine:function(){if(this.goal){this._d.stroke=this.goal_color;this._d.stroke_opacity=0.5;this._d.stroke_width=2;y=Math.round(this._graph_top+((1-(this.goal/this.maximum_value))*this._graph_height));this._d.line(this._graph_left,y,this._raw_columns-this.right_margin,y);notey=y-25;if(this.goal>(this.maximum_value/2))
{notey=y+10;}
this._d.annotate_scaled(this._raw_columns,1.0,0,notey,this.goal_label.replace(/%d/,this.goal),this._scale);}},clear:function(){this._render_background();},_setup_drawing:function(){if(!this._has_data)return this._draw_no_data();this._normalize();this._setup_graph_measurements();if(this.sort)this._sort_norm_data();this._draw_legend();this._draw_line_markers();this._draw_axis_labels();this._draw_title();},_normalize:function(force){if(this._norm_data===null||force===true){this._norm_data=[];if(!this._has_data)return;this._calculate_spread();Bluff.each(this._data,function(data_row){var norm_data_points=[];Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point){if(data_point===null||data_point===undefined)
norm_data_points.push(null);else
norm_data_points.push((data_point-this.minimum_value)/this._spread);},this);this._norm_data.push([data_row[this.klass.DATA_LABEL_INDEX],norm_data_points,data_row[this.klass.DATA_COLOR_INDEX]]);},this);}},_calculate_spread:function(){this._spread=this.maximum_value-this.minimum_value;this._spread=this._spread>0?this._spread:1;},_setup_graph_measurements:function(){this._marker_caps_height=this.hide_line_markers?0:this._calculate_caps_height(this.marker_font_size);this._title_caps_height=this.hide_title?0:this._calculate_caps_height(this.title_font_size);this._legend_caps_height=this.hide_legend?0:this._calculate_caps_height(this.legend_font_size);var longest_label,longest_left_label_width,line_number_width,last_label,extra_room_for_long_label,x_axis_label_height,key;if(this.hide_line_markers){this._graph_left=this.left_margin;this._graph_right_margin=this.right_margin;this._graph_bottom_margin=this.bottom_margin;}else{longest_left_label_width=0;if(this.has_left_labels){longest_label='';for(key in this.labels){longest_label=longest_label.length>this.labels[key].length?longest_label:this.labels[key];}
longest_left_label_width=this._calculate_width(this.marker_font_size,longest_label)*1.25;}else{longest_left_label_width=this._calculate_width(this.marker_font_size,this._label(this.maximum_value));}
line_number_width=this.hide_line_numbers&&!this.has_left_labels?0:longest_left_label_width+this.klass.LABEL_MARGIN*2;this._graph_left=this.left_margin+
line_number_width+
(this.y_axis_label===null?0.0:this._marker_caps_height+this.klass.LABEL_MARGIN*2);last_label=-Infinity;for(key in this.labels)
last_label=last_label>Number(key)?last_label:Number(key);last_label=Math.round(last_label);extra_room_for_long_label=(last_label>=(this._column_count-1)&&this.center_labels_over_point)?this._calculate_width(this.marker_font_size,this.labels[last_label])/2:0.0;this._graph_right_margin=this.right_margin+extra_room_for_long_label;this._graph_bottom_margin=this.bottom_margin+
this._marker_caps_height+this.klass.LABEL_MARGIN;}
this._graph_right=this._raw_columns-this._graph_right_margin;this._graph_width=this._raw_columns-this._graph_left-this._graph_right_margin;this._graph_top=this.top_margin+
(this.hide_title?this.klass.TITLE_MARGIN:this._title_caps_height+this.klass.TITLE_MARGIN*2)+
(this.hide_legend?this.klass.LEGEND_MARGIN:this._legend_caps_height+this.klass.LEGEND_MARGIN*2);x_axis_label_height=(this.x_axis_label===null)?0.0:this._marker_caps_height+this.klass.LABEL_MARGIN;this._graph_bottom=this._raw_rows-this._graph_bottom_margin-x_axis_label_height;this._graph_height=this._graph_bottom-this._graph_top;},_draw_axis_labels:function(){if(this.x_axis_label){var x_axis_label_y_coordinate=this._graph_bottom+this.klass.LABEL_MARGIN*2+this._marker_caps_height;this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.stroke='transparent';this._d.pointsize=this._scale_fontsize(this.marker_font_size);this._d.gravity='north';this._d.annotate_scaled(this._raw_columns,1.0,0.0,x_axis_label_y_coordinate,this.x_axis_label,this._scale);this._debug(function(){this._d.line(0.0,x_axis_label_y_coordinate,this._raw_columns,x_axis_label_y_coordinate);});}},_draw_line_markers:function(){if(this.hide_line_markers)return;if(this.y_axis_increment===null){if(this.marker_count===null){Bluff.each([3,4,5,6,7],function(lines){if(!this.marker_count&&this._spread%lines==0)
this.marker_count=lines;},this);this.marker_count=this.marker_count||4;}
this._increment=(this._spread>0)?this._significant(this._spread/this.marker_count):1;}else{this.maximum_value=Math.max(Math.ceil(this.maximum_value),this.y_axis_increment);this.minimum_value=Math.floor(this.minimum_value);this._calculate_spread();this._normalize(true);this.marker_count=Math.round(this._spread/this.y_axis_increment);this._increment=this.y_axis_increment;}
this._increment_scaled=this._graph_height/(this._spread/this._increment);var index,n,y,marker_label;for(index=0,n=this.marker_count;index<=n;index++){y=this._graph_top+this._graph_height-index*this._increment_scaled;this._d.stroke=this.marker_color;this._d.stroke_width=1;this._d.line(this._graph_left,y,this._graph_right,y);marker_label=index*this._increment+this.minimum_value;if(!this.hide_line_numbers){this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.stroke='transparent';this._d.pointsize=this._scale_fontsize(this.marker_font_size);this._d.gravity='east';this._d.annotate_scaled(this._graph_left-this.klass.LABEL_MARGIN,1.0,0.0,y,this._label(marker_label),this._scale);}}},_center:function(size){return(this._raw_columns-size)/2;},_draw_legend:function(){if(this.hide_legend)return;this._legend_labels=[];for(var i=0,n=this._data.length;i<n;i++)
this._legend_labels.push(this._data[i][this.klass.DATA_LABEL_INDEX]);var legend_square_width=this.legend_box_size;if(this.font)this._d.font=this.font;this._d.pointsize=this.legend_font_size;var label_widths=[[]];Bluff.each(this._legend_labels,function(label){var last=label_widths.length-1;var metrics=this._d.get_type_metrics(label);var label_width=metrics.width+legend_square_width*2.7;label_widths[last].push(label_width);if(Bluff.sum(label_widths[last])>(this._raw_columns*0.9))
label_widths.push([label_widths[last].pop()]);},this);var current_x_offset=this._center(Bluff.sum(label_widths[0]));var current_y_offset=this.hide_title?this.top_margin+this.klass.LEGEND_MARGIN:this.top_margin+
this.klass.TITLE_MARGIN+this._title_caps_height+
this.klass.LEGEND_MARGIN;this._debug(function(){this._d.stroke_width=1;this._d.line(0,current_y_offset,this._raw_columns,current_y_offset);});Bluff.each(this._legend_labels,function(legend_label,index){this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.pointsize=this._scale_fontsize(this.legend_font_size);this._d.stroke='transparent';this._d.font_weight='normal';this._d.gravity='west';this._d.annotate_scaled(this._raw_columns,1.0,current_x_offset+(legend_square_width*1.7),current_y_offset,legend_label,this._scale);this._d.stroke='transparent';this._d.fill=this._data[index][this.klass.DATA_COLOR_INDEX];this._d.rectangle(current_x_offset,current_y_offset-legend_square_width/2.0,current_x_offset+legend_square_width,current_y_offset+legend_square_width/2.0);this._d.pointsize=this.legend_font_size;var metrics=this._d.get_type_metrics(legend_label);var current_string_offset=metrics.width+(legend_square_width*3.7),line_height;label_widths[0].shift();if(label_widths[0].length==0){this._debug(function(){this._d.line(0.0,current_y_offset,this._raw_columns,current_y_offset);});label_widths.shift();if(label_widths.length>0)current_x_offset=this._center(Bluff.sum(label_widths[0]));line_height=Math.max(this._legend_caps_height,legend_square_width)+this.klass.LEGEND_MARGIN;if(label_widths.length>0){current_y_offset+=line_height;this._graph_top+=line_height;this._graph_height=this._graph_bottom-this._graph_top;}}else{current_x_offset+=current_string_offset;}},this);this._color_index=0;},_draw_title:function(){if(this.hide_title||!this.title)return;this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.pointsize=this._scale_fontsize(this.title_font_size);this._d.font_weight='bold';this._d.gravity='north';this._d.annotate_scaled(this._raw_columns,1.0,0,this.top_margin,this.title,this._scale);},_draw_label:function(x_offset,index){if(this.hide_line_markers)return;var y_offset;if(this.labels[index]&&!this._labels_seen[index]){y_offset=this._graph_bottom+this.klass.LABEL_MARGIN;this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.stroke='transparent';this._d.font_weight='normal';this._d.pointsize=this._scale_fontsize(this.marker_font_size);this._d.gravity='north';this._d.annotate_scaled(1.0,1.0,x_offset,y_offset,this.labels[index],this._scale);this._labels_seen[index]=true;this._debug(function(){this._d.stroke_width=1;this._d.line(0.0,y_offset,this._raw_columns,y_offset);});}},_draw_no_data:function(){this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.stroke='transparent';this._d.font_weight='normal';this._d.pointsize=this._scale_fontsize(80);this._d.gravity='center';this._d.annotate_scaled(this._raw_columns,this._raw_rows/2,0,10,this.no_data_message,this._scale);},_render_background:function(){var colors=this._theme_options.background_colors;switch(true){case colors instanceof Array:this._render_gradiated_background.apply(this,colors);break;case typeof colors=='string':this._render_solid_background(colors);break;default:this._render_image_background(this._theme_options.background_image);break;}},_render_solid_background:function(color){this._d.render_solid_background(this._columns,this._rows,color);},_render_gradiated_background:function(top_color,bottom_color){this._d.render_gradiated_background(this._columns,this._rows,top_color,bottom_color);},_render_image_background:function(image_path){},_reset_themes:function(){this._color_index=0;this._labels_seen={};this._theme_options={};this._d.scale(this._scale,this._scale);},_scale_value:function(value){return this._scale*value;},_scale_fontsize:function(value){var new_fontsize=value*this._scale;return new_fontsize;},_clip_value_if_greater_than:function(value,max_value){return(value>max_value)?max_value:value;},_larger_than_max:function(data_point,index){return data_point>this.maximum_value;},_less_than_min:function(data_point,index){return data_point<this.minimum_value;},_max:function(data_point,index){return data_point;},_min:function(data_point,index){return data_point;},_significant:function(inc){if(inc==0)return 1.0;var factor=1.0;while(inc<10){inc*=10;factor/=10;}
while(inc>100){inc/=10;factor*=10;}
return Math.floor(inc)*factor;},_sort_norm_data:function(){var sums=this._sums,index=this.klass.DATA_VALUES_INDEX;this._norm_data.sort(function(a,b){return sums(b[index])-sums(a[index]);});},_sums:function(data_set){var total_sum=0;Bluff.each(data_set,function(num){total_sum+=num});return total_sum;},_make_stacked:function(){var stacked_values=[],i=this._column_count;while(i--)stacked_values[i]=0;Bluff.each(this._data,function(value_set){Bluff.each(value_set[this.klass.DATA_VALUES_INDEX],function(value,index){stacked_values[index]+=value;},this);value_set[this.klass.DATA_VALUES_INDEX]=Bluff.array(stacked_values);},this);},_debug:function(block){if(this.klass.DEBUG){this._d.fill='transparent';this._d.stroke='turquoise';block.call(this);}},_increment_color:function(){if(this._color_index==0){this._color_index+=1;return this.colors[0];}else{if(this._color_index<this.colors.length){this._color_index+=1;return this.colors[this._color_index-1];}else{this._color_index=0;return this.colors[this.colors.length-1];}}},_label:function(value){if(this._spread%this.marker_count==0||this.y_axis_increment!==null){return String(Math.round(value));}
if(this._spread>10)
return String(Math.floor(value));else if(this._spread>=3)
return String(Math.floor(value*100)/100);else
return String(value);},_calculate_caps_height:function(font_size){return this._d.caps_height(font_size);},_calculate_width:function(font_size,text){return this._d.text_width(font_size,text);}});Bluff.Area=new JS.Class(Bluff.Base,{draw:function(){this.callSuper();if(!this._has_data)return;this._x_increment=this._graph_width/(this._column_count-1);this._d.stroke='transparent';Bluff.each(this._norm_data,function(data_row){var poly_points=[];var prev_x=0.0,prev_y=0.0;Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,index){var new_x=this._graph_left+(this._x_increment*index);var new_y=this._graph_top+(this._graph_height-data_point*this._graph_height);if(prev_x>0&&prev_y>0){poly_points.push(new_x);poly_points.push(new_y);}else{poly_points.push(this._graph_left);poly_points.push(this._graph_bottom-1);poly_points.push(new_x);poly_points.push(new_y);}
this._draw_label(new_x,index);prev_x=new_x;prev_y=new_y;},this);poly_points.push(this._graph_right);poly_points.push(this._graph_bottom-1);poly_points.push(this._graph_left);poly_points.push(this._graph_bottom-1);this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];this._d.polyline(poly_points);},this);}});Bluff.BarConversion=new JS.Class({mode:null,zero:null,graph_top:null,graph_height:null,minimum_value:null,spread:null,getLeftYRightYscaled:function(data_point,result){var val;switch(this.mode){case 1:result[0]=this.graph_top+this.graph_height*(1-data_point)+1;result[1]=this.graph_top+this.graph_height-1;break;case 2:result[0]=this.graph_top+1;result[1]=this.graph_top+this.graph_height*(1-data_point)-1;break;case 3:val=data_point-this.minimum_value/this.spread;if(data_point>=this.zero){result[0]=this.graph_top+this.graph_height*(1-(val-this.zero))+1;result[1]=this.graph_top+this.graph_height*(1-this.zero)-1;}else{result[0]=this.graph_top+this.graph_height*(1-(val-this.zero))+1;result[1]=this.graph_top+this.graph_height*(1-this.zero)-1;}
break;default:result[0]=0.0;result[1]=0.0;}}});Bluff.Bar=new JS.Class(Bluff.Base,{draw:function(){var labels=0,key;for(key in this.labels)labels+=1;this.center_labels_over_point=(labels>this._column_count);this.callSuper();if(!this._has_data)return;this._draw_bars();this.drawGoalLine();},_draw_bars:function(){var spacing_factor=0.9;this._bar_width=this._graph_width/(this._column_count*this._data.length);var padding=(this._bar_width*(1-spacing_factor))/2;this._d.stroke_opacity=0.0;var conversion=new Bluff.BarConversion();conversion.graph_height=this._graph_height;conversion.graph_top=this._graph_top;if(this.minimum_value>=0){conversion.mode=1;}else{if(this.maximum_value<=0){conversion.mode=2;}else{conversion.mode=3;conversion.spread=this._spread;conversion.minimum_value=this.minimum_value;conversion.zero=-this.minimum_value/this._spread;}}
Bluff.each(this._norm_data,function(data_row,row_index){Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,point_index){var left_x=this._graph_left+(this._bar_width*(row_index+point_index+((this._data.length-1)*point_index)))+padding;var right_x=left_x+this._bar_width*spacing_factor;var conv=[];conversion.getLeftYRightYscaled(data_point,conv);this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];this._d.stroke='transparent';this._d.rectangle(left_x,conv[0],right_x,conv[1]);var label_center=this._graph_left+
(this._data.length*this._bar_width*point_index)+
(this._data.length*this._bar_width/2.0)+
padding;this._draw_label(label_center-(this.center_labels_over_point?this._bar_width/2.0:0.0),point_index);},this);},this);if(this.center_labels_over_point)
this._draw_label(this._graph_right,this._column_count);}});Bluff.Line=new JS.Class(Bluff.Base,{baseline_value:null,baseline_color:null,hide_dots:null,hide_lines:null,initialize:function(renderer){if(arguments.length>3)throw'Wrong number of arguments';if(arguments.length==1||(typeof arguments[1]!='number'&&typeof arguments[1]!='string'))
this.callSuper(renderer,null);else
this.callSuper();this.hide_dots=this.hide_lines=false;this.baseline_color='red';this.baseline_value=null;this.minimum_value=0;},draw:function(){this.callSuper();if(!this._has_data)return;this.x_increment=(this._column_count>1)?(this._graph_width/(this._column_count-1)):this._graph_width;var level;if(this._norm_baseline!==undefined){level=this._graph_top+(this._graph_height-this._norm_baseline*this._graph_height);this._d.push();this._d.stroke=this.baseline_color;this._d.stroke_width=3.0;this._d.line(this._graph_left,level,this._graph_left+this._graph_width,level);this._d.pop();}
Bluff.each(this._norm_data,function(data_row){var prev_x=null,prev_y=null;i=0;Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,index){var new_x=this._graph_left+(this.x_increment*index);if(data_point===undefined)return;if(this.x_marker_count)
{if(i++%Math.floor(data_row[this.klass.DATA_VALUES_INDEX].length/this.x_marker_count)==0){this._draw_label(new_x,index);}}
else
{this._draw_label(new_x,index);}
var new_y=this._graph_top+(this._graph_height-data_point*this._graph_height);this._d.stroke=data_row[this.klass.DATA_COLOR_INDEX];this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];this._d.stroke_opacity=1.0;this._d.stroke_width=this._clip_value_if_greater_than(this._columns/(this._norm_data[0][1].length*6),3.0);if(!this.hide_lines&&prev_x!==null&&prev_y!==null)
this._d.line(prev_x,prev_y,new_x,new_y);var circle_radius=this._clip_value_if_greater_than(this._columns/(this._norm_data[0][1].length*2),4.0);if(!this.hide_dots)this._d.circle(new_x,new_y,new_x-circle_radius,new_y);prev_x=new_x;prev_y=new_y;},this);},this);this.drawGoalLine();},_normalize:function(){this.maximum_value=Math.max(this.maximum_value,this.baseline_value);if(this.goal)
{this.maximum_value=Math.max(this.maximum_value,this.goal);}
this.callSuper();if(this.baseline_value!==null)this._norm_baseline=this.baseline_value/this.maximum_value;}});Bluff.Net=new JS.Class(Bluff.Base,{hide_dots:null,initialize:function(){this.callSuper();this.hide_dots=false;},draw:function(){this.callSuper();if(!this._has_data)return;this._radius=this._graph_height/2.0;this._center_x=this._graph_left+(this._graph_width/2.0);this._center_y=this._graph_top+(this._graph_height/2.0)-10;this._x_increment=this._graph_width/(this._column_count-1);var circle_radius=this._clip_value_if_greater_than(this._columns/(this._norm_data[0][this.klass.DATA_VALUES_INDEX].length*2.5),7.0);this._d.stroke_opacity=1.0;this._d.stroke_width=this._clip_value_if_greater_than(this._columns/(this._norm_data[0][this.klass.DATA_VALUES_INDEX].length*4),3.0);var level;if(this._norm_baseline!==undefined){level=this._graph_top+(this._graph_height-this._norm_baseline*this._graph_height);this._d.push();this._d.stroke_color=this.baseline_color;this._d.fill_opacity=0.0;this._d.stroke_width=5;this._d.line(this._graph_left,level,this._graph_left+this._graph_width,level);this._d.pop();}
Bluff.each(this._norm_data,function(data_row){var prev_x=null,prev_y=null;Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,index){if(data_point===undefined)return;var rad_pos=index*Math.PI*2/this._column_count,point_distance=data_point*this._radius,start_x=this._center_x+Math.sin(rad_pos)*point_distance,start_y=this._center_y-Math.cos(rad_pos)*point_distance,next_index=(index+1<data_row[this.klass.DATA_VALUES_INDEX].length)?index+1:0,next_rad_pos=next_index*Math.PI*2/this._column_count,next_point_distance=data_row[this.klass.DATA_VALUES_INDEX][next_index]*this._radius,end_x=this._center_x+Math.sin(next_rad_pos)*next_point_distance,end_y=this._center_y-Math.cos(next_rad_pos)*next_point_distance;this._d.stroke=data_row[this.klass.DATA_COLOR_INDEX];this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];this._d.line(start_x,start_y,end_x,end_y);if(!this.hide_dots)this._d.circle(start_x,start_y,start_x-circle_radius,start_y);},this);},this);},_draw_line_markers:function(){if(this.hide_line_markers)return;this._radius=this._graph_height/2.0;this._center_x=this._graph_left+(this._graph_width/2.0);this._center_y=this._graph_top+(this._graph_height/2.0)-10;var rad_pos,marker_label;for(var index=0,n=this._column_count;index<n;index++){rad_pos=index*Math.PI*2/this._column_count;this._d.stroke=this.marker_color;this._d.stroke_width=1;this._d.line(this._center_x,this._center_y,this._center_x+Math.sin(rad_pos)*this._radius,this._center_y-Math.cos(rad_pos)*this._radius);marker_label=labels[index]?labels[index]:'000';this._draw_label(this._center_x,this._center_y,rad_pos*360/(2*Math.PI),this._radius,marker_label);}},_draw_label:function(center_x,center_y,angle,radius,amount){var r_offset=1.1,x_offset=center_x,y_offset=center_y,rad_pos=angle*Math.PI/180,x=x_offset+(radius*r_offset*Math.sin(rad_pos)),y=y_offset-(radius*r_offset*Math.cos(rad_pos));this._d.fill=this.marker_color;if(this.font)this._d.font=this.font;this._d.pointsize=this._scale_fontsize(20);this._d.stroke='transparent';this._d.font_weight='bold';var s=rad_pos/(2*Math.PI);switch(true){case s>=0.96||s<0.04:this._d.gravity='south';break;case s>=0.04&&s<0.21:this._d.gravity='west';break;case s>=0.21&&s<0.29:this._d.gravity='west';break;case s>=0.29&&s<0.46:this._d.gravity='west';break;case s>=0.46&&s<0.54:this._d.gravity='north';break;case s>=0.54&&s<0.71:this._d.gravity='east';break;case s>=0.71&&s<0.79:this._d.gravity='east';break;case s>=0.79&&s<0.96:this._d.gravity='east';break;}
this._d.annotate_scaled(0,0,x,y,amount,this._scale);}});Bluff.Pie=new JS.Class(Bluff.Base,{extend:{TEXT_OFFSET_PERCENTAGE:0.15},zero_degreee:null,initialize_ivars:function(){this.callSuper();this.zero_degree=0.0;},draw:function(){this.hide_line_markers=true;this.callSuper();if(!this._has_data)return;var diameter=this._graph_height,radius=(Math.min(this._graph_width,this._graph_height)/2)*0.8,top_x=this._graph_left+(this._graph_width-diameter)/2,center_x=this._graph_left+(this._graph_width/2),center_y=this._graph_top+(this._graph_height/2)-10,total_sum=this._sums_for_pie(),prev_degrees=this.zero_degree,index=this.klass.DATA_VALUES_INDEX;if(this.sort)this._data.sort(function(a,b){return a[index][0]-b[index][0];});Bluff.each(this._data,function(data_row,i){if(data_row[this.klass.DATA_VALUES_INDEX][0]>0){this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];var current_degrees=(data_row[this.klass.DATA_VALUES_INDEX][0]/total_sum)*360;this._d.circle(center_x,center_y,center_x+radius,center_y,prev_degrees,prev_degrees+current_degrees+0.5);var half_angle=prev_degrees+((prev_degrees+current_degrees)-prev_degrees)/2;var label_string=Math.round((data_row[this.klass.DATA_VALUES_INDEX][0]/total_sum)*100.0)+'%';this._draw_label(center_x,center_y,half_angle,radius+(radius*this.klass.TEXT_OFFSET_PERCENTAGE),label_string);prev_degrees+=current_degrees;}},this);},_draw_label:function(center_x,center_y,angle,radius,amount){var r_offset=20.0,x_offset=center_x,y_offset=center_y,radius_offset=radius+r_offset,ellipse_factor=radius_offset*0.15,x=x_offset+((radius_offset+ellipse_factor)*Math.cos(angle*Math.PI/180)),y=y_offset+(radius_offset*Math.sin(angle*Math.PI/180));this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.pointsize=this._scale_fontsize(this.marker_font_size);this._d.font_weight='bold';this._d.gravity='center';this._d.annotate_scaled(0,0,x,y,amount,this._scale);},_sums_for_pie:function(){var total_sum=0;Bluff.each(this._data,function(data_row){total_sum+=data_row[this.klass.DATA_VALUES_INDEX][0];},this);return total_sum;}});Bluff.SideBar=new JS.Class(Bluff.Base,{draw:function(){this.has_left_labels=true;this.callSuper();if(!this._has_data)return;var spacing_factor=0.9;this._bars_width=this._graph_height/this._column_count;this._bar_width=this._bars_width*spacing_factor/this._norm_data.length;this._d.stroke_opacity=0.0;var height=[],i=this._column_count;while(i--)height[i]=0;var length=[],j=this._column_count;while(j--)length[j]=this._graph_left;var padding=(this._bars_width*(1-spacing_factor))/2;Bluff.each(this._norm_data,function(data_row,row_index){Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,point_index){var temp1=this._graph_left+(this._graph_width-data_point*this._graph_width-height[point_index]),temp2=this._graph_left+this._graph_width-height[point_index],difference=temp2-temp1,left_x=length[point_index]-1,left_y=this._graph_top+(this._bars_width*point_index)+(this._bar_width*row_index)+padding,right_x=left_x+difference,right_y=left_y+this._bar_width;height[point_index]+=(data_point*this._graph_width);this._d.stroke='transparent';this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];this._d.rectangle(left_x,left_y,right_x,right_y);var label_center=this._graph_top+(this._bars_width*point_index+this._bars_width/2)+padding;this._draw_label(label_center,point_index);},this)},this);},_draw_line_markers:function(){if(this.hide_line_markers)return;this._d.stroke_width=1;var number_of_lines=5;var increment=this._significant(this.maximum_value/number_of_lines),line_diff,x,diff,marker_label;for(var index=0;index<=number_of_lines;index++){line_diff=(this._graph_right-this._graph_left)/number_of_lines;x=this._graph_right-(line_diff*index)-1;diff=index-number_of_lines;marker_label=Math.abs(diff)*increment;this._d.stroke=this.marker_color;this._d.line(x,this._graph_bottom,x,this._graph_top);if(!this.hide_line_numbers){this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.stroke='transparent';this._d.pointsize=this._scale_fontsize(this.marker_font_size);this._d.gravity='center';this._d.annotate_scaled(0,0,x,this._graph_bottom+(this.klass.LABEL_MARGIN*2.0),marker_label,this._scale);}}},_draw_label:function(y_offset,index){if(this.labels[index]&&!this._labels_seen[index]){this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.stroke='transparent';this._d.font_weight='normal';this._d.pointsize=this._scale_fontsize(this.marker_font_size);this._d.gravity='east';this._d.annotate_scaled(1,1,this._graph_left-this.klass.LABEL_MARGIN*2.0,y_offset,this.labels[index],this._scale);this._labels_seen[index]=true;}}});Bluff.Spider=new JS.Class(Bluff.Base,{hide_text:null,hide_axes:null,transparent_background:null,initialize:function(renderer,max_value,target_width){this.callSuper(renderer,target_width);this._max_value=max_value;this.hide_legend=true;},draw:function(){this.hide_line_markers=true;this.callSuper();if(!this._has_data)return;var diameter=this._graph_height,radius=this._graph_height/2.0,top_x=this._graph_left+(this._graph_width-diameter)/2.0,center_x=this._graph_left+(this._graph_width/2.0),center_y=this._graph_top+(this._graph_height/2.0)-25;this._unit_length=radius/this._max_value;var total_sum=this._sums_for_spider(),prev_degrees=0.0,additive_angle=(2*Math.PI)/this._data.length,current_angle=0.0;if(!this.hide_axes)this._draw_axes(center_x,center_y,radius,additive_angle);this._draw_polygon(center_x,center_y,additive_angle);},_normalize_points:function(value){return value*this._unit_length;},_draw_label:function(center_x,center_y,angle,radius,amount){var r_offset=50,x_offset=center_x,y_offset=center_y+0,x=x_offset+((radius+r_offset)*Math.cos(angle)),y=y_offset+((radius+r_offset)*Math.sin(angle));this._d.fill=this.marker_color;if(this.font)this._d.font=this.font;this._d.pointsize=this._scale_fontsize(this.legend_font_size);this._d.stroke='transparent';this._d.font_weight='bold';this._d.gravity='center';this._d.annotate_scaled(0,0,x,y,amount,this._scale);},_draw_axes:function(center_x,center_y,radius,additive_angle,line_color){if(this.hide_axes)return;var current_angle=0.0;Bluff.each(this._data,function(data_row){this._d.stroke=line_color||data_row[this.klass.DATA_COLOR_INDEX];this._d.stroke_width=5.0;var x_offset=radius*Math.cos(current_angle);var y_offset=radius*Math.sin(current_angle);this._d.line(center_x,center_y,center_x+x_offset,center_y+y_offset);if(!this.hide_text)this._draw_label(center_x,center_y,current_angle,radius,data_row[this.klass.DATA_LABEL_INDEX]);current_angle+=additive_angle;},this);},_draw_polygon:function(center_x,center_y,additive_angle,color){var points=[],current_angle=0.0;Bluff.each(this._data,function(data_row){points.push(center_x+this._normalize_points(data_row[this.klass.DATA_VALUES_INDEX][0])*Math.cos(current_angle));points.push(center_y+this._normalize_points(data_row[this.klass.DATA_VALUES_INDEX][0])*Math.sin(current_angle));current_angle+=additive_angle;},this);this._d.stroke_width=1.0;this._d.stroke=color||this.marker_color;this._d.fill=color||this.marker_color;this._d.fill_opacity=0.4;this._d.polyline(points);},_sums_for_spider:function(){var sum=0.0;Bluff.each(this._data,function(data_row){sum+=data_row[this.klass.DATA_VALUES_INDEX][0];},this);return sum;}});Bluff.Base.StackedMixin=new JS.Module({_get_maximum_by_stack:function(){var max_hash={};Bluff.each(this._data,function(data_set){Bluff.each(data_set[this.klass.DATA_VALUES_INDEX],function(data_point,i){if(!max_hash[i])max_hash[i]=0.0;max_hash[i]+=data_point;},this);},this);for(var key in max_hash){if(max_hash[key]>this.maximum_value)this.maximum_value=max_hash[key];}
if(this.goal){this.maximum_value=Math.max(this.maximum_value,this.goal);}
this.minimum_value=0;}});Bluff.StackedArea=new JS.Class(Bluff.Base,{include:Bluff.Base.StackedMixin,last_series_goes_on_bottom:null,draw:function(){this._get_maximum_by_stack();this.callSuper();if(!this._has_data)return;this._x_increment=this._graph_width/(this._column_count-1);this._d.stroke='transparent';var height=[],i=this._column_count;while(i--)height.push(0);var data_points=null;var iterator=this.last_series_goes_on_bottom?'reverse_each':'each';Bluff[iterator](this._norm_data,function(data_row){var prev_data_points=data_points;data_points=[];Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,index){var new_x=this._graph_left+(this._x_increment*index);var new_y=this._graph_top+(this._graph_height-data_point*this._graph_height-height[index]);height[index]+=(data_point*this._graph_height);data_points.push(new_x);data_points.push(new_y);this._draw_label(new_x,index);},this);var poly_points,i,n;if(prev_data_points){poly_points=Bluff.array(data_points);for(i=prev_data_points.length/2-1;i>=0;i--){poly_points.push(prev_data_points[2*i]);poly_points.push(prev_data_points[2*i+1]);}
poly_points.push(data_points[0]);poly_points.push(data_points[1]);}else{poly_points=Bluff.array(data_points);poly_points.push(this._graph_right);poly_points.push(this._graph_bottom-1);poly_points.push(this._graph_left);poly_points.push(this._graph_bottom-1);poly_points.push(data_points[0]);poly_points.push(data_points[1]);}
this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];this._d.polyline(poly_points);},this);}});Bluff.StackedBar=new JS.Class(Bluff.Base,{include:Bluff.Base.StackedMixin,draw:function(){this._get_maximum_by_stack();this.callSuper();if(!this._has_data)return;var spacing_factor=0.9;this._bar_width=this._graph_width/this._column_count;var padding=(this._bar_width*(1-spacing_factor))/2;var height=[],i=this._column_count;while(i--)height.push(0);Bluff.each(this._norm_data,function(data_row,row_index){Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,point_index){var label_center=this._graph_left+(this._bar_width*point_index)+(this._bar_width*spacing_factor/2.0)+padding;this._draw_label(label_center,point_index);if(data_point==0)return;var left_x=this._graph_left+(this._bar_width*point_index)+padding;var left_y=this._graph_top+(this._graph_height-
data_point*this._graph_height-
height[point_index])+1;var right_x=left_x+this._bar_width*spacing_factor;var right_y=this._graph_top+this._graph_height-height[point_index]-1;height[point_index]+=(data_point*this._graph_height);this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];this._d.rectangle(left_x,left_y,right_x,right_y);},this);},this);this.drawGoalLine();}});Bluff.AccumulatorBar=new JS.Class(Bluff.StackedBar,{draw:function(){if(this._data.length!=1)throw'Incorrect number of datasets exception';var accumulator_array=[];var index=0;var increment_array=[];Bluff.each(this._data[0][this.klass.DATA_VALUES_INDEX],function(value){var max=-Infinity;Bluff.each(increment_array,function(x){max=Math.max(max,x);});increment_array.push((index>0)?(value+max):value);accumulator_array.push(increment_array[index]-value);index+=1;},this);this.data("Accumulator",accumulator_array);this.callSuper();}});Bluff.SideStackedBar=new JS.Class(Bluff.SideBar,{include:Bluff.Base.StackedMixin,draw:function(){this.has_left_labels=true;this._get_maximum_by_stack();this.callSuper();if(!this._has_data)return;var spacing_factor=0.9;this._bar_width=this._graph_height/this._column_count;var height=[],i=this._column_count,length=[],j=this._column_count,padding=(this._bar_width*(1-spacing_factor))/2;while(i--)height.push(0);while(j--)length.push(this._graph_left);Bluff.each(this._norm_data,function(data_row,row_index){this._d.fill=data_row[this.klass.DATA_COLOR_INDEX];Bluff.each(data_row[this.klass.DATA_VALUES_INDEX],function(data_point,point_index){var temp1=this._graph_left+(this._graph_width-
data_point*this._graph_width-
height[point_index])+1;var temp2=this._graph_left+this._graph_width-height[point_index]-1;var difference=temp2-temp1;var left_x=length[point_index],left_y=this._graph_top+(this._bar_width*point_index)+padding,right_x=left_x+difference,right_y=left_y+this._bar_width*spacing_factor;length[point_index]+=difference;height[point_index]+=(data_point*this._graph_width-2);this._d.rectangle(left_x,left_y,right_x,right_y);var label_center=this._graph_top+(this._bar_width*point_index)+(this._bar_width*spacing_factor/2.0)+padding;this._draw_label(label_center,point_index);},this);},this);},_larger_than_max:function(data_point,index){index=index||0;return this._max(data_point,index)>this.maximum_value;},_max:function(data_point,index){var sum=0;Bluff.each(this._data,function(item){sum+=item[this.klass.DATA_VALUES_INDEX][index];},this);return sum;}});Bluff.Mini.Legend=new JS.Module({_expand_canvas_for_vertical_legend:function(){this._original_rows=this._raw_rows;this._rows+=this._data.length*this._calculate_caps_height(this._scale_fontsize(this.legend_font_size))*1.7;this._render_background();},_draw_vertical_legend:function(){this._legend_labels=[];Bluff.each(this._data,function(item){this._legend_labels.push(item[this.klass.DATA_LABEL_INDEX]);},this);var legend_square_width=40.0,legend_square_margin=10.0,legend_left_margin=100.0,legend_top_margin=40.0;if(this.font)this._d.font=this.font;this._d.pointsize=this.legend_font_size;var current_x_offset=legend_left_margin,current_y_offset=this._original_rows+legend_top_margin;this._debug(function(){this._d.line(0.0,current_y_offset,this._raw_columns,current_y_offset);});Bluff.each(this._legend_labels,function(legend_label,index){this._d.fill=this.font_color;if(this.font)this._d.font=this.font;this._d.pointsize=this._scale_fontsize(this.legend_font_size);this._d.stroke='transparent';this._d.font_weight='normal';this._d.gravity='west';this._d.annotate_scaled(this._raw_columns,1.0,current_x_offset+(legend_square_width*1.7),current_y_offset,this._truncate_legend_label(legend_label),this._scale);this._d.stroke='transparent';this._d.fill=this._data[index][this.klass.DATA_COLOR_INDEX];this._d.rectangle(current_x_offset,current_y_offset-legend_square_width/2.0,current_x_offset+legend_square_width,current_y_offset+legend_square_width/2.0);current_y_offset+=this._calculate_caps_height(this.legend_font_size)*1.7;},this);this._color_index=0;},_truncate_legend_label:function(label){var truncated_label=String(label);while(this._calculate_width(this._scale_fontsize(this.legend_font_size),truncated_label)>(this._columns-this.legend_left_margin-this.right_margin)&&(truncated_label.length>1))
truncated_label=truncated_label.substr(0,truncated_label.length-1);return truncated_label+(truncated_label.length<String(label).length?"…":'');}});Bluff.Mini.Bar=new JS.Class(Bluff.Bar,{include:Bluff.Mini.Legend,draw:function(){this.hide_legend=true;this.hide_title=true;this.hide_line_numbers=true;this.marker_font_size=50.0;this.minimum_value=0.0;this.legend_font_size=60.0;this._expand_canvas_for_vertical_legend();this.callSuper();this._draw_vertical_legend();}});Bluff.Mini.Pie=new JS.Class(Bluff.Pie,{include:Bluff.Mini.Legend,initialize_ivars:function(){this.callSuper();this.hide_legend=true;this.hide_title=true;this.hide_line_numbers=true;this.marker_font_size=60.0;this.legend_font_size=60.0;},draw:function(){this._expand_canvas_for_vertical_legend();this.callSuper();this._draw_vertical_legend();}});Bluff.Mini.SideBar=new JS.Class(Bluff.SideBar,{include:Bluff.Mini.Legend,initialize_ivars:function(){this.callSuper();this.hide_legend=true;this.hide_title=true;this.hide_line_numbers=true;this.marker_font_size=50.0;this.legend_font_size=50.0;},draw:function(){this._expand_canvas_for_vertical_legend();this.callSuper();this._draw_vertical_legend();}});Bluff.Renderer=new JS.Class({extend:{WRAPPER_CLASS:'bluff-wrapper',TEXT_CLASS:'bluff-text'},font:'Arial, Helvetica, Verdana, sans-serif',gravity:'north',initialize:function(canvasId){this._canvas=document.getElementById(canvasId);if(typeof G_vmlCanvasManager!='undefined'){G_vmlCanvasManager.initElement(this._canvas);}
this._ctx=this._canvas.getContext('2d');},scale:function(sx,sy){this._sx=sx;this._sy=sy||sx;},caps_height:function(font_size){var X=this._sized_text(font_size,'X'),height=this._element_size(X).height;this._remove_text_node(X);return height;},text_width:function(font_size,text){var element=this._sized_text(font_size,text);var width=this._element_size(element).width;this._remove_text_node(element);return width;},get_type_metrics:function(text){var node=this._sized_text(this.pointsize,text);var size=this._element_size(node);this._remove_text_node(node);return size;},clear:function(width,height){this._canvas.width=width;this._canvas.height=height;this._ctx.clearRect(0,0,width,height);var wrapper=this._text_container(),children=wrapper.childNodes,i=children.length;wrapper.style.width=width+'px';wrapper.style.height=height+'px';while(i--){if(children[i]&&children[i].className==this.klass.TEXT_CLASS)
this._remove_text_node(children[i]);}},push:function(){this._ctx.save();},pop:function(){this._ctx.restore();},render_gradiated_background:function(width,height,top_color,bottom_color){this.clear(width,height);var gradient=this._ctx.createLinearGradient(0,0,0,height);gradient.addColorStop(0,top_color);gradient.addColorStop(1,bottom_color);this._ctx.fillStyle=gradient;this._ctx.fillRect(0,0,width,height);},render_solid_background:function(width,height,color){this.clear(width,height);this._ctx.fillStyle=color;this._ctx.fillRect(0,0,width,height);},annotate_scaled:function(width,height,x,y,text,scale){var scaled_width=(width*scale)>=1?(width*scale):1;var scaled_height=(height*scale)>=1?(height*scale):1;var text=this._sized_text(this.pointsize,text);text.style.color=this.fill;text.style.fontWeight=this.font_weight;text.style.textAlign='center';text.style.left=(this._sx*x+this._left_adjustment(text,scaled_width))+'px';text.style.top=(this._sy*y+this._top_adjustment(text,scaled_height))+'px';},circle:function(origin_x,origin_y,perim_x,perim_y,arc_start,arc_end){var radius=Math.sqrt(Math.pow(perim_x-origin_x,2)+Math.pow(perim_y-origin_y,2));this._ctx.fillStyle=this.fill;this._ctx.beginPath();var alpha=(arc_start||0)*Math.PI/180;var beta=(arc_end||360)*Math.PI/180;if(arc_start!==undefined&&arc_end!==undefined){this._ctx.moveTo(this._sx*(origin_x+radius*Math.cos(beta)),this._sy*(origin_y+radius*Math.sin(beta)));this._ctx.lineTo(this._sx*origin_x,this._sy*origin_y);this._ctx.lineTo(this._sx*(origin_x+radius*Math.cos(alpha)),this._sy*(origin_y+radius*Math.sin(alpha)));}
this._ctx.arc(this._sx*origin_x,this._sy*origin_y,this._sx*radius,alpha,beta,false);this._ctx.fill();},line:function(sx,sy,ex,ey){this._ctx.strokeStyle=this.stroke;this._ctx.lineWidth=this.stroke_width;this._ctx.beginPath();this._ctx.moveTo(this._sx*sx,this._sy*sy);this._ctx.lineTo(this._sx*ex,this._sy*ey);this._ctx.stroke();},polyline:function(points){this._ctx.fillStyle=this.fill;this._ctx.globalAlpha=this.fill_opacity||1;try{this._ctx.strokeStyle=this.stroke;}catch(e){}
var x=points.shift(),y=points.shift();this._ctx.beginPath();this._ctx.moveTo(this._sx*x,this._sy*y);while(points.length>0){x=points.shift();y=points.shift();this._ctx.lineTo(this._sx*x,this._sy*y);}
this._ctx.fill();},rectangle:function(ax,ay,bx,by){var temp;if(ax>bx){temp=ax;ax=bx;bx=temp;}
if(ay>by){temp=ay;ay=by;by=temp;}
try{this._ctx.fillStyle=this.fill;this._ctx.fillRect(this._sx*ax,this._sy*ay,this._sx*(bx-ax),this._sy*(by-ay));}catch(e){}
try{this._ctx.strokeStyle=this.stroke;if(this.stroke!='transparent')
this._ctx.strokeRect(this._sx*ax,this._sy*ay,this._sx*(bx-ax),this._sy*(by-ay));}catch(e){}},_left_adjustment:function(node,width){var w=this._element_size(node).width;switch(this.gravity){case'west':return 0;case'east':return width-w;case'north':case'south':case'center':return(width-w)/2;}},_top_adjustment:function(node,height){var h=this._element_size(node).height;switch(this.gravity){case'north':return 0;case'south':return height-h;case'west':case'east':case'center':return(height-h)/2;}},_text_container:function(){var wrapper=this._canvas.parentNode;if(wrapper.className==this.klass.WRAPPER_CLASS)return wrapper;wrapper=document.createElement('div');wrapper.className=this.klass.WRAPPER_CLASS;wrapper.style.position='relative';wrapper.style.border='none';wrapper.style.padding='0 0 0 0';this._canvas.parentNode.insertBefore(wrapper,this._canvas);wrapper.appendChild(this._canvas);return wrapper;},_sized_text:function(size,content){var text=this._text_node(content);text.style.fontFamily=this.font;text.style.fontsize=(typeof size=='number')?size+'px':size;return text;},_text_node:function(content){var div=document.createElement('div');div.className=this.klass.TEXT_CLASS;div.style.position='absolute';div.appendChild(document.createTextNode(content));this._text_container().appendChild(div);return div;},_remove_text_node:function(node){node.parentNode.removeChild(node);},_element_size:function(element){var display=element.style.display;return(display&&display!='none')?{width:element.offsetWidth,height:element.offsetHeight}:{width:element.clientWidth,height:element.clientHeight};}});Bluff.TableReader=new JS.Class({NUMBER_FORMAT:/\-?(0|[1-9]\d*)(\.\d+)?(e[\+\-]?\d+)?/i,initialize:function(table,transpose){this._table=(typeof table=='string')?document.getElementById(table):table;this._swap=!!transpose;},get_data:function(){if(!this._data)this._read();return this._data;},get_labels:function(){if(!this._labels)this._read();return this._labels;},get_title:function(){return this._title;},get_series:function(i){if(this._data[i])return this._data[i];return this._data[i]={points:[]};},_read:function(){this._row=this._col=0;this._row_offset=this._col_offset=0;this._data=[];this._labels={};this._row_headings=[];this._col_headings=[];this._walk(this._table);if((this._row_headings.length>1&&this._col_headings.length==1)||this._row_headings.length<this._col_headings.length){if(!this._swap)this._transpose();}else{if(this._swap)this._transpose();}
Bluff.each(this._col_headings,function(heading,i){this.get_series(i-this._col_offset).name=heading;},this);Bluff.each(this._row_headings,function(heading,i){this._labels[i-this._row_offset]=heading;},this);},_walk:function(node){this._visit(node);var i,children=node.childNodes,n=children.length;for(i=0;i<n;i++)this._walk(children[i]);},_visit:function(node){if(!node.tagName)return;var content=this._strip_tags(node.innerHTML),x,y;switch(node.tagName.toUpperCase()){case'TR':if(!this._has_data)this._row_offset=this._row;this._row+=1;this._col=0;break;case'TD':if(!this._has_data)this._col_offset=this._col;this._col+=1;content=parseFloat(content.match(this.NUMBER_FORMAT)[0]);if(typeof content=='number'){this._has_data=true;x=this._col-this._col_offset-1;y=this._row-this._row_offset-1;this.get_series(x).points[y]=parseFloat(content);}
break;case'TH':this._col+=1;if(this._col==1&&this._row==1)
this._row_headings[0]=this._col_headings[0]=content;else if(node.scope=="row"||this._col==1)
this._row_headings[this._row-1]=content;else
this._col_headings[this._col-1]=content;break;case'CAPTION':this._title=content;break;}},_transpose:function(){var data=this._data,tmp;this._data=[];Bluff.each(data,function(row,i){Bluff.each(row.points,function(point,p){this.get_series(p).points[i]=point;},this);},this);tmp=this._row_headings;this._row_headings=this._col_headings;this._col_headings=tmp;tmp=this._row_offset;this._row_offset=this._col_offset;this._col_offset=tmp;},_strip_tags:function(string){return string.replace(/<\/?[^>]+>/gi,'');},extend:{Mixin:new JS.Module({data_from_table:function(table,transpose){var reader=new Bluff.TableReader(table,transpose),data_rows=reader.get_data();Bluff.each(data_rows,function(row){this.data(row.name,row.points);},this);this.labels=reader.get_labels();this.title=reader.get_title()||this.title;}})}});Bluff.Base.include(Bluff.TableReader.Mixin);var FitnessTools=Class.create({bind:function(){var ft_wp=$('fitness-tools-walking-pace');if(ft_wp){var error;var errorMessage;var errorDiv;var unitType;var input_distUnit;var distRatio;var slUnits;var slRatio;var milekm;var milekmDist;var hideWalk;var hideRun;$$('#fitness-tools-walking-pace .result').each(function(e){e.insert('<div class="error" id="ft_error"></div>');errorDiv=$('ft_error');errorDiv.hide();});$$('#fitness-tools-walking-pace .result p').each(Element.hide);$('ft_clear').observe('click',function(e){$$('#fitness-tools-walking-pace .result p').each(Element.hide);$(errorDiv).hide();});$('ft_unit').observe('change',function(e){$('ft_stride_type').innerHTML=$('ft_unit').value=="mi"?"inches":"cm";if(isNaN($('ft_stride').value)||$('ft_stride').value==""){}else{var newStride=($('ft_unit').value=="mi"?Math.round(($('ft_stride').value/2.54251)*10)/10:Math.round($('ft_stride').value*2.54251));$('ft_stride').value=Math.round(newStride*100)/100;}});$('ft_calculate').observe('click',function(e){$$('#fitness-tools-walking-pace .result p').each(Element.hide);var error=null;var errorMessage=null;var hideWalk=null;var hideRun=null;input_distUnit=$('ft_unit').getValue();var dist=$('ft_distance').getValue();var duration=$('ft_duration').getValue();var stride=$('ft_stride').getValue();switch(input_distUnit){case"ft":unitType='imperial';distRatio=0.3048;break;case"mi":unitType='imperial';distRatio=1609.334;strideRatio=0.0254251;break;case"km":unitType='metric';distRatio=1000;strideRatio=0.01;break;default:unitType='metric';distRatio=1;break;}
dist=dist*distRatio;stride=Math.round((stride*strideRatio)*100)/100;if(isNaN(dist)||dist==''){error=true;errorMessage='Please enter a numeric distance.';}
if(isNaN(stride)||stride==''){error=true;errorMessage='Please enter a numeric stride.';}
if(isNaN(duration)&&duration!=''){error=true;errorMessage='Please enter a numeric duration in minutes.';}
if(error==true){$$('#fitness-tools-stride-length .result p').each(Element.hide);$(errorDiv).update(errorMessage).show();}else{$(errorDiv).hide();var resSteps=Math.round(dist/stride);$('ft_steps').update("You have walked <strong>"+resSteps+" steps</strong>");if(!isNaN(duration)&&duration!=''){if($('ft_unit').value=="mi"){var resSpeedSteps=Math.round(resSteps/duration);var resSpeedKm=Math.round(((dist/(duration/60))/1600)*10)/10;$('ft_speed').update("You are averaging <strong>"+resSpeedSteps+" steps/minute</strong><br/> Your average speed is <strong>"+resSpeedKm+" m/h</strong>");}else{var resSpeedSteps=Math.round(resSteps/duration);var resSpeedKm=Math.round(((dist/(duration/60))/1000)*10)/10;$('ft_speed').update("You are averaging <strong>"+resSpeedSteps+" steps/minute</strong><br/> Your average speed is <strong>"+resSpeedKm+" km/h</strong>");}}else{$('ft_speed').update("");}
$$('#fitness-tools-walking-pace .result p').each(Element.show);}});}
var ft_sl=$('fitness-tools-stride-length');if(ft_sl){var error;var errorMessage;var errorDiv;var unitType;var input_distUnit;var distRatio;var slUnits;var slRatio;var milekm;var milekmDist;var hideWalk;var hideRun;$$('#fitness-tools-stride-length .result').each(function(e){e.insert('<div class="error" id="ft_error"></div>');errorDiv=$('ft_error');errorDiv.hide();});$$('#fitness-tools-stride-length .result p').each(Element.hide);$('ft_clear').observe('click',function(e){$$('#fitness-tools-stride-length .result p').each(Element.hide);$(errorDiv).hide();});$('ft_calculate').observe('click',function(e){var error=null;var errorMessage=null;var hideWalk=null;var hideRun=null;input_distUnit=$('ft_unit').getValue();var dist=$('ft_distance').getValue();var w_steps=$('ft_walking_steps').getValue();var r_steps=$('ft_running_steps').getValue();if(input_distUnit=='ft'){unitType='imperial';distRatio=0.3048;}else if(input_distUnit=='mi'){unitType='imperial';distRatio=1609.344;}else if(input_distUnit=='km'){unitType='metric';distRatio=1000;}else{unitType='metric';distRatio=1;}
dist=dist*distRatio;if(isNaN(dist)||dist==''){error=true;errorMessage='Please enter a numeric distance.';}
if(isNaN(w_steps)||w_steps==''){hideWalk=true;}else{hideWalk=false;}
if(isNaN(r_steps)||r_steps==''){hideRun=true;}else{hideRun=false;}
if(hideWalk==true&&hideRun==true){error=true;errorMessage='Please enter your walking/running steps.';}
if(unitType=='metric'){slUnits='cm';slRatio=1;milekm='1 km';milekmDist=1000;}else{slUnits='in';slRatio=0.393700787;milekm='1 mile';milekmDist=1609.344;}
if(error==true){$$('#fitness-tools-stride-length .result p').each(Element.hide);$(errorDiv).update(errorMessage).show();}else{$$('#fitness-tools-stride-length .result p').each(Element.show);$(errorDiv).hide();$('ft_wsl').update(Math.round((dist/w_steps)*100*slRatio)+' '+slUnits);$('ft_rsl').update(Math.round((dist/r_steps)*100*slRatio)+' '+slUnits);$('ft_wsu').update(milekm);$('ft_rsu').update(milekm);$('ft_ws').update(Math.round((w_steps/dist)*milekmDist)+' steps');$('ft_rs').update(Math.round((r_steps/dist)*milekmDist)+' steps');if(hideWalk){$$('#fitness-tools-stride-length .result p.ft_walk').each(Element.hide);}
if(hideRun){$$('#fitness-tools-stride-length .result p.ft_run').each(Element.hide);}}});}
var ft_wthr=$('fitness-tools-waist-hip');if(ft_wthr){var error;var errorMessage;var errorDiv;var activeM;var activeW;var ratio;$$('#fitness-tools-waist-hip .right-col').each(function(e){e.insert({top:'<div class="error" id="ft_error"></div>'});errorDiv=$('ft_error');errorDiv.hide();});$$('#fitness-tools-waist-hip .result').each(Element.hide);$('ft_clear').observe('click',function(e){$$('#fitness-tools-waist-hip .result').each(Element.hide);$(errorDiv).hide();});$('ft_calculate').observe('click',function(e){error=null;errorMessage=null;var waist=$('ft_waist').getValue();var hip=$('ft_hip').getValue();if(isNaN(waist)||waist==''){error=true;errorMessage='Please enter a numeric value.';}
if(isNaN(hip)||hip==''){error=true;errorMessage='Please enter a numeric value.';}
$$('#ft_wthr_table td').each(function(e){e.removeClassName('active');});if(error!=true){ratio=Math.round((waist/hip)*100)/100;if(ratio<=0.8){activeW=$('ft_w_low');}
else if(ratio>=0.85){activeW=$('ft_w_hi');}
else{activeW=$('ft_w_med');}
if(ratio<=0.95){activeM=$('ft_m_low');}
else if(ratio>=1){activeM=$('ft_m_hi');}
else{activeM=$('ft_m_med');}}
if(error==true){$$('#fitness-tools-waist-hip .result').each(Element.hide);$(errorDiv).update(errorMessage).show();}else{$$('#fitness-tools-waist-hip .result').each(Element.show);$(errorDiv).hide();$('ft_result').update(ratio);if(activeM){$(activeM).addClassName('active');}
if(activeW){$(activeW).addClassName('active');}}});}
var ft_bmr=$('fitness-tools-basal-metabolic-rate');if(ft_bmr){var error;var errorMessage;var errorDiv;var form=$('ft_bmr_form');var unitType='metric';var gender='male';var age;var height;var weight;var activity;var heightRatio=1;var weightRatio=1;var bmr;var den;$('ft_switch_metric').observe('click',function(e){unitType='metric';$('ft_switch_metric').addClassName('active');$('ft_switch_imperial').removeClassName('active');$('ft_weight_unit').update('kg');$('ft_height_unit').update('cm');heightRatio=1;weightRatio=1;});$('ft_switch_imperial').observe('click',function(e){unitType='imperial';$('ft_switch_metric').removeClassName('active');$('ft_switch_imperial').addClassName('active');$('ft_weight_unit').update('lb');$('ft_height_unit').update('in');heightRatio=2.54;weightRatio=0.45359237;});$$('#ft_bmr_form').each(function(e){e.insert({top:'<div class="error" id="ft_error"></div>'});errorDiv=$('ft_error');errorDiv.hide();});$$('#fitness-tools-basal-metabolic-rate .results').each(Element.hide);$('ft_clear').observe('click',function(e){$$('#fitness-tools-basal-metabolic-rate .results').each(Element.hide);$(errorDiv).hide();});$('ft_calculate').observe('click',function(e){error=null;errorMessage=null;if($('ft_gender_male').getValue()!=null){gender='male';}else{gender='female';}
age=$F(form['ft_age']);weight=$F(form['ft_weight']);height=$F(form['ft_height']);activity=$F(form['ft_activity']);if(isNaN(height)||height==''){error=true;errorMessage='Please enter your height.';}
if(isNaN(weight)||weight==''){error=true;errorMessage='Please enter your weight.';}
if(isNaN(age)||age==''){error=true;errorMessage='Please enter your age.';}
if(error!=true){height=height*heightRatio;weight=weight*weightRatio;if(gender=='male'){bmr=66+(13.7*weight)+(5*height)-(6.8*age);}else{bmr=655+(9.6*weight)+(1.8*height)-(4.7*age);}
den=bmr*activity;}
if(error==true){$$('#fitness-tools-basal-metabolic-rate .results').each(Element.hide);$(errorDiv).update(errorMessage).show();}else{$$('#fitness-tools-basal-metabolic-rate .results').each(Element.show);$(errorDiv).hide();$('ft_bmr_kj').update(Math.round(bmr*4.1868));$('ft_bmr_cal').update(Math.round(bmr));$('ft_den_kj').update(Math.round(den*4.1868));$('ft_den_cal').update(Math.round(den));}});}
var ft_hr=$('fitness-tools-heart-rate');if(ft_hr){var error;var errorMessage;var errorDiv;var form=$('ft-hr-form');var gender='male';var age;var mhr;var mhr90;var mhr80;var mhr70;var mhr60;var mhr50;$$('#ft-hr-form').each(function(e){e.insert({before:'<div class="error" id="ft_error"></div>'});errorDiv=$('ft_error');errorDiv.hide();});$$('#ft-hr-table .results').each(Element.hide);$('ft_clear').observe('click',function(e){$$('#ft-hr-table .results').each(Element.hide);$(errorDiv).hide();});$('ft_calculate').observe('click',function(e){error=null;errorMessage=null;if($('ft_gender_male').getValue()!=null){gender='male';}else{gender='female';}
age=$F(form['ft_age']);if(isNaN(age)||age==''){error=true;errorMessage='Please enter your age.';}
if(error!=true){if(gender=='male'){mhr=Math.round(220-age);}else{mhr=Math.round(226-age);}
mhr90=Math.round(mhr*0.9);mhr80=Math.round(mhr*0.8);mhr70=Math.round(mhr*0.7);mhr60=Math.round(mhr*0.6);mhr50=Math.round(mhr*0.5);}
if(error==true){$$('#ft-hr-table .results').each(Element.hide);$(errorDiv).update(errorMessage).show();}else{$$('#ft-hr-table .results').each(Element.show);$(errorDiv).hide();$$('.ft-hr-100').each(function(e){e.update(mhr);});$$('.ft-hr-90').each(function(e){e.update(mhr90);});$$('.ft-hr-80').each(function(e){e.update(mhr80);});$$('.ft-hr-70').each(function(e){e.update(mhr70);});$$('.ft-hr-60').each(function(e){e.update(mhr60);});$$('.ft-hr-50').each(function(e){e.update(mhr50);});}});}
var ft_bmi=$('fitness-tools-body-mass-index');if(ft_bmi){var error;var errorMessage;var errorDiv;var form=$('ft_bmi_form');var unitType='metric';var height;var weight;var heightRatio=1;var weightRatio=1;var bmi;var bmi_r;var bmi_rating;$('ft_switch_metric').observe('click',function(e){unitType='metric';$('ft_switch_metric').addClassName('active');$('ft_switch_imperial').removeClassName('active');$('ft_weight_unit').update('kg');$('ft_height_unit').update('cm');heightRatio=1;weightRatio=1;});$('ft_switch_imperial').observe('click',function(e){unitType='imperial';$('ft_switch_metric').removeClassName('active');$('ft_switch_imperial').addClassName('active');$('ft_weight_unit').update('lb');$('ft_height_unit').update('in');heightRatio=2.54;weightRatio=0.45359237;});$$('#ft-bmi-table').each(function(e){e.insert({before:'<div class="error" id="ft_error"></div>'});errorDiv=$('ft_error');errorDiv.hide();});$$('#fitness-tools-body-mass-index .result').each(Element.hide);$('ft_clear').observe('click',function(e){$$('#fitness-tools-body-mass-index .result').each(Element.hide);$$('#ft-bmi-table tr').each(function(e){e.removeClassName('active-row');});$(errorDiv).hide();});$('ft_calculate').observe('click',function(e){error=null;errorMessage=null;weight=$F(form['ft_weight']);height=$F(form['ft_height']);if(isNaN(height)||height==''){error=true;errorMessage='Please enter your height.';}
if(isNaN(weight)||weight==''){error=true;errorMessage='Please enter your weight.';}
if(error!=true){weight=weight*weightRatio;height=(height*heightRatio)/100;bmi=weight/(height*height);bmi_r=(Math.round(bmi*10)/10);$$('#ft-bmi-table tr').each(function(e){e.removeClassName('active-row');});if(bmi<=18.5){bmi_rating='Underweight';$('ft-bmi-under').addClassName('active-row');}else if(bmi>18.5&&bmi<=25){bmi_rating='Ideal';$('ft-bmi-ideal').addClassName('active-row');}else if(bmi>25&&bmi<=30){bmi_rating='Overweight';$('ft-bmi-over').addClassName('active-row');}else if(bmi>30&&bmi<=40){bmi_rating='Obese';$('ft-bmi-obese').addClassName('active-row');}else{bmi_rating='Morbidly Obese';$('ft-bmi-mobese').addClassName('active-row');}}
if(error==true){$$('#fitness-tools-body-mass-index .result').each(Element.hide);$$('#ft-bmi-table tr').each(function(e){e.removeClassName('active-row');});$(errorDiv).update(errorMessage).show();}else{$$('#fitness-tools-body-mass-index .result').each(Element.show);$(errorDiv).hide();$('ft-bmi-result').update(bmi_r);$('ft_bmi').value=bmi_r;$('ft_bmi_rating').update(bmi_rating);$('ft_bmi_rating2').update(bmi_rating);}});}
var ft_rft=$('fitness-tools-rockport');if(ft_rft){var error;var errorMessage;var errorDiv;var form=$('ft_rft_form');var unitType='metric';var age;var weight;var gender;var heart_rate;var time_min;var time_sec;var time;var gender_mod;var v02max;var age_row;var cell;var category;var category_text;var weightRatio=2.2046226;$('ft_switch_metric').observe('click',function(e){unitType='metric';$('ft_switch_metric').addClassName('active');$('ft_switch_imperial').removeClassName('active');$('ft_weight_unit').update('kg');weightRatio=2.2046226;});$('ft_switch_imperial').observe('click',function(e){unitType='imperial';$('ft_switch_metric').removeClassName('active');$('ft_switch_imperial').addClassName('active');$('ft_weight_unit').update('lb');weightRatio=1;});$$('#ft_rft_form').each(function(e){e.insert({top:'<div class="error" id="ft_error"></div>'});errorDiv=$('ft_error');errorDiv.hide();});$$('#fitness-tools-rockport .results').each(Element.hide);$('rockport-table-female').hide();$('rockport-table-male').hide();$('ft_clear').observe('click',function(e){$$('#fitness-tools-rockport .results').each(Element.hide);$$('#fitness-tools-rockport table td').each(function(e){e.removeClassName('active');});$(errorDiv).hide();$('rockport-table-female').hide();$('rockport-table-male').hide();});$('ft_calculate').observe('click',function(e){$$('#fitness-tools-rockport table td').each(function(e){e.removeClassName('active');});error=null;errorMessage=null;if($('ft_gender_male').getValue()!=null){gender='male';gender_mod=1;}else{gender='female';gender_mod=0;}
weight=$F(form['ft_weight']);age=$F(form['ft_age']);heart_rate=$F(form['ft_heart_rate']);time_min=$F(form['ft_time_min']);time_sec=$F(form['ft_time_sec']);if(age<13&&age!=''){$error=true;errorMessage='This calculator is only acurate for people over the age of 13.';}
if(isNaN(age)||age==''){error=true;errorMessage='Please enter your age.';}
if(isNaN(weight)||weight==''){error=true;errorMessage='Please enter your weight.';}
if(isNaN(heart_rate)||heart_rate==''){error=true;errorMessage='Please enter your recorded heart rate.';}
if(isNaN(time_min)||time_min==''){error=true;errorMessage='Please enter your recorded time.';}
if(isNaN(time_sec)||time_sec==''){error=true;errorMessage='Please enter your recorded time.';}
if(error!=true){weight=Number(weight);age=Number(age);heart_rate=Number(heart_rate);time_min=Number(time_min);time_sec=Number(time_sec);weight=weight*weightRatio;time=((time_min*60)+time_sec)/60;v02max=132.853-(0.0769*weight)-(0.3877*age)+(6.315*gender_mod)-(3.2649*time)-(0.1565*heart_rate);if(age>=13&&age<20){age_row='.age-13-19';}
else if(age>=20&&age<30){age_row='.age-20-29';}
else if(age>=30&&age<40){age_row='.age-30-39';}
else if(age>=40&&age<50){age_row='.age-40-49';}
else if(age>=50&&age<60){age_row='.age-50-59';}
else{age_row='.age-60';}
if(gender=='male'){$('rockport-table-male').show();$('rockport-table-female').hide();}else{$('rockport-table-female').show();$('rockport-table-male').hide();}
if(gender=='female'){if(age_row=='.age-13-19'){if(v02max<25.0){cell='f_a_1';}
else if(v02max<31.0){cell='f_a_2';}
else if(v02max<35.0){cell='f_a_3';}
else if(v02max<39.0){cell='f_a_4';}
else if(v02max<=41.9){cell='f_a_5';}
else{cell='f_a_6';}}else if(age_row=='.age-20-29'){if(v02max<23.6){cell='f_b_1';}
else if(v02max<29.0){cell='f_b_2';}
else if(v02max<33.0){cell='f_b_3';}
else if(v02max<37.0){cell='f_b_4';}
else if(v02max<=41.0){cell='f_b_5';}
else{cell='f_b_6';}}else if(age_row=='.age-30-39'){if(v02max<22.8){cell='f_c_1';}
else if(v02max<27.0){cell='f_c_2';}
else if(v02max<31.5){cell='f_c_3';}
else if(v02max<35.7){cell='f_c_4';}
else if(v02max<=40.0){cell='f_c_5';}
else{cell='f_c_6';}}else if(age_row=='.age-40-49'){if(v02max<21.0){cell='f_d_1';}
else if(v02max<24.5){cell='f_d_2';}
else if(v02max<29.0){cell='f_d_3';}
else if(v02max<32.9){cell='f_d_4';}
else if(v02max<=36.9){cell='f_d_5';}
else{cell='f_d_6';}}else if(age_row=='.age-50-59'){if(v02max<20.2){cell='f_e_1';}
else if(v02max<22.8){cell='f_e_2';}
else if(v02max<27.0){cell='f_e_3';}
else if(v02max<31.5){cell='f_e_4';}
else if(v02max<=35.7){cell='f_e_5';}
else{cell='f_e_6';}}else if(age_row=='.age-60'){if(v02max<17.5){cell='f_f_1';}
else if(v02max<20.2){cell='f_f_2';}
else if(v02max<24.5){cell='f_f_3';}
else if(v02max<30.3){cell='f_f_4';}
else if(v02max<=31.4){cell='f_f_5';}
else{cell='f_f_6';}}}else{if(age_row=='.age-13-19'){if(v02max<35.0){cell='m_a_1';}
else if(v02max<38.4){cell='m_a_2';}
else if(v02max<45.2){cell='m_a_3';}
else if(v02max<51.0){cell='m_a_4';}
else if(v02max<=55.9){cell='m_a_5';}
else{cell='m_a_6';}}else if(age_row=='.age-20-29'){if(v02max<33.0){cell='m_b_1';}
else if(v02max<36.5){cell='m_b_2';}
else if(v02max<42.5){cell='m_b_3';}
else if(v02max<46.5){cell='m_b_4';}
else if(v02max<=52.4){cell='m_b_5';}
else{cell='m_b_6';}}else if(age_row=='.age-30-39'){if(v02max<31.5){cell='m_c_1';}
else if(v02max<35.5){cell='m_c_2';}
else if(v02max<41.0){cell='m_c_3';}
else if(v02max<45.0){cell='m_c_4';}
else if(v02max<=49.4){cell='m_c_5';}
else{cell='m_c_6';}}else if(age_row=='.age-40-49'){if(v02max<30.2){cell='m_d_1';}
else if(v02max<33.6){cell='m_d_2';}
else if(v02max<39.0){cell='m_d_3';}
else if(v02max<43.8){cell='m_d_4';}
else if(v02max<=48.0){cell='m_d_5';}
else{cell='m_d_6';}}else if(age_row=='.age-50-59'){if(v02max<26.1){cell='m_e_1';}
else if(v02max<31.0){cell='m_e_2';}
else if(v02max<35.8){cell='m_e_3';}
else if(v02max<41.0){cell='m_e_4';}
else if(v02max<=45.3){cell='m_e_5';}
else{cell='m_e_6';}}else if(age_row=='.age-60'){if(v02max<20.5){cell='m_f_1';}
else if(v02max<26.1){cell='m_f_2';}
else if(v02max<32.3){cell='m_f_3';}
else if(v02max<36.5){cell='m_f_4';}
else if(v02max<=44.2){cell='m_f_5';}
else{cell='m_f_6';}}}
category=Number(cell.substring(4,5));if(category==1){category_text='Very Poor';}
if(category==2){category_text='Poor';}
if(category==3){category_text='Fair';}
if(category==4){category_text='Good';}
if(category==5){category_text='Excellent';}
if(category==6){category_text='Superior';}}
if(error==true){$$('#fitness-tools-rockport .results').each(Element.hide);$$('#fitness-tools-rockport table td').each(function(e){e.removeClassName('active');});$(errorDiv).update(errorMessage).show();$('rockport-table-female').hide();$('rockport-table-male').hide();}else{$$('#fitness-tools-rockport .results').each(Element.show);$(errorDiv).hide();$('ft_v02_max').update(v02max.toFixed(2));$(cell).addClassName('active');$('ft_rft_rating').update(category_text);}});}}});var Message=Class.create({bindMessageFields:function(){var toTypeSelector=$('to_type_selector');if(toTypeSelector){var radios=toTypeSelector.getElementsBySelector('input[type=radio]');$$('fieldset.to_type_receiver').each(function(r){r.style.display='none';$(r).getElementsBySelector('input').each(function(i){i.disabled=true;});$(r).getElementsBySelector('select').each(function(i){i.disabled=true;});});for(i=0;i<radios.length;i++){if(fieldset=$(radios[i].value)){if(radios[i].checked)
{fieldset.style.display='block';$(fieldset).getElementsBySelector('input').each(function(i){i.disabled=false;});$(fieldset).getElementsBySelector('select').each(function(i){i.disabled=false;});}
radios[i].observe('click',function(e){$$('fieldset.to_type_receiver').each(function(r){r.style.display='none';$(fieldset).getElementsBySelector('input').each(function(i){i.disabled=true;});$(fieldset).getElementsBySelector('select').each(function(i){i.disabled=true;});});if(fieldset=$(e.element().value)){if(e.element().checked)
{fieldset.style.display='block';$(fieldset).getElementsBySelector('input').each(function(i){i.disabled=false;});$(fieldset).getElementsBySelector('select').each(function(i){i.disabled=false;});}}});}}}
var autocomplete=$('username_autocomplete');if(autocomplete){new Ajax.Autocompleter('message_to_string','username_autocomplete','/users/autocomplete',{method:'get',minChars:2});console.log($('message_to_string'));console.log($('username_autocomplete'));}}});Object.extend(Message,{bind:function(){var m=new Message();m.bindMessageFields();}});