// browser sniffer 
agt = navigator.userAgent.toLowerCase();
verReal = navigator.appVersion;
ver = parseInt(verReal);
app = navigator.appName.toLowerCase();
ie = (agt.indexOf('msie') != -1 || agt.indexOf('microsoft') != -1)?1:0;
ns = (agt.indexOf('netscape') != -1 || app.indexOf('netscape') != -1)?1:0;
ie4 = (ie && ver==4 && !(agt.indexOf('msie 5')!=-1))?1:0;
ie5 = (ie && (ver==5 || agt.indexOf('msie 5')!=-1))?1:0;
ie6 = (ie && ver==6)?1:0;
ns4 = (ns && ver==4)?1:0;
ns6 = (ns && ver==5)?1:0
dom = (document.getElementById)?1:0
win = (agt.indexOf('win')!=-1)?1:0
mac=(agt.indexOf('mac')!=-1)?1:0
//to reduce file size
function dw(theText){
  document.writeln(theText)
}
//Reload window onResize for Netscape

var Nav_browser = document.layers
if (Nav_browser) {
var beginWidth = innerWidth;
var beginHeight = innerHeight;
}

function reloadWindow() {
if (innerWidth != beginWidth || innerHeight != beginHeight)
location.reload();
}
if (Nav_browser) onresize = reloadWindow

//preload images function

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//the ads functions
iens6=document.all||document.getElementById
ord=Math.random()*10000000000000000;

function dart(zone, dcopt, width, height, tile) {
    
    if (width == 468 && height == 60) {
        dw('<SCRIPT LANGUAGE="JavaScript" SRC="http://a'+'d.uk.doubleclick.net/adj/ban'+'ner.hemscott.tmuk/' + zone +';' + dcopt + 'sz=' + width + 'x' + height +';ord=' + ord + '?" ><\/SCRIPT>');
    
        if (zone == 'isaworld' || zone =='warrants') {
          dw('<SCRIPT LANGUAGE="JavaScript" SRC="http://a'+'d.uk.doubleclick.net/adj/pix'+'el.hemscott.tmuk/' + zone +';' + dcopt + 'sz=1x1;ord=' + ord + '?" ><\/SCRIPT>');
        }
    } 
    else if (width == 120 && height == 600) {
        dw('<SCRIPT LANGUAGE="JavaScript" SRC="http://a'+'d.uk.doubleclick.net/adj/skyscraper.hemscott.tmuk/' + zone +';sz=' + width + 'x' + height +';ord=' + ord + '?" ><\/SCRIPT>');
    }
}

