function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		spmenu_home_over = newImage("images/spmenu_home_over.jpg");
		spmenu_locat_over = newImage("images/spmenu_locat_over.jpg");
		spmenu_contact_over = newImage("images/spmenu_contact_over.jpg");
		spmenu_weekend_over = newImage("images/spmenu_weekend_over.jpg");
		spmenu_map_over = newImage("images/spmenu_map_over.jpg");
		spmenu_about_over = newImage("images/spmenu_about_over.jpg");
		spmenu_sub_over = newImage("images/spmenu_sub_over.jpg");
		spmenu_gallary_over = newImage("images/spmenu_gallary_over.jpg");
		preloadFlag = true;
	}
}

var t = 0;
var lDelay = 3;
var lCount = 0;
var pause = 200;

function findLivePageWidth() {
	if (window.innerWidth != null)
		return window.innerWidth;
	if (document.body.clientWidth != null)
		return document.body.clientWidth;
	return (null);
}
	
function popUp(evt,objectID){
	if (isDHTML) { // Makes sure this is a DHTML browser
		var livePageWidth = findLivePageWidth();
		//alert(livePageWidth);
		domStyle = findDOM(objectID,1);
		dom = findDOM(objectID,0);
		state = domStyle.visibility;
		if (dom.offsetWidth) elemWidth = dom.offsetWidth;
		else { if (dom.clip.width)	elemWidth = dom.clip.width; }
		if (state == "visible" || state == "show")  { domStyle.visibility = "hidden"; }
			domStyle.visibility = "visible"; // Makes the element visable 
	}
}
		

function delayHide() {
///// Checks to see if there is a menu showing and whether 
///// the global variable 't' has been set to 0
    if ((domStyle) && (t == 0)) {

///// Hides the old menu, resets menu conditions, 
///// and stops the function running
        domStyle.visibility = 'hidden'; 
        domStyle = null;
        lCount = 0; 
        return false;
    }

///// Interupts the function if another menu is opened
    if (t == 2) { lCount = 0; return false; }

///// Repeats the function adding 1 to lCount each time until 
///// lCount is equal to lDelay and then sets 't' to 0 so that 
///// the menu will hide when it runs again
    if (t == 1) { 
        lCount = lCount + 1;
        if (lDelay <= lCount) { t = 0; }
        if (lDelay >= lCount) { setTimeout('delayHide(' + t + ')',pause); }
    }
}

function hideBox(hideID){
	if (isDHTML) { // Makes sure this is a DHTML browser
		hideStyle = findDOM(hideID,1);
			hideStyle.visibility = "hidden"; // Makes the element hidden 
	}
}

