

    // preload all the menu mouseovers
    var image1 = new Image();
    image1.src = "res/img/homer.jpg";
    var image2 = new Image();
    image2.src = "res/img/visitorsr.jpg";
    var image3 = new Image();
    image3.src = "res/img/studentsr.jpg";
    var image4 = new Image();
    image4.src = "res/img/parentsr.jpg";
    var image5 = new Image();
    image5.src = "res/img/staffr.jpg";
    var image6 = new Image();
    image6.src = "res/img/nogar.jpg";
    var image7 = new Image();
    image7.src = "res/img/contactusr.jpg";
    
    function ci(p1, p2) { // changeimage
       document[p1].src = "res/img/" + p2;
    }
    
    function showPanel2(PanelName,ImageName,xoffset,yoffset) {
        var menuPosition = imgXY(ImageName);                                    /* detect the coordinates of the specified image */
        showPanel(PanelName, menuPosition.x+xoffset, menuPosition.y+yoffset);   /* display the menu x-offset and y-offset from upper left corner of image */
    }

    function imgXY(imgID) {                                                     /* This function returns the upperleft x,y coordinates of the specified image */
        var XY = new Object();
        var imgObj = document.images[imgID];
        if (document.layers) {
            XY.x = eval(imgObj).x;
            XY.y = eval(imgObj).y;
        } else {
            var x,y, tempEl;
            x = eval(imgObj).offsetLeft;
            y = eval(imgObj).offsetTop;
            tempEl = eval(imgObj).offsetParent;
            while (tempEl != null) {
                x += tempEl.offsetLeft;
                y += tempEl.offsetTop;
                tempEl = tempEl.offsetParent;
            }
            XY.x = x;
            XY.y = y;
        }
        return XY;
    }

    function checkdata() { 
        var sSearchfor = document.ngsearch.searchfor.value;
        sSearchfor = sSearchfor.replace(/ /g, ""); // remove spaces
        if (sSearchfor.length ==0 || sSearchfor == "Search") {
            document.ngsearch.searchfor.value = "Search";
            return false;
        }
    }

         
   function IsValidEmail(EmailAddr) {
        return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(EmailAddr))
    }
   function IsNumeric(strString) {      //  check for valid numeric strings   

      var strValidChars = "0123456789";
      var strChar;
      var blnResult = true;
      
      strString = strString.replace(/ /g, ""); // remove spaces
      if (strString.length == 0) return false;
   
      //  test strString consists of valid characters listed above
      for (i = 0; i < strString.length && blnResult == true; i++) {
         strChar = strString.charAt(i);
         if (strValidChars.indexOf(strChar) == -1) blnResult = false;
      }
      return blnResult;
   }   
   
   
    function NewWindow(mypage, myname, w, h, scroll) {
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
        win = window.open(mypage, myname, winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }
    
    function show3() {
        changeObjectVisibility('yr1', 'hidden');
        changeObjectVisibility('yr3', 'visible');
    }
    function show1() {
        changeObjectVisibility('yr3', 'hidden');
        changeObjectVisibility('yr1', 'visible');
    }        
    function changeObjectVisibility(objectId, newVisibility) {
        // first get a reference to the cross-browser style object 
        // and make sure the object exists
        var styleObject = getStyleObject(objectId);
        if(styleObject) {
            //alert("setting "+objectId+" "+newVisibility);
               styleObject.visibility = newVisibility;
               return true;
        } else {
               // we couldn't find the object, so we can't change its visibility
               return false;
       }
    }
    function getStyleObject(objectId) {
        // checkW3C DOM, then MSIE 4, then NN 4.
        if(document.getElementById && document.getElementById(objectId)) {
               return document.getElementById(objectId).style;
        }
        else if (document.all && document.all(objectId)) {  
            return document.all(objectId).style;
        } 
        else if (document.layers && document.layers[objectId]) { 
               return document.layers[objectId];
        } else {
               return false;
      }
    }  