function resolveUrl(url) {
var pathName = window.location.pathname.substring(1);
var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
var newurl = "";
var ch = new Array;
ch = pathName.split("/");
ch.pop();
var i = 0;
if (url.substring(0, 2) == "~/") {
url = "/" + webName + url.substring(1);
return url;
}
else if (url.substring(0, 1) == "/") {
return url;
}
else if (url.substring(0, 3) == "../") {
while (url.substring(0, 3) == "../") {
i++;
url = url.substring(3);
}
for (i > 0; i--; ) {
ch.pop();
}
}
newurl = "/";
for (j = 0; j < ch.length; j++) {
newurl = newurl + ch[j] + "/";
}
newurl = newurl + url;
//return window.location.protocol + '//' + window.location.host+newurl;
return newurl;
}
var pathName = window.location.pathname.substring(1);
var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
var newurl = "";
var ch = new Array;
ch = pathName.split("/");
ch.pop();
var i = 0;
if (url.substring(0, 2) == "~/") {
url = "/" + webName + url.substring(1);
return url;
}
else if (url.substring(0, 1) == "/") {
return url;
}
else if (url.substring(0, 3) == "../") {
while (url.substring(0, 3) == "../") {
i++;
url = url.substring(3);
}
for (i > 0; i--; ) {
ch.pop();
}
}
newurl = "/";
for (j = 0; j < ch.length; j++) {
newurl = newurl + ch[j] + "/";
}
newurl = newurl + url;
//return window.location.protocol + '//' + window.location.host+newurl;
return newurl;
}