function adtable(site,industry,table){
//if (iens6){
//    dw('<IFRAME SRC="http://a'+'d.uk.doubleclick.net/adi/'+ site +'/'+ industry +';table='+ table +';tn=4;tcs=5;sz=110x41;te=2;ord='+ ord +'" WIDTH="600" HEIGHT="46" MARGINWIDTH="0" MARGINHEIGHT="0" HSPACE="0" VSPACE="0" FRAMEBORDER="0" SCROLLING="no" BORDERCOLOR="#000000">');
//    dw('</IFRAME>');
//  }
//else if (document.layers){
//    dw('<ILAYER SRC="http://a'+'d.uk.doubleclick.net/adi/'+ site +'/'+ industry +';table='+ table +';tn=4;tcs=5;sz=110x41;te=2;ord='+ ord +'" WIDTH="600" HEIGHT="46">');
//    dw('</ILAYER>');
//  }
}
// height extender
var imageHeight = screen.availHeight-320;
function heightextender(){
  dw('<img id="heightExtenderGif" src="/images/transparent.gif" border="0" width="5" height="' + imageHeight + '">');
}
// height extender change
function resizeHeightExtenderGif(){
  if(ie){
  theNewHeight = document.body.clientHeight > document.body.scrollHeight ? document.body.clientHeight : document.body.scrollHeight
  document.all.heightExtenderGif.style.height = theNewHeight-156;
  }
}
function HeightExtendingTable(){
  if(ie){
  theNewHeight = document.body.clientHeight > document.body.scrollHeight ? document.body.clientHeight : document.body.scrollHeight
  document.all.contenttable.style.height = theNewHeight-172;
  }
}
// disclaimer popup
function termsOfUse(){
  if(inPremium){
    urlTermsOfUse = getLinkRootUrlNotS()+'/servlet/HsPublic?context=premium.home&path=util&service=getPage&page=premiumstatic&content=terms_of_use'
  } else {
    urlTermsOfUse = 'http://www.hemscott.com/equities/cust_disclaim.htm'
  }
    OpenWin = this.open(urlTermsOfUse, "CtrlWindow", "toolbar=no,menubar=no,height=500,width=658,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
}

//  popup window
function popup(page){
    OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=600,width=700,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
}
// write to a div
function writeToDiv(whichDiv,whatText){
    if(document.getElementById){
      document.getElementById(whichDiv).innerHTML = whatText
    } else if(document.all){
      document.all(whichDiv).innerHTML = whatText
    } else if (document.layers){
      nsWriteToDivWidth = '440'
      whatText = '<div id="nsRelativeFixDiv" style="position:absolute; left:0px; top:0px; width:'+nsWriteToDivWidth+'; height:1; z-index:1; visibility: visible;" class="textsmallprintbold">'+whatText+'</div>'
      eval('document.'+whichDiv+'.document.open()');
      eval('document.'+whichDiv+'.document.write(\''+whatText+'\')');
      eval('document.'+whichDiv+'.document.close()');
    }
}
//check for &.  Used when constructing url's.
function checkForAnd(textToCheck){
  if (textToCheck.indexOf('&') != -1){
    brokenBits = textToCheck.split('&')
    textToCheck=brokenBits[0];
    for(i=1;i<brokenBits.length;i++){
      textToCheck+= '%26'+brokenBits[i]
    }
    return textToCheck
  }else{
    return textToCheck;
  }
}
//swaps GBP for£
function swapGBP(theString) {
  theString = theString.replace(/GBP/gi, '£')
  dw(theString)
}
//converts to two decimal places
function twoDP(theValue){
  if(isNaN(theValue)){
    return '-'
  } else {
    theValue = Math.round(theValue*100)/100
    theValue = theValue.toString()
    if(theValue.indexOf('.') == -1){
      theValue = theValue + '.00'
    } else if((theValue.indexOf('.') + 2) == theValue.length){
      theValue = theValue + '0'
    }
    return theValue
  }
}
//Date 0 pad.
function dateZeroPad(dateNum){
  dateNum = dateNum.toString()
  if(dateNum.length == 1){
    dateNum = '0' + dateNum
  }
  return dateNum
}
//deletes a cookie given its name.
function deleteCookieByName(cookieName){
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++){
    var nameValuePair = aCookie[i].split("=");
    if (nameValuePair[0] == cookieName){
      document.cookie = cookieName + '=' + nameValuePair[1] + "; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
    }
  }
}
// open window ie target blank
function openInTargetBlank(page) {
    OpenWin = this.open(page, "NewWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,status=yes,left=0,top=0");
}
//top location change
var urlHemscottHome = "http://www.hemscott.net"
var urlHemscottSupport = "/servlet/HsPublic?context=premium.home&path=util&service=getPage&page=premiumincludedir&directory=support&content=welcome&menu=sitesupport"
var urlHemscottContacts = "/premium/premium.jsp?content=contacts"

function goToNewUrl(newUrl){
  top.location.href = newUrl;
}
function goToNewUrlSelf(newUrl){
  self.location.href = newUrl;
}

