/*** prototype.js ***/
var Prototype={Version:"1.5.1.1",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:(document.createElement("div").__proto__!==document.createElement("form").__proto__)},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var Abstract=new Object();Object.extend=function(a,c){for(var b in c){a[b]=c[b]}return a};Object.extend(Object,{inspect:function(a){try{if(a===undefined){return"undefined"}if(a===null){return"null"}return a.inspect?a.inspect():a.toString()}catch(b){if(b instanceof RangeError){return"..."}throw b}},toJSON:function(a){var c=typeof a;switch(c){case"undefined":case"function":case"unknown":return;case"boolean":return a.toString()}if(a===null){return"null"}if(a.toJSON){return a.toJSON()}if(a.ownerDocument===document){return}var b=[];for(var e in a){var d=Object.toJSON(a[e]);if(d!==undefined){b.push(e.toJSON()+": "+d)}}return"{"+b.join(", ")+"}"},keys:function(a){var b=[];for(var c in a){b.push(c)}return b},values:function(b){var a=[];for(var c in b){a.push(b[c])}return a},clone:function(a){return Object.extend({},a)}});Function.prototype.bind=function(){var a=this,c=$A(arguments),b=c.shift();return function(){return a.apply(b,c.concat($A(arguments)))}};Function.prototype.bindAsEventListener=function(c){var a=this,b=$A(arguments),c=b.shift();return function(d){return a.apply(c,[d||window.event].concat(b))}};Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this},toPaddedString:function(c,b){var a=this.toString(b||10);return"0".times(c-a.length)+a},toJSON:function(){return isFinite(this)?this.toString():"null"}});Date.prototype.toJSON=function(){return'"'+this.getFullYear()+"-"+(this.getMonth()+1).toPaddedString(2)+"-"+this.getDate().toPaddedString(2)+"T"+this.getHours().toPaddedString(2)+":"+this.getMinutes().toPaddedString(2)+":"+this.getSeconds().toPaddedString(2)+'"'};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback(this)}finally{this.currentlyExecuting=false}}}};Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(e,c){var a="",d=this,b;c=arguments.callee.prepareReplacement(c);while(d.length>0){if(b=d.match(e)){a+=d.slice(0,b.index);a+=String.interpret(c(b));d=d.slice(b.index+b[0].length)}else{a+=d,d=""}}return a},sub:function(c,a,b){a=this.gsub.prepareReplacement(a);b=b===undefined?1:b;return this.gsub(c,function(d){if(--b<0){return d[0]}return a(d)})},scan:function(b,a){this.gsub(b,a);return this},truncate:function(b,a){b=b||30;a=a===undefined?"...":a;return this.length>b?this.slice(0,b-a.length)+a:this},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img");var a=new RegExp(Prototype.ScriptFragment,"im");return(this.match(b)||[]).map(function(c){return(c.match(a)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var a=arguments.callee;a.text.data=this;return a.div.innerHTML},unescapeHTML:function(){var a=document.createElement("div");a.innerHTML=this.stripTags();return a.childNodes[0]?(a.childNodes.length>1?$A(a.childNodes).inject("",function(b,c){return b+c.nodeValue}):a.childNodes[0].nodeValue):""},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a){return{}}return a[1].split(b||"&").inject({},function(e,f){if((f=f.split("="))[0]){var c=decodeURIComponent(f.shift());var d=f.length>1?f.join("="):f[0];if(d!=undefined){d=decodeURIComponent(d)}if(c in e){if(e[c].constructor!=Array){e[c]=[e[c]]}e[c].push(d)}else{e[c]=d}}return e})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(c){var a="";for(var b=0;b<c;b++){a+=this}return a},camelize:function(){var d=this.split("-"),a=d.length;if(a==1){return d[0]}var c=this.charAt(0)=="-"?d[0].charAt(0).toUpperCase()+d[0].substring(1):d[0];for(var b=1;b<a;b++){c+=d[b].charAt(0).toUpperCase()+d[b].substring(1)}return c},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(b){var a=this.gsub(/[\x00-\x1f\\]/,function(c){var d=String.specialChar[c[0]];return d?d:"\\u00"+c[0].charCodeAt().toPaddedString(2,16)});if(b){return'"'+a.replace(/"/g,'\\"')+'"'}return"'"+a.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){var a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(a)},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(a){return this.indexOf(a)>-1},startsWith:function(a){return this.indexOf(a)===0},endsWith:function(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(b){if(typeof b=="function"){return b}var a=new Template(b);return function(c){return a.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text)}var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){return this.template.gsub(this.pattern,function(b){var c=b[1];if(c=="\\"){return b[2]}return c+String.interpret(a[b[3]])})}};var $break={},$continue=new Error('"throw $continue" is deprecated, use "return" instead');var Enumerable={each:function(b){var a=0;try{this._each(function(d){b(d,a++)})}catch(c){if(c!=$break){throw c}}return this},eachSlice:function(c,b){var a=-c,d=[],e=this.toArray();while((a+=c)<e.length){d.push(e.slice(a,a+c))}return d.map(b)},all:function(b){var a=true;this.each(function(d,c){a=a&&!!(b||Prototype.K)(d,c);if(!a){throw $break}});return a},any:function(b){var a=false;this.each(function(d,c){if(a=!!(b||Prototype.K)(d,c)){throw $break}});return a},collect:function(b){var a=[];this.each(function(d,c){a.push((b||Prototype.K)(d,c))});return a},detect:function(b){var a;this.each(function(d,c){if(b(d,c)){a=d;throw $break}});return a},findAll:function(b){var a=[];this.each(function(d,c){if(b(d,c)){a.push(d)}});return a},grep:function(c,b){var a=[];this.each(function(f,e){var d=f.toString();if(d.match(c)){a.push((b||Prototype.K)(f,e))}});return a},include:function(a){var b=false;this.each(function(c){if(c==a){b=true;throw $break}});return b},inGroupsOf:function(b,a){a=a===undefined?null:a;return this.eachSlice(b,function(c){while(c.length<b){c.push(a)}return c})},inject:function(a,b){this.each(function(d,c){a=b(a,d,c)});return a},invoke:function(b){var a=$A(arguments).slice(1);return this.map(function(c){return c[b].apply(c,a)})},max:function(b){var a;this.each(function(d,c){d=(b||Prototype.K)(d,c);if(a==undefined||d>=a){a=d}});return a},min:function(b){var a;this.each(function(d,c){d=(b||Prototype.K)(d,c);if(a==undefined||d<a){a=d}});return a},partition:function(c){var b=[],a=[];this.each(function(e,d){((c||Prototype.K)(e,d)?b:a).push(e)});return[b,a]},pluck:function(b){var a=[];this.each(function(d,c){a.push(d[b])});return a},reject:function(b){var a=[];this.each(function(d,c){if(!b(d,c)){a.push(d)}});return a},sortBy:function(a){return this.map(function(c,b){return{value:c,criteria:a(c,b)}}).sort(function(f,e){var d=f.criteria,c=e.criteria;return d<c?-1:d>c?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var b=Prototype.K,a=$A(arguments);if(typeof a.last()=="function"){b=a.pop()}var c=[this].concat(a).map($A);return this.map(function(e,d){return b(c.pluck(d))})},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,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(d){if(!d){return[]}if(d.toArray){return d.toArray()}else{var b=[];for(var a=0,c=d.length;a<c;a++){b.push(d[a])}return b}};if(Prototype.Browser.WebKit){$A=Array.from=function(d){if(!d){return[]}if(!(typeof d=="function"&&d=="[object NodeList]")&&d.toArray){return d.toArray()}else{var b=[];for(var a=0,c=d.length;a<c;a++){b.push(d[a])}return b}}}Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(b){for(var a=0,c=this.length;a<c;a++){b(this[a])}},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(a){return a!=null})},flatten:function(){return this.inject([],function(b,a){return b.concat(a&&a.constructor==Array?a.flatten():[a])})},without:function(){var a=$A(arguments);return this.select(function(b){return !a.include(b)})},indexOf:function(a){for(var b=0,c=this.length;b<c;b++){if(this[b]==a){return b}}return -1},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(a){return this.inject([],function(d,c,b){if(0==b||(a?d.last()!=c:!d.include(c))){d.push(c)}return d})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var a=[];this.each(function(b){var c=Object.toJSON(b);if(c!==undefined){a.push(c)}});return"["+a.join(", ")+"]"}});Array.prototype.toArray=Array.prototype.clone;function $w(a){a=a.strip();return a?a.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var e=[];for(var b=0,c=this.length;b<c;b++){e.push(this[b])}for(var b=0,c=arguments.length;b<c;b++){if(arguments[b].constructor==Array){for(var a=0,d=arguments[b].length;a<d;a++){e.push(arguments[b][a])}}else{e.push(arguments[b])}}return e}}var Hash=function(a){if(a instanceof Hash){this.merge(a)}else{Object.extend(this,a||{})}};Object.extend(Hash,{toQueryString:function(b){var a=[];a.add=arguments.callee.addPair;this.prototype._each.call(b,function(d){if(!d.key){return}var c=d.value;if(c&&typeof c=="object"){if(c.constructor==Array){c.each(function(e){a.add(d.key,e)})}return}a.add(d.key,c)});return a.join("&")},toJSON:function(a){var b=[];this.prototype._each.call(a,function(d){var c=Object.toJSON(d.value);if(c!==undefined){b.push(d.key.toJSON()+": "+c)}});return"{"+b.join(", ")+"}"}});Hash.toQueryString.addPair=function(a,c,b){a=encodeURIComponent(a);if(c===undefined){this.push(a)}else{this.push(a+"="+(c==null?"":encodeURIComponent(c)))}};Object.extend(Hash.prototype,Enumerable);Object.extend(Hash.prototype,{_each:function(b){for(var a in this){var c=this[a];if(c&&c==Hash.prototype[a]){continue}var d=[a,c];d.key=a;d.value=c;b(d)}},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},merge:function(a){return $H(a).inject(this,function(b,c){b[c.key]=c.value;return b})},remove:function(){var a;for(var b=0,c=arguments.length;b<c;b++){var d=this[arguments[b]];if(d!==undefined){if(a===undefined){a=d}else{if(a.constructor!=Array){a=[a]}a.push(d)}}delete this[arguments[b]]}return a},toQueryString:function(){return Hash.toQueryString(this)},inspect:function(){return"#<Hash:{"+this.map(function(a){return a.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Hash.toJSON(this)}});function $H(a){if(a instanceof Hash){return a}return new Hash(a)}if(function(){var a=0,c=function(d){this.key=d};c.prototype.key="foo";for(var b in new c("bar")){a++}return a>1}()){Hash.prototype._each=function(c){var a=[];for(var b in this){var d=this[b];if((d&&d==Hash.prototype[b])||a.include(b)){continue}a.push(b);var e=[b,d];e.key=b;e.value=d;c(e)}}}ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(c,a,b){this.start=c;this.end=a;this.exclusive=b},_each:function(a){var b=this.start;while(this.include(b)){a(b);b=b.succ()}},include:function(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}});var $R=function(c,a,b){return new ObjectRange(c,a,b)};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(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(d,b,c,a){this.each(function(f){if(typeof f[d]=="function"){try{f[d].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string"){this.options.parameters=this.options.parameters.toQueryParams()}}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(b,a){this.transport=Ajax.getTransport();this.setOptions(a);this.request(b)},request:function(a){this.url=a;this.method=this.options.method;var c=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){c._method=this.method;this.method="post"}this.parameters=c;if(c=Hash.toQueryString(c)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+c}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){c+="&_="}}}try{if(this.options.onCreate){this.options.onCreate(this.transport)}Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1)}.bind(this),10)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||c):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(b){this.dispatchException(b)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["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){e.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(typeof c.push=="function"){for(var b=0,d=c.length;b<d;b+=2){e[c[b]]=c[b+1]}}else{$H(c).each(function(f){e[f.key]=f.value})}}for(var a in e){this.transport.setRequestHeader(a,e[a])}},success:function(){return !this.transport.status||(this.transport.status>=200&&this.transport.status<300)},respondToReadyState:function(a){var c=Ajax.Request.Events[a];var g=this.transport,b=this.evalJSON();if(c=="Complete"){try{this._complete=true;(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(g,b)}catch(d){this.dispatchException(d)}var f=this.getHeader("Content-type");if(f&&f.strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(g,b);Ajax.Responders.dispatch("on"+c,this,g,b)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},evalJSON:function(){try{var a=this.getHeader("X-JSON");return a?a.evalJSON():null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};this.transport=Ajax.getTransport();this.setOptions(b);var d=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(f,e){this.updateContent();d(f,e)}).bind(this);this.request(c)},updateContent:function(){var b=this.container[this.success()?"success":"failure"];var a=this.transport.responseText;if(!this.options.evalScripts){a=a.stripScripts()}if(b=$(b)){if(this.options.insertion){new this.options.insertion(b,a)}else{b.update(a)}}if(this.success()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10)}}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(a,c,b){this.setOptions(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;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(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push($(arguments[a]))}return d}if(typeof b=="string"){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(f,a){var c=[];var e=document.evaluate(f,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,d=e.snapshotLength;b<d;b++){c.push(e.snapshotItem(b))}return c};document.getElementsByClassName=function(b,a){var c=".//*[contains(concat(' ', @class, ' '), ' "+b+" ')]";return document._getElementsByXPath(c,a)}}else{document.getElementsByClassName=function(g,j){var d=($(j)||document.body).getElementsByTagName("*");var a=[],b,f=new RegExp("(^|\\s)"+g+"(\\s|$)");for(var e=0,c=d.length;e<c;e++){b=d[e];var h=b.className;if(h.length==0){continue}if(h==g||h.match(f)){a.push(Element.extend(b))}}return a}}if(!window.Element){var Element={}}Element.extend=function(e){var f=Prototype.BrowserFeatures;if(!e||!e.tagName||e.nodeType==3||e._extended||f.SpecificElementExtensions||e==window){return e}var b={},d=e.tagName,a=Element.extend.cache,c=Element.Methods.ByTag;if(!f.ElementExtensions){Object.extend(b,Element.Methods),Object.extend(b,Element.Methods.Simulated)}if(c[d]){Object.extend(b,c[d])}for(var h in b){var g=b[h];if(typeof g=="function"&&!(h in e)){e[h]=a.findOrStore(g)}}e._extended=Prototype.emptyFunction;return e};Element.extend.cache={findOrStore:function(a){return this[a]=this[a]||function(){return a.apply(null,[this].concat($A(arguments)))}}};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){$(a).style.display="none";return a},show:function(a){$(a).style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(b,a){a=typeof a=="undefined"?"":a.toString();$(b).innerHTML=a.stripScripts();setTimeout(function(){a.evalScripts()},10);return b},replace:function(c,b){c=$(c);b=typeof b=="undefined"?"":b.toString();if(c.outerHTML){c.outerHTML=b.stripScripts()}else{var a=c.ownerDocument.createRange();a.selectNodeContents(c);c.parentNode.replaceChild(a.createContextualFragment(b.stripScripts()),c)}setTimeout(function(){b.evalScripts()},10);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(f){var e=f.first(),c=f.last();var d=(b[e]||"").toString();if(d){a+=" "+c+"="+d.inspect(true)}});return a+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $A($(a).getElementsByTagName("*")).each(Element.extend)},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(b,a){if(typeof a=="string"){a=new Selector(a)}return a.match($(b))},up:function(b,d,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=b.ancestors();return d?Selector.findElement(c,d,a):c[a||0]},down:function(b,c,a){b=$(b);if(arguments.length==1){return b.firstDescendant()}var d=b.descendants();return c?Selector.findElement(d,c,a):d[a||0]},previous:function(b,d,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var c=b.previousSiblings();return d?Selector.findElement(c,d,a):c[a||0]},next:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=c.nextSiblings();return d?Selector.findElement(a,d,b):a[b||0]},getElementsBySelector:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},getElementsByClassName:function(a,b){return document.getElementsByClassName(b,a)},readAttribute:function(c,a){c=$(c);if(Prototype.Browser.IE){if(!c.attributes){return null}var b=Element._attributeTranslations;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}var d=c.attributes[a];return d?d.nodeValue:null}return c.getAttribute(a)},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;if(c.length==0){return false}if(c==b||c.match(new RegExp("(^|\\s)"+b+"(\\s|$)"))){return true}return false},addClassName:function(a,b){if(!(a=$(a))){return}Element.classNames(a).add(b);return a},removeClassName:function(a,b){if(!(a=$(a))){return}Element.classNames(a).remove(b);return a},toggleClassName:function(a,b){if(!(a=$(a))){return}Element.classNames(a)[a.hasClassName(b)?"remove":"add"](b);return a},observe:function(){Event.observe.apply(Event,arguments);return $A(arguments).first()},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first()},cleanWhitespace:function(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Position.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}if(c=="opacity"){return d?parseFloat(d):1}return d=="auto"?null:d},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,c,b){a=$(a);var e=a.style;for(var d in c){if(d=="opacity"){a.setOpacity(c[d])}else{e[(d=="float"||d=="cssFloat")?(e.styleFloat===undefined?"cssFloat":"styleFloat"):(b?d:d.camelize())]=c[d]}}return a},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(c){c=$(c);var g=$(c).getStyle("display");if(g!="none"&&g!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var f=b.visibility;var d=b.position;var a=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var h=c.clientWidth;var e=c.clientHeight;b.display=a;b.position=d;b.visibility=f;return{width:h,height:e}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(window.opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=a.style.overflow||"auto";if((Element.getStyle(a,"overflow")||"visible")!="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a}};Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf,childElements:Element.Methods.immediateDescendants});if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;Element.Methods.getStyle=function(a,b){switch(b){case"left":case"top":case"right":case"bottom":if(Element._getStyle(a,"position")=="static"){return null}default:return Element._getStyle(a,b)}}}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(a,d){a=$(a);var c=a.getStyle("filter"),b=a.style;if(d==1||d===""){b.filter=c.replace(/alpha\([^\)]*\)/gi,"");return a}else{if(d<0.00001){d=0}}b.filter=c.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+(d*100)+")";return a};Element.Methods.update=function(c,b){c=$(c);b=typeof b=="undefined"?"":b.toString();var a=c.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(a)){var d=document.createElement("div");switch(a){case"THEAD":case"TBODY":d.innerHTML="<table><tbody>"+b.stripScripts()+"</tbody></table>";depth=2;break;case"TR":d.innerHTML="<table><tbody><tr>"+b.stripScripts()+"</tr></tbody></table>";depth=3;break;case"TD":d.innerHTML="<table><tbody><tr><td>"+b.stripScripts()+"</td></tr></tbody></table>";depth=4}$A(c.childNodes).each(function(e){c.removeChild(e)});depth.times(function(){d=d.firstChild});$A(d.childNodes).each(function(e){c.appendChild(e)})}else{c.innerHTML=b.stripScripts()}setTimeout(function(){b.evalScripts()},10);return c}}else{if(Prototype.Browser.Gecko){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}}}Element._attributeTranslations={names:{colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){var b=a.getAttributeNode("title");return b.specified?b.nodeValue:null}}};(function(){Object.extend(this,{href:this._getAttr,src:this._getAttr,type:this._getAttr,disabled:this._flag,checked:this._flag,readonly:this._flag,multiple:this._flag})}).call(Element._attributeTranslations.values);Element.Methods.Simulated={hasAttribute:function(b,d){var a=Element._attributeTranslations,c;d=a.names[d]||d;c=$(b).getAttributeNode(d);return c&&c.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.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(c){var h=Prototype.BrowserFeatures,d=Element.Methods.ByTag;if(!c){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 b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(b.constructor==Array){b.each(g)}else{g(b)}}function g(j){j=j.toUpperCase();if(!Element.Methods.ByTag[j]){Element.Methods.ByTag[j]={}}Object.extend(Element.Methods.ByTag[j],c)}function a(m,k,j){j=j||false;var l=Element.extend.cache;for(var o in m){var n=m[o];if(!j||!(o in k)){k[o]=l.findOrStore(n)}}}function e(l){var j;var k={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(k[l]){j="HTML"+k[l]+"Element"}if(window[j]){return window[j]}j="HTML"+l+"Element";if(window[j]){return window[j]}j="HTML"+l.capitalize()+"Element";if(window[j]){return window[j]}window[j]={};window[j].prototype=document.createElement(l).__proto__;return window[j]}if(h.ElementExtensions){a(Element.Methods,HTMLElement.prototype);a(Element.Methods.Simulated,HTMLElement.prototype,true)}if(h.SpecificElementExtensions){for(var i in Element.Methods.ByTag){var f=e(i);if(typeof f=="undefined"){continue}a(d[i],f.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag};var Toggle={display:Element.toggle};Abstract.Insertion=function(a){this.adjacency=a};Abstract.Insertion.prototype={initialize:function(b,c){this.element=$(b);this.content=c.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)}catch(d){var a=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(a)){this.insertContent(this.contentFromAnonymousTable())}else{throw d}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange){this.initializeRange()}this.insertContent([this.range.createContextualFragment(this.content)])}setTimeout(function(){c.evalScripts()},10)},contentFromAnonymousTable:function(){var a=document.createElement("div");a.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(a.childNodes[0].childNodes[0].childNodes)}};var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element)},insertContent:function(a){a.each((function(b){this.element.parentNode.insertBefore(b,this.element)}).bind(this))}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true)},insertContent:function(a){a.reverse(false).each((function(b){this.element.insertBefore(b,this.element.firstChild)}).bind(this))}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element)},insertContent:function(a){a.each((function(b){this.element.appendChild(b)}).bind(this))}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)},insertContent:function(a){a.each((function(b){this.element.parentNode.insertBefore(b,this.element.nextSibling)}).bind(this))}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(a){this.expression=a.strip();this.compileMatcher()},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!(/\[[\w-]*?:/).test(this.expression)){return this.compileXPathMatcher()}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(typeof c[i]=="function"?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 f=this.expression,g=Selector.patterns,b=Selector.xpath,d,a;if(Selector._cache[f]){this.xpath=Selector._cache[f];return}this.matcher=[".//*"];while(f&&d!=f&&(/\S/).test(f)){d=f;for(var c in g){if(a=f.match(g[c])){this.matcher.push(typeof b[c]=="function"?b[c](a):new Template(b[c]).evaluate(a));f=f.replace(a[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;if(this.xpath){return document._getElementsByXPath(this.xpath,a)}return this.matcher(a)},match:function(a){return this.findElements(document).include(a)},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(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(a){a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(typeof b==="function"){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(b){var j=b[6],h=Selector.patterns,a=Selector.xpath,f,b,c;var g=[];while(j&&f!=j&&(/\S/).test(j)){f=j;for(var d in h){if(b=j.match(h[d])){c=typeof a[d]=="function"?a[d](b):new Template(a[d]).evaluate(b);g.push("("+c.substring(1,c.length-1)+")");j=j.replace(b[0],"");break}}}return"[not("+g.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(g,e){var h,i=e[6],d;if(i=="even"){i="2n+0"}if(i=="odd"){i="2n+1"}if(h=i.match(/^(\d+)$/)){return"["+g+"= "+h[1]+"]"}if(h=i.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(h[1]=="-"){h[1]=-1}var f=h[1]?Number(h[1]):1;var c=h[2]?Number(h[2]):0;d="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(d).evaluate({fragment:g,a:f,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);   c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c);        c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}"); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/},handlers:{concat:function(d,c){for(var e=0,f;f=c[e];e++){d.push(f)}return d},mark:function(a){for(var b=0,c;c=a[b];b++){c._counted=true}return a},unmark:function(a){for(var b=0,c;c=a[b];b++){c._counted=undefined}return a},index:function(a,d,f){a._counted=true;if(d){for(var b=a.childNodes,e=b.length-1,c=1;e>=0;e--){node=b[e];if(node.nodeType==1&&(!f||node._counted)){node.nodeIndex=c++}}}else{for(var e=0,c=1,b=a.childNodes;node=b[e];e++){if(node.nodeType==1&&(!f||node._counted)){node.nodeIndex=c++}}}},unique:function(b){if(b.length==0){return b}var d=[],e;for(var c=0,a=b.length;c<a;c++){if(!(e=b[c])._counted){e._counted=true;d.push(Element.extend(e))}}return Selector.handlers.unmark(d)},descendant:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,e.getElementsByTagName("*"))}return b},child:function(a){var f=Selector.handlers;for(var e=0,d=[],g;g=a[e];e++){for(var b=0,c=[],k;k=g.childNodes[b];b++){if(k.nodeType==1&&k.tagName!="!"){d.push(k)}}}return d},adjacent:function(a){for(var c=0,b=[],e;e=a[c];c++){var d=this.nextElementSibling(e);if(d){b.push(d)}}return b},laterSibling:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,Element.nextSiblings(e))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(b,a,e,j){e=e.toUpperCase();var d=[],f=Selector.handlers;if(b){if(j){if(j=="descendant"){for(var c=0,g;g=b[c];c++){f.concat(d,g.getElementsByTagName(e))}return d}else{b=this[j](b)}if(e=="*"){return b}}for(var c=0,g;g=b[c];c++){if(g.tagName.toUpperCase()==e){d.push(g)}}return d}else{return a.getElementsByTagName(e)}},id:function(b,a,j,f){var g=$(j),d=Selector.handlers;if(!b&&a==document){return g?[g]:[]}if(b){if(f){if(f=="child"){for(var c=0,e;e=b[c];c++){if(g.parentNode==e){return[g]}}}else{if(f=="descendant"){for(var c=0,e;e=b[c];c++){if(Element.descendantOf(g,e)){return[g]}}}else{if(f=="adjacent"){for(var c=0,e;e=b[c];c++){if(Selector.handlers.previousElementSibling(g)==e){return[g]}}}else{b=d[f](b)}}}}for(var c=0,e;e=b[c];c++){if(e==g){return[g]}}return[]}return(g&&Element.descendantOf(g,a))?[g]:[]},className:function(b,a,c,d){if(b&&d){b=this[d](b)}return Selector.handlers.byClassName(b,a,c)},byClassName:function(c,b,f){if(!c){c=Selector.handlers.descendant([b])}var h=" "+f+" ";for(var e=0,d=[],g,a;g=c[e];e++){a=g.className;if(a.length==0){continue}if(a==f||(" "+a+" ").include(h)){d.push(g)}}return d},attrPresence:function(c,b,a){var e=[];for(var d=0,f;f=c[d];d++){if(Element.hasAttribute(f,a)){e.push(f)}}return e},attr:function(a,h,g,j,b){if(!a){a=h.getElementsByTagName("*")}var k=Selector.operators[b],d=[];for(var e=0,c;c=a[e];e++){var f=Element.readAttribute(c,g);if(f===null){continue}if(k(f,j)){d.push(c)}}return d},pseudo:function(b,c,e,a,d){if(b&&d){b=this[d](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[c](b,e,a)}},pseudos:{"first-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.previousElementSibling(e)){continue}c.push(e)}return c},"last-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.nextElementSibling(e)){continue}c.push(e)}return c},"only-child":function(b,g,a){var e=Selector.handlers;for(var d=0,c=[],f;f=b[d];d++){if(!e.previousElementSibling(f)&&!e.nextElementSibling(f)){c.push(f)}}return c},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,d,a){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](b,d,a),d,a)},getIndices:function(d,c,e){if(d==0){return c>0?[c]:[]}return $R(1,e).inject([],function(a,b){if(0==(b-c)%d&&(b-c)/d>=0){a.push(b)}return a})},nth:function(c,s,u,r,e){if(c.length==0){return[]}if(s=="even"){s="2n+0"}if(s=="odd"){s="2n+1"}var q=Selector.handlers,p=[],d=[],g;q.mark(c);for(var o=0,f;f=c[o];o++){if(!f.parentNode._counted){q.index(f.parentNode,r,e);d.push(f.parentNode)}}if(s.match(/^\d+$/)){s=Number(s);for(var o=0,f;f=c[o];o++){if(f.nodeIndex==s){p.push(f)}}}else{if(g=s.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(g[1]=="-"){g[1]=-1}var v=g[1]?Number(g[1]):1;var t=g[2]?Number(g[2]):0;var w=Selector.pseudos.getIndices(v,t,c.length);for(var o=0,f,k=w.length;f=c[o];o++){for(var n=0;n<k;n++){if(f.nodeIndex==w[n]){p.push(f)}}}}}q.unmark(c);q.unmark(d);return p},empty:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.tagName=="!"||(e.firstChild&&!e.innerHTML.match(/^\s*$/))){continue}c.push(e)}return c},not:function(a,d,k){var g=Selector.handlers,l,c;var j=new Selector(d).findElements(k);g.mark(j);for(var f=0,e=[],b;b=a[f];f++){if(!b._counted){e.push(b)}}g.unmark(j);return e},enabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(!e.disabled){c.push(e)}}return c},disabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.disabled){c.push(e)}}return c},checked:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.checked){c.push(e)}}return c}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b.startsWith(a)},"$=":function(b,a){return b.endsWith(a)},"*=":function(b,a){return b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+b.toUpperCase()+"-").include("-"+a.toUpperCase()+"-")}},matchElements:function(f,g){var e=new Selector(g).findElements(),d=Selector.handlers;d.mark(e);for(var c=0,b=[],a;a=f[c];c++){if(a._counted){b.push(a)}}d.unmark(e);return b},findElement:function(b,c,a){if(typeof c=="number"){a=c;c=false}return Selector.matchElements(b,c||"*")[a||0]},findChildElements:function(e,g){var j=g.join(","),g=[];j.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(h){g.push(h[1].strip())});var d=[],f=Selector.handlers;for(var c=0,b=g.length,a;c<b;c++){a=new Selector(g[c].strip());f.concat(d,a.findElements(e))}return(b>1)?f.unique(d):d}});function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(c,a){var b=c.inject({},function(d,f){if(!f.disabled&&f.name){var e=f.name,g=$(f).getValue();if(g!=null){if(e in d){if(d[e].constructor!=Array){d[e]=[d[e]]}d[e].push(g)}else{d[e]=g}}}return d});return a?b:Hash.toQueryString(b)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){if(Form.Element.Serializers[c.tagName.toLowerCase()]){b.push(Element.extend(c))}return b})},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var e=0,h=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue}h.push(Element.extend(b))}return h},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(a){return $(a).getElements().find(function(b){return b.type!="hidden"&&!b.disabled&&["input","select","textarea"].include(b.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var c=a.parameters;a.parameters=b.serialize(true);if(c){if(typeof c=="string"){c=c.toQueryParams()}Object.extend(a.parameters,c)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(b.readAttribute("action"),a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Hash.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.blur();a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a);default:return Form.Element.Serializers.textarea(a)}},inputSelector:function(a){return a.checked?a.value:null},textarea:function(a){return a.value},select:function(a){return this[a.type=="select-one"?"selectOne":"selectMany"](a)},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(d){var a,e=d.length;if(!e){return null}for(var c=0,a=[];c<e;c++){var b=d.options[c];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(a,b,c){this.frequency=b;this.element=$(a);this.callback=c;this.lastValue=this.getValue();this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){var a=this.getValue();var b=("string"==typeof this.lastValue&&"string"==typeof a?this.lastValue!=a:String(this.lastValue)!=String(a));if(b){this.callback(this.element,a);this.lastValue=a}}};Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=function(){};Abstract.EventObserver.prototype={initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this))},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}};Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event=new Object()}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,element:function(a){return $(a.target||a.srcElement)},isLeftClick:function(a){return(((a.which)&&(a.which==1))||((a.button)&&(a.button==1)))},pointerX:function(a){return a.pageX||(a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(a){return a.pageY||(a.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(a){if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.returnValue=false;a.cancelBubble=true}},findElement:function(c,b){var a=Event.element(c);while(a.parentNode&&(!a.tagName||(a.tagName.toUpperCase()!=b.toUpperCase()))){a=a.parentNode}return a},observers:false,_observeAndCache:function(d,c,b,a){if(!this.observers){this.observers=[]}if(d.addEventListener){this.observers.push([d,c,b,a]);d.addEventListener(c,b,a)}else{if(d.attachEvent){this.observers.push([d,c,b,a]);d.attachEvent("on"+c,b)}}},unloadCache:function(){if(!Event.observers){return}for(var a=0,b=Event.observers.length;a<b;a++){Event.stopObserving.apply(this,Event.observers[a]);if(typeof Event.observers[a]!="undefined"&&Event.observers[a][0]){Event.observers[a][0]=null}}Event.observers=false},observe:function(d,c,b,a){d=$(d);a=a||false;if(c=="keypress"&&(Prototype.Browser.WebKit||d.attachEvent)){c="keydown"}Event._observeAndCache(d,c,b,a)},stopObserving:function(d,c,b,a){d=$(d);a=a||false;if(c=="keypress"&&(Prototype.Browser.WebKit||d.attachEvent)){c="keydown"}if(d.removeEventListener){d.removeEventListener(c,b,a)}else{if(d.detachEvent){try{d.detachEvent("on"+c,b)}catch(f){}}}}});if(Prototype.Browser.IE){Event.observe(window,"unload",Event.unloadCache,false)}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},realOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return[c,a]},cumulativeOffset:function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return[c,a]},positionedOffset:function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName=="BODY"){break}var c=Element.getStyle(b,"position");if(c=="relative"||c=="absolute"){break}}}while(b);return[d,a]},offsetParent:function(a){if(a.offsetParent){return a.offsetParent}if(a==document.body){return a}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return a}}return document.body},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=this.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=this.realOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[1]-this.deltaY;this.offset=this.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},page:function(d){var a=0,c=0;var b=d;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}}while(b=b.offsetParent);b=d;do{if(!window.opera||b.tagName=="BODY"){a-=b.scrollTop||0;c-=b.scrollLeft||0}}while(b=b.parentNode);return[c,a]},clone:function(c,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});c=$(c);var d=Position.page(c);e=$(e);var f=[0,0];var b=null;if(Element.getStyle(e,"position")=="absolute"){b=Position.offsetParent(e);f=Position.page(b)}if(b==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop}if(a.setLeft){e.style.left=(d[0]-f[0]+a.offsetLeft)+"px"}if(a.setTop){e.style.top=(d[1]-f[1]+a.offsetTop)+"px"}if(a.setWidth){e.style.width=c.offsetWidth+"px"}if(a.setHeight){e.style.height=c.offsetHeight+"px"}},absolutize:function(b){b=$(b);if(b.style.position=="absolute"){return}Position.prepare();var d=Position.positionedOffset(b);var f=d[1];var e=d[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=e-parseFloat(b.style.left||0);b._originalTop=f-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=f+"px";b.style.left=e+"px";b.style.width=c+"px";b.style.height=a+"px"},relativize:function(a){a=$(a);if(a.style.position=="relative"){return}Position.prepare();a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth}};if(Prototype.Browser.WebKit){Position.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return[c,a]}}Element.addMethods();


