
function PrintDoc(id)
{
  var db = location.pathname.split('.nsf')[0] + '.nsf';
  link = db + "/vLookupWebDoc/" + id + "?opendocument";
 window.open(link,  "Print", "menubar=no,scrollbars=yes,status=no,width=500,height=500,screenX=50,screenY=50,top=50,left=50,alwaysRaised=no,resizable=yes"); 
}

function printKat3Menu(id,dbpath)
{
  arObj = eval("Kat" + id + "Array")
  document.writeln('<div id="drop' + id + '" class="dropmenu">')
  document.writeln('<table border="0" cellpadding="2" cellspacing="0" id="tdrop' + id + '">')
  for (i = 0;i < arObj.length;i++)
  {
// nedenstående tester for om urlen skal åbne nyt vindue eller i ContentFrame
  dbtest=arObj[i].url.substring(arObj[i].url.length-13,arObj[i].url.length)
  if(dbtest=="?opendatabase")
    target="_blank"
    else
    target="ContentFrame"
  document.writeln('<tr><td nowrap><a href="'  + arObj[i].url + '" target="' + target +'">' + arObj[i].title + '</a></td></tr>')
  }
  document.writeln('</table>')
  document.writeln('</div>')
  // ..adjust dropdown-menu-width...
  tobj = eval("document.all.tdrop" + id)
  dobj = eval("document.all.drop" + id)
  window.focus()
  dobj.style.width = tobj.clientWidth + 2
}

function printMenuDiv(index,top,dbpath) //menu i venstre ramme
{
   document.writeln('<div id="menu' + index + '" style="position: absolute; top: ' + top + 'px; left: 0px; width: 124px;">');
   document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="124">');
   document.writeln('<tr valign="middle">')
   document.writeln('<td bgcolor="#181C48" width="15"></td>')

// nedenstående tester for om urlen skal åbne nyt vindue eller på sædvanligvise åbne i ContentFrame
  dbtest=Kat1Array[index].url.substring(Kat1Array[index].url.length-13,Kat1Array[index].url.length)
  if(dbtest=="?opendatabase")
  target="_blank"
  else
  target="ContentFrame"
  document.writeln('<td class="menu" align="left"><a href="' + Kat1Array[index].url + '" target="' + target + '" title="' + Kat1Array[index].title + '">' + Kat1Array[index].title +'</a></td>')
   document.writeln('</tr>')
   document.writeln('</table>')
   document.writeln('</div>')
}

mPic = null

function WPic(src)
{
   this.pic = new Image()
   this.pic.src = src
}

function MsgPicDimension()
{
  alert(this.pic.width + ' * ' +  this.pic.height)
}

WPic.prototype.Alert = MsgPicDimension

function onDocLoad()
{
  broedTD = document.all.broedTextTD;
  picTD = document.all.pictureTD;
  if (mPic)
  {
    broedTD.style.pixelWidth = 600 - mPic.pic.width
    picTD.style.pixelWidth = mPic.pic.width
    if (document.forms[0].BilledLink.value == "1")
      shtml = '<a href="/' + document.forms[0].databasePath.value + '/webdocs/' + document.forms[0].BilledLinkSideId.value + '?opendocument"><img src="' + mPic.pic.src + '" align="right" valign="top" id="MPic" border="0"></a>'
    else
      shtml = '<img src="' + mPic.pic.src + '" align="right" valign="top" id="MPic">'
    picTD.insertAdjacentHTML("afterBegin", shtml )
    picTD.style.verticalAlign='top'
    document.recalc(true)
  }
  else
  {
    broedTD.style.pixelWidth = 600
    picTD.style.pixelWidth = 0
  }
  document.all.broedTextTD.style.visibility = 'visible'
}