// Date on top right
function addDate(){
   var mydate=new Date()
   var year=mydate.getYear()

   if (year<2000){
     year=1900+year
   }

   var month=mydate.getMonth()
   var daym=mydate.getDate()

   var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
   dw(""+montharray[month]+" "+daym+", "+year+"")
}
var currentChannel = 'none'
var urlToPremium = "" //for businessplus sites
var inHemscottOne = false
var loggedIn = false
var inPremium = false
var inPremiumPlus = false
var colorTableNavTopOver = '#ff6600'
var colorTableNavTopOut = '#003399'
function navTopOver(theId,theLink){
  if(theId != currentChannel){
    eval('document.all.'+theId+'.style.backgroundColor = "' + colorTableNavTopOver + '";');
    window.status = theLink
  }
}
function navTopOut(theId){
  if(theId != currentChannel){
    eval('document.all.'+theId+'.style.backgroundColor = "' + colorTableNavTopOut + '";');
    window.status = ''
  }
}
//these two are redone in site js
function getLinkRootUrlNotS(){
  return ''
}
function getLinkRootUrlS(){
  return ''
}
// ------------------------------------------------
// This stuff writes all the top table.
// ------------------------------------------------
function aLine(theClass,theHeight){
  dw('  <tr> ');
  dw('    <td height="1" colspan="5" valign="middle" class="' + theClass + '"><img src="/images/transparent.gif" width="1" height="' + theHeight + '"></td>');
  dw('  </tr>');
}
function topnavCells(theName,id,theLink){
  if(id != currentChannel){
    dw('            <td id="td'+id+'" onmouseover="navTopOver(\'td'+id+'\',\''+theLink+'\')" onmouseout="navTopOut(\'td'+id+'\')" onclick="goToNewUrl(\'' + theLink + '\')" class="tablenavtop" align="center" valign="middle"><span class="navtop">' + theName + '</span></td>');
  } else {
    dw('            <td id="td'+id+'" onclick="goToNewUrl(\'' + theLink + '\')" class="tablenavtopin" align="center" valign="middle"><span class="navtop">' + theName + '</span></td>');
  }
  dw('            <td width="2"><img src="/images/transparent.gif" width="2" height="1"></td>');
}
function specifyTopNavCellDefault(){
  topnavCells('Home','home','http://www.hemscott.net/');
  topnavCells('Sitemap','sitemap','http://www.hemscott.com/sitemap/map.htm');
  topnavCells('Support','support','http://www.hemscott.com/HelpService/index.htm');
  topnavCells('Email','email','http://support.hemscott.net/services/eweb/');
  topnavCells('Registration','registration','http://businessplus.hemscott.net/register/index.asp');
  topnavCells('About Us','aboutus','http://www.hemscottplc.com');
}
function specifyTopNavCell(){
  specifyTopNavCellDefault()
}
function writeTopOneAdOpen(){
  dw('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabletopandnav">');
  dw('  <tr> ');
  dw('    <td class="tabletopandnav"><img src="../images/transparent.gif" width="1" height="12"></td>');
  dw('    <td colspan="3" height="16" valign="top" class="textreversemediumemphasis" align="right">');
  sitemapName = 'sitemap'
  if(inPremiumPlus){sitemapName = 'sitemapplus'}
  mainLogoUrl = '<img src="/images/portal_logo.gif" width="184" height="29" alt="Hemscott logo" border="0">'
  if(inHemscottOne){mainLogoUrl = '<img src="/images/one_logo_white.gif" width="184" height="40" alt="Hemscott logo" border="0">'}
  if(!inPremium){
    urlCurrentHome = urlHemscottHome
    dw('      &nbsp;');
  } else if(loggedIn){
    urlCurrentHome = urlPremiumHomeIn
    dw('      Site: ');
    dw('      <a class="linkopposite" href="JavaScript:window.external.AddFavorite(location.href, document.title)">Bookmark this page</a> | ');    
    dw('      <a class="linkopposite" href="'+getLinkRootUrlNotS()+'/servlet/HsSession?context=premium&path=util&service=getPage&page=premiumincludedir&directory=support&content=welcome&menu=sitesupport" target="_top">Help</a> | ');
    dw('      <a class="linkopposite" href="http://www.hemscottplc.com" target="_blank">About Us</a> | ');
    dw('      <a class="linkopposite" href="'+getLinkRootUrlNotS()+'/servlet/HsSession?context=premium&path=util&service=getPage&page=premiuminclude&content='+sitemapName+'&menu=inhome" target="_top">Site Map</a> | ');
    dw('      <a class="linkopposite" href="'+urlPremiumProfile+'" target="_top">Your Profile</a> | ');
    dw('      <a class="linkopposite" href="'+getLinkRootUrlNotS()+'/servlet/HsSession?context=premium&path=users&service=doWebLogoff" target="_top">Log out</a>');
  } else {
    urlCurrentHome = urlPremiumHomeOut
    dw('      Site: ');
    dw('      <a class="linkopposite" href="JavaScript:window.external.AddFavorite(location.href, document.title)">Bookmark this page</a> | ');    
    dw('      <a class="linkopposite" href="'+getLinkRootUrlNotS()+'/servlet/HsPublic?context=premium.home&path=util&service=getPage&page=premiumincludedir&directory=support&content=welcome&menu=sitesupport" target="_top">Help</a> | ');
    dw('      <a class="linkopposite" href="http://www.hemscottplc.com" target="_blank">About Us</a> | ');
    dw('      <a class="linkopposite" href="'+getLinkRootUrlNotS()+'/servlet/HsPublic?context=premium.home&path=util&service=getPage&page=premiuminclude&content='+sitemapName+'&menu=outhome" target="_top">Site Map</a> | ');
    dw('      <a class="linkopposite" href="'+urlPremiumSubscribe+'" target="_top">Subscribe</a> | ');
    dw('      <a class="linkopposite" href="'+getLinkRootUrlNotS()+'/servlet/HsSession?context=premium&path=premium&service=home" target="_top">Log In</a>');
  }
  dw('    </td>');
  dw('    <td class="tabletopandnav"><img src="../images/transparent.gif" width="1" height="12"></td>');
  dw('  </tr>');
  aLine('tablefooterandpopup',1);
  dw('  <tr>');
  dw('    <td width="12"><img src="/images/transparent.gif" width="12" height="8"></td>');
  dw('    <td width="184" valign="middle"><a href="'+urlCurrentHome+'" target="_top">'+mainLogoUrl+'</a></td>');
  dw('    <td width="81"><img src="/images/transparent.gif" width="81" height="15"></td>');
  dw('    <td align="right" width="478" height="60">');
}

