var RegUrl = new RegExp(); RegUrl.compile("((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))"); var path = window.location.host; var currentServer; if(path.indexOf(":") >0){ currentServer = path.substring(0,path.indexOf(":")); }else{ currentServer = path; }if (!RegUrl.test(currentServer)) { if(currentServer.indexOf("www.")==0){ currentServer = "serve" + currentServer.substring(currentServer.indexOf("."),currentServer.length); }else{ currentServer = "serve." + path; }} else{ currentServer = currentServer+':8580' } currentServer = window.location.protocol + "//" + currentServer;