/*** scriptaculous/scriptaculous.js ***/
var Scriptaculous={Version:"1.7.1_beta2",require:function(a){document.write('<script type="text/javascript" src="'+a+'"><\/script>')},REQUIRED_PROTOTYPE:"1.5.1",load:function(){function a(b){var c=b.split(".");return parseInt(c[0])*100000+parseInt(c[1])*1000+parseInt(c[2])}if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||(a(Prototype.Version)<a(Scriptaculous.REQUIRED_PROTOTYPE))){throw ("script.aculo.us requires the Prototype JavaScript framework >= "+Scriptaculous.REQUIRED_PROTOTYPE)}$A(document.getElementsByTagName("script")).findAll(function(b){return(b.src&&b.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(c){var d=c.src.replace(/scriptaculous\.js(\?.*)?$/,"");var b=c.src.match(/\?.*load=([a-z,]*)/);(b?b[1]:"builder,effects,dragdrop,controls,slider,sound").split(",").each(function(e){Scriptaculous.require(d+e+".js")})})}};Scriptaculous.load();

/*** scriptaculous/effects.js ***/
String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};Array.prototype.call=function(){var a=arguments;this.each(function(b){b.apply(this,a)})};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},tagifyText:function(a){if(typeof Builder=="undefined"){throw ("Effect.tagifyText requires including script.aculo.us' builder.js library")}var b="position:relative";if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(Builder.node("span",{style:b},d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(b,c){var e;if(((typeof b=="object")||(typeof b=="function"))&&(b.length)){e=b}else{e=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;$A(e).each(function(g,f){new c(g,Object.extend(a,{delay:f*a.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c){b=$(b);c=(c||"appear").toLowerCase();var a=Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},arguments[2]||{});Effect[b.visible()?Effect.PAIRS[c][1]:Effect.PAIRS[c][0]](b,a)}};var Effect2=Effect;Effect.Transitions={linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return(a>1?1:a)},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){a=a||5;return(Math.round((b%(1/a))*a)==0?((b*a*2)-Math.floor(b*a*2)):1-((b*a*2)-Math.floor(b*a*2)))},none:function(a){return 0},full:function(a){return 1}};Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=(typeof b.options.queue=="string")?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)}}});Effect.Queues={instances:$H(),get:function(a){if(typeof a!="string"){return a}if(!this.instances[a]){this.instances[a]=new Effect.ScopedQueue()}return this.instances[a]}};Effect.Queue=Effect.Queues.get("global");Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"};Effect.Base=function(){};Effect.Base.prototype={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.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(options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(options,"afterSetup")+'};if(this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=Math.round(b*this.totalFrames);if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(typeof this[property]!="function"){a[property]=this[property]}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}};Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Event=Class.create();Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize:function(){var a=Object.extend({duration:0},arguments[0]||{});this.start(a)},update:Prototype.emptyFunction});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},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(a){this.element.setStyle({left:Math.round(this.options.x*a+this.originalLeft)+"px",top:Math.round(this.options.y*a+this.originalTop)+"px"})}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.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(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,e){var f={};if(this.options.scaleX){f.width=Math.round(e)+"px"}if(this.options.scaleY){f.height=Math.round(a)+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(e-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){f.top=this.originalTop-c+"px"}if(this.options.scaleX){f.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){f.top=-c+"px"}if(this.options.scaleX){f.left=-b+"px"}}}this.element.setStyle(f)}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},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(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+(Math.round(this._base[d]+(this._delta[d]*a)).toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(a){this.element=$(a);this.start(arguments[1]||{})},setup:function(){Position.prepare();var b=Position.cumulativeOffset(this.element);if(this.options.offset){b[1]+=this.options.offset}var a=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(b[1]>a?a:b[1])-this.scrollStart},update:function(a){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(a*this.delta))}});Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left")};return new Effect.Move(b,{x:20,y:0,duration:0.05,afterFinishInternal:function(c){new Effect.Move(c.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(d){new Effect.Move(d.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(e){new Effect.Move(e.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(f){new Effect.Move(f.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(h){h.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(b){b=$(b).cleanWhitespace();var a=b.down().getStyle("bottom");return new Effect.Scale(b,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(c){c.element.makePositioned();c.element.down().makePositioned();if(window.opera){c.element.setStyle({top:""})}c.element.makeClipping().show()},afterUpdateInternal:function(c){c.element.down().setStyle({bottom:(c.dims[0]-c.element.clientHeight)+"px"})},afterFinishInternal:function(c){c.element.hide().undoClipping().undoPositioned().setStyle({bottom:a});c.element.down().undoPositioned()}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var g=c.getDimensions();var h,f;var e,d;switch(b.direction){case"top-left":h=f=e=d=0;break;case"top-right":h=g.width;f=d=0;e=-g.width;break;case"bottom-left":h=e=0;f=g.height;d=-g.height;break;case"bottom-right":h=g.width;f=g.height;e=-g.width;d=-g.height;break;case"center":h=g.width/2;f=g.height/2;e=-g.width/2;d=-g.height/2;break}return new Effect.Move(c,{x:h,y:f,duration:0.01,beforeSetup:function(i){i.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(i){new Effect.Parallel([new Effect.Opacity(i.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(i.element,{x:e,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(i.element,100,{scaleMode:{originalHeight:g.height,originalWidth:g.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(j){j.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(j){j.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var f=c.getDimensions();var e,d;switch(b.direction){case"top-left":e=d=0;break;case"top-right":e=f.width;d=0;break;case"bottom-left":e=0;d=f.height;break;case"bottom-right":e=f.width;d=f.height;break;case"center":e=f.width/2;d=f.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:e,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{};var a=c.getInlineOpacity();var e=b.transition||Effect.Transitions.sinoidal;var d=function(f){return e(1-Effect.Transitions.pulse(f,b.pulses))};d.bind(e);return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:a})}},b),{transition:d}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create();Object.extend(Object.extend(Effect.Morph.prototype,Effect.Base.prototype),{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({style:{}},arguments[1]||{});if(typeof b.style=="string"){if(b.style.indexOf(":")==-1){var d="",a="."+b.style;$A(document.styleSheets).reverse().each(function(e){if(e.cssRules){cssRules=e.cssRules}else{if(e.rules){cssRules=e.rules}}$A(cssRules).reverse().each(function(f){if(a==f.selectorText){d=f.style.cssText;throw $break}});if(d){throw $break}});this.style=d.parseStyle();b.afterFinishInternal=function(e){e.element.addClassName(e.options.style);e.transforms.each(function(f){if(f.style!="opacity"){e.element.style[f.style]=""}})}}else{this.style=b.style.parseStyle()}}else{this.style=$H(b.style)}this.start(b)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(g){var f=g[0],e=g[1],d=null;if(e.parseColor("#zzzzzz")!="#zzzzzz"){e=e.parseColor();d="color"}else{if(f=="opacity"){e=parseFloat(e);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(e)){var c=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(c[1]);d=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(f);return{style:f.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(e):e,unit:d}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var d={},b,c=this.transforms.length;while(c--){d[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():b.originalValue+Math.round(((b.targetValue-b.originalValue)*a)*1000)/1000+b.unit}this.element.setStyle(d,true)}});Effect.Transform=Class.create();Object.extend(Effect.Transform.prototype,{initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){var c=$H(b).values().first();this.tracks.push($H({ids:$H(b).keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var b=[$(a.ids)||$$(a.ids)].flatten();return b.map(function(c){return new a.effect(c,Object.extend({sync:true},a.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.prototype.parseStyle=function(){var b=document.createElement("div");b.innerHTML='<div style="'+this+'"></div>';var c=b.childNodes[0].style,a=$H();Element.CSS_PROPERTIES.each(function(d){if(c[d]){a[d]=c[d]}});if(Prototype.Browser.IE&&this.indexOf("opacity")>-1){a.opacity=this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]}return a};Element.morph=function(a,b){new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a};["getInlineOpacity","forceRerendering","setContentZoom","collectTextNodes","collectTextNodesIgnoreClass","morph"].each(function(a){Element.Methods[a]=Element[a]});Element.Methods.visualEffect=function(b,c,a){s=c.dasherize().camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](b,a);return $(b)};Element.addMethods();

/*** scripts.js ***/
function IsArray(obj) { return obj instanceof Array; }
function SafeMail(name, domain, addinfo) {
  style     = (addinfo.style)   ? ' class="' + addinfo.style + '"' : '';
  subject   = (addinfo.subject) ? '?subject=' + addinfo.subject : '';
  displayed = (addinfo.display) ? addinfo.display : name + '@' + domain;
  mailto    = name + '@' + domain + subject;
  add_display = '';
  if (addinfo.display && addinfo.display_email) {
    add_display = ' (' + name + '@' + domain + ')';
  }
  document.write('<a href="mailto:' + mailto + '"' + style + '>' + displayed + '</a>' + add_display);
}
function PopWindow(title, url, width, height, modal) {
  var id = 'popwindow';
  if (!$(id)) {
    BuildWindow({id:id, title:title, url:url, width:width, height:height, modal:modal});
  }
}
function SpellCheck() {
	var speller = new spellChecker();
	speller.spellCheckAll();
}
function DisableButton(obj) {
  obj.blur();
  //obj.value        = 'Processing...';
  obj.src          = '/images/loading.gif';
  obj.disabled     = true;
  obj.style.border = 'none';
}
function SubmitForm(obj, form_action) {
  // disable button
  DisableButton(obj);
  
  // get elements
  var frm = obj.form;
  var act = frm.elements['form_action'];
  
  // set form action
  act.value = form_action;
  
  // submit form
  frm.submit();
}
function IncludeLibraries(libraries) {
	if (libraries == undefined) { return; }
	var head = document.getElementsByTagName('head')[0];
	var i, sc;
	
	for (i in libraries) {
		if (typeof libraries[i] != 'string') { continue; }
		sc = document.createElement('script');
		sc.type = 'text/javascript';
		sc.src  = libraries[i];
		head.appendChild(sc);
	}
}
function StripeTable(id) {
  $A($(id).getElementsByTagName('tbody')).each(function(tbody) {
    $A($(tbody).immediateDescendants()).each(function(row, i) {
      $(row).removeClassName('odd');
      $(row).removeClassName('even');
      $(row).addClassName((i % 2) ? 'odd' : 'even');
    });
  });
}
function StripeRows(id) {
  $A($(id).immediateDescendants()).each(function(row, i) {
    row.removeClassName('odd');
    row.removeClassName('even');
    row.addClassName((i % 2) ? 'odd' : 'even');
  });
}
function StripeVisibleRows(id) {
  var j = 0;
  $A($(id).childElements()).each(function(row, i) {
    if (row.visible()) {
      row.removeClassName('odd');
      row.removeClassName('even');
      row.addClassName((j++ % 2) ? 'odd' : 'even');
    }
  });
}
function SetNotice(content, status) {
  // :KLUDGE: having to force background colors
  //          highlight effect isn't reading new color
  //          from dynamically set classname
  // status related colors
  var colors = new Array();
  colors['success'] = '#e2f9e3';
  colors['error']   = '#ffcfce';
  var bgcolor = (status) ? colors[status] : colors['success'];
  
  // update notice
  var e = $('notice');
  e.update(unescape(content));
  if (status) { e.className = 'notice-' + status; }
  e.show();
  new Effect.Highlight(e, {duration:1.5, keepBackgroundImage:true, startcolor:'#ffff88', endcolor:bgcolor, restorecolor:bgcolor});
}
function ClearNotice() {
  var e = $('notice');
  e.update('');
  e.hide();
}
function SelectAction(form, action, id) {
  // require confirmation?
  if (IsArray(immediate_actions) && immediate_actions.indexOf(action) > -1) {
    PostForm(form, action, id);
  } else if (IsArray(confirmed_actions) && confirmed_actions.indexOf(action) > -1) {
    ConfirmAction(form, action, id);
  }
}
function ConfirmAction(form, action, id) {
  // "now" indicates action from list
  if (action.match(/_now$/)) {
    // highlight selected row
    $('row' + id).addClassName('highlight');
    
    // ask for confirmation
    response = confirm("Please confirm you wish to " + action.sub('_now', '') + " the highlighted item." + ((action == 'archive_now') ? "\nThis will permanently delete this post from our system." : ""));
  } else {
    // ask for confirmation
    response = confirm("Please confirm you wish to " + action + " this item." + ((action == 'archive_now') ? "\nThis will permanently delete this post from our system." : ""));
  }
  
  // check response
  if (response === true) {
    // post form
    PostForm(form, action.sub('_now', ''), id);
  } else if (action.match(/_now$/)) {
    // remove highlight
    $('row' + id).removeClassName('highlight');
    
    // clear select
    if ($('select' + id)) { $('select' + id).selectedIndex = ''; }
  }
}
function PostForm(form, action, id) {
  // get form
  var frm = $(form);
  
  // set values and submit
  frm.elements['form_action'].value = action;
  frm.elements['id'].value          = id;
  frm.submit();
}
function ToggleElement(id) {
  if ($(id)) { Element.toggle(id); }
}
function TestPassword(passwd) {
  var e = $('passwd');
  if (passwd.length > 5) {
    e.removeClassName('password-bad');
    e.addClassName('password-good');
  } else {
    e.removeClassName('password-good');
    e.addClassName('password-bad');
  }
}
function LoginRequired() {
  SetNotice('You must <a href="/login">login</a> first to perform this action.', 'error');
}
function LimitChecked(checkbox, limit) {
  var e     = checkbox.form.elements[checkbox.name];
  var len   = e.length;
  var count = 0;
  for (var i = 0; i < len; i++) {
    count += (e[i].checked == true) ? 1 : 0;
  }
  if (count > limit) {
    checkbox.checked = false;
  }
}
function StateInput(country, prefix) {
  // check prefix
  prefix = (prefix) ? prefix : '';
  
  // elements
  var drop_down = prefix + 'state-drop-down';
  var text      = prefix + 'state-text';
  
  // show/hide elements
  if(country && country != 'United States') {
    $(drop_down).hide();
    $(text).show();
  } else {
    $(drop_down).show();
    $(text).hide();
  }
}
function ToggleUnanswered(category_id) {
  $$('tr.unanswered' + category_id).invoke('toggle');
  $$('span.unanswered' + category_id + '-control').invoke('toggle');
  StripeVisibleRows('questions-cat' + category_id);
}

// anchor links scrolling
function ScrollForm(id) {
	if (!id) {
		return;
	}
	// if Scriptaculous is loaded do smooth scroll
	if (typeof window['Scriptaculous'] == 'object') {
		new Effect.ScrollTo(id, { offset:-5 });
	} else {
		$(id).scrollTo();
	}
}

// track external link in GA via ajax
function TrackLink(target, referer) {
	try {
		// track locally
		new Ajax.Request('/ajax_track_link.php', {
			method: 'post',
			parameters: {
				target:  target,
				referer: referer
			}
		});
		
		// track GA event
		pageTracker._trackEvent('banner', target, referer);
	} catch (e) { }
}

// row behaviors for lists
function AddRowBehaviors(id) {
	var RowBehavior = Behavior.create({
		onmouseover:function() {
			this.element.addClassName('row-mouseover');
		},
		onmouseout:function() {
			this.element.removeClassName('row-mouseover');
		}
	});
	
  var list = $$('#'+id+' tbody > tr');
  list.each(function(row) {
    RowBehavior.attach(row);
  });
}

/*************************************
* window onload
*************************************/
Event.observe(window, 'load', function() {
	// add events for external link tracking
	$$('a[rel~=track_link]').each(function(obj) {
		obj.observe('click', function() {
			TrackLink(this.href, document.location.href);
		});
	});
});


/*** lowpro.js ***/
LowPro={};LowPro.Version="0.4.1";if(!Element.addMethods){Element.addMethods=function(a){Object.extend(Element.Methods,a)}}DOM={insertAfter:function(b,c,a){b=$(b);if(a.nextSibling){return b.insertBefore(c,a.nextSibling)}else{return b.appendChild(c)}},addBefore:function(a,b){a=$(a);return a.parentNode.insertBefore(b,a)},addAfter:function(a,b){a=$(a);return $(a.parentNode).insertAfter(b,a)},replaceElement:function(a,b){$(a).parentNode.replaceChild(b,a);return b},prependChild:function(a,b){$(a).insertBefore(b,a.firstChild)},appendChildren:function(b,a){b=$(b);if(!(a instanceof Array)){a=Array.prototype.slice.call(arguments,1)}a.each(function(c){b.appendChild(c)});return a}};Element.addMethods(DOM);DOM.Builder={IE_TRANSLATIONS:{"class":"className","for":"htmlFor"},cache:{},ieAttrSet:function(b,a,d){var c;if(c=this.IE_TRANSLATIONS[a]){d[c]=b[a]}else{if(a=="style"){d.style.cssText=b[a]}else{if(a.match(/^on/)){d[a]=new Function(b[a])}else{d.setAttribute(a,b[a])}}}},getElement:function(a){var b=DOM.Builder.cache[a];if(b==null){b=DOM.Builder.cache[a]=document.createElement(a)}return b.cloneNode(false)},tagFunc:function(a){return function(){var b,c;if(arguments.length>0){if(arguments[0].nodeName||typeof arguments[0]=="string"){c=arguments}else{b=arguments[0];c=Array.prototype.slice.call(arguments,1)}}return DOM.Builder.create(a,b,c)}},create:function(b,c,e){c=c||{};e=e||[];b=b.toLowerCase();var g=navigator.userAgent.match(/MSIE/);var f=(g&&c.name)?document.createElement("<"+b+" name="+c.name+">"):DOM.Builder.getElement(b);for(var a in c){if(c[a]===true){c[a]=a}if(typeof c[a]!="function"){if(g){this.ieAttrSet(c,a,f)}else{f.setAttribute(a,c[a].toString())}}else{if(a.match(/^on(.+)$/)){Event.observe(f,RegExp.$1,c[a])}}}for(var d=0;d<e.length;d++){if(typeof e[d]=="string"){e[d]=document.createTextNode(e[d])}f.appendChild(e[d])}return $(f)}};(function(){var b=("p|div|span|strong|em|img|table|tr|td|th|thead|tbody|tfoot|pre|code|h1|h2|h3|h4|h5|h6|ul|ol|li|form|input|textarea|legend|fieldset|select|option|blockquote|cite|br|hr|dd|dl|dt|address|a|button|abbr|acronym|script|link|style|bdo|ins|del|object|param|col|colgroup|optgroup|caption|label|dfn|kbd|samp|var").split("|");var c,a=0;while(c=b[a++]){window["$"+c]=DOM.Builder.tagFunc(c)}})();DOM.Builder.fromHTML=function(b){var a;if(!(a=arguments.callee._root)){a=arguments.callee._root=document.createElement("div")}a.innerHTML=b;return a.childNodes[0]};String.prototype.toElement=function(){return DOM.Builder.fromHTML(this)};(function(){var a=$;$=function(b){if(b&&b.toElement&&b.match(/^<(.+)>$/)){return $(b.toElement())}return a.apply(this,arguments)}})();Object.extend(Event,{_domReady:function(){if(arguments.callee.done){return}arguments.callee.done=true;if(Event._timer){clearInterval(Event._timer)}Event._readyCallbacks.each(function(a){a()});Event._readyCallbacks=null},onReady:function(f){if(!this._readyCallbacks){var domReady=this._domReady;if(domReady.done){return f()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",domReady,false);
/*@cc_on @*/
/*@if (@_win32)
            var dummy = location.protocol == "https:" ?  "https://javascript:void(0)" : "javascript:void(0)";
            document.write("<script id=__ie_onload defer src='" + dummy + "'><\/script>");
            document.getElementById("__ie_onload").onreadystatechange = function() {
                if (this.readyState == "complete") { domReady(); }
            };
        /*@end @*/
}if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){domReady()}},10)}Event.observe(window,"load",domReady);Event._readyCallbacks=[]}Event._readyCallbacks.push(f)}});if(typeof Element.Methods.observe=="undefined"){Element.addMethods({observe:function(a,b,c){Event.observe(a,b,c)},stopObserving:function(a,b,c){Event.stopObserving(a,b,c)}})}Object.extend(Event,{_observeAndCache:function(c,b,d){if(!d.$$guid){d.$$guid=Event._guid++}if(!c.events){c.events={}}var a=c.events[b];if(!a){a=c.events[b]={};if(c["on"+b]){a[0]=c["on"+b]}}a[d.$$guid]=d;c["on"+b]=Event._handleEvent;if(!Event.observers){Event.observers=[]}Event.observers.push([c,b,d,false])},stopObserving:function(c,b,d){c=$(c);if(c.events&&c.events[b]){delete c.events[b][d.$$guid]}for(var a=0;a<Event.observers.length;a++){if(Event.observers[a]&&Event.observers[a][0]==c&&Event.observers[a][1]==b&&Event.observers[a][2]==d){delete Event.observers[a]}}},_handleEvent:function(f){var d=true;if(!f&&!window.event){return true}f=f||Event._fixEvent(window.event);var a=this.events[f.type],c=$(this);for(var b in a){c.$$handleEvent=a[b];if(c.$$handleEvent(f)===false){d=false}}if(d==false){f.preventDefault()}return d},_fixEvent:function(a){a.preventDefault=Event._preventDefault;a.stopPropagation=Event._stopPropagation;return a},_preventDefault:function(){this.returnValue=false},_stopPropagation:function(){this.cancelBubble=true},_guid:1});Object.extend(Event,{trigger:function(a,b,c){a=$(a);c=c||{type:b};if(a.events&&a.events[b]){$H(a.events[b]).each(function(d){d[1].call(a,c)})}}});Event.addBehavior=function(b){var a=this.addBehavior;Object.extend(a.rules,b);if(!a.responderApplied){Ajax.Responders.register({onComplete:function(){if(Event.addBehavior.reassignAfterAjax){setTimeout(function(){a.unload();a.load(a.rules)},10)}}});a.responderApplied=true}if(a.autoTrigger){this.onReady(a.load.bind(a,b))}};Object.extend(Event.addBehavior,{rules:{},cache:[],reassignAfterAjax:true,autoTrigger:true,load:function(d){for(var b in d){var c=d[b];var a=b.split(",");a.each(function(g){var h=g.split(/:(?=[a-z]+$)/),e=h[0],f=h[1];$$(e).each(function(i){if(f){$(i).observe(f,c);Event.addBehavior.cache.push([i,f,c])}else{if(!i.$$assigned||!i.$$assigned.include(c)){if(c.attach){c.attach(i)}else{c.call($(i))}i.$$assigned=i.$$assigned||[];i.$$assigned.push(c)}}})})}},unload:function(){this.cache.each(function(a){Event.stopObserving.apply(Event,a)});this.cache=[]}});Event.observe(window,"unload",Event.addBehavior.unload.bind(Event.addBehavior));$$$=Event.addBehavior;Behavior={create:function(a){var b=function(){var e=arguments.callee;if(this==window||$H(this).values().include(e)){var c=[];for(var d=0;d<arguments.length;d++){c.push(arguments[d])}return function(){var f=[this].concat(c);e.attach.apply(e,f)}}else{var c=(arguments.length==2&&arguments[1] instanceof Array)?arguments[1]:Array.prototype.slice.call(arguments,1);this.element=$(arguments[0]);this.initialize.apply(this,c);e._bindEvents(this);e.instances.push(this)}};b.prototype.initialize=Prototype.K;Object.extend(b.prototype,a);Object.extend(b,Behavior.ClassMethods);b.instances=[];return b},ClassMethods:{attach:function(a){return new this(a,Array.prototype.slice.call(arguments,1))},_bindEvents:function(a){for(var b in a){if(b.match(/^on(.+)/)&&typeof a[b]=="function"){a.element.observe(RegExp.$1,a[b].bindAsEventListener(a))}}}}};

/*** tooltips.js ***/
// include required libraries
var libraries = [
  '/js/prototip.js'
];
IncludeLibraries(libraries);

// add tool tips when ready
Event.observe(window, 'load', function() {
  AddToolTips();
});
function AddToolTips() {
  $$('a').each(function(e) {
    if (e.rel.startsWith('tooltip|')) {
      // set input and type
      input   = e.rel.split('|');
      type    = input[1];
      content = input[2];
      
      // which type?
      if (type == 'glossary') {
        AddGlossaryToolTip(e, content);
      } else if (type == 'general') {
        AddGeneralToolTip(e, content);
      }
    }
  });
}
function AddGeneralToolTip(e, content) {
  new Tip(e, content, {effect:'appear', hook:{target:'topLeft', tip:'bottomLeft'}, offset:{x:10, y:-5}});
}
function AddGlossaryToolTip(e, id) {
  var url  = '/ajax_get_glossary_term.php';
  var pars = {id:id};
  new Ajax.Request(
    url,
    {
      method:'get',
      parameters:pars,
      onSuccess:function(transport) {
        var data = transport.responseText.evalJSON();
        new Tip(e, data.definition, {title:data.term, effect:'appear', hook:{target:'topLeft', tip:'bottomLeft'}, offset:{x:10, y:-5}});
      }
    }
  );
}



/*** addthis.js ***/
// global config
var addthis_config = {
	username:             'xa-4a6e8044563ffb18',
	services_compact:     'email, favorites, linkedin, facebook, twitter, myspace, google, yahoobkm, live, myaol, friendfeed, more',
	services_exclude:     'print',
	ui_header_background: '#aec2d8',
	ui_header_color:      '#2b4973',
	ui_click:             true
}

/* (c) 2008, 2009 Add This, LLC */
if(!window._ate){var _atd="www.addthis.com/",_atr="//s7.addthis.com/",_euc=encodeURIComponent,_duc=decodeURIComponent,_atu="undefined",_atc={dr:0,ver:250,loc:0,enote:"",cwait:500,tamp:1,samp:0.01,camp:1,vamp:1,addr:-1,addt:1,xfl:!!window.addthis_disable_flash,abf:!!window.addthis_do_ab};(function(){try{var _1,xi,h=window.location.hostname,hl=h.length,x=["aol","pawnation","spinner","parentdish","fanhouse","popeater","tmz","games","asylum"],xl=x.length;for(var i=0;i<xl;i++){xi=x[i];_1=h.indexOf(xi+".com");if((_1!==-1)&&(_1===(hl-xi.length-4))){_atc.xfl=true;return;}}}catch(e){}})();(function(){try{var l=window.location;if(l.protocol.indexOf("file")===0){_atr="http:"+_atr;}if(l.hostname.indexOf("localhost")!=-1){_atc.loc=1;}}catch(e){}var ua=navigator.userAgent.toLowerCase(),d=document,w=window,wa=w.addEventListener,we=w.attachEvent,dl=d.location,b={win:/windows/.test(ua),chr:/chrome/.test(ua),iph:/iphone/.test(ua),saf:(/webkit/.test(ua))&&!(/chrome/.test(ua)),web:/webkit/.test(ua),opr:/opera/.test(ua),msi:(/msie/.test(ua))&&!(/opera/.test(ua)),ffx:/firefox/.test(ua),ie6:/msie 6.0/.test(ua),ie7:/msie 7.0/.test(ua),mod:-1},_10={isBound:false,isReady:false,readyList:window.addthis_onload||[],onReady:function(){if(!_10.isReady){_10.isReady=true;var l=_10.readyList;for(var fn=0;fn<l.length;fn++){l[fn].call(window);}_10.readyList=[];}},addLoad:function(_13){var _14=w.onload;if(typeof w.onload!="function"){w.onload=_13;}else{w.onload=function(){if(_14){_14();}_13();};}},bindReady:function(){if(r.isBound){return;}r.isBound=true;if(d.addEventListener&&!b.opr){d.addEventListener("DOMContentLoaded",r.onReady,false);}var apc=window.addthis_product;if(apc&&apc.indexOf("f")>-1){r.onReady();return;}if(b.msi&&window==top){(function(){if(r.isReady){return;}try{d.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}r.onReady();})();}if(b.opr){d.addEventListener("DOMContentLoaded",function(){if(r.isReady){return;}for(var i=0;i<d.styleSheets.length;i++){if(d.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}}r.onReady();},false);}if(b.saf){var _17;(function(){if(r.isReady){return;}if(d.readyState!="loaded"&&d.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(_17===undefined){var _19=d.gn("link");for(var i=0;i<_19.length;i++){if(_19[i].getAttribute("rel")=="stylesheet"){_17++;}}var _1b=d.gn("style");_17+=_1b.length;}if(d.styleSheets.length!=_17){setTimeout(arguments.callee,0);return;}r.onReady();})();}r.addLoad(r.onReady);},append:function(fn,_1d){r.bindReady();if(r.isReady){fn.call(window,[]);}else{r.readyList.push(function(){return fn.call(window,[]);});}}},r=_10,_1e={vst:[],rev:"$Rev: 68227 $",bro:b,clck:1,show:1,dl:dl,camp:_atc.camp-Math.random(),samp:_atc.samp-Math.random(),vamp:_atc.vamp-Math.random(),tamp:_atc.tamp-Math.random(),ab:"-",scnt:1,seq:1,inst:1,wait:500,tmo:null,cvt:[],svt:[],sttm:new Date().getTime(),max:268435455,pix:"tev",sid:0,sub:!!window.at_sub,uid:null,oot:null,swf:"//bin.clearspring.com/at/v/1/button1.6.swf",evu:"//e1.clearspring.com/at/",ifpp:null,ifm:function(m){if(addthis_wpl){var a=(addthis_wpl.split("#"))[0];window.parent.location.href=a+"#at"+m;}return false;},hash:window.location.hash,ifp:function(){var a=_1e,m=window.location.hash,p=0;if(m&&m.indexOf("#atssh-")>-1){m=m.substr(7);if(!a.hash.length||a.hash==""){a.hash="#";}window.location.hash=a.hash;clearInterval(a.ifpp);a.ssh(m);}},pmh:function(e){if(e.origin.substr(e.origin.length-12)==".addthis.com"){_1e.ssh(e.data.substr(4));}},ssh:function(ssh){window.addthis_ssh=_duc(ssh);d.body.removeChild(d.getElementById("_atssh"));},mun:function(s){var mv=291;if(s){for(var i=0;i<s.length;i++){mv=(mv*(s.charCodeAt(i)+i)+3)&1048575;}}return(mv&16777215).toString(32);},off:function(){return Math.floor((new Date().getTime()-_1e.sttm)/100).toString(16);},ran:function(){return Math.floor(Math.random()*4294967295).toString(36);},srd:function(){if(_1e.dr){return"&pre="+_euc(_1e.dr);}else{return"";}},cst:function(c){return"CXNID=2000001.521545608054043907"+(c||2)+"NXC";},imgz:[],hrr:function(_2a){if(_2a&&_2a.urls&&_2a.urls instanceof Array){for(var i=0;i<_2a.urls.length;i++){var img=new Image();_1e.imgz.push(img);img.src=_2a.urls[i];}}},img:function(i,c){if(!window.at_sub&&!_atc.xtr){var a=_1e,dr=a.dr;if(dr){dr=(dr.split("?")).shift();dr=(dr.split("http://")).pop();if(dr.length>25){dr=dr.substr(0,25);}}var img=new Image();a.imgz.push(img);img.src=_atr+"live/t00/"+i+".gif?"+(a.uid!==null?"uid="+a.uid+"&":"")+a.ran()+"&"+a.cst(c)+(a.pub()?"&pub="+a.pub():"")+(dr?"&dr="+_euc(dr):"");}},cuid:function(){return(_1e.sttm&_1e.max).toString(16)+(Math.floor(Math.random()*_1e.max)).toString(16);},ssid:function(){if(_1e.sid===0){_1e.sid=_1e.cuid();}return _1e.sid;},sev:function(id,_33){_1e.pix="sev-"+(typeof(id)!=="number"?_euc(id):id);_1e.svt.push(id+";"+_1e.off());if(_33===1){_1e.xmi(true);}else{_1e.sxm(true);}},cev:function(k,v){_1e.pix="cev-"+_euc(k);_1e.cvt.push(_euc(k)+"="+_euc(v)+";"+_1e.off());_1e.sxm(true);},sxm:function(b){if(_1e.tmo!==null){clearTimeout(_1e.tmo);}if(b){_1e.tmo=_1e.sto("_ate.xmi(false)",_1e.wait);}},sto:function(c,t){return setTimeout(c,t);},sta:function(){var a=_1e;return"AT-"+(a.pub()?a.pub():"unknown")+"/-/"+a.ab+"/"+a.ssid()+"/"+(a.seq++)+(a.uid!==null?"/"+a.uid:"");},xmi:function(_3a){var a=_1e,h=a.dl?a.dl.hostname:"";if(!a.uid){a.dck("X"+a.cuid());}else{a.coo();}if(a.cvt.length+a.svt.length>0){a.sxm(false);if(a.seq===1){a.cev("pin",a.inst);}if(_atc.xtr){return;}if(h.indexOf(".gov")>-1||h.indexOf(".mil")>-1){_atc.xck=1;}var urp=a.pix+"-"+a.ran()+".png?ev="+_1e.sta()+"&se="+a.svt.join(",")+"&ce="+a.cvt.join(",")+(_atc.xck?"&xck=1":""),url=a.evu+urp;a.cvt=[];a.svt=[];if(_3a){var d=document,i=d.ce("iframe");i.id="_atf";i.src=url;_1e.opp(i.style);d.body.appendChild(i);i=d.getElementById("_atf");}else{var img=new Image();a.imgz.push(img);img.src=url;}}},loc:function(){return _atc.loc;},opp:function(st){st.width="1px";st.height="1px";st.position="absolute";st.zIndex=100000;},pub:function(){return window.addthis_config&&addthis_config.username?_euc(addthis_config.username):(window.addthis_pub||"");},plo:[],lad:function(x){_1e.plo.push(x);},lng:function(al){var d=document;if(al&&(al.toLowerCase()).indexOf("en")!==0&&!_1e.pll){var o=d.ce("script");o.src=_atr+"static/r07/lang01.js";d.gn("head")[0].appendChild(o);_1e.pll=o;}},jlo:function(){try{var d=document,al=(window.addthis_language||addthis_config.ui_language||(_1e.bro.msi?navigator.userLanguage:navigator.language));_1e.lng(al);if(!_1e.pld){var m=d.ce("script");m.src=_atr+"static/r07/menu32.js";d.gn("head")[0].appendChild(m);_1e.pld=m;}}catch(e){}},igv:function(u,t){if(!w.addthis_share){w.addthis_share={url:w.addthis_url||u,title:w.addthis_title||t};}if(!w.addthis_config){w.addthis_config={username:w.addthis_pub};}else{if(addthis_config.data_use_flash===false){_atc.xfl=1;}if(addthis_config.data_use_cookies===false){_atc.xck=1;}}},lod:function(arg){try{var w=window,a=_1e,hp=0,f=((arg===1||w.addthis_load_flash)&&!_atc.abf),dr=d.referer||d.referrer||"",du=dl?dl.href:null,si=du?du.indexOf("sms_ss"):-1,ifr=false/*d.ce("iframe")*/,al=((w.addthis_language||(w.addthis_config?w.addthis_config.ui_language:null)||(_1e.bro.msi?navigator.userLanguage:navigator.language)).split("-"))[0],fnd=0,lks=d.getElementsByTagName("link");for(var i=0;i<lks.length;i++){var l=lks[i];if(l.rel&&l.rel=="canonical"&&l.href){du=l.href;}}a.igv(du,d.title||"");_1e.gov();a.dr=dr;a.ab="~";if(dl.href.indexOf(_atr)==-1){ifr.id="_atssh";ifr.style.width=ifr.style.height=1;ifr.width=ifr.height=1;ifr.frameborder=ifr.style.border=0;ifr.src=_atr+"static/r07/sh03.html?wpl="+_euc(dl.href);if(window.postMessage){if(_1e.bro.msi){window.attachEvent("onmessage",a.pmh);}else{window.addEventListener("message",a.pmh,false);}}else{if(a.ifpp){clearInterval(a.ifpp);}a.ifpp=setInterval(function(){_1e.ifp();},100);}ifr=d.body.appendChild(ifr);a.sifr=ifr;}if(!f){if(a.samp>=0&&!a.sub){a.sev("20");a.cev("plo",Math.round(1/_atc.samp));if(a.dr){a.cev("pre",a.dr);hp=1;}}if(a.camp>=0&&du&&dl&&dl.protocol&&(dr.indexOf(".com")>-1)&&(dl.protocol.indexOf("https")==-1)){if(dr&&dr.match(/ws\/results\/(Web|Images|Video|News)/)){fnd=1;}else{if(dr.indexOf(".com/search")>-1){var t=dr.split("?").pop().split("&");for(var i=0;i<t.length;i++){if(t[i].indexOf("q=")==0||t[i].indexOf("p=")==0||t[i].indexOf("query")==0||t[i].indexOf("qry")==0||t[i].indexOf("text")==0){fnd=1;break;}}}}if(!_atc.xtr&&!_atc.xck&&fnd&&a.mun(a.pub())!=="mu2r"){var o=d.ce("script");o.src="//cf.addthis.com/red/p.json?callback=_ate.hrr"+(a.pub()?"&pub="+a.pub():"")+(a.uid&&a.uid!=="anonymous"?"&uid="+_euc(a.uid):"")+"&url="+_euc(du)+"&ref="+_euc((d.referer||d.referrer));d.gn("head")[0].appendChild(o);}}if(si>-1){var sm=du.substr(si),am=sm.indexOf("&");if(am>-1){sm=sm.substr(0,am);}sm=(sm.split("="))[1];if(a.vamp>=0&&!a.sub&&sm.length){a.cev("plv",Math.round(1/_atc.vamp));a.cev("rsc",sm);}}a.img(_atc.ver+"lo","2");}if(a.plo.length>0){a.jlo();}if(a.swf&&!_atc.xfl&&!(a.loc())&&!_atc.abf&&(f||a.uid===null||(a.uid!=="anonymous"&&a.oot&&((new Date()).getTime()-a.oot>60480000)))){a.uoo();var _5e=function(o,n,v){var c=d.createElement("param");c.name=n;c.value=v;o.appendChild(c);};var o=d.createElement("object");a.opp(o.style);o.id="atff";if(b.msi){o.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";_5e(o,"movie",a.swf);}else{o.data=a.swf;o.quality="high";o.type="application/x-shockwave-flash";}_5e(o,"wmode","transparent");_5e(o,"allowScriptAccess","always");d.body.insertBefore(o,d.body.firstChild);if(b.msi){o.outerHTML+=" ";}}}catch(e){}},unl:function(){var a=_1e;if(a.samp>=0&&!a.sub&&!_atc.abf){a.sev("21",1);a.cev("pun",1/_atc.samp);}return true;},kck:function(k){var d=document;if(d.cookie){d.cookie=k+"= ; expires=Tue, 31 Mar 2009 05:47:11 UTC; path=/";}},rck:function(k){var d=document;if(d.cookie){var ck=d.cookie.split(";");for(var i=0;i<ck.length;i++){var c=ck[i],x=c.indexOf(k+"=");if(x>=0){return c.substring(x+(k.length+1));}}}return;},uoo:function(){_1e.sck("_csoot",(new Date().getTime()));},coo:function(f){if(_1e.uid=="anonymous"&&!_1e.oot){_1e.xck=1;_1e.uoo();}},dck:function(c){_1e.uid=c;_1e.sck("_csuid",c);_1e.coo();},gov:function(){var h=_1e.dl?_1e.dl.hostname:"";if(h.indexOf(".gov")>-1||h.indexOf(".mil")>-1){_atc.xck=1;_atc.xfl=1;}var p=_1e.pub(),x=["usarmymedia","gobiernousa","govdelivery"];for(i in x){if(p==x[i]){_atc.xck=1;_atc.xfl=1;break;}}},sck:function(u,v,s){_1e.gov();if(!_atc.xck){d.cookie=u+"="+v+(!s?"; expires=Wed, 04 Oct 2028 03:19:53 GMT":"")+"; path=/";}},fcl:null,asetup:function(x){var a=_1e;try{if(x!==null&&x!==_atu){a.dck(x);}if(a.fcl){a.fcl();}}catch(e){}return x;},ao:function(elt,_78,_79,_7a,_7b,_7c){_1e.lad(["open",elt,_78,_79,_7a,_7b,_7c]);_1e.jlo();return false;},ac:function(){},as:function(s,cf,sh){_1e.lad(["send",s,cf,sh]);_1e.jlo();}},a=_1e;w._ate=a;w._adr=r;d.ce=d.createElement;d.gn=d.getElementsByTagName;r.bindReady();if(wa){wa("unload",a.unl,false);}else{if(we){we("onunload",a.unl);}else{w.onunload=a.unl;}}if(!_atc.ost){if(!w.addthis_conf){w.addthis_conf={};}for(var i in addthis_conf){_atc[i]=addthis_conf[i];}_atc.ost=1;}r.append(a.lod);if(d.cookie){var ck=d.cookie.split(";");for(var i=0;i<ck.length;i++){var c=ck[i],x=c.indexOf("_csuid="),y=c.indexOf("_csoot=");if(x>=0){_1e.uid=c.substring(x+7);}else{if(y>=0){_1e.oot=c.substring(y+7);}}}}var ss=d.gn("script"),s=ss[ss.length-1],q=s.src.replace(/^[^\?]+\??/,""),pq=function(q){var p={};if(!q){return p;}var ps=q.split(/[;&]/);for(var i=0;i<ps.length;i++){var kv=ps[i].split("=");if(!kv||kv.length!=2){continue;}var k=_duc(kv[0]),v=_duc(kv[1]);v=v.replace(/\+/g," ");ps[k]=v;}return ps;},p=pq(q);if(p.pub){w.addthis_pub=_duc(p.pub);if(w.addthis_config){w.addthis_config.username=w.addthis_pub;}}else{if(p.username){w.addthis_pub=_duc(p.username);if(w.addthis_config){w.addthis_config.username=w.addthis_pub;}}}if(p.domready){_atc.dr=1;}try{if(_atc.ver===120){var rc="atb"+w._ate.cuid();d.write("<span id=\""+rc+"\"></span>");w._ate.igv();w._ate.lad(["span",rc,addthis_share.url||"[url]",addthis_share.title||"[title]"]);}if(w.addthis_clickout){_1e.lad(["cout"]);}}catch(e){}})();function addthis_open(elt,_93,_94,_95,_96,_97){if(typeof _96=="string"){_96=null;}return _ate.ao(elt,_93,_94,_95,_96,_97);}function addthis_close(){_ate.ac();}function addthis_sendto(s,cf,sh){_ate.as(s,cf,sh);return false;}if(_atc.dr){_adr.onReady();}}else{_ate.inst++;}if(_atc.abf){addthis_open(document.getElementById("ab"),"emailab",window.addthis_url||"[URL]",window.addthis_title||"[TITLE]");}if(!window.addthis||window.addthis.nodeType!==undefined){window.addthis={ost:0,cache:{},plo:[],links:[],ems:[],button:function(){this.plo.push({call:"button",args:arguments});},toolbox:function(){this.plo.push({call:"toolbox",args:arguments});},update:function(){this.plo.push({call:"update",args:arguments});}};}_adr.append((function(){if(!window.addthis.ost){var d=document,u=undefined,w=window,_4=w.addthis_config,_5=w.addthis_share,_6={},_7={},_8=d.gn("body").item(0),_9=function(o,n){if(n&&o!==n){for(var k in n){if(o[k]===u){o[k]=n[k];}}}},_d=function(o,n){var r={};for(var k in o){if(n[k]){r[k]=n[k];}else{r[k]=o[k];}}return r;},_12=window.addthis,_13=function(_14){return"mailto:?subject="+(_14.title?_14.title:"%20")+"&body="+(_14.title?_14.title+"%0D%0A":"")+(_14.url)+"%0D%0A%0D%0AShared via AddThis.com";},_15=function(_16,tag,_18,_19){tag=tag.toUpperCase();var els=(_16==_8&&_12.cache[tag]?_12.cache[tag]:(_16||_8).getElementsByTagName(tag)),rv=[],o;if(_16==_8){_12.cache[tag]=els;}_18=_18.replace(/\-/g,"\\-");var rx=new RegExp("(^|\\s)"+_18+(_19?"\\w*":"")+"(\\s|$)");for(var i=0;i<els.length;i++){o=els[i];if(rx.test(o.className)){rv.push(o);}}return(rv);},_1f={"aim":"AIM","kirtsy":"kIRTSY","linkagogo":"Link-a-Gogo","meneame":"Men&eacute;ame","misterwong":"Mister Wong","myaol":"myAOL","myspace":"MySpace","yahoobkm":"Y! Bookmarks","typepad":"TypePad","wordpress":"WordPress"},_20={email:"Email",print:"Print",favorites:"Save to Favorites",twitter:"Tweet This",digg:"Digg This"},_21={services_custom:1},_22={more:1,email:1},_23={email:1,print:1,more:1,favorites:1},_24=["username","services_custom","services_custom_name","services_custom_url","services_custom_title","services_exclude","services_compact","services_expanded","ui_click","ui_hide_embed","ui_delay","ui_hover_direction","ui_language","ui_offset_top","ui_offset_left","ui_header_color","ui_header_background","ui_icons","ui_cobrand","data_use_flash","data_use_cookies","data_track_linkback"],_25=["url","title","templates","description","content"],_26=d.getElementsByClassname||_15,_27=function(_28,_29){var sv=_28.services instanceof Array?_28.services[0]:_28.services||"";return"http://"+_atd+"bookmark.php?v="+_atc.ver+"&pub="+_euc(_ate.pub())+"&s="+sv+(_29.url?"&url="+_euc(_29.url):"")+(_29.title?"&title="+_euc(_29.title):"");},_2b=function(_2c){if(typeof _2c=="string"){var c=_2c.substr(0,1);if(c=="#"){_2c=d.getElementById(_2c.substr(1));}else{if(c=="."){_2c=_26(_8,"*",_2c.substr(1));}else{}}}if(!(_2c instanceof Array)){_2c=[_2c];}return _2c;},_2e=function(el,_30,_31,_32){var rv={};_31=_31||{};for(var i=0;i<_30.length;i++){if(_31[_30[i]]&&!_32){rv[_30[i]]=_31[_30[i]];}else{if(el){var p="addthis:"+_30[i],v=el.getAttribute?el.getAttribute(p)||el[p]:el[p];if(v){rv[_30[i]]=v;}else{if(_31[_30[i]]){rv[_30[i]]=_31[_30[i]];}}}}if(rv[_30[i]]!==undefined&&_21[_30[i]]&&(typeof rv[_30[i]]=="string")){eval("var e = "+rv[_30[i]]);rv[_30[i]]=e;}}return rv;},_37=function(el,_39,_3a,_3b){var rv={conf:_39||{},share:_3a||{}};rv.conf=_2e(el,_24,_39,_3b);rv.share=_2e(el,_25,_3a,_3b);return rv;},_3d=function(_3e,_3f,_40){if(_3e){_3f=_3f||{};_40=_40||{};var _41=_3f.conf||_4,_42=_3f.share||_5;var _43=_40.onmouseover,_44=_40.onmouseout,_45=_40.onclick,_46=_40.internal,ss=_40.singleservice;if(ss){_41.product="tbx-"+_atc.ver;if(_45===u){_45=_22[ss]?function(el,_49,_4a){var s=_d(_4a,_7);return addthis_open(el,ss,s.url,s.title,_d(_49,_6),s);}:_23[ss]?function(el,_4d,_4e){var s=_d(_4e,_7);return addthis_sendto(ss,_d(_4d,_6),s);}:null;}}else{if(!_40.noevents){if(!_40.nohover&&(!_41||!_41.ui_click)){if(_43===u){_43=function(el,_51,_52){return addthis_open(el,"",null,null,_51,_52);};}if(_44===u){_44=function(el){return addthis_close();};}if(_45===u){_45=function(el,_55,_56){return addthis_sendto("more",_55,_56);};}}else{if(!_41||!_41.ui_click){if(_45===u){_45=function(el,_58,_59){return addthis_open(el,"more");};}}else{if(_45===u){_45=function(el,_5b,_5c){return addthis_open(el,"",null,null,_5b,_5c);};}}}}}_3e=_2b(_3e);for(var i=0;i<_3e.length;i++){var o=_3e[i],_5f=_37(o,_41,_42,true)||{};_9(_5f.conf,_4);_9(_5f.share,_5);o.conf=_5f.conf;o.share=_5f.share;if(o.conf.ui_language){_ate.lng(o.conf.ui_language);}if(_43){o.onmouseover=function(){return _43(this,this.conf,this.share);};}if(_44){o.onmouseout=function(){return _44(this);};}if(_45){o.onclick=function(){return _45(this,this.conf,this.share);};}if(o.tagName.toLowerCase()=="a"){if(ss){o.conf.product="tbx-"+_atc.ver;if((_ate.bro.ffx||_ate.bro.saf||_ate.bro.chr||_ate.bro.iph)&&!_23[ss]){var _60=o.share.templates&&o.share.templates[ss]?o.share.templates[ss]:"";o.href="//"+_atd+"bookmark.php?pub="+_euc(addthis_config.username||o.conf.username||_ate.pub())+"&v="+_atc.ver+"&source=tbx-"+_atc.ver+"&s="+ss+"&url="+_euc(_5f.share.url||addthis_share.url||"")+"&title="+_euc(_5f.share.title||addthis_share.title||"")+"&content="+_euc(_5f.share.content||addthis_share.content||"")+(_60?"&template="+_euc(_60):"")+(o.conf.data_track_linkback?"&sms_ss=1":"");o.target="_blank";_12.links.push(o);}else{if(!_23[ss]){o.onclick=function(){return addthis_sendto.call(this,ss,_d(this.conf,_6),_d(this.share,_7));};}else{if(ss=="email"&&(o.conf.ui_use_mailto||_ate.bro.iph)){o.href=_13(o.share);o.onclick=null;_12.ems.push(o);}}}if(!o.title){o.title=_20[ss]?_20[ss]:"Send to "+(_1f[ss]?_1f[ss]:ss.substr(0,1).toUpperCase()+ss.substr(1));}}}if(_46){var app=_46;if(!o.hasChildNodes()){if(_46=="img"){var img=d.ce("img");img.width=125;img.height=16;img.border=0;img.alt="Share";img.src="//s7.addthis.com/static/btn/v2/lg-share-en.gif";app=img;}o.appendChild(app);}}}}},_63=_15(_8,"A","addthis_button_",true),_64=function(_65,_66,_67,_68){for(var i=0;i<_65.length;i++){var b=_65[i];if(b==null){continue;}if(_68!==false||!b.ost){var _66=_66||_4;_67=_67||_5;attr=_37(b,_66,_67,true),hc=0,a="at300";c=b.className||"",s=c.match(/addthis_button_(\w+)(?:\s|$)/),opts=u,sv=s&&s.length?s[1]:0;if(sv){if(!b.childNodes.length){var sp=d.ce("span");b.appendChild(sp);sp.className=a+"bs at15t_"+sv;}else{if(b.childNodes.length==1){var cn=b.childNodes[0];if(cn.nodeType==3){var sp=d.ce("span"),tv=cn.nodeValue;b.insertBefore(sp,cn);sp.className=a+"bs at15t_"+sv;}}else{hc=1;}}if(sv==="compact"){if(!hc&&c.indexOf(a)==-1){b.className+=" "+a+"m";}}else{if(sv==="expanded"){if(!hc&&c.indexOf(a)==-1){b.className+=" "+a+"m";}opts={nohover:true};}else{if(!hc&&c.indexOf(a)==-1){b.className+=" "+a+"b";}opts={singleservice:sv};}}_3d([b],attr,opts);b.ost=1;}}}};_12.update=function(_6e,_6f,_70){if(_6e=="share"){if(!window.addthis_share){window.addthis_share={};}window.addthis_share[_6f]=_70;_7[_6f]=_70;for(var i in _12.links){var o=_12.links[i],rx=new RegExp("&"+_6f+"=(.*)&"),ns="&"+_6f+"="+_euc(_70)+"&";o.href=o.href.replace(rx,ns);if(o.href.indexOf(_6f)==-1){o.href+=ns;}}for(var i in _12.ems){var o=_12.ems[i];o.href=_13(addthis_share);}}else{if(_6e=="config"){if(!window.addthis_config){window.addthis_config={};}window.addthis_config[_6f]=_70;_6[_6f]=_70;}}};_12.button=function(_75,_76,_77){_3d(_75,{conf:_76,share:_77},{internal:"img"});};_12.toolbox=function(_78,_79,_7a){var _7b=_2b(_78);for(var i=0;i<_7b.length;i++){var tb=_7b[i],_7e=_37(tb,_79,_7a),sp=d.ce("div"),c=tb.getElementsByTagName("a");if(c){_64(c,_7e.conf,_7e.share);}tb.appendChild(sp);sp.className="atclear";}};_12.ready=function(){if(this.ost){return;}this.ost=1;var a=".addthis_";_12.toolbox(a+"toolbox");_12.button(a+"button");_64(_63,null,null,false);for(var i=0;i<this.plo.length;i++){_12[this.plo[i].call].apply(this,this.plo[i].args);}};window.addthis=_12;window.addthis.ready();}}));

/*** switchbox.js ***/
/////////
// :NOTE:
// requires prototype.js
/////////
function TransferOptions(select1, select2) {
  // transfer selected options
  var options = $A($(select1).getElementsByTagName('option'));
  options.each(function(option) {
    if (option.selected == true) {
      AddOption(select2, option.value, option.text);
      Element.remove(option);
    }
  });
  
  // resort select list
  SortSelect(select2);
  
}
function AddOption(id, value, text) {
  var option = document.createElement('option');
  option.setAttribute('value', value);
  option.appendChild(document.createTextNode(text));
  $(id).appendChild(option);
}
function SortSelect(id) {
  var options = $A($(id).getElementsByTagName('option'));
  var sorted  = new Array();
  if (options.length > 0) {
    // sort
    sorted = options.sortBy(function(option) {
      return option.text;
    });
    
    // remove unsorted
    options.each(function(option) {
      Element.remove(option);
    });
    
    // add sorted
    sorted.each(function(option) {
      AddOption(id, option.value, option.text);
    });
  }
}
function SelectAllOptions(id) {
  if ($(id)) {
    var options = $A($(id).getElementsByTagName('option'));
    options.each(function(option) {
      option.selected = true;
    });
  }
}
function PostSwitchboxes(id) {
  // find all switchboxes
  var elements = $(id).getElementsByClassName('switchbox');
  $A(elements).each(function(e) {
    if (e.id.indexOf('selected_') == 0) {
      // select options so they are posted
      SelectAllOptions(e.id)
    }
  });
}


/*** date_select.js ***/
function CheckDateFormat(e) {
  var d = parseDate(e.value);
  if(d == null) {
    // clear value
    e.value = '';
  } else{
    e.value = formatDate(d, 'MM/dd/yyyy');
  }
}

// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================


function getAnchorPosition(anchorname){var useWindow=false;var coordinates=new Object();var x=0,y=0;var use_gebi=false,use_css=false,use_layers=false;if(document.getElementById){use_gebi=true;}
else if(document.all){use_css=true;}
else if(document.layers){use_layers=true;}
if(use_gebi&&document.all){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}
else if(use_gebi){var o=document.getElementById(anchorname);x=AnchorPosition_getPageOffsetLeft(o);y=AnchorPosition_getPageOffsetTop(o);}
else if(use_css){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}
else if(use_layers){var found=0;for(var i=0;i<document.anchors.length;i++){if(document.anchors[i].name==anchorname){found=1;break;}}
if(found==0){coordinates.x=0;coordinates.y=0;return coordinates;}
x=document.anchors[i].x;y=document.anchors[i].y;}
else{coordinates.x=0;coordinates.y=0;return coordinates;}
coordinates.x=x;coordinates.y=y;return coordinates;}
function getAnchorWindowPosition(anchorname){var coordinates=getAnchorPosition(anchorname);var x=0;var y=0;if(document.getElementById){if(isNaN(window.screenX)){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}
else{x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}}
else if(document.all){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}
else if(document.layers){x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}
coordinates.x=x;coordinates.y=y;return coordinates;}
function AnchorPosition_getPageOffsetLeft(el){var ol=el.offsetLeft;while((el=el.offsetParent)!=null){ol+=el.offsetLeft;}
return ol;}
function AnchorPosition_getWindowOffsetLeft(el){return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;}
function AnchorPosition_getPageOffsetTop(el){var ot=el.offsetTop;while((el=el.offsetParent)!=null){ot+=el.offsetTop;}
return ot;}
function AnchorPosition_getWindowOffsetTop(el){return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;}
var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');function LZ(x){return(x<0||x>9?"":"0")+x}
function isDate(val,format){var date=getDateFromFormat(val,format);if(date==0){return false;}
return true;}
function compareDates(date1,dateformat1,date2,dateformat2){var d1=getDateFromFormat(date1,dateformat1);var d2=getDateFromFormat(date2,dateformat2);if(d1==0||d2==0){return-1;}
else if(d1>d2){return 1;}
return 0;}
function formatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length<4){y=""+(y-0+1900);}
value["y"]=""+y;value["yyyy"]=y;value["yy"]=y.substring(2,4);value["M"]=M;value["MM"]=LZ(M);value["MMM"]=MONTH_NAMES[M-1];value["NNN"]=MONTH_NAMES[M+11];value["d"]=d;value["dd"]=LZ(d);value["E"]=DAY_NAMES[E+7];value["EE"]=DAY_NAMES[E];value["H"]=H;value["HH"]=LZ(H);if(H==0){value["h"]=12;}
else if(H>12){value["h"]=H-12;}
else{value["h"]=H;}
value["hh"]=LZ(value["h"]);if(H>11){value["K"]=H-12;}else{value["K"]=H;}
value["k"]=H+1;value["KK"]=LZ(value["K"]);value["kk"]=LZ(value["k"]);if(H>11){value["a"]="PM";}
else{value["a"]="AM";}
value["m"]=m;value["mm"]=LZ(m);value["s"]=s;value["ss"]=LZ(s);while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}
if(value[token]!=null){result=result+value[token];}
else{result=result+token;}}
return result;}
function _isInteger(val){var digits="1234567890";for(var i=0;i<val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false;}}
return true;}
function _getInt(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length<minlength){return null;}
if(_isInteger(token)){return token;}}
return null;}
function getDateFromFormat(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getYear();var month=now.getMonth()+1;var date=1;var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var ampm="";while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}
if(token=="yyyy"||token=="yy"||token=="y"){if(token=="yyyy"){x=4;y=4;}
if(token=="yy"){x=2;y=2;}
if(token=="y"){x=2;y=4;}
year=_getInt(val,i_val,x,y);if(year==null){return 0;}
i_val+=year.length;if(year.length==2){if(year>70){year=1900+(year-0);}
else{year=2000+(year-0);}}}
else if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i<MONTH_NAMES.length;i++){var month_name=MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){if(token=="MMM"||(token=="NNN"&&i>11)){month=i+1;if(month>12){month-=12;}
i_val+=month_name.length;break;}}}
if((month<1)||(month>12)){return 0;}}
else if(token=="EE"||token=="E"){for(var i=0;i<DAY_NAMES.length;i++){var day_name=DAY_NAMES[i];if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){i_val+=day_name.length;break;}}}
else if(token=="MM"||token=="M"){month=_getInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12)){return 0;}
i_val+=month.length;}
else if(token=="dd"||token=="d"){date=_getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return 0;}
i_val+=date.length;}
else if(token=="hh"||token=="h"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0;}
i_val+=hh.length;}
else if(token=="HH"||token=="H"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0;}
i_val+=hh.length;}
else if(token=="KK"||token=="K"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0;}
i_val+=hh.length;}
else if(token=="kk"||token=="k"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0;}
i_val+=hh.length;hh--;}
else if(token=="mm"||token=="m"){mm=_getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0;}
i_val+=mm.length;}
else if(token=="ss"||token=="s"){ss=_getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0;}
i_val+=ss.length;}
else if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM";}
else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM";}
else{return 0;}
i_val+=2;}
else{if(val.substring(i_val,i_val+token.length)!=token){return 0;}
else{i_val+=token.length;}}}
if(i_val!=val.length){return 0;}
if(month==2){if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(date>29){return 0;}}
else{if(date>28){return 0;}}}
if((month==4)||(month==6)||(month==9)||(month==11)){if(date>30){return 0;}}
if(hh<12&&ampm=="PM"){hh=hh-0+12;}
else if(hh>11&&ampm=="AM"){hh-=12;}
var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime();}
function parseDate(val){var preferEuro=(arguments.length==2)?arguments[1]:false;generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');dateFirst=new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst');var d=null;for(var i=0;i<checkList.length;i++){var l=window[checkList[i]];for(var j=0;j<l.length;j++){d=getDateFromFormat(val,l[j]);if(d!=0){return new Date(d);}}}
return null;}
function PopupWindow_getXYPosition(anchorname){var coordinates;if(this.type=="WINDOW"){coordinates=getAnchorWindowPosition(anchorname);}
else{coordinates=getAnchorPosition(anchorname);}
this.x=coordinates.x;this.y=coordinates.y;}
function PopupWindow_setSize(width,height){this.width=width;this.height=height;}
function PopupWindow_populate(contents){this.contents=contents;this.populated=false;}
function PopupWindow_setUrl(url){this.url=url;}
function PopupWindow_setWindowProperties(props){this.windowProperties=props;}
function PopupWindow_refresh(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).innerHTML=this.contents;}
else if(this.use_css){document.all[this.divName].innerHTML=this.contents;}
else if(this.use_layers){var d=document.layers[this.divName];d.document.open();d.document.writeln(this.contents);d.document.close();}}
else{if(this.popupWindow!=null&&!this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url;}
else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close();}
this.popupWindow.focus();}}}
function PopupWindow_showPopup(anchorname){this.getXYPosition(anchorname);this.x+=this.offsetX;this.y+=this.offsetY;if(!this.populated&&(this.contents!="")){this.populated=true;this.refresh();}
if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.left=this.x+"px";document.getElementById(this.divName).style.top=this.y+"px";document.getElementById(this.divName).style.visibility="visible";}
else if(this.use_css){document.all[this.divName].style.left=this.x;document.all[this.divName].style.top=this.y;document.all[this.divName].style.visibility="visible";}
else if(this.use_layers){document.layers[this.divName].left=this.x;document.layers[this.divName].top=this.y;document.layers[this.divName].visibility="visible";}}
else{if(this.popupWindow==null||this.popupWindow.closed){if(this.x<0){this.x=0;}
if(this.y<0){this.y=0;}
if(screen&&screen.availHeight){if((this.y+this.height)>screen.availHeight){this.y=screen.availHeight-this.height;}}
if(screen&&screen.availWidth){if((this.x+this.width)>screen.availWidth){this.x=screen.availWidth-this.width;}}
var avoidAboutBlank=window.opera||(document.layers&&!navigator.mimeTypes['*'])||navigator.vendor=='KDE'||(document.childNodes&&!document.all&&!navigator.taintEnabled);this.popupWindow=window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");}
this.refresh();}}
function PopupWindow_hidePopup(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.visibility="hidden";}
else if(this.use_css){document.all[this.divName].style.visibility="hidden";}
else if(this.use_layers){document.layers[this.divName].visibility="hidden";}}
else{if(this.popupWindow&&!this.popupWindow.closed){this.popupWindow.close();this.popupWindow=null;}}}
function PopupWindow_isClicked(e){if(this.divName!=null){if(this.use_layers){var clickX=e.pageX;var clickY=e.pageY;var t=document.layers[this.divName];if((clickX>t.left)&&(clickX<t.left+t.clip.width)&&(clickY>t.top)&&(clickY<t.top+t.clip.height)){return true;}
else{return false;}}
else if(document.all){var t=window.event.srcElement;while(t.parentElement!=null){if(t.id==this.divName){return true;}
t=t.parentElement;}
return false;}
else if(this.use_gebi&&e){var t=e.originalTarget;try{while(t.parentNode!=null){if(t.id==this.divName){return true;}
	t=t.parentNode;}}catch(err){}
return false;}
return false;}
return false;}
function PopupWindow_hideIfNotClicked(e){if(this.autoHideEnabled&&!this.isClicked(e)){this.hidePopup();}}
function PopupWindow_autoHide(){this.autoHideEnabled=true;}
function PopupWindow_hidePopupWindows(e){for(var i=0;i<popupWindowObjects.length;i++){if(popupWindowObjects[i]!=null){var p=popupWindowObjects[i];p.hideIfNotClicked(e);}}}
function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP);}
window.popupWindowOldEventListener=document.onmouseup;if(window.popupWindowOldEventListener!=null){document.onmouseup=new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");}
else{document.onmouseup=PopupWindow_hidePopupWindows;}}
function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex=0;}
if(!window.popupWindowObjects){window.popupWindowObjects=new Array();}
if(!window.listenerAttached){window.listenerAttached=true;PopupWindow_attachListener();}
this.index=popupWindowIndex++;popupWindowObjects[this.index]=this;this.divName=null;this.popupWindow=null;this.width=0;this.height=0;this.populated=false;this.visible=false;this.autoHideEnabled=false;this.contents="";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName=arguments[0];}
else{this.type="WINDOW";}
this.use_gebi=false;this.use_css=false;this.use_layers=false;if(document.getElementById){this.use_gebi=true;}
else if(document.all){this.use_css=true;}
else if(document.layers){this.use_layers=true;}
else{this.type="WINDOW";}
this.offsetX=0;this.offsetY=0;this.getXYPosition=PopupWindow_getXYPosition;this.populate=PopupWindow_populate;this.setUrl=PopupWindow_setUrl;this.setWindowProperties=PopupWindow_setWindowProperties;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.setSize=PopupWindow_setSize;this.isClicked=PopupWindow_isClicked;this.autoHide=PopupWindow_autoHide;this.hideIfNotClicked=PopupWindow_hideIfNotClicked;}
function CalendarPopup(){var c;if(arguments.length>0){c=new PopupWindow(arguments[0]);}
else{c=new PopupWindow();c.setSize(150,175);}
c.offsetX=-152;c.offsetY=25;c.autoHide();c.monthNames=new Array("January","February","March","April","May","June","July","August","September","October","November","December");c.monthAbbreviations=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");c.dayHeaders=new Array("S","M","T","W","T","F","S");c.returnFunction="CP_tmpReturnFunction";c.returnMonthFunction="CP_tmpReturnMonthFunction";c.returnQuarterFunction="CP_tmpReturnQuarterFunction";c.returnYearFunction="CP_tmpReturnYearFunction";c.weekStartDay=0;c.isShowYearNavigation=false;c.displayType="date";c.disabledWeekDays=new Object();c.disabledDatesExpression="";c.yearSelectStartOffset=2;c.currentDate=null;c.todayText="Today";c.cssPrefix="";c.isShowNavigationDropdowns=false;c.isShowYearNavigationInput=false;window.CP_calendarObject=null;window.CP_targetInput=null;window.CP_dateFormat="MM/dd/yyyy";c.copyMonthNamesToWindow=CP_copyMonthNamesToWindow;c.setReturnFunction=CP_setReturnFunction;c.setReturnMonthFunction=CP_setReturnMonthFunction;c.setReturnQuarterFunction=CP_setReturnQuarterFunction;c.setReturnYearFunction=CP_setReturnYearFunction;c.setMonthNames=CP_setMonthNames;c.setMonthAbbreviations=CP_setMonthAbbreviations;c.setDayHeaders=CP_setDayHeaders;c.setWeekStartDay=CP_setWeekStartDay;c.setDisplayType=CP_setDisplayType;c.setDisabledWeekDays=CP_setDisabledWeekDays;c.addDisabledDates=CP_addDisabledDates;c.setYearSelectStartOffset=CP_setYearSelectStartOffset;c.setTodayText=CP_setTodayText;c.showYearNavigation=CP_showYearNavigation;c.showCalendar=CP_showCalendar;c.hideCalendar=CP_hideCalendar;c.getStyles=getCalendarStyles;c.refreshCalendar=CP_refreshCalendar;c.getCalendar=CP_getCalendar;c.select=CP_select;c.setCssPrefix=CP_setCssPrefix;c.showNavigationDropdowns=CP_showNavigationDropdowns;c.showYearNavigationInput=CP_showYearNavigationInput;c.copyMonthNamesToWindow();return c;}
function CP_copyMonthNamesToWindow(){if(typeof(window.MONTH_NAMES)!="undefined"&&window.MONTH_NAMES!=null){window.MONTH_NAMES=new Array();for(var i=0;i<this.monthNames.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthNames[i];}
for(var i=0;i<this.monthAbbreviations.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthAbbreviations[i];}}}
function CP_tmpReturnFunction(y,m,d){if(window.CP_targetInput!=null){var dt=new Date(y,m-1,d,0,0,0);if(window.CP_calendarObject!=null){window.CP_calendarObject.copyMonthNamesToWindow();}
window.CP_targetInput.value=formatDate(dt,window.CP_dateFormat);}
else{alert('Use setReturnFunction() to define which function will get the clicked results!');}}
function CP_tmpReturnMonthFunction(y,m){alert('Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , month='+m);}
function CP_tmpReturnQuarterFunction(y,q){alert('Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , quarter='+q);}
function CP_tmpReturnYearFunction(y){alert('Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year='+y);}
function CP_setReturnFunction(name){this.returnFunction=name;}
function CP_setReturnMonthFunction(name){this.returnMonthFunction=name;}
function CP_setReturnQuarterFunction(name){this.returnQuarterFunction=name;}
function CP_setReturnYearFunction(name){this.returnYearFunction=name;}
function CP_setMonthNames(){for(var i=0;i<arguments.length;i++){this.monthNames[i]=arguments[i];}
this.copyMonthNamesToWindow();}
function CP_setMonthAbbreviations(){for(var i=0;i<arguments.length;i++){this.monthAbbreviations[i]=arguments[i];}
this.copyMonthNamesToWindow();}
function CP_setDayHeaders(){for(var i=0;i<arguments.length;i++){this.dayHeaders[i]=arguments[i];}}
function CP_setWeekStartDay(day){this.weekStartDay=day;}
function CP_showYearNavigation(){this.isShowYearNavigation=(arguments.length>0)?arguments[0]:true;}
function CP_setDisplayType(type){if(type!="date"&&type!="week-end"&&type!="month"&&type!="quarter"&&type!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false;}
this.displayType=type;}
function CP_setYearSelectStartOffset(num){this.yearSelectStartOffset=num;}
function CP_setDisabledWeekDays(){this.disabledWeekDays=new Object();for(var i=0;i<arguments.length;i++){this.disabledWeekDays[arguments[i]]=true;}}
function CP_addDisabledDates(start,end){if(arguments.length==1){end=start;}
if(start==null&&end==null){return;}
if(this.disabledDatesExpression!=""){this.disabledDatesExpression+="||";}
if(start!=null){start=parseDate(start);start=""+start.getFullYear()+LZ(start.getMonth()+1)+LZ(start.getDate());}
if(end!=null){end=parseDate(end);end=""+end.getFullYear()+LZ(end.getMonth()+1)+LZ(end.getDate());}
if(start==null){this.disabledDatesExpression+="(ds<="+end+")";}
else if(end==null){this.disabledDatesExpression+="(ds>="+start+")";}
else{this.disabledDatesExpression+="(ds>="+start+"&&ds<="+end+")";}}
function CP_setTodayText(text){this.todayText=text;}
function CP_setCssPrefix(val){this.cssPrefix=val;}
function CP_showNavigationDropdowns(){this.isShowNavigationDropdowns=(arguments.length>0)?arguments[0]:true;}
function CP_showYearNavigationInput(){this.isShowYearNavigationInput=(arguments.length>0)?arguments[0]:true;}
function CP_hideCalendar(){if(arguments.length>0){window.popupWindowObjects[arguments[0]].hidePopup();}
else{this.hidePopup();}}
function CP_refreshCalendar(index){var calObject=window.popupWindowObjects[index];if(arguments.length>1){calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]));}
else{calObject.populate(calObject.getCalendar());}
calObject.refresh();}
function CP_showCalendar(anchorname){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date();}
else{this.currentDate=new Date(parseDate(arguments[1]));}}
this.populate(this.getCalendar());this.showPopup(anchorname);}
function CP_select(inputobj,linkname,format){var selectedDate=(arguments.length>3)?arguments[3]:null;if(!window.getDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return;}
if(this.displayType!="date"&&this.displayType!="week-end"){alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");return;}
if(inputobj.type!="text"&&inputobj.type!="hidden"&&inputobj.type!="textarea"){alert("calendar.select: Input object passed is not a valid form input object");window.CP_targetInput=null;return;}
if(inputobj.disabled){return;}
window.CP_targetInput=inputobj;window.CP_calendarObject=this;this.currentDate=null;var time=0;if(selectedDate!=null){time=getDateFromFormat(selectedDate,format)}
else if(inputobj.value!=""){time=getDateFromFormat(inputobj.value,format);}
if(selectedDate!=null||inputobj.value!=""){if(time==0){this.currentDate=null;}
else{this.currentDate=new Date(time);}}
window.CP_dateFormat=format;this.showCalendar(linkname);}
function getCalendarStyles(){var result="";var p="";if(this!=null&&typeof(this.cssPrefix)!="undefined"&&this.cssPrefix!=null&&this.cssPrefix!=""){p=this.cssPrefix;}
result+="<STYLE>\n";result+="."+p+"cpYearNavigation,."+p+"cpMonthNavigation { background-color:#C0C0C0; text-align:center; vertical-align:center; text-decoration:none; color:#000000; font-weight:bold; }\n";result+="."+p+"cpDayColumnHeader, ."+p+"cpYearNavigation,."+p+"cpMonthNavigation,."+p+"cpCurrentMonthDate,."+p+"cpCurrentMonthDateDisabled,."+p+"cpOtherMonthDate,."+p+"cpOtherMonthDateDisabled,."+p+"cpCurrentDate,."+p+"cpCurrentDateDisabled,."+p+"cpTodayText,."+p+"cpTodayTextDisabled,."+p+"cpText { font-family:arial; font-size:8pt; }\n";result+="TD."+p+"cpDayColumnHeader { text-align:right; border:solid thin #C0C0C0;border-width:0px 0px 1px 0px; }\n";result+="."+p+"cpCurrentMonthDate, ."+p+"cpOtherMonthDate, ."+p+"cpCurrentDate  { text-align:right; text-decoration:none; }\n";result+="."+p+"cpCurrentMonthDateDisabled, ."+p+"cpOtherMonthDateDisabled, ."+p+"cpCurrentDateDisabled { color:#D0D0D0; text-align:right; text-decoration:line-through; }\n";result+="."+p+"cpCurrentMonthDate, .cpCurrentDate { color:#000000; }\n";result+="."+p+"cpOtherMonthDate { color:#808080; }\n";result+="TD."+p+"cpCurrentDate { color:white; background-color: #C0C0C0; border-width:1px; border:solid thin #800000; }\n";result+="TD."+p+"cpCurrentDateDisabled { border-width:1px; border:solid thin #FFAAAA; }\n";result+="TD."+p+"cpTodayText, TD."+p+"cpTodayTextDisabled { border:solid thin #C0C0C0; border-width:1px 0px 0px 0px;}\n";result+="A."+p+"cpTodayText, SPAN."+p+"cpTodayTextDisabled { height:20px; }\n";result+="A."+p+"cpTodayText { color:black; }\n";result+="."+p+"cpTodayTextDisabled { color:#D0D0D0; }\n";result+="."+p+"cpBorder { border:solid thin #808080; }\n";result+="</STYLE>\n";return result;}
function CP_getCalendar(){var now=new Date();if(this.type=="WINDOW"){var windowref="window.opener.";}
else{var windowref="";}
var result="";if(this.type=="WINDOW"){result+="<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>\n";result+='<CENTER><TABLE WIDTH=100% BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>\n';}
else{result+='<TABLE CLASS="'+this.cssPrefix+'cpBorder" WIDTH=144 BORDER=1 BORDERWIDTH=1 CELLSPACING=0 CELLPADDING=1>\n';result+='<TR><TD ALIGN=CENTER>\n';result+='<CENTER>\n';}
if(this.displayType=="date"||this.displayType=="week-end"){if(this.currentDate==null){this.currentDate=now;}
if(arguments.length>0){var month=arguments[0];}
else{var month=this.currentDate.getMonth()+1;}
if(arguments.length>1&&arguments[1]>0&&arguments[1]-0==arguments[1]){var year=arguments[1];}
else{var year=this.currentDate.getFullYear();}
var daysinmonth=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if(((year%4==0)&&(year%100!=0))||(year%400==0)){daysinmonth[2]=29;}
var current_month=new Date(year,month-1,1);var display_year=year;var display_month=month;var display_date=1;var weekday=current_month.getDay();var offset=0;offset=(weekday>=this.weekStartDay)?weekday-this.weekStartDay:7-this.weekStartDay+weekday;if(offset>0){display_month--;if(display_month<1){display_month=12;display_year--;}
display_date=daysinmonth[display_month]-offset+1;}
var next_month=month+1;var next_month_year=year;if(next_month>12){next_month=1;next_month_year++;}
var last_month=month-1;var last_month_year=year;if(last_month<1){last_month=12;last_month_year--;}
var date_class;if(this.type!="WINDOW"){result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";}
result+='<TR>\n';var refresh=windowref+'CP_refreshCalendar';var refreshLink='javascript:'+refresh;if(this.isShowNavigationDropdowns){result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="78" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpMonthNavigation" name="cpMonth" onChange="'+refresh+'('+this.index+',this.options[this.selectedIndex].value-0,'+(year-0)+');">';for(var monthCounter=1;monthCounter<=12;monthCounter++){var selected=(monthCounter==month)?'SELECTED':'';result+='<option value="'+monthCounter+'" '+selected+'>'+this.monthNames[monthCounter-1]+'</option>';}
result+='</select></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="56" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpYearNavigation" name="cpYear" onChange="'+refresh+'('+this.index+','+month+',this.options[this.selectedIndex].value-0);">';for(var yearCounter=year-this.yearSelectStartOffset;yearCounter<=year+this.yearSelectStartOffset;yearCounter++){var selected=(yearCounter==year)?'SELECTED':'';result+='<option value="'+yearCounter+'" '+selected+'>'+yearCounter+'</option>';}
result+='</select></TD>';}
else{if(this.isShowYearNavigation){result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;</A></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="58"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+'</SPAN></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;</A></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year-1)+');">&lt;</A></TD>';if(this.isShowYearNavigationInput){result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><INPUT NAME="cpYear" CLASS="'+this.cssPrefix+'cpYearNavigation" SIZE="4" MAXLENGTH="4" VALUE="'+year+'" onBlur="'+refresh+'('+this.index+','+month+',this.value-0);"></TD>';}
else{result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><SPAN CLASS="'+this.cssPrefix+'cpYearNavigation">'+year+'</SPAN></TD>';}
result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year+1)+');">&gt;</A></TD>';}
else{result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;&lt;</A></TD>\n';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="100"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+' '+year+'</SPAN></TD>\n';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;&gt;</A></TD>\n';}}
result+='</TR></TABLE>\n';result+='<TABLE WIDTH=120 BORDER=0 CELLSPACING=0 CELLPADDING=1 ALIGN=CENTER>\n';result+='<TR>\n';for(var j=0;j<7;j++){result+='<TD CLASS="'+this.cssPrefix+'cpDayColumnHeader" WIDTH="14%"><SPAN CLASS="'+this.cssPrefix+'cpDayColumnHeader">'+this.dayHeaders[(this.weekStartDay+j)%7]+'</TD>\n';}
result+='</TR>\n';for(var row=1;row<=6;row++){result+='<TR>\n';for(var col=1;col<=7;col++){var disabled=false;if(this.disabledDatesExpression!=""){var ds=""+display_year+LZ(display_month)+LZ(display_date);eval("disabled=("+this.disabledDatesExpression+")");}
var dateClass="";if((display_month==this.currentDate.getMonth()+1)&&(display_date==this.currentDate.getDate())&&(display_year==this.currentDate.getFullYear())){dateClass="cpCurrentDate";}
else if(display_month==month){dateClass="cpCurrentMonthDate";}
else{dateClass="cpOtherMonthDate";}
if(disabled||this.disabledWeekDays[col-1]){result+=' <TD CLASS="'+this.cssPrefix+dateClass+'"><SPAN CLASS="'+this.cssPrefix+dateClass+'Disabled">'+display_date+'</SPAN></TD>\n';}
else{var selected_date=display_date;var selected_month=display_month;var selected_year=display_year;if(this.displayType=="week-end"){var d=new Date(selected_year,selected_month-1,selected_date,0,0,0,0);d.setDate(d.getDate()+(7-col));selected_year=d.getYear();if(selected_year<1000){selected_year+=1900;}
selected_month=d.getMonth()+1;selected_date=d.getDate();}
result+=' <TD CLASS="'+this.cssPrefix+dateClass+'"><A HREF="javascript:'+windowref+this.returnFunction+'('+selected_year+','+selected_month+','+selected_date+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+this.cssPrefix+dateClass+'">'+display_date+'</A></TD>\n';}
display_date++;if(display_date>daysinmonth[display_month]){display_date=1;display_month++;}
if(display_month>12){display_month=1;display_year++;}}
result+='</TR>';}
var current_weekday=now.getDay()-this.weekStartDay;if(current_weekday<0){current_weekday+=7;}
result+='<TR>\n';result+=' <TD COLSPAN=7 ALIGN=CENTER CLASS="'+this.cssPrefix+'cpTodayText">\n';if(this.disabledDatesExpression!=""){var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());eval("disabled=("+this.disabledDatesExpression+")");}
if(disabled||this.disabledWeekDays[current_weekday+1]){result+='  <SPAN CLASS="'+this.cssPrefix+'cpTodayTextDisabled">'+this.todayText+'</SPAN>\n';}
else{result+='  <A CLASS="'+this.cssPrefix+'cpTodayText" HREF="javascript:'+windowref+this.returnFunction+'(\''+now.getFullYear()+'\',\''+(now.getMonth()+1)+'\',\''+now.getDate()+'\');'+windowref+'CP_hideCalendar(\''+this.index+'\');">'+this.todayText+'</A>\n';}
result+='  <BR>\n';result+=' </TD></TR></TABLE></CENTER></TD></TR></TABLE>\n';}
if(this.displayType=="month"||this.displayType=="quarter"||this.displayType=="year"){if(arguments.length>0){var year=arguments[0];}
else{if(this.displayType=="year"){var year=now.getFullYear()-this.yearSelectStartOffset;}
else{var year=now.getFullYear();}}
if(this.displayType!="year"&&this.isShowYearNavigation){result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result+='<TR>\n';result+=' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-1)+');">&lt;&lt;</A></TD>\n';result+=' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="100">'+year+'</TD>\n';result+=' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+1)+');">&gt;&gt;</A></TD>\n';result+='</TR></TABLE>\n';}}
if(this.displayType=="month"){result+='<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<4;i++){result+='<TR>';for(var j=0;j<3;j++){var monthindex=((i*3)+j);result+='<TD WIDTH=33% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnMonthFunction+'('+year+','+(monthindex+1)+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+this.monthAbbreviations[monthindex]+'</A></TD>';}
result+='</TR>';}
result+='</TABLE></CENTER></TD></TR></TABLE>\n';}
if(this.displayType=="quarter"){result+='<BR><TABLE WIDTH=120 BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<2;i++){result+='<TR>';for(var j=0;j<2;j++){var quarter=((i*2)+j+1);result+='<TD WIDTH=50% ALIGN=CENTER><BR><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnQuarterFunction+'('+year+','+quarter+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">Q'+quarter+'</A><BR><BR></TD>';}
result+='</TR>';}
result+='</TABLE></CENTER></TD></TR></TABLE>\n';}
if(this.displayType=="year"){var yearColumnSize=4;result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result+='<TR>\n';result+=' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-(yearColumnSize*2))+');">&lt;&lt;</A></TD>\n';result+=' <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+(yearColumnSize*2))+');">&gt;&gt;</A></TD>\n';result+='</TR></TABLE>\n';result+='<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<yearColumnSize;i++){for(var j=0;j<2;j++){var currentyear=year+(j*yearColumnSize)+i;result+='<TD WIDTH=50% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnYearFunction+'('+currentyear+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+currentyear+'</A></TD>';}
result+='</TR>';}
result+='</TABLE></CENTER></TD></TR></TABLE>\n';}
if(this.type=="WINDOW"){result+="</BODY></HTML>\n";}
return result;}

// set styles
document.write(getCalendarStyles());

// init calendar
var date_select = new CalendarPopup("calendar-div");
// :NOTE: removed; broken in FF3
//date_select.setCssPrefix("CAL");
//date_select.showNavigationDropdowns();
date_select.offsetX = 35;
date_select.offsetY = 0;

// changes to work with drop downs
function SelectDate(prefix) {
  date_select.dateFormat = 'MM/dd/yyyy'
  date_select.setReturnFunction('SetDateValues');
  date_select.showCalendar('anchor_' + prefix);
  field_prefix = prefix;
}
function SetDateValues(y, m, d) {
  m = LZ(m);
  d = LZ(d);
  $(field_prefix + '_year').value  = y;
  $(field_prefix + '_month').value = m;
  $(field_prefix + '_day').value   = d;
}
function ClearDateValues(field_prefix) {
  $(field_prefix + '_year').value  = '';
  $(field_prefix + '_month').value = '';
  $(field_prefix + '_day').value   = '';
}