var pageName;
function writeTopOneAdClose(pageName){
  if (pageName == null){
    pageName = '<img src="/images/transparent.gif" width="148" height="6">'
  }
  dw('    </td>');
  dw('    <td width="100%">&nbsp;</td>');
  dw('  </tr>');
  aLine('tablefooterandpopup',1);
  dw('  <!-- top level navigation -->');
  dw('  <tr> ');
  dw('    <td colspan="4" align="right" class="tabletoptabsbar"> ');
  dw('      <table cellspacing="0" cellpadding="0" border="0" width="755" class="tabletoptabsbar">');
  dw('        <tr>');
  dw('          <td width="160" class="textbrand" align="left"><img src="/images/transparent.gif" width="12" height="6">' + pageName + '</td>');
  dw('          <td>');
  dw('            <table cellspacing="0" cellpadding="0" width="100%" border="0" height="17" class="tabletoptabsbar">');
  dw('              <tr>');
  specifyTopNavCell()
  dw('              </tr>');
  dw('            </table>');
  dw('          </td>');
  dw('          <td class="textbrand" width="');
  if(inPremium){
  dw('100');
  } else {
  dw('140');
  }
  dw('" align="right">&nbsp;');
  addDate()
  dw('          </td>');
  dw('        </tr>');
  dw('      </table>');
  dw('      <!-- end top level navigation -->');
  dw('    </td>');
  dw('    <td height="17" class="tabletoptabsbar"><img src="/images/transparent.gif" width="1" height="17" ></td>');
  dw('  </tr>');
  dw('  <tr> ');
  dw('    <td height="1" colspan="5" class="tablefooterandpopup"><img src="/images/transparent.gif" width="1" height="1"></td>');
  dw('  </tr>');
  dw('</table>');
}
function writeTopNoAd(theTitle){
  writeTopOneAdOpen()
  dw('&nbsp;')
  writeTopOneAdClose(theTitle)
}

// ------------------------------------------------
// End of - This stuff writes all the top table.
// ------------------------------------------------



