//By Dan Beeby, Mellon Language Project.  dbeeby@haverford.edu  http://lang.swarthmore.edu/makers/
//  Content by: Matt Errey, matterry@loxinfo.co.th
   
    function MM_showHideLayers() { //v2.0
          if (document.form.counter.value!=2){
          var i, visStr, args, theObj;
          args = MM_showHideLayers.arguments;
          for (i=0; i<(args.length-2); i+=3) { //with arg triples (objNS,objIE,visStr)
           visStr   = args[i+2];
            if (navigator.appName == 'Netscape' && document.layers != null) {
              theObj = eval(args[i]);
       
              if (theObj) theObj.visibility = visStr;
            } else { // assume we can use document.all
              if (visStr == 'show') visStr = 'visible'; //convert vals
              if (visStr == 'hide') visStr = 'hidden';
              theObj = eval(args[i+1]);
              if (theObj) theObj.style.visibility = visStr;
            }
          }
        }
       }
      
        // check and see if they match
        function checkit(g, h, i){
          if (document.form.counter.value!=2){
          if (document.form.one.value==""){
           document.form.one.value = g;
           document.form.memoryone.value = h;
           var j=i;
             document.form.j.value = j;
          }
          else{
               document.form.two.value = g;
               document.form.memorytwo.value = h;
               document.form.counter.value = 2;
              }
          if (document.form.two.value != ""){
              if (document.form.two.value==document.form.memoryone.value && document.form.one.value == document.form.memorytwo.value){
                 document.form.g.value=g;
                 document.form.h.value=h;
                 document.form.one.value="";
                 document.form.memoryone.value="";
                 document.form.two.value="";
                 document.form.memorytwo.value="";
                 var timer=setTimeout("disappear()",1000)
       
                  }
                  else{
                       document.form.i.value=i;
                       document.form.one.value="";
                       document.form.memoryone.value="";
                       document.form.two.value="";
                       document.form.memorytwo.value="";
                       var timer=setTimeout("flip()",2000)
                   }
               }
           } 
        } 
       
        function flip(){
                       var j=document.form.j.value;
                       var i=document.form.i.value;
                       document.all[i].style.visibility='visible';
                       document.all[j].style.visibility='visible';
                 clear();
          }
       
        function disappear(){
                       var g=document.form.g.value;
                       var h=document.form.h.value;
                 document.all[g].style.visibility='hidden';
                 document.all[h].style.visibility='hidden';
                 clear();
          }
        function clear(){
                 document.form.counter.value="";
                 document.form.g.value="";
                 document.form.h.value="";
                 document.form.i.value="";
                 document.form.j.value="";
                 document.form.one.value="";
                 document.form.memoryone.value="";
                 document.form.two.value="";
                 document.form.memorytwo.value="";
          }
   
function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v2.0
  var newURL = '', version = parseFloat(navigator.appVersion);
  if (navigator.appName.indexOf('Netscape') != -1) {
    if (version >= NSvers) {if (NSpass>0) newURL = (NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL = (NSnoPass==1)?URL:altURL;}
  } else if (navigator.appName.indexOf('Microsoft') != -1) {
    if (version >= IEvers) {if (IEpass>0) newURL = (IEpass==1)?URL:altURL;}
    else {if (IEnoPass>0) newURL = (IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL = (OBpass==1)?URL:altURL;
  if (newURL) {
    window.location = unescape(newURL);
    document.MM_returnValue = false;
  }
}
