
function getWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && document.body.clientWidth ) {
      //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return(myWidth);
}

function getHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return(myHeight);
}

function GoToStart() {
  document.location='index.php?id=1';
}

function ShowWhenReady() {
  document.getElementById('tekst').style.display='';
  document.getElementById('foto').style.display='';
  if (document.getElementById('blok')) {
    setTimeout('beeldwissel()',4000);
  }
}

function ShowFrameWhenReady() {
  document.getElementById('foto').style.display='';
  if (document.getElementById('blok')) {
    setTimeout('beeldwisselInFrame()',4000);
  }
}

function runSlideShow() {
	if (document.all) {
		document.images.SlideShow.style.filter="blendTrans(duration=2)";
		document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
		document.images.SlideShow.filters.blendTrans.Apply();
	}
	document.images.SlideShow.src = preLoad[j].src;
	if (document.all) {
		document.images.SlideShow.filters.blendTrans.Play();
	}
	j = j + 1;
	if (j > (p - 1)) j = 0;
	t = setTimeout('runSlideShow()', slideShowSpeed);
}

function beeldwissel(){
  if (window.createPopup)
    blok.filters[0].apply()
    document.images.blok.src=afb[teller].src;
    document.images.data.src=text[teller].src;
  if (window.createPopup)
    blok.filters[0].play()
    teller++;
  if (teller==afb.length)
    teller=0;
  setTimeout("beeldwissel()",tussentijd)
}

function beeldwisselInFrame(){
  if (window.createPopup)
    blok.filters[0].apply()
    document.images.blok.src=afb[teller].src;
  if (window.createPopup)
    blok.filters[0].play()
    teller++;
  if (teller==afb.length)
    teller=0;
  setTimeout("beeldwisselInFrame()",tussentijd)
}

function vergrootwissel(){
  if (window.createPopup)
    vergroting.filters[0].apply()
    document.images.vergroting.src=vergr[teller].src;
  if (window.createPopup)
    vergroting.filters[0].play()
    teller++;
  if (teller==vergr.length)
    teller=0;
  setTimeout("vergrootwissel()",tussentijd)
}

function ShowButton(obj) {
//  obj.style = 'background: url(img_mt/minisave.gif); background-repeat: no-repeat; width: 26px; padding: 0 0 0 0 ';
  obj.style.display = '';
}

function showImage(image, title, width, height, imagetext, description) {
  var windowNote;
  windowNote = window.open('','Image','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + width + ',height='+height);
  text = '<HTML><HEAD><TITLE>' + title + '</TITLE><link rel="STYLESHEET" type="text/css" href="ppp.css"></HEAD><BODY scroll="no" alink="ff0000" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">';
  text += '<table border="0" cellspacing="2" cellpadding="0"><tr><td><IMG SRC="' + image + '" BORDER=0 ALIGN=LEFT></td></tr>';
  text += '<tr><td class="book_header" align="center">' + imagetext + '</td></tr>';
  text += '<tr><td align="center">' + description + '</td></tr>';
  text += '</table></BODY></HTML>';
  windowNote.document.write(text);
  windowNote.focus();
  windowNote.document.close();
  return false;
}

function GoToSubPage(list) {
	document.location='mt_pagina.php?id='+list.options[list.selectedIndex].value;
}

function SetTooltip(n, b, l, editable) {
  if (n.value == '' || n.value == l.options[l.selectedIndex].text) {
    b.style.background = "url(img_mt/miniback.gif)";
//    b.style.background-repeat = "no-repeat";
    b.title = 'Terug naar selectie';
  } else {
    if (editable==0) {   // item aanpassen NIET toegestaan!!
      b.style.background = "url(img_mt/minisave_n.gif)";
//    	b.style.background-repeat = "no-repeat";
      b.title = "Nieuw item opslaan";
    } else if (l.options[l.selectedIndex].value==0) {   // geen item geselecteerd!!
      b.style.background = "url(img_mt/minisave_n.gif)";
//    	b.style.background-repeat = "no-repeat";
      b.title = "Nieuw item opslaan";
    } else {
      b.style.background = "url(img_mt/minisave_e.gif)";
//    	b.style.background-repeat = "no-repeat";
      b.title = "Aanpassing opslaan";
    }
  }
}

function ToggleListbox(n, b, l, t, id, cb) {
  if (b.title == "Aanpassing opslaan" || b.title == "Nieuw item opslaan") {
    document.forms[0].submit();
    b.title = 'Terug naar de selectie';
    b.style.background = "url(img_mt/miniback.gif)"
//		b.style.background-repeat = "no-repeat";
  } else {    // in rust...
    if (l.options[l.selectedIndex].value==0) {   // geen item geselecteerd, dus toevoegen!!
      if (n.style.display == '') {
        document.getElementById(id).style.color = '#000099';
        b.style.background = 'url(img_mt/minikruisje.gif)';
//				b.style.background-repeat = "no-repeat";
        b.title = t + ' toevoegen';
        n.style.display = 'none';
        if (cb) {
          cb.style.display = 'none';
        }
        l.style.display = '';
      } else {
        n.value = '';
        document.getElementById(id).style.color = 'Red';
        b.style.background = 'url(img_mt/miniback.gif)';
//				b.style.background-repeat = "no-repeat";
        b.title = 'Terug naar de selectie';
        n.style.display = '';
        if (cb) {
          cb.style.display = '';
        }
        l.style.display = 'none';
        n.focus();
      }
    } else {                              // wel een item geselecteerd !!
      if (n.style.display == '') {
        document.getElementById(id).style.color = '#000099';
        b.style.background = 'url(img_mt/b_edit.png)';
//				b.style.background-repeat = "no-repeat";
        b.title = t + ' voor ALLE gekoppelde items aanpassen?';
        n.style.display = 'none';
        if (cb) {
          cb.style.display = 'none';
        }
        l.style.display = '';
      } else {
        n.value = l.options[l.selectedIndex].text;
        document.getElementById(id).style.color = 'Red';
        b.style.background = "url(img_mt/miniback.gif)";
//				b.style.background-repeat = "no-repeat";
        b.title = 'Terug naar de selectie';
        n.style.display = '';
        if (cb) {
          cb.style.display = '';
        }
        l.style.display = 'none';
        n.focus();
      }
    }
  }
}

function AddOrEdit(n, b, l, t, editible) {
  if (l.options[l.selectedIndex].value==n) {
    b.title = t + ' toevoegen';
  }  else {
    if (editible==1) {   // forceer: bewerken is WEL toegestaan!!!
       b.title = t + ' voor ALLE gekoppelde items aanpassen?';
  } else {
      b.title = t + ' toevoegen';
   }
  }
}

function AddOrRemove(lst1, b) {
  if (lst1.options[lst1.selectedIndex].value < 0) {
    b.title = 'Voeg een koppeling toe van de geselecteerde artikelomschr. naar de geselecteerde artikelgroep';
    b.style ='background: url(img_mt/miniback.gif); background-repeat: no-repeat; width: 26px; padding: 0 0 0 0';
  } else if (lst1.options[lst1.selectedIndex].value > 0) {
    b.title = 'Verwijder de koppeling van de geselecteerde artikelomschr. naar de geselecteerde artikelgroep';
    b.style ='background: url(img_mt/ed_delete.gif); background-repeat: no-repeat; width: 26px; padding: 0 0 0 0' ;
  }
}