// This writes the footer.
doAdvertiseLink = true
function writeFooter(){
  dtNow = new Date();
  if(doAdvertiseLink){
    advertiseWithUs = '<a class="textreverseemphasis" href="http://www.hemscott.com/media%20pack/index1.htm" target="_blank" class="textreverseemphasis">Advertise with us</a>'
  } else {
    advertiseWithUs = '<img src="/images/transparent.gif" width="1" height="1" border="0">'
  }
  dw('<table width="100%" cellspacing="0" cellpadding="0" border="0" class="tablefooterandpopup">');
  dw('  <tr>');
  dw('    <td bgcolor="#ffcc99" height="2" colspan="4"><img src="/images/transparent.gif" width="1" height="2" border="0"></td>');
  dw('  </tr>');
  dw('  <tr>');
  dw('    <td height="30" width="12" valign="middle"><img src="/images/transparent.gif" width="1" height="1" border="0"></td>');
  dw('    <td width="542"><a class="textreverseemphasis" href="javascript:termsOfUse()" target="_self">Terms of Use</a><span class="textreverseemphasis"> | </span><a class="textreverseemphasis" href="http://www.hemscott.com/equities/Privacy/priv_index.htm" target="_blank">Privacy Policy</a><span class="textreverseemphasis"> | </span><a class="textreverseemphasis" href="http://www.hemscott.com/equities/main.htm" target="_blank">Sources and Disclaimer</a></td>');
  dw('    <td width="201" align="right">' + advertiseWithUs + '</td>');
  dw('    <td><img src="/images/transparent.gif" width="1" height="1" border="0"></td>');
  dw('  </tr>');
  dw('  <tr>');
  dw('    <td height="30" width="12" valign="middle"><img src="/images/transparent.gif" width="1" height="1" border="0"></td>');
  dw('    <td colspan="3" class="tablefooterandpopup"><span class="textreversesmall">© '+dtNow.getFullYear()+' Hemscott Group Limited <br>Hemscott is the UK registered trademark of Hemscott Group Limited</span></td>');
  dw('  </tr>');
  dw('</table>');
}

// This is the stuff that makes our menus work.  Please dont alter.
var lastMouseOutTime = new Date().getTime();
var closePending=false;
var running = false;


function findDiv(name) {
    if(name != null) {
    /*if (document.layers)
        layer = eval("document." + "menu"+name);
    else if (document.all)
        layer = eval("document.all." + "menu"+name + ".style");
  */
  layer = eval(document.getElementById("menu"+name).style);
  return(layer);
    }
}

function _handleMouseOver(evt) {
    if(document.layers) {
        var handledHere=false;
        for(var i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
                if (evt.target.id == ("menu"+menuLayers[i])) {
                    closePending=false;
                    handledHere=true;
                }
            }
        }
        if (!handledHere) routeEvent(evt);
    }
    else {
    closePending=false;
    }
}

function _handleMouseOut(evt) {
    if(document.layers) {
        var handledHere=false;
        for(var i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
                if (evt.target.id == ("menu"+menuLayers[i])) {
                    mouseOutMenu();
                    handledHere=true;
                }
            }
        }
        if (!handledHere) routeEvent(evt);
    }
    else {
        mouseOutMenu();
    }
}

function mouseOverMenu(menuItem) {
    if (menuItem != null) {
        closePending=false;
        for(var i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
            if (menuLayers[i] == menuItem)
                findDiv(menuItem).visibility="visible";
            else
                findDiv(menuLayers[i]).visibility="hidden";
            }
        }
    }
}
function mouseOutMenu(menuItem) {
    lastMouseOutTime = new Date().getTime();
    closePending=true;
}

function closeMenus() {
    for(var i=0; i<menuLayers.length;i++) {
        if (menuLayers[i] != null) {
            findDiv(menuLayers[i]).visibility="hidden";
        }
    }
    closePending=false;
}

function advance() {
    if (closePending && (lastMouseOutTime < (new Date().getTime() - optionsHideDelay)))
        closeMenus();
}

function thread() {
    advance();
    if (running) setTimeout('thread()',100);
}

