var CM_SESSION_KEY_KEY="cmSessionKeyKey";if(typeof(encodeURIComponent)=="undefined"){encodeURIComponent=function(a){return escape(a)}}if(typeof(decodeURIComponent)=="undefined"){decodeURIComponent=function(a){return unescape(a)}}function URL(h,g,k){h=URL.buildURL(h);this.protocol=null;this.host=null;this.port=-1;this.file=null;this.query=null;this.authority=null;this.path=null;this.userInfo=null;this.ref=null;this.qParams=new Object();var e,d,f;var b=h;var a=0;var m=null;var j=false;d=h.length;while((d>0)&&(h.charAt(d-1)<=" ")){d--}while((a<d)&&(h.charAt(a)<=" ")){a++}if(h.substr(a,4).toLowerCase()=="url:"){a+=4}if(a<h.length&&h.charAt(a)=="#"){j=true}for(e=a;!j&&(e<d)&&((f=h.charAt(e))!="/");e++){if(f==":"){var l=h.substring(a,e).toLowerCase();if(this.isValidProtocol(l)){m=l;a=e+1}break}}this.protocol=m;if(this.protocol==null){}e=h.indexOf("#",a);if(e>=0){this.ref=h.substring(e+1,d);d=e}parseURL(this,h,a,d);this.parseQueryString();if(!g){this.setSession()}if(!k){this.setParameter("cc",Math.random(),true)}}function URL_set(h,d,b,g,a,f,e,c){this.protocol=h;this.host=d;this.port=b;this.file=e==null?f:f+"?"+e;this.userInfo=a;this.path=f;this.ref=c;this.query=e;this.authority=g}function URL_debug(){var a="protocol:  "+this.protocol+"\nhost:      "+this.host+"\nport:      "+this.port+"\nfile:      "+this.file+"\nuserInfo:  "+this.userInfo+"\npath:      "+this.path+"\nref:       "+this.ref+"\nquery:     "+this.query+"\nauthority: "+this.authority+"\n\n";var c;for(c in this.qParams){var d=this.qParams[c];if(typeof d=="function"){continue}a+=c+" -> [";if(!d){alert("missing: "+c);continue}for(var b=0;b<d.length;b++){a+=d[b]+(b!=(d.length-1)?",":"")}a+="]\n"}alert(a)}function URL_getParameter(c,a){if(!c){return a}var b=this.qParams[c];if(b==null){return a}else{return b[0]}}function URL_getParameterValues(a){return this.qParams[a]}function URL_getParameterNames(){var a;var b=new Array();for(a in this.qParams){if(typeof this.qParams[a]=="function"){continue}b[b.length]=a}return b}function parseURL(j,f,a,p){var k=j.protocol;var e=j.authority;var d=j.userInfo;var l=j.host;var h=j.port;var q=j.file;var c=j.ref;var b=null;var r=false;var n=false;if(a<p){var s=f.indexOf("?");n=(s==a);if(s!=-1){b=f.substring(s+1,p);if(p>s){p=s}f=f.substring(0,s)}}var o=0;if((a<=p-2)&&(f.charAt(a)=="/")&&(f.charAt(a+1)=="/")){a+=2;o=f.indexOf("/",a);if(o<0){o=f.indexOf("?",a);if(o<0){o=p}}l=e=f.substring(a,o);var g=e.indexOf("@");if(g!=-1){d=e.substring(0,g);l=e.substring(g+1)}g=l.indexOf(":");h=-1;if(g>=0){if(l.length>(g+1)){h=parseInt(l.substring(g+1))}l=l.substring(0,g)}a=o;if(e!=null&&e.length>0){q=""}}if(l==null){l=""}if(a<p){if(f.charAt(a)=="/"){q=f.substring(a,p)}else{if(q!=null&&q.length>0){r=true;var g=q.lastIndexOf("/");var m="";if(g==-1&&e!=null){m="/"}q=q.substring(0,g+1)+m+f.substring(a,p)}else{var m=(e!=null)?"/":"";q=m+f.substring(a,p)}}}else{if(n&&q!=null){var g=q.lastIndexOf("/");if(g<0){g=0}q=q.substring(0,g)+"/"}}if(q==null){q=""}if(r){while((o=q.indexOf("/./"))>=0){q=q.substring(0,o)+q.substring(o+2)}while((o=q.indexOf("/../"))>=0){if((p=q.lastIndexOf("/",o-1))>=0){q=q.substring(0,p)+q.substring(o+3)}else{q=q.substring(o+3)}}while(q.substring(q.length-3,q.length)=="/.."){o=q.indexOf("/..");if((p=q.lastIndexOf("/",o-1))>=0){q=q.substring(0,p+1)}else{q=q.substring(0,o)}}if(q.substring(q.length-2,q.length)=="/."){q=q.substring(0,q.length()-1)}}setURL(j,k,l,h,e,d,q,b,c)}function setURL(e,g,h,b,c,f,i,d,a){e.set(e.protocol,h,b,c,f,i,d,a)}function URL_isValidProtocol(a){return true}function URL_setParameter(b,c,a){if(!b){return}if(a||this.qParams[b]==null){this.qParams[b]=new Array()}this.qParams[b][this.qParams[b].length]=c}function URL_removeParameter(b){var c;var a=new Object();for(c in this.qParams){if(typeof this.qParams[c]=="function"){continue}if(c!=b){a[c]=this.qParams[c]}}this.qParams=a}function URL_removeAllParams(){var a=new Object();this.qParams=a}function URL_parseQueryString(){var e;if(this.query==null||this.query.length==0){return}else{e="&"+this.query}var b;var a=e.indexOf("&");while(a!=-1){var d=null;var f=0;b=e.indexOf("&",a+1);if(b!=-1){d=e.substring(a+1,b)}else{d=e.substr(a+1)}f=d.indexOf("=");if(f!=-1){var c=d.substring(0,f);var g=d.substr(f+1);this.setParameter(c,g)}a=b}}function URL_getQueryString(){var d="";var b;for(b in this.qParams){var c=this.qParams[b];if(typeof c=="function"){continue}for(var a=0;a<c.length;a++){if(d.length==0){d+=b+"="+c[a]}else{d+="&"+b+"="+c[a]}}}return d}function URL_toExternalForm(c){var a=this.protocol;a+=":";if(this.authority!=null&&this.authority.length>0){a+="//";a+=this.authority}if(this.path!=null){a+=this.path}if(!c){var b=this.getQueryString();if(b.length>0){a+="?"+b}if(this.ref!=null){a+="#";a+=this.ref}}return a}function URL_setSession(){var a=getSessionPair();if(a[0]&&a[1]){this.setParameter(a[0],a[1],true);this.setParameter(CM_SESSION_KEY_KEY,a[0],true);return true}return false}function URL_getPrototypePair(){return{url:this.toExternalForm(true),parameters:this.getQueryString()}}URL.buildURL=function(c){if(c.indexOf(":")==-1){var b=new URL(document.location.href);if(c.indexOf("./")==0||c.indexOf("../")==0){var a=b.path.lastIndexOf("/");if(a!=-1){b.path=b.path.substring(0,a)+"/"}return(b.protocol+"://"+b.authority+b.path+c)}else{return(b.protocol+"://"+b.authority+c)}}else{return c}};URL.getSessionPair=function(d){try{var a;var f=window.cmSessionKey;var b=window.cmSessionValue;if(!d){d=document.location.href}if(!f||!b){a=new URL(d,true,true);f=a.getParameter(CM_SESSION_KEY_KEY,"");b=a.getParameter(f,"")}return[f,b]}catch(c){return[]}};URL.getSessionHref=function(){var a=new URL(document.location.href,true,true);a.setSession();return a.toExternalForm()};URL.processLinkz=function(h){if(!h){h=window.document}var g=getSessionPair();var j=g[0];var f=g[1];for(var e=0;e<h.links.length;e++){var c=h.links[e];var b=new URL(c.href,true,true);var d=b.getParameter("*session*id*key*","");if(d=="*session*id*val*"){b.removeParameter("*session*id*key*");if(j&&f){b.setParameter(j,f,true);b.setParameter(CM_SESSION_KEY_KEY,j,true)}c.href=b.toExternalForm()}}};URL.getSessionString=function(){var a=getSessionPair();if(a[0]&&a[1]){return a[0]+"="+a[1]+"&"+CM_SESSION_KEY_KEY+"="+a[0]}else{return""}};URL.jdecode=function(b){var a=/\+/g;b=b.replace(a,"%20");return decodeURIComponent(b)};URL.deamplify=function(b){var a=/&amp;/g;b=b.replace(a,"&");return b};URL.jencode=function(d){var c=/\+/g;var b=/%20/g;var a=/'/g;d=encodeURIComponent(d);return d.replace(c,"%2B").replace(b,"+").replace(a,"%27")};URL.testEmail=function(a){var b=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;return b.test(a)};URL.prototype.set=URL_set;URL.prototype.debug=URL_debug;URL.prototype.isValidProtocol=URL_isValidProtocol;URL.prototype.toExternalForm=URL_toExternalForm;URL.prototype.toString=URL_toExternalForm;URL.prototype.parseQueryString=URL_parseQueryString;URL.prototype.getPrototypePair=URL_getPrototypePair;URL.prototype.getQueryString=URL_getQueryString;URL.prototype.getParameter=URL_getParameter;URL.prototype.getParameterValues=URL_getParameterValues;URL.prototype.getParameterNames=URL_getParameterNames;URL.prototype.setParameter=URL_setParameter;URL.prototype.removeParameter=URL_removeParameter;URL.prototype.setSession=URL_setSession;URL.prototype.removeAllParams=URL_removeAllParams;function getSessionPair(a){return URL.getSessionPair(a)}function getSessionHref(){return URL.getSessionHref()}function processLinkz(a){URL.processLinkz(a)}function getSessionString(){return URL.getSessionString()}function jdecode(a){return URL.jdecode(a)}function jencode(a){return URL.jencode(a)};
