jQuery.extend({__stringPrototype:{JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"},blank:function(s){return/^\s*$/.test(this.s(s)||" ");},camelize:function(s){var a=this.s(s).split("-"),i;s=[a[0]];for(i=1;i<a.length;i++){s.push(a[i].charAt(0).toUpperCase()+a[i].substring(1));}s=s.join("");return this.r(arguments,0,s);},capitalize:function(s){s=this.s(s);s=s.charAt(0).toUpperCase()+s.substring(1).toLowerCase();return this.r(arguments,0,s);},dasherize:function(s){s=this.s(s).split("_").join("-");return this.r(arguments,0,s);},empty:function(s){return this.s(s)==="";},endsWith:function(pattern,s){s=this.s(s);var d=s.length-pattern.length;return d>=0&&s.lastIndexOf(pattern)===d;},escapeHTML:function(s){s=this.s(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return this.r(arguments,0,s);},evalJSON:function(sanitize,s){s=this.s(s);var json=this.unfilterJSON(false,s);try{if(!sanitize||this.isJSON(json)){return eval("("+json+")");}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+s);},evalScripts:function(s){var scriptTags=this.extractScripts(this.s(s)),results=[];if(scriptTags.length>0){for(var i=0;i<scriptTags.length;i++){results.push(eval(scriptTags[i]));}}return results;},extractScripts:function(s){var matchAll=new RegExp(this.ScriptFragment,"img"),matchOne=new RegExp(this.ScriptFragment,"im"),scriptMatches=this.s(s).match(matchAll)||[],scriptTags=[];if(scriptMatches.length>0){for(var i=0;i<scriptMatches.length;i++){scriptTags.push(scriptMatches[i].match(matchOne)[1]||"");}}return scriptTags;},gsub:function(pattern,replacement,s){s=this.s(s);if(jQuery.isFunction(replacement)){s=this.sub(pattern,replacement,-1,s);}else{s=s.split(pattern).join(replacement);}return this.r(arguments,2,s);},include:function(pattern,s){return this.s(s).indexOf(pattern)>-1;},inspect:function(useDoubleQuotes,s){s=this.s(s);var escapedString;try{escapedString=this.sub(/[\x00-\x1f\\]/,function(match){var character=jQuery.__stringPrototype.specialChar[match[0]];return character?character:"\\u00"+match[0].charCodeAt().toPaddedString(2,16);},-1,s);}catch(e){escapedString=s;}s=(useDoubleQuotes)?'"'+escapedString.replace(/"/g,'\\"')+'"':"'"+escapedString.replace(/'/g,"\\'")+"'";return this.r(arguments,1,s);},interpolate:function(obj,pattern,s){s=this.s(s);if(!pattern){pattern=/(\#\{\s*(\w+)\s*\})/;}var gpattern=new RegExp(pattern.source,"g");var matches=s.match(gpattern),i;for(i=0;i<matches.length;i++){s=s.replace(matches[i],obj[matches[i].match(pattern)[2]]);}return this.r(arguments,2,s);},isJSON:function(s){s=this.s(s);if(this.blank(s)){return false;}s=s.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(s);},scan:function(pattern,replacement,s){s=this.s(s);this.sub(pattern,replacement,-1,s);return this.r(arguments,2,s);},startsWith:function(pattern,s){return this.s(s).indexOf(pattern)===0;},strip:function(s){s=jQuery.trim(this.s(s));return this.r(arguments,0,s);},stripScripts:function(s){s=this.s(s).replace(new RegExp(this.ScriptFragment,"img"),"");return this.r(arguments,0,s);},stripTags:function(s){s=this.s(s).replace(/<\/?[^>]+>/gi,"");return this.r(arguments,0,s);},sub:function(pattern,replacement,count,s){s=this.s(s);if(pattern.source&&!pattern.global){var patternMods=(pattern.ignoreCase)?"ig":"g";patternMods+=(pattern.multiline)?"m":"";pattern=new RegExp(pattern.source,patternMods);}var sarray=s.split(pattern),matches=s.match(pattern);if(jQuery.browser.msie){if(s.indexOf(matches[0])==0){sarray.unshift("");}if(s.lastIndexOf(matches[matches.length-1])==s.length-matches[matches.length-1].length){sarray.push("");}}count=(count<0)?(sarray.length-1):count||1;s=sarray[0];for(var i=1;i<sarray.length;i++){if(i<=count){if(jQuery.isFunction(replacement)){s+=replacement(matches[i-1]||matches)+sarray[i];}else{s+=replacement+sarray[i];}}else{s+=(matches[i-1]||matches)+sarray[i];}}return this.r(arguments,3,s);},succ:function(s){s=this.s(s);s=s.slice(0,s.length-1)+String.fromCharCode(s.charCodeAt(s.length-1)+1);return this.r(arguments,0,s);},times:function(count,s){s=this.s(s);var newS="";for(var i=0;i<count;i++){newS+=s;}return this.r(arguments,1,newS);},toJSON:function(s){return this.r(arguments,0,this.inspect(true,this.s(s)));},toQueryParams:function(separator,s){s=this.s(s);var paramsList=s.substring(s.indexOf("?")+1).split("#")[0].split(separator||"&"),params={},i,key,value,pair;for(i=0;i<paramsList.length;i++){pair=paramsList[i].split("=");key=decodeURIComponent(pair[0]);value=(pair[1])?decodeURIComponent(pair[1]):undefined;if(params[key]){if(typeof params[key]=="string"){params[key]=[params[key]];}params[key].push(value);}else{params[key]=value;}}return params;},truncate:function(length,truncation,s){s=this.s(s);length=length||30;truncation=(!truncation)?"...":truncation;s=(s.length>length)?s.slice(0,length-truncation.length)+truncation:String(s);return this.r(arguments,2,s);},underscore:function(s){s=this.sub(/[A-Z]/,function(c){return"_"+c.toLowerCase();},-1,this.s(s));if(s.charAt(0)=="_"){s=s.substring(1);}return this.r(arguments,0,s);},unescapeHTML:function(s){s=this.stripTags(this.s(s)).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">");return this.r(arguments,0,s);},unfilterJSON:function(filter,s){s=this.s(s);filter=filter||this.JSONFilter;var filtered=s.match(filter);s=(filtered!==null)?filtered[1]:s;return this.r(arguments,1,jQuery.trim(s));},r:function(args,size,s){if(args.length>size||this.str===undefined){return s;}else{this.str=""+s;return this;}},s:function(s){if(s===""||s){return s;}if(this.str===""||this.str){return this.str;}return this;}},string:function(str){if(str===String.prototype){jQuery.extend(String.prototype,jQuery.__stringPrototype);}else{return jQuery.extend({str:str},jQuery.__stringPrototype);}}});jQuery.__stringPrototype.parseQuery=jQuery.__stringPrototype.toQueryParams;
