var urlOrderOnline = getLinkRootUrlS()+'/servlet/HsPublic?context=dofd&path=dofdonline&service=getSubscriptions&channel=services&message=message&righthandpanel=righthandpanel3'

var urlProductHome  = getLinkRootUrlNotS()+'/servlet/HsSession?context=dofd&path=dofdonline&service=onlinehome'
var urlProductLogin = urlProductHome
var urlProductSubscribe = getLinkRootUrlS()+"/servlet/HsPublic?context=dofd&path=dofdonline&service=getOnlineProducts&createSession=true"
var urlProductSupport = getLinkRootUrlNotS()+"/servlet/HsPublic?context=premium.home&path=util&service=getPage&page=premiumincludedir&directory=support&content=welcome&menu=sitesupport"
var urlProductProfile = getLinkRootUrlS()+"/servlet/HsSession?context=dofd&path=dofdonline&service=getWebProfile"


function pageSpecificOnload(){
  var hereforpagespecific;
}
function siteSpecificOnload2(){
  pageSpecificOnload();
}
function siteSpecificOnload(){
  pageSpecificOnload();
}

function findRootUrlForHttps(){
  hsCurrentUrl = location.href
  getTopMainUrl = hsCurrentUrl.split('//')[1]
  if(getTopMainUrl.indexOf('/') != -1){
    getTopMainUrl = getTopMainUrl.split('/')[0]
  }
  return getTopMainUrl
}
function getLinkRootUrlNotS(){
  rootUrlForHttp = findRootUrlForHttps()
  if(rootUrlForHttp != 'www.hemscott.com'){
    return 'http://' + rootUrlForHttp
  } else {
    return 'http://www.hemscott.com'
  }
}
function getLinkRootUrlS(){
  // SSL
	rootUrlForHttp = findRootUrlForHttps()
  return 'https://www.hemscott.com'
}
//for all A to Z pages
function doAToZSearch(urlToGoTo){
  top.location.href =urlToGoTo
}
function aToZOver(theId,urlToGoTo){
  eval('document.all.'+theId+'.style.borderColor = "#F48F4C";');
  window.status = urlToGoTo
}
function aToZOut(theId){
  eval('document.all.'+theId+'.style.borderColor = "#A55D42";');
}
function writeAtoZTable(startUrl,endUrl,searchType){
  document.write('<table border="0" cellspacing="5" cellpadding="0">')
  document.write('<tr>')
  for(i=65;i<=90;i++){
    urlToGoTo = startUrl+'&#0'+i+';'+endUrl
    document.write('<td align="center" class="tableatoz" id="atoz'+i+'" onclick="doAToZSearch(\''+urlToGoTo+'\')" onmouseover="aToZOver(\'atoz'+i+'\',\''+urlToGoTo+'\')" onmouseout="aToZOut(\'atoz'+i+'\')">')
    document.write('<span class="linkatoz">&#0'+i+';</span>')
    document.write('</td>')
		if(searchType == 'companies'){
			if(i==78){
				document.write('</tr>')
				document.write('<tr>')
			}
		}else{
			if(i==77){
				document.write('</tr>')
				document.write('<tr>')
			}
		}
  }
	if(searchType == 'companies'){
		numericUrlToGoTo = startUrl+'numeric'+endUrl
		 document.write('<td colspan="2" align="center" class="tableatoznumeric" id="atozNumeric" onclick="doAToZSearch(\''+numericUrlToGoTo+'\')" onmouseover="aToZOver(\'atozNumeric\',\''+numericUrlToGoTo+'\')" onmouseout="aToZOut(\'atozNumeric\')">')
    document.write('<span class="linkatoz">0-9</span>')
    document.write('</td>')
	}
  document.write('</tr>')
  document.write('</table>')
}

function printPage(){
 nnV = parseInt(navigator.appVersion)
 if (nnV >= 4) window.print()
}

function helpWindow(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=350,width=700,location=no,scrollbars=yes,resizable=yes,status=no,left=100,top=100");
}

function Start(page){
  OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=500,width=700,location=no,scrollbars=yes,resizable=yes,status=no,left=100,top=100");
}

function offerWin(){
  OpenWin = this.open("/dofd/offers/125_edition.htm", "OfferWindow", "toolbar=no,menubar=no,height=340,width=540,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
}

function orderPage(){
  opener.location.href = '/servlet/HsPublic?context=dofd&path=dofd&target=purchase&channel=order&message=message'
  window.close()
}

function popup(page) {
    OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=530,width=650,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
}
function sitetour() {
	OpenWin = this.open("/dofd/sitetour/intro.htm", "CtrlWindow", "toolbar=no,menubar=no,height=510,width=790,location=no,scrollbars=yes,resizable=yes,status=no,left=100,top=100");
}

var globalContactListOptionsInputElement = null;

function createContactList(resultCount, url) {
	var ok = true;
	if ( resultCount > 1000)
	{
		alert("Contact list's are restricted to a maximum of 1000 contacts. Please refine your search");
		ok = false;
	}
	else if (resultCount > 200)
		ok = confirm("You have requested a contact list with more than 200 entries, this may take up to a minute to generate, are you sure?");

	OpenWin = this.open("", "CtrlWindow", "toolbar=no,menubar=no,height=500,width=700,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
	OpenWin.document.write('<html><title>Directory of Directors - Directory of UK Company Directors</title><meta name="keywords" content="chairman, CEO, Directors, Directory, Biographies, Management, UK companies, UK businesses"/><meta name="description" content="Extensive profiles of over 53,000 directors &amp; the 13,000 companies they lead"/><link rel="stylesheet" href="/dofd/styles/dofd.css" type="text/css" media="screen"/><link rel="stylesheet" href="/dofd/styles/print.css" type="text/css" media="print"/><script language="JavaScript1.2" type="text/javascript" src="/javascripts/sitewide.js"></script><script language="JavaScript1.2" type="text/javascript" src="/dofd/javascripts/dofd.js"></script><script language="JavaScript1.2" type="text/javascript" src="/dofd/javascripts/coolmenus4.js"></script><body><table cellpadding="0" cellspacing="0" width="100%"  border="0"><tr><td align="center" height="49" width="150"><img src="/dofd/images/logo.gif" width="106" height="49" border="0" alt="Directory of Directors"></td><td align="right" height="30"><img src="/dofd/images/hemscott.gif" alt="Hemscott plc Corporate Site" width="163" height="25" border="0"></td></tr><tr><td colspan="2"><hr /></td></tr><tr><td class="maintextheader" colspan="2"><div id="loadingDiv" style="position:relative; width:100%; height:40; z-index:1">Generating contact list...</div><iframe scrolling="no" frameborder="0" vspace="0" src="'+url+'" height="1" width="100%" style="position:absolute;top:80px;left;0px;visibility:visible" name="loadingIframe"></iframe></td></tr></table></body></html>');
}

function showIframe() {
	  parent.document.getElementById("loadingIframe").style.visibility = "visible";
	  parent.document.getElementById("loadingDiv").style.visibility = "hidden";
	  return true;
}

function resizeIframe(){
		parent.document.all.loadingIframe.style.height = document.body.scrollHeight
		parent.document.all.loadingIframe.style.width = document.body.scrollWidth
}
