


var URL_argument = location.search.substring(1, location.search.length);

if (!(URL_argument))
  {URL_argument = "index=Oppslag"}


var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag & drop Netscape 4////
////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag & drop ie4+ and Netscape 6////
/////////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage

var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////


function hidebox(){
  var closeOK = true;
//  if (postIt_frame.document.getElementById('PostIt').Lagre.disabled == '')
  if (!(postIt_frame.TextChanged == ''))
    {
      if (!confirm (' Du har ikke lagret endringene!\n\nEndringene går tapt om du glemmer å lagre\nfør du går til et annet dokument.\n\n Velg "Avbryt" om du vil likevel vil lagre.'))
//        postIt_frame.TextChanged = ''
//      else 
        closeOK = false
    }
  if (closeOK == true)
    {
      if (ie4)
        {
        crossobj.style.visibility="hidden" 
        }
      else if (ns6)
        {
          document.getElementById('showimage').style.visibility="hidden";
        }
      else if (ns4)
        document.showimage.visibility="hidden"
    } 
//    postIt_frame.document.getElementById('PostIt').submit();
}

function showbox(){
  if (ie4)
    {
     document.all.showimage.style.left=screen.availWidth-320;
     document.all.showimage.style.visibility=""
    }

  else if (ns6)
    {
      document.getElementById('showimage').style.left=screen.availWidth-320;
      document.getElementById('showimage').style.visibility=""
    }
  else 
if (ns4)
    document.showimage.visibility=""
}

function CheckOpenClose()
  {
    if (ie4)
      {
        if (document.all.showimage.style.visibility=='hidden')
          showbox()
        else 
          hidebox()
      }
    else if (ns6)
      {
        if (document.getElementById('showimage').style.visibility=='hidden')
          showbox()
        else 
          hidebox()
      }
    else if (ns4)
      {
        if (document.showimage.style.visibility=='hidden')
          showbox()
        else 
          hidebox()
      }
  }



function SkrivPostIt() {
  document.write('<div id="showimage" style="position:absolute;visibility:hidden;width:270px;left:0;top:0;z-index:100">');
  document.write('<ilayer width="100%" onSelectStart="return false">');
  document.write('<layer width="100%" onMouseover="dragswitch=1;if (ns4) drag_dropns(showimage)" onMouseout="dragswitch=0">');
  document.write('<table id="notattabell" border="1" style="border:1px solid #000000; width:100%;height:320;background:#FFFF99;color:#FFFFFF" cellspacing="0" cellpadding="0">');
  document.write('  <tr>');
  document.write('    <td>');
  document.write('    <table border="0" width="270" cellspacing="0" cellpadding="0">');
  document.write('      <tr style="oolor:#000000">');
  document.write('<th id="dragbar" align="left" style="cursor:hand;width:254px;font-family:Arial;font.size:12px;"><img src="/EdOnWebGrafikk/ikoner/postit_mover.gif" width="15" height="15" border="0" align="left">&nbsp;EdOnWeb: Notater</th>');
  document.write('<td align="right" style="width:16px" valign="middle"><a href="javascript:void(0);" onClick="hidebox();"><img src="/EdOnWebGrafikk/ikoner/postit_close.gif" width="21" height="21" border="0" alt="Minimer notatet (NB! husk å lagre)"></a></td>');
  document.write('</tr>');
  document.write('      <tr>');
  document.write('        <td style="padding:0px" colspan="2" valign="top" align="center">');
  if (eowBruker)
    document.write('<iframe width="260" id="postIt_frame" name="postIt_frame" height="300" frameborder="0" scrolling="no" src="admin/PostIt.cgi?index='+eowIndex+'&dokument='+eowDocument+'&aktivdokument='+eowDocument+'&txtwidth=260&txtheight=270"></iframe>');
  document.write('      </td>');
  document.write('      </tr>');
  document.write('    </table>');
  document.write('    </td>');
  document.write('  </tr>');
  document.write('</table>');
  document.write('</layer>');
  document.write('</ilayer>');
  document.write('</div>');
}

SkrivPostIt();






