// ******************************************************
// Script from Stefan Koch - Voodoo's Intro to JavaScript
//     http://rummelplatz.uni-mannheim.de/~skoch/js/
//       JS-book: http://www.dpunkt.de/javascript
//    You can use this code if you leave this message
// ******************************************************

// ok, we have a JavaScript browser
var browserOK = false;
var pics;

// JavaScript 1.1 browser - oh yes!
browserOK = true;
pics = new Array();

var objCount = 0; // number of (changing) images on web-page

function preload(name, imgOff, imgOver, imgOn, selected) {
  // preload images and place them in an array

  if (browserOK) {
    pics[objCount] = new Array(5);
    pics[objCount][0] = new Image();
    pics[objCount][1] = new Image();
    pics[objCount][0].src = imgOff;
    pics[objCount][1].src = imgOver;
    pics[objCount][2] = name;
    pics[objCount][3] = selected;
    pics[objCount][5] = new Image();    
    pics[objCount][5].src = imgOn;
    objCount++;
  }
}

function on(name){
  if (browserOK) {
     for (i = 0; i < objCount; i++) {
      if (document.images[pics[i][2]] != null)
          if (name != pics[i][2]) {
            if (pics[i][3] != 'on') {
  		 // set back all other pictures
             document.images[pics[i][2]].src = pics[i][0].src;
	      }
          } else {
             // show the second image because cursor moves across this image
            if (pics[i][3] != 'on') {
              document.images[pics[i][2]].src = pics[i][1].src;
	    } 
         }
    }
  }
}

function off(name){
  if (browserOK) {
     for (i = 0; i < objCount; i++) {
      if (document.images[pics[i][2]] != null)
          if (name == pics[i][2]) {
            // set the picture
            if (pics[i][3] != 'on') {
		    document.images[pics[i][2]].src = pics[i][0].src;
	      } else {
                if (pics[i][3] != 'on') {
                  document.images[pics[i][2]].src = pics[i][1].src;
	        } 
	      }
          }
    }
  }
}

function bclick(name){
  if (browserOK) {
     for (i = 0; i < objCount; i++) {
      if (document.images[pics[i][2]] != null)
        if (name == pics[i][2]) {
	    // set the picture
	    document.images[pics[i][2]].src = pics[i][5].src;
	    pics[i][3] = 'on';          
        } else {
	    pics[i][3] = 'off'; 
	    document.images[pics[i][2]].src = pics[i][0].src;
        }
    }
  }
}

function resetall(){
  if (browserOK) {
     for (i = 0; i < objCount; i++) {
      // set back all pictures
      if (document.images[pics[i][2]] != null)
        document.images[pics[i][2]].src = pics[i][0].src;
    }
  }
}

function DubbeleLink(link1, link2)
{
   parent.frames[1].location.href=link1;
   parent.frames[2].location.href=link2;
}

function displayAnswer(qid)
{
	if( (qid.style.display == "") || (qid.style.display == "none") ) {
		qid.style.display = "block";
	}
	else {
		qid.style.display = "none";
	}
}
