


    // preload all the menu mouseovers
    var image1 = new Image();
    image1.src = "res/img/aboutthetrustover.jpg";
    var image2 = new Image();
    image2.src = "res/img/nicholasstoryover.jpg";
    var image3 = new Image();
    image3.src = "res/img/howtohelpover.jpg";
    var image4 = new Image();
    image4.src = "res/img/contactusover.jpg";
    var image5 = new Image();
    image5.src = "res/img/latestnewsover.jpg";
   
    
    function ci(p1, p2) { // changeimage
		document[p1].src = 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 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;
      }
    }  
        

        
        
   function IsValidEmail(EmailAddr) {
        return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(EmailAddr))
    }
    
    
    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) {
    	    styleObject.visibility = newVisibility;
    	    return true;
        } else {
    	    // we couldn't find the object, so we can't change its visibility
    	    return false;
        }
    }


   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 ShowPic(sFileName,sDimensions, sNote) {
       var pop_win = window.open("", "win2", sDimensions);
       pop_win.document.open("text/html", "replace");
       pop_win.document.write("<HTML><HEAD><title>" + sFileName + "</title></HEAD>");
       pop_win.document.write("<body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0>");
       pop_win.document.write("<center><a href='javascript:self.close();'><img src='" + sFileName + "' alt='Click to close' border=0></a>");
       pop_win.document.write("<br><font face=verdana size=1>" + sNote + "</font></center>");
       pop_win.document.write("</body></HTML>");
       pop_win.focus();
    }