// JQuery URL Parser
// Written by Mark Perkins, mark@allmarkedup.com
// License: http://unlicense.org/ (i.e. do what you want with it!)
jQuery.url=function(){var d={},b={},c={url:window.location,strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},
j=function(){str=decodeURI(c.url);for(var a=c.parser[c.strictMode?"strict":"loose"].exec(str),e={},g=14;g--;)e[c.key[g]]=a[g]||"";e[c.q.name]={};e[c.key[12]].replace(c.q.parser,function(k,h,i){if(h)e[c.q.name][h]=i});return e},f=function(){b=j();var a=b.path;d=[];d=b.path.length==1?{}:(a.charAt(a.length-1)=="/"?a.substring(1,a.length-1):path=a.substring(1)).split("/")};return{setMode:function(a){c.strictMode=a=="strict"?true:false;return this},setUrl:function(a){c.url=a===undefined?window.location:
a;f();return this},segment:function(a){jQuery.isEmptyObject(b)&&f();if(a===undefined)return d.length;return d[a]===""||d[a]===undefined?null:d[a]},attr:function(a){jQuery.isEmptyObject(b)&&f();if(a=="base")return b.port!==null&&b.port!==""?b.protocol+"://"+b.host+":"+b.port+"/":b.protocol+"://"+b.host+"/";return b[a]===""?null:b[a]},param:function(a){jQuery.isEmptyObject(b)&&f();return b.queryKey[a]===null?null:b.queryKey[a]}}}();
