if(!String.prototype.trim){String.prototype.trim=String.prototype.strip}Object.extend(Array.prototype,{sum:function(){if(this.length==0){return 0}var c=this[0];for(var b=1,a=this.length;b<a;b++){c+=this[b]}return c},diff:function(b){var d,a=this.length,c=[];for(d=0;d<a;d++){if(!b.include(this[d])){c.push(this[d])}}return c}});Date.isValid=function(e,a,c){var b=(e%4==0)&&(e%100!=0);if([1,3,5,7,8,10,12].include(a)&&c>31){return false}else{if([4,6,9,11].include(a)&&c>30){return false}}if(a==2&&(b&&c>29||!b&&c>28)){return false}return true};Position.elementOverlaps=function(c,a){c=$(c);a=$(a);var d=Position.cumulativeOffset(c);var b=Position.cumulativeOffset(a);if((d[0]>=b[0]&&d[0]<=(b[0]+a.offsetWidth)||(d[0]+c.offsetWidth)>=b[0]&&(d[0]+c.offsetWidth)<=(b[0]+a.offsetWidth))&&(d[1]>=b[1]&&d[1]<=(b[1]+a.offsetHeight)||(d[1]+c.offsetHeight)>=b[1]&&d[1]<=(b[1]+a.offsetHeight))){return true}return false};function toggleSelects(a){if(!Browser.IE6){return}a=$(a);$$("select").each(function(b){if(b.childOf(a)){return}if(a.visible()&&Position.elementOverlaps(b,a)){b.style.visibility="hidden"}else{b.style.visibility="visible"}})}var Browser=Object.extend({IE6:/MSIE 6/i.test(navigator.userAgent)&&Prototype.Browser.IE,IE7:/MSIE 7/i.test(navigator.userAgent)&&Prototype.Browser.IE,OLD_IE:/MSIE [1-6]/i.test(navigator.userAgent)&&Prototype.Browser.IE},Prototype.Browser);Element.addMethods({getFullWidth:function(a){a=$(a);var b=parseInt(a.getStyle("margin-left"))+parseInt(a.getStyle("margin-right"));return a.offsetWidth+b},getFullHeight:function(a){a=$(a);var b=parseInt(a.getStyle("margin-top"))+parseInt(a.getStyle("margin-bottom"));return a.offsetHeight+b},getContentWidth:function(a){a=$(a);var b=parseInt(a.getStyle("padding-left"))+parseInt(a.getStyle("padding-right"));return a.clientWidth-b},getContentHeight:function(a){a=$(a);var b=parseInt(a.getStyle("padding-top"))+parseInt(a.getStyle("padding-bottom"));return a.clientHeight-b},showNextTo:function(e){e=$(e);var k=arguments[1]||null;if(k){k=$(k)}var f=arguments[2]||"";var p=arguments[3]||null;var b=arguments[4]||{};var c=[0,0],h=[0,0],n=null,m=null;e.setStyle({visibility:"hidden",display:""});if(k&&k.tagName){if(["static","relative"].include(e.getStyle("position"))){e.style.position="absolute"}c=k.cumulativeOffset()}else{e.style.position=Browser.IE6?"absolute":"fixed";h=[document.viewport.getWidth(),document.viewport.getHeight()]}var g=k?k.offsetWidth:h[0];var a=k?k.offsetHeight:h[1];var j=c[0]+g/2-e.offsetWidth/2;var o=c[1]+a/2-e.offsetHeight/2;if(Browser.IE6&&!k){j+=document.documentElement.scrollLeft;o+=document.documentElement.scrollTop}f=f.toLowerCase().trim().split(" ");for(var d=0;d<f.length;d++){switch(f[d]){case"top":m=(n===null&&k)?c[1]-e.offsetHeight:c[1];break;case"bottom":m=(n===null&&k)?c[1]+a:c[1]+a-e.offsetHeight;break;case"right":n=(m===null&&k)?c[0]+g:c[0]+g-e.offsetWidth;break;case"left":n=(m===null&&k)?c[0]-e.offsetWidth:c[0];break;case"center":n=j;break;case"middle":m=o;break}}if(n===null){n=j}if(m===null){m=o}var l=Position.offsetParent(e).cumulativeOffset();n-=l[0];m-=l[1];e.setStyle({visibility:"visible",left:n+"px",top:m+"px"});if(p){e.hide();new Effect[p](e,b)}return e},show:function(c){c=$(c);var b=arguments[1]||null;if(b){c.update(arguments[1])}if(typeof arguments[3]=="object"){var a=arguments[3];c.showNextTo(a.target,a.position,a.effect,a.effectOptions)}else{c.style.display=""}if(arguments[2]){setTimeout(function(){c.hide()},arguments[2]*1000)}return c},realVisible:function(d){if(!$(d).visible()){return false}var b=d.ancestors(),e=b.length;for(var c=0;c<e;c++){if(!b[c].visible()){return false}}return true},getNodeIndex:function(d){d=$(d);var c=$(d.parentNode).childElements();for(var b=0,a=c.length;b<a;b++){if(c[b]==d){return b}}return -1},swap:function(d,c){var a=$(c).next();var b=!a?c.previous():a;$(d).insert({after:c});if(a){b.insert({before:d})}else{if(!a&&b==d){c.insert({after:d})}else{b.insert({after:d})}}}});Element.addMethods("SELECT",{selectAll:function(d,a){if(d.type!="select-multiple"){return}var c=d.options;for(var b=0;b<c.length;b++){c[b].selected=(typeof a=="undefined"?true:a)}}});