function start() {
    if (!running) {
        running=true;
        thread();
    }
    if (!(document.layers)) {
        for(i=0; i<menuLayers.length;i++) {
            if (menuLayers[i] != null) {
                layer = eval("document.all." + "menu"+menuLayers[i]);
                if (layer) {
                  layer.onmouseover = _handleMouseOver;
                  layer.onmouseout = _handleMouseOut;
                }
            }
        }
    }
    if (!running) {
        running=true;
        thread();
    }
}

function stop() {
    running=false;
}

function init() {
    if(document.layers) {
        captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);
        onmouseover = _handleMouseOver;
        onmouseout = _handleMouseOut;
    }
    start();
}

//end of dhtml script

// -------------------------- New menu JavaScript Below ------------------

// This specifies how long the pop-up menus appear after mouse out.
var optionsHideDelay=500;

// This defines all active layers.  null layers need not be defined.
var menuLayers=new Array();
function definelayers(menuNo){
    if (menuNo != null){
        menuLayers[menuNo]=menuNo;
    }
}
// Opens the main nav table  -----------------------------------------------------
function openMainOnlyTable(){
    dw('<table cellspacing="0" cellpadding="0" border="0" width="160">');
}
function openMainTable(){
    dw('<table cellspacing="0" cellpadding="0" border="0" width="160">');
    dw('  <tr>');
    dw('    <td><img src="/images/transparent.gif" width="9" height="12"></td>');
    dw('    <td width="16"><img src="/images/transparent.gif" width="1" height="12"></td>');
    dw('    <td><img src="/images/transparent.gif" width="9" height="12"></td>');
    dw('  </tr>');
}
// Creates each main nav row
function mainTableTitle(itemName){
  if(itemName.indexOf('{indent}') != -1){
    itemName = itemName.replace(/{indent}/gi, '<img src="/images/transparent.gif" width="12" height="12" border="0">')
  }
  document.write('<span class="navmaintexttitle"><img src="/images/transparent.gif" width="12" height="12" border="0"/>'+itemName+'</span>')
}
function mainTable(itemName,theLink,menuNo){
  mainTableTarget(itemName,theLink,menuNo,'_top')
}
function mainTableTarget(itemName,theLink,menuNo,theTarget){
    definelayers(menuNo);
    if(itemName.indexOf('{indent}') != -1){
      itemName = itemName.replace(/{indent}/gi, '<img src="/images/transparent.gif" width="25" height="12" border="0">')
    }
    outmenuNo = "menu" + menuNo
    dw('  <tr>');
    dw('    <td colspan="3"><span class="navmain"><a onMouseOver="mouseOverMenu(\'' + menuNo + '\')" onMouseOut="mouseOutMenu(\'' + outmenuNo + '\')" href="' + theLink + '" class="navmain" target="' + theTarget + '"><img src="/images/transparent.gif" width="12" height="12" border="0"><span class="dot">&#149;</span><img src="/images/transparent.gif" width="4" height="12" border="0">' + itemName + '</a></span></td>');
    dw('  </tr>');
}

function mainTablePopUp(itemName,theLink,menuNo,theTarget){
    definelayers(menuNo);
    if(itemName.indexOf('{indent}') != -1){
      itemName = itemName.replace(/{indent}/gi, '<img src="/images/transparent.gif" width="25" height="12" border="0">')
    }
    outmenuNo = "menu" + menuNo
    dw('  <tr>');
    dw('    <td colspan="3"><span class="navmain"><a onMouseOver="mouseOverMenu(\'' + menuNo + '\')" onMouseOut="mouseOutMenu(\'' + outmenuNo + '\')" href="JavaScript:mediumpopup(\'' + theLink + '\')" class="navmain" ><img src="/images/transparent.gif" width="12" height="12" border="0"><span class="dot">&#149;</span><img src="/images/transparent.gif" width="4" height="12" border="0">' + itemName + '</a></span></td>');
    dw('  </tr>');
}

//  popup window
function mediumpopup(page){
    OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=650,width=630,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
}

//  popup window
function smallpopup(page){
    OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=250,width=430,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
}


