function openTopixWin(url) {
  x=Math.max(1, screen.width-798);
  y=1;
  h=Math.min(640, screen.availHeight);
  windowName='topix';
  if (self.name=='topix') {
    x=1;
    y=40;
    windowName='topix2';
  }
  window.open(url, windowName, 'width=788,height='+h+',top='+y+',left='+x+',scrollbars=yes,toolbar=yes,status=yes,menubar=yes,location=yes,resizable=yes').focus();
}

if (topixcats.length > 0) {
  document.write(
  '<tr><td class="relatedstoryborder"><table border="0" cellpadding="2" cellspacing="1" width="100%">' +
  '<tr><td class="relatedstorytitlebkg" align="center"><span class="storyrelatedtitle">' +
  'M&nbsp;O&nbsp;R&nbsp;E&nbsp; &nbsp;N&nbsp;E&nbsp;W&nbsp;S&nbsp; &nbsp;F&nbsp;R&nbsp;O&nbsp;M&nbsp;&nbsp;&nbsp;' +
  '<a href="http://www.topix.net"><img src="/images/logos/partners/topix_button.gif" alt="topix.net" width="91" height="17" border="0" align="absmiddle"></a>' +
  '</span></td></tr>\n');

  /* _isTestEnv is in global.js */
  var topixSmartTag = 'PB';
  if (_isTestEnv) topixSmartTag = 'PB-TEST';

  for( i = 0; i < topixcats.length; i++ ) {
    document.write(
    '<tr><td class="relatedstorybkg">' +
    '<span class="relatedstorybullet">&nbsp;&#149;&nbsp;</span>' +
    '<a href="javascript:openTopixWin(\'http://www.topix.net/' +
    topixcats[i].node + '?p=' + krd_topix_property +
    '&s=' +  topixSmartTag + '&co=1\')" class="relatedstorylink">' + topixcats[i].name +
    '</a></td></tr>\n');
  }
  document.write( '</table>\n</td></tr>\n' );
}

