
$=Ext.get;$$=Ext.DomQuery.select;Object.extend=function(destination,source){for(var property in source)
destination[property]=source[property];return destination;};Object.extend(Object.prototype,{oshift:function(){for(i in this){return this[i];}}});var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}};Object.extend(String,{interpret:function(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return String(this);},truncate:function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var self=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';},toQueryParams:function(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};var pieces=match[1].split(separator||'&');var hash={};for(var i=0;i<pieces.length;i++){var pair=pieces[i].split('=');var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);hash[key]=value;}
return hash;},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();},underscore:function(){return this.gsub(/::/,'/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},dasherize:function(){return this.gsub(/_/,'-');},inspect:function(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'";},toJSON:function(){return this.inspect(true);},unfilterJSON:function(filter){return this.sub(filter||Prototype.JSONFilter,'#{1}');},isJSON:function(){var str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},blank:function(){return/^\s*$/.test(this);},interpolate:function(object,pattern){return new Template(this,pattern).evaluate(object);},getExtension:function(){return this.substr(this.lastIndexOf('.')+1);},stripExtension:function(){return this.substr(0,this.lastIndexOf('.'));},baseName:function(){var s=this.split('/');return s[s.length-1].substr(0,s[s.length-1].lastIndexOf('.'));}});function evalScripts(wrapper){Ext.each($(wrapper).query('script'),function(e){eval(e.innerHTML);});}
Ext.Element.prototype.movePosition=function(){var box=this.getBox();return{x:box.x,y:box.y,width:box.width,height:box.height}}
Ext.Element.prototype.ghostIn=function(target,callback){var el=this.getFxEl();var ghostElem=Ext.DomHelper.append(document.body,'<div style="border: 1px solid #fff; background-color: #fff; opacity: 0.3">&nbsp;</div>',true);ghostElem.setBox(target.movePosition());var box=el.getBox();var display=el.getStyle('display');el.setStyle({'display':'none'});ghostElem.shift({x:box.x,y:box.y,width:box.width,height:box.height,opacity:.95,duration:1,callback:function(){el.setStyle({'display':display});el.show();setTimeout(function(){ghostElem.remove()},500);if(callback)callback();}});}
Ext.Element.prototype.ghostOut=function(target,options){var el=this.getFxEl();var ghostElem=Ext.DomHelper.append(document.body,'<div style="border: 1px solid #fff; background-color: #fff; opacity: 0.9">&nbsp;</div>',true);ghostElem.setBox(el.getBox());var targetBox=target.movePosition();el.hide();var display=el.getStyle('display');el.setStyle({'display':'none'});ghostElem.shift({x:targetBox.x,y:targetBox.y,width:targetBox.width,height:targetBox.height,opacity:0.1,duration:1,callback:function(){el.setStyle({'display':display});if(options.callback)options.callback();ghostElem.remove();}});}
Ext.Element.prototype.isClipped=function(){var el=this;var clipEl=el.up('{clip*=rect}');if(!clipEl)return false;var clipBox=clipEl.getBox();var elBox=el.getBox();if(elBox.x>clipBox.right)return true;if(elBox.y>clipBox.bottom)return true;if(elBox.x<clipBox.x)return true;if(elBox.bottom<clipBox.y)return true;return false;}
Ext.Element.prototype.clipBox=function(){var el=this;var clipEl=el.up('{clip*=rect}');if(!clipEl)return false;return clipEl.getBox();}