//Double height menu items
function mainTableDoubleHeight(itemName,theLink,menuNo){
  mainTableTargetDoubleHeight(itemName,theLink,menuNo,'_top')
}
function mainTableTargetDoubleHeight(itemName,theLink,menuNo,theTarget){
    definelayers(menuNo);
    outmenuNo = "menu" + menuNo
    dw('  <tr>');
    dw('    <td colspan="3"><span class="navmain"><a onMouseOver="mouseOverMenu(\'' + menuNo + '\')" onMouseOut="mouseOutMenu(\'' + outmenuNo + '\')" href="' + theLink + '" class="navmain" target="' + theTarget + '"><img src="/images/transparent.gif" width="12" height="18" border="0"><span class="dot">&#149;</span><img src="/images/transparent.gif" width="4" height="18" border="0">' + itemName + '</a></span></td>');
    dw('  </tr>');
}


// Ends the main nav table
function closeMainTable(){
    dw('</table>');
}
// Defines the pop-up layer positions.  Done this way due to the NN 4.5 Ttyle error.
// (YOU CAN EDIT THE NEXT FEW LINES)
function divarray(menuNo,heightPosition,startHeight){
    if (startHeight == "default"){
        startHeightPosition = 184;//Change to alter the height of the first menu item.
    } else if (startHeight == "noSearch"){
        startHeightPosition = 111;//Change to alter the height of the first menu item when no company search box is used.
    } else {
        startHeightPosition = startHeight;
    }
    if (ie){
        topPosition = startHeightPosition + (heightPosition - 1)*18;//Change this number to edit the spacing of each menu.
    } else {
        topPosition = startHeightPosition + (heightPosition - 1)*18;//and for Netscape.
    }
    dw('<style>');
    dw('#menu' +  menuNo + ' {z-index: 10; position: absolute; left: 160px; top: ' +  topPosition + 'px; width: 123px; visibility: hidden}');
    dw('</style>');
}
// Opens the pop-up layer and table.  ---------------------------------------------------
function openPopupTable(menuNo,heightPosition,startHeight){
    divarray(menuNo,heightPosition,startHeight)
    dw('<div id="menu' +  menuNo + '"><img src="/images/transparent.gif" width="1" height="1"><br>');
    dw('  <table cellspacing="0" cellpadding="0" border="0" width="123" class="tablefooterandpopup">');
    dw('    <tr>');
    dw('      <td>');
    dw('        <table cellspacing="0" cellpadding="0" border="0" width="100%">');
}
// Writes each pop-up layer row.
function popupTable(itemName,theLink){
  popupTableTarget(itemName,theLink,'_top')
}
function popupTableTarget(itemName,theLink,theTarget){
    if(itemName.indexOf('{indent}') != -1){
      itemName = itemName.replace(/{indent}/gi, '<br>&nbsp;&nbsp;')
    }
    dw('          <tr>');
    dw('            <td><a href="' + theLink + '" class="navpopup" target="' + theTarget + '">&nbsp;&nbsp;' + itemName + '</a></td>');
    dw('          </tr>');
}
// closes the pop-up layers table and row.
function closePopupTable(){
    dw('        </table>');
    dw('      </td>');
    dw('    </tr>');
    dw('  </table>');
    dw('</div>');
}
// ---------------- EDIT BELOW HERE  -----------

//new framesets

function loadFrames2(page1, page2) {
framecode = "<frameset rows='150,*' frameborder='NO' framespacing='0' marginwidth='0' marginheight='0' 'noresize'>"
+ "<frame src='" + page1 + "' scrolling='NO'>"
+ "<frame src='" + page2 + "' scrolling='AUTO'>"
+ "</frameset>";

page = window.open("");
page.document.open();
page.dw(framecode);
page.document.close();
}
function siteSpecificOnload(){
  var hereforsitespecific;
}
function onloadAll(){
  init();
  siteSpecificOnload();
}
function removeDontPrints(){
  for(i=1;eval('document.all.dontprint'+i+'');i++){
    eval('document.all.dontprint'+i+'.style.display="none"')
  }
}

function startPrintBorder(){

    if (document.all.printborder1) {
        document.all.printborder1.border='1';
        document.all.printborder1.cellSpacing='0';
        }
    if (document.all.printborder2) {
        document.all.printborder2.border='1';
        document.all.printborder2.cellSpacing='0';
        }
    if (document.all.printborder3) {
        document.all.printborder3.border='1';
        document.all.printborder3.cellSpacing='0';
        }       
  
}

