﻿new function(a){var b=a.separator||"&",e=a.spaces===false?false:true,g=a.suffix===false?"":"[]",d=a.prefix===false?false:true,f=d?a.hash===true?"#":"?":"",c=a.numbers===false?false:true;jQuery.query=new function(){var a=function(a,b){return a!=undefined&&a!==null&&(!!b?a.constructor==b:true)},h=function(e){var c,f=/\[([^[]*)\]/g,b=/^(\S+?)(\[\S*\])?$/.exec(e),d=b[1],a=[];while(c=f.exec(b[2]))a.push(c[1]);return [d,a]},d=function(b,c,e){var j,g=c.shift();if(typeof b!="object")b=null;if(g===""){if(!b)b=[];if(a(b,Array))b.push(c.length==0?e:d(null,c.slice(0),e));else if(a(b,Object)){var f=0;while(b[f++]!=null);b[--f]=c.length==0?e:d(b[f],c.slice(0),e)}else{b=[];b.push(c.length==0?e:d(null,c.slice(0),e))}}else if(g&&g.match(/^\s*[0-9]+\s*$/)){var h=parseInt(g,10);if(!b)b=[];b[h]=c.length==0?e:d(b[h],c.slice(0),e)}else if(g){var h=g.replace(/^\s*|\s*$/g,"");if(!b)b={};if(a(b,Array)){var i={};for(var f=0;f<b.length;++f)i[f]=b[f];b=i}b[h]=c.length==0?e:d(b[h],c.slice(0),e)}else return e;return b},g=function(b){var a=this;a.keys={};if(b.queryObject)jQuery.each(b.get(),function(b,c){a.SET(b,c)});else jQuery.each(arguments,function(){var b=""+this;b=b.replace(/^[?#]/,"");b=b.replace(/[;&]$/,"");if(e)b=b.replace(/[+]/g," ");jQuery.each(b.split(/[&;]/),function(){var d=decodeURIComponent(this.split("=")[0]),b=decodeURIComponent(this.split("=")[1]);if(!d)return;if(c)if(/^[+-]?[0-9]+\.[0-9]*$/.test(b))b=parseFloat(b);else if(/^[+-]?[0-9]+$/.test(b))b=parseInt(b,10);b=!b&&b!==0?true:b;if(b!==false&&b!==true&&typeof b!="number")b=b;a.SET(d,b)})});return a};g.prototype={queryObject:true,has:function(d,c){var b=this.get(d);return a(b,c)},GET:function(e){if(!a(e))return this.keys;var c=h(e),f=c[0],d=c[1],b=this.keys[f];while(b!=null&&d.length!=0)b=b[d.shift()];return typeof b=="number"?b:b||""},"get":function(c){var b=this.GET(c);if(a(b,Object))return jQuery.extend(true,{},b);else if(a(b,Array))return b.slice(0);return b},SET:function(j,e){var i=!a(e)?null:e,b=h(j),c=b[0],g=b[1],f=this.keys[c];this.keys[c]=d(f,g.slice(0),i);return this},"set":function(a,b){return this.copy().SET(a,b)},REMOVE:function(a){return this.SET(a,null).COMPACT()},remove:function(a){return this.copy().REMOVE(a)},EMPTY:function(){var a=this;jQuery.each(a.keys,function(b){delete a.keys[b]});return a},load:function(a){var c=a.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1"),b=a.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new g(a.length==b.length?"":b,a.length==c.length?"":c)},empty:function(){return this.copy().EMPTY()},copy:function(){return new g(this)},COMPACT:function(){function b(c){var d=typeof c=="object"?a(c,Array)?[]:{}:c;if(typeof c=="object"){function e(b,d,c){if(a(b,Array))b.push(c);else b[d]=c}jQuery.each(c,function(f,c){if(!a(c))return true;e(d,f,b(c))})}return d}this.keys=b(this.keys);return this},compact:function(){return this.copy().COMPACT()},toString:function(){var i=0,c=[],d=[],h=this,g=function(d,e,b){if(!a(b)||b===false)return;var c=[encodeURIComponent(e)];if(b!==true){c.push("=");c.push(encodeURIComponent(b))}d.push(c.join(""))},e=function(c,a){var b=function(b){return !a||a==""?[b].join(""):[a,"[",b,"]"].join("")};jQuery.each(c,function(c,a){if(typeof a=="object")e(a,b(c));else g(d,b(c),a)})};e(this.keys);if(d.length>0)c.push(f);c.push(d.join(b));return c.join("")}};return new g(location.search,location.hash)}}(jQuery.query||{})
