(function(c){function d(j,b){var i=this,a,k,l;b=i.settings=b||{};if(/^(mailto|news|javascript|about):/i.test(j)||/^\s*#/.test(j)){i.source=j;return}if(j.indexOf("/")===0&&j.indexOf("//")!==0){j=(b.base_uri?b.base_uri.protocol||"http":"http")+"://mce_host"+j}if(j.indexOf(":/")===-1&&j.indexOf("//")!==0){j=(b.base_uri.protocol||"http")+"://mce_host"+i.toAbsPath(b.base_uri.path,j)}j=j.replace(/@@/g,"(mce_at)");j=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(j);c(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"]).each(function(f,g){var e=j[f];if(e){e=e.replace(/\(mce_at\)/g,"@@")}i[g]=e});if(l=b.base_uri){if(!i.protocol){i.protocol=l.protocol}if(!i.userInfo){i.userInfo=l.userInfo}if(!i.port&&i.host=="mce_host"){i.port=l.port}if(!i.host||i.host=="mce_host"){i.host=l.host}i.source=""}}c.extend(d.prototype,{setPath:function(a){var b=this;a=/^(.*?)\/?(\w+)?$/.exec(a);b.path=a[0];b.directory=a[1];b.file=a[2];b.source="";b.getURI()},toRelative:function(f){var b=this,a;if(f==="./"){return f}f=new d(f,{base_uri:b});if((f.host!="mce_host"&&b.host!=f.host&&f.host)||b.port!=f.port||b.protocol!=f.protocol){return f.getURI()}a=b.toRelPath(b.path,f.path);if(f.query){a+="?"+f.query}if(f.anchor){a+="#"+f.anchor}return a},toAbsolute:function(b,a){var b=new d(b,{base_uri:this});return b.getURI(this.host==b.host?a:0)},toRelPath:function(b,a){var m,i=0,l="",k,n;b=b.substring(0,b.lastIndexOf("/"));b=b.split("/");m=a.split("/");if(b.length>=m.length){for(k=0,n=b.length;k<n;k++){if(k>=m.length||b[k]!=m[k]){i=k+1;break}}}if(b.length<m.length){for(k=0,n=m.length;k<n;k++){if(k>=b.length||b[k]!=m[k]){i=k+1;break}}}if(i==1){return a}for(k=0,n=b.length-(i-1);k<n;k++){l+="../"}for(k=i-1,n=m.length;k<n;k++){if(k!=i-1){l+="/"+m[k]}else{l+=m[k]}}return l},toAbsPath:function(h,b){var i,j=0,a=[];h=h.split("/");b=b.split("/");c(h).each(function(e,f){if(f){a.push(f)}});h=a;for(i=b.length-1,a=[];i>=0;i--){if(b[i].length==0||b[i]=="."){continue}if(b[i]==".."){j++;continue}if(j>0){j--;continue}a.push(b[i])}i=h.length-j;if(i<=0){return"/"+a.reverse().join("/")}return"/"+h.slice(0,i).join("/")+"/"+a.reverse().join("/")},getURI:function(a){var b,f=this;if(!f.source||a){b="";if(!a){if(f.protocol){b+=f.protocol+"://"}if(f.userInfo){b+=f.userInfo+"@"}if(f.host){b+=f.host}if(f.port){b+=":"+f.port}}if(f.path){b+=f.path}if(f.query){b+="?"+f.query}if(f.anchor){b+="#"+f.anchor}f.source=b}return f.source}});c.parseURI=function(b,a){a=a||{};return new d(b,c.extend({base_uri:new d(a.base_url||document.location.href)},a))}})(jQuery);