
     var layerRef = ""; 
     var styleSwitch = "";
     var isIE = 0;
     var isNav = 0;
     var Vnum  = 0;
    
     //  Determine our browser
     if (navigator.appName == 'Netscape'){
         layerRef = 'document.layers';
         styleSwitch = '';
	 isNav = 1;
	 Vnum = navigator.appVersion.substring(0, 1);
     }
     else{		// IE
         layerRef = 'document.all';
         styleSwitch = '.style';
	 isIE = 1;
	 Vnum = navigator.userAgent.substring(30, 31);
     }

     //  If the browser detected does not meet our standards, show requirements page
     if (Vnum >= 4) {
        //  Browser meets our standards, check for cookies.
	//  If cookies are not enabled, show our cookie requirement page
	//
	//  *sigh* netscape considers this "private" information; one must used a "signed" script
	//  in order to read the cookieBehavior property...
	//if ((isIE && !navigator.cookieEnabled) || (isNav && (preference("network.cookie.cookieBehavior") == 2))){
	if (isIE && !navigator.cookieEnabled) {
	    window.open("cookie.htm","wname","width=400","height=200","toolbar=0","location=0","directories=0","menubar=0","scrollbars=0","resizeable=0");
	}
     }

     //  Preload images 
     function preLoad() {
	if (document.layers || document.all) {
	    for (var i=0; i<arguments.length; i++) {
		eval(arguments[i]+' = new Image()')
		eval(arguments[i]+'.src = "images/'+arguments[i]+'.gif"')
	    }
	}
	
     }

     function hideLayer(layerID){
	if (Vnum >= 4) eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="hidden"');
     }

     function showLayer(layerID){
       if (Vnum >= 4) eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="visible"');
     }

/*
**  Flash menu selections on mouse events.
**  This one turns on the active color.
*/
function FlashOn(color, target){
    var eSrc;
    if (document.all){		// IE
   	eSrc = window.event.srcElement.style;
	eSrc.color=color;
    }
}
/*
**  Return to default color.
*/
function FlashOff(target){
    var eSrc;
    if (document.all){		// IE
   	eSrc = window.event.srcElement.style;
	eSrc.color="";
    }
}

/*
**  Replace an image source.
*/
function imageFlash(imageID, Image){
    if (document.images) {
	document.images[imageID].src = "images/" + Image + ".gif";
    }
}

/*
**  Update the content of a div/layer
*/
function layerWrite(id,text){
    if (Vnum >= 4){ 
        if (isNav) {
	    document.layers[id].document.write(text);
	    document.layers[id].document.close();
        }
        else if (isIE) document.all[id].innerHTML = text;
    }
}

/*
**  Update the candy bowl to the current candy count
*/
function showCandy(candyCount){
	if (isIE) {
	    candyImg.src = "images/c" + candyCount + ".gif";
	}
	if (isNav) {
	    layerWrite("candyDiv", '<font face=arial><img NAME="candyImg" src="images/c' + candyCount + '.gif"</font>');
	}
}
