function outputBase(pageURL) { var websiteServer = 'www.homestead.com'; var onlineEditorServer = 'nocache.homestead.com'; if (pageURL.indexOf(onlineEditorServer.toLowerCase()) == -1) { var baseHref = ''; var tmpHref = pageURL; var hsName = ''; tmpHref = tmpHref.toLowerCase(); if (tmpHref.indexOf('http://') == 0) { tmpHref = tmpHref.substr(7); } if (tmpHref.indexOf(websiteServer.toLowerCase()) == 0) { tmpHref = tmpHref.substr(tmpHref.indexOf('/')+1); var hsName = '/'; if (tmpHref.indexOf('/') != -1) { hsName += tmpHref.substring(0, tmpHref.indexOf('/')+1); } else { hsName += tmpHref; } baseHref = ''; } else { var domain = tmpHref; if (domain.indexOf('/') != -1) { domain = domain.substring(0, domain.indexOf('/')); } baseHref = ''; } document.write(baseHref); } }