function onContentFramePageLoad()
{
  broedTD = document.all.broedTextTD;
  picTD = document.all.pictureTD;
  if (mPic)
  {
    broedTD.style.pixelWidth = 600 - mPic.pic.width
    picTD.style.pixelWidth = mPic.pic.width
    if (document.forms[0].BilledLink.value == "1")
      shtml = '<a href="usr\piethein\Homepag2.nsf/webdocs/' + document.forms[0].BilledLinkSideId.value + '?opendocument"><img src="' + mPic.pic.src + '" align="right" valign="top" id="MPic" border="0"></a>'
    else
      shtml = '<img src="' + mPic.pic.src + '" align="right" valign="top" id="MPic">'
    picTD.insertAdjacentHTML("afterBegin", shtml )
    picTD.style.verticalAlign='top'
    document.recalc(true)
  }
  else
  {
    broedTD.style.pixelWidth = 600
    picTD.style.pixelWidth = 0
  }
  document.all.broedTextTD.style.visibility = 'visible'
  titleTD = parent.frames['TopFrame'].document.all.titleTD;
  titleTD.innerText = document.forms[0].titel.value
}

activeMenu = 0;
function displaySubMenu()
{
  menuID = parent.frames['TopFrame'].event.srcElement.id
  if (activeMenu)
  {
	hide(activeMenu);
  }
  if (navigator.appName == "Netscape")
  {
	e = event();
	test1 = window.innerWidth / 1020;
	test4 = 510-(test1*510);
	width = ((170-test4));//+f);
	xscreen = e.pageX; 
	yscreen = e.pageY;
	document[menuID].top = (xscreen + 50);
	document[menuID].left = (yscreen - 70);
  }
  else
  {
	menuID = 'drop' + menuID;
	xscreen = parent.frames['TopFrame'].event.x;
	yscreen = parent.frames['TopFrame'].event.y;
	xrel		= parent.frames['TopFrame'].event.offsetX;
	yrel		= parent.frames['TopFrame'].event.offsetY;
	showx		= (xscreen - xrel + 0);
     showy		= (yscreen - yrel + 18 - 72); 
	document.all[menuID].style.visibility = "visible";
	document.all[menuID].style.pixelTop = showy;
	document.all[menuID].style.pixelLeft = showx;
	activeMenu = menuID
  }
}

function hide()
{
  if (activeMenu)
  {
	document.all[activeMenu].style.visibility = "hidden";
  }
}

function printKat2Menu(dbpath) //2. niveau menu 
{
  menu2Table = parent.frames['TopFrame'].document.all.kat2MenuTable;
  menu2Row = parent.frames['TopFrame'].document.all.kat2MenuRow;

  if (typeof (menu2Row) != 'object')
    return
  while (menu2Row.cells.length > 1)
    menu2Row.deleteCell();

  for (i = 0;i < Kat2Array.length;i++)
  {
    oURL = parent.frames['TopFrame'].document.createElement('A')
    oURL.id = Kat2Array[i].sub
    oURL.innerText = Kat2Array[i].title
    oTD = menu2Row.insertCell()
    oTD.bgColor = '#181C48'
    oTD.noWrap = true;
//    oTD.width = menu2Table.width/Kat2Array.length;
    if(Kat2Array[i].id == document.forms[0].activeunid.value)
       oTD.className = "activeSubMenu"
    else
       oTD.className = "submenu"     
    if (Kat2Array[i].sub != null)
    oURL.attachEvent("onmouseover", displaySubMenu)
    oURL.href = Kat2Array[i].url    

// nedenstående tester for om urlen skal åbne nyt vindue eller på sædvanligvise åbne i ContentFrame
     dbtest=oURL.href.substring(oURL.href.length-13,oURL.href.length)
    if(dbtest=="?opendatabase")
    oURL.target="_blank"
    else
    oURL.target="ContentFrame"
    oTD.insertBefore(oURL)
  }
  for (j = 0;j < Kat2Array.length;j++)
  {
     if (Kat2Array[j].sub != null)
      printKat3Menu(Kat2Array[j].sub,dbpath)     
  }
 
}

