var active = '';

function toggle(timage, tdiv, tlink, open, closed, fopen, fclosed){
  if ( timage ) {
    var re = new RegExp(fopen);
    var m = re.exec(timage.src);

    //if ( timage.src==fopen && !open ){
    if (open) {
      timage.src=fopen;
    } else if (closed) {
      timage.src=fclosed;
    } else if ( m ){
      timage.src=fclosed;
    } else {
      timage.src=fopen;
    }
  }
  if ( tdiv ) {
    var currDiv = document.getElementById(tdiv);
    if ( currDiv.style.display=='block' && !open ) {
      currDiv.style.display='none';
    }
    else {
      currDiv.style.display='block';
    }
  }
  if ( tlink ) {
    active.background='#ffffff';
    active.color='#000000';
    
    tlink.background='#666666';
    tlink.color='#ffffff';
    
    active=tlink;
  }
}



function vindu(url,title,width,height) {
  newwin=window.open(url,title,'width='+width+',height='+height+',scrollbars=yes,resizable=yes,menubar=no,toolbar=no');
  newwin.resizeTo(width,height);
  newwin.focus();
  x = screen.width;
  y = screen.height;
  newwin.moveTo((x/2)-(width/2),(y/2)-(height/2));
}