function SkrivIkoner() {
  var usePrevNext = false;
  document.write('<div id="waterMark" style="position:absolute;z-index:50">');
  document.write('<a href="javascript:void(0);" title="Rull til toppen av dokumentet" onClick="window.scrollTo(0,0)"><img src="/EdOnWebGrafikk/pekere/til_topp.gif" hspace="13" width="21" height="13" border="0"></a><br />');

  if (eowPrevDocument && eowBruker && eowUseNavArrows)
   {
    if (eowPrevDocument) 
       document.write(eowPrevDocument);
    document.write('<a href="javascript:void(0);" title="Skrive notat til dette dokumentet" onClick="CheckOpenClose();"><img src="/EdOnWebGrafikk/ikoner/postit.gif" name="notatikon" hspace="0" width="21" height="21" border="0"></a>');
    if (eowNextDocument)
      document.write(eowNextDocument);
   }
  else if (eowBruker)
    document.write('<a href="javascript:void(0);" title="Skrive notat til dette dokumentet" onClick="CheckOpenClose();"><img src="/EdOnWebGrafikk/ikoner/postit.gif" name="notatikon" hspace="15" width="21" height="21" border="0"></a><br />');
  else
    document.write('<br />');
  document.write('<a href="javascript:void(0);" title="Rull ned et skjermbilde" onClick="window.scrollBy(0,window.innerHeight-50);"><img src="/EdOnWebGrafikk/pekere/til_bunn.gif" name="bunnikon" hspace="13" width="21" height="13" border="0" alt="Rull ned"></a>');
  if (eowBruker == 'frode')
    {
     document.write('<a href="javascript:void(0)" onClick="eowNavOversikt=window.resizeTo(screen.availWidth-120,screen.availHeight);window.moveTo(0,0);window.open(\'admin/oversikt.cgi\',\'eowNavOversikt\',\'width=120,height=\'+(screen.availHeight-30)+\',top=0,left=\'+(screen.availWidth-120)+\',scrollbars=yes,resizable,menubar=no\');">*</a>')
    }
  document.write('</div>');
  if (eowOpenNotebook)
    {CheckOpenClose();}
}

markW = 60;       // pixels wide
markH = 57;       // pixels high
markX = 100;      // percent right
markY = 100;      // percent down
markRefresh = 10; // milliseconds
// set common object reference

SkrivIkoner();


if (!document.all)
  document.all = document;
//if (!document.all.waterMark.style)
//  document.all.waterMark.style = document.all.waterMark;


if (ns6)
 wMark = document.getElementById('waterMark').style;
else
 wMark = document.all.waterMark.style;
wMark.width = markW;
wMark.height = markH;
navDOM = window.innerHeight; // Nav DOM flag

function setVals() {
 if (!ie4)
   barW = 0; // scrollbar compensation for PC Nav
 else
   barW = 5;
 barH = 10;
 if (navDOM) {
  if (document.height > innerHeight) barW = 20;
  if (document.width > innerWidth) barH = 20;
  } else {
  innerWidth = document.body.clientWidth;
  innerHeight = document.body.clientHeight;
  }
 posX = (innerWidth - markW)-barW;
 posY = (innerHeight - markH)-barH;
 }

function wRefresh() {
 wMark.left = posX + (navDOM?pageXOffset:document.body.scrollLeft);
 var myScreenTop = parseInt(navDOM?pageYOffset:document.body.scrollTop);
 wMark.top = posY + myScreenTop;
 if (ns6)
   {
     var noteTop =parseInt(document.getElementById('showimage').style.top)
     if (noteTop < myScreenTop)
       document.getElementById('showimage').style.top = myScreenTop
   else if (noteTop+325 > myScreenTop +parseInt(innerHeight))
     document.getElementById('showimage').style.top = (myScreenTop +innerHeight) -325
   }
 else
   {
     if (parseInt(document.all.showimage.style.top) < myScreenTop)
       document.all.showimage.style.top = myScreenTop
   else if (parseInt(document.all.showimage.style.top)+325 > myScreenTop +parseInt(innerHeight))
     document.all.showimage.style.top = (myScreenTop +innerHeight) -325
   }
 }

function markMe() {
 setVals();
 window.onresize=setVals;
 markID = setInterval ("wRefresh()",markRefresh);
 }

function StartEOW(){
 markMe();  // safety for Mac IE4.5
// start();
}

document.onload=StartEOW();



