function getSiteUrl(){
        var loc = window.location.href;
        arrFolders = loc.split('/');
        if(loc.indexOf("~") >= 0){
                url = arrFolders[0] + "//" + arrFolders[2] + "/" + arrFolders[3] + "/";
        }else{
                url = arrFolders[0] + "//" + arrFolders[2] + "/";
        }
        return url;
}

function l_st(lnk) {
	// if the url starts with an fqd
	if (lnk.href.toLowerCase().indexOf("http://") == 0 || lnk.href.toLowerCase().indexOf("https://") == 0) {
		var dom = getCookieDomain();
		if (!dom) dom = getSiteUrl().replace(/http.?:\/\/(.*)\//,'$1');
				
		// if the domain is found in between "//" and the next "/"
		if ((i=lnk.href.toLowerCase().indexOf(dom))<0 || i > lnk.href.toLowerCase().indexOf ("/", 8)) {
			lnk.target = "_blank";
		}
	}
}