function stopPrintBorder(){

    if (document.all.printborder1) {
      document.all.printborder1.border='0';
      document.all.printborder1.cellSpacing='1'; 
    }
    if (document.all.printborder2) {
      document.all.printborder2.border='0';
      document.all.printborder2.cellSpacing='1'; 
    }
    if (document.all.printborder3) {
      document.all.printborder3.border='0';
      document.all.printborder3.cellSpacing='1'; 
    }   
}


function retrieveDontPrints(){
  for(i=1;eval('document.all.dontprint'+i+'');i++){
    eval('document.all.dontprint'+i+'.style.display="block"')
  }
}

function beforePrintAll(){
  removeDontPrints()
    startPrintBorder()
}

function afterPrintAll(){
  retrieveDontPrints()
    stopPrintBorder()
}
function doMainSearch(channelname){
  doSearch = true;


  if (document.navForm.name.value.indexOf('%') != -1) {
    alert('Search contains invalid character');
    doSearch = false;
    return false;
  }

  if (document.navForm.name.value == null) {
    alert('Search box is empty');
    doSearch = false;
    return false;
  }


  if (document.navForm.searchtype[0].checked == 1)
  {
  var type = 'company';
  }
  if (document.navForm.searchtype[1].checked == 1)
  {
  var type = 'epic';
  }
  newUrl = document.navForm.name.value;
  if(newUrl == "")
  {
  //top.location.href = "/premium/premium.jsp?content=searchnoletters";
  }
  else
  {
  top.location.href = getLinkRootUrlNotS() + "/servlet/HsSession?context=premium&path=compfund&service=getHsCompanySearch&"+type+"="+newUrl+"&listing_status=3&channel="+channelname;
  }
}

function writeSearch(channelname){
  if(!channelname){
    channelname = 'companies'
  }
  document.writeln('      <table width="160" border="0" cellspacing="0" cellpadding="0" class="tabletopandnav">');
  document.writeln('        <form action="/servlet/HsSession" method="POST" name="navForm" onsubmit="doMainSearch(\''+channelname+'\');return false">');
  document.writeln('          <tr>');
  document.writeln('            <td valign="middle" colspan="3"><img src="/images/transparent.gif" width="160" height="12"></td>');
  document.writeln('          </tr>');
  document.writeln('          <tr> ');
  document.writeln('            <td class="textreversemediumemphasis" colspan="3"><img src="/images/transparent.gif" width="12" height="6" border="0"><span class="dot">&#149;</span><img src="/images/transparent.gif" width="4" height="6" border="0">Company Search</td>');
  document.writeln('          </tr>');
  document.writeln('          <tr> ');
  document.writeln('            <td><img src="/images/transparent.gif" width="25" height="8"></td>');
  document.writeln('            <td width="76"><input type="text" name="name" value="" class="inputsearch" size="8"></td>');
  document.writeln('            <td width="59">&nbsp;&nbsp;<input onclick="doMainSearch(\''+channelname+'\')" value="Go" name="go" type="button" class="submitsearch">');
  document.writeln('            </td>');
  document.writeln('          </tr>');
  document.writeln('          <tr>');
  document.writeln('          <td colspan="3" class="textreversemediumemphasis">&#160;<input type="radio" name="searchtype" value="company" checked="yes" onfocus="document.navForm.name.focus()">&#160;&#160;Name&#160;&#160;<input type="radio" name="searchtype" value="epic" onfocus="document.navForm.name.focus()">&#160;&#160;Epic</td>');
  document.writeln('          </tr>');
  document.writeln('          <tr>');
  document.writeln('            <td colspan="3"><img src="/images/transparent.gif" width="160" height="5"></td>');
  document.writeln('          </tr>');
  document.writeln('          <tr>');
  document.writeln('            <td colspan="3" class="tablefooterandpopup"><img src="/images/transparent.gif" width="160" height="1"></td>');
  document.writeln('          </tr>');
  document.writeln('        </form>');
  document.writeln('      </table>');
}

