
 //
 // Copyright @ Aug 2002. All rights reserved. Do not copy or adapt from this
 // code without getting permission from me...
 // I sweated for days to get this working, the least you can do it ask before
 // you take it.
 //    Gordon Russell <Dr_G_Russell@hotmail.com>

 // ----
 // Browser control librar
 // ----
 var isNS4;
 var isIE4;
 var isIE5;
 var isNS6;
 var boxVisible=0;
 var whatVisible;

 function browser() {
   isNS4 = (document.layers) ? true : false;
   isIE4 = (document.all && !document.getElementById) ? true : false;
   isIE5 = (document.all && document.getElementById) ? true : false;
   isNS6 = (!document.all && document.getElementById) ? true : false;
   setTimeout("KeepToTop()",300);
 }
 function wclose() {
   if (boxVisible==1) {
     setHidden(whatVisible);
   }
   boxVisible=0;
   whatVisible="";
   return false;
 }
 var imageset = new Array();
 function logChoice(press) {
   //for (var i=0; i<imageset.length; i++) {
   //  alert("Image "+i+" is "+imageset[i].complete);
   //}
   var id = document.getElementById('rtn'+press);
   if (id != null) {
     var code = id.firstChild.nodeValue;
     var i = new Image(50,50);
     var rnd = Math.floor(Math.random()*100000)+1;
     i.src = "http://linuxzoo.net/mc/press.cgi?rnd="+rnd+"&qno="+code+"&ans="+press;
     imageset.push(i);
   }
   //window.status = "Done (really)";
 }
 function bpress(id) {
   bname = "none";
   if (id == "A") {bname = "ans0"}
   if (id == "B") {bname = "ans1"}
   if (id == "C") {bname = "ans2"}
   if (id == "D") {bname = "ans3"}
   if (id == "E") {bname = "ans4"}
   if (boxVisible==1) {
     setHidden(whatVisible);
     boxVisible=0;
   }
   if (whatVisible != document.getElementById(bname)) {
     if (bname != "none") {
       whatVisible = document.getElementById(bname);
       setVisible(whatVisible);
       logChoice(id);
       boxVisible=1;
       updatePos();
     }
   } else {
     whatVisible="";
   }
 }
 function updatePos() {
   x = 0;
   y = 0;
   if (window.innerHeight) {
     y = window.pageYOffset
     x = window.pageXOffset
   } else if (document.documentElement && document.documentElement.scrollTop) {
     y = document.documentElement.scrollTop
     x = document.documentElement.scrollLeft
   } else if (document.body) {
     y = document.body.scrollTop
     x = document.body.scrollLeft
   }

   if (boxVisible==1) {
     setLeft(whatVisible,x+20);
     setTop(whatVisible,y+140);
   }
 }
 function KeepToTop() {
   updatePos();
   setTimeout("KeepToTop()",300);
 }
 function setHidden(ob) {
   if (isIE4 || isIE5 || isNS6) { ob.style.display="none"; }
   if (isNS4) { ob="hide"; }
 }
 function setVisible(ob) {
   if (isIE4 || isIE5 || isNS6) { ob.style.display="block"; }
   if (isNS4) { ob="show"; }
 }
 function getElement(name) {
   if (isNS4) { return document.layer[name]; }
   if (isIE4) { return document.all[name]; }
   if (isIE5 || isNS6) { return document.getElementById(name); }
 }
 function setStyle(ob) {
   if (isIE4 || isIE5 || isNS6) { return ob.style; }
   if (isNS4) { return ob ; }
 }
 function setBGC(ob,x) {
   if (isIE4 || isIE5) { ob.style.backgroundColor = x; }
   if (isNS4 ) { ob.bgColor= x; }
   if (isNS6 ) { ob.style.backgroundColor  = x; }
 }
 function setLeft(ob,x) {
   if (isIE4 || isIE5 ) { ob.style.left= x; }
   if (isNS6 ) { ob.style.left= x + "px"; }
   if (isNS4) { ob.left= x; }
 }
 function setTop(ob,x) {
   if (isIE4 || isIE5 ) { ob.style.top= x; }
   if (isNS6 ) { ob.style.top= x + "px"; }
   if (isNS4) { ob.top = x; }
 }
 function setZindex(ob,zi) {
   if (isIE4 || isIE5 || isNS6 ) { ob.style.zIndex = zi; }
   if (isNS4) { ob.zIndex = zi; }
 }

