function getFromurl() { var ptl = window.location.protocol; var host = window.location.host; var folder = window.location.pathname; var f = new Array(); f = folder.split("/"); var path = ""; if (f[1].indexOf('.') < 0) path = f[1]; var fromurl = ptl + "//" + host + "/" + path; return fromurl; } window.document.getElementById("topStatusRegister").href = window.document.getElementById("topStatusRegister").href + "?fromurl=" + getFromurl();