<!-- Begin

// Pre-load images.
if (document.images)
{
	var nav0 = new Image();
	nav0.src = 'images/header_all_off.gif';
	var nav1 = new Image();
	nav1.src = 'images/home_on.gif';
	var nav2 = new Image();
	nav2.src = 'images/about_on.gif';
	var nav3 = new Image();
	nav3.src = 'images/technique_on.gif';
	var nav4 = new Image();
	nav4.src = 'images/photographs_on.gif';
	var nav5 = new Image();
	nav5.src = 'images/history_on.gif';
	var nav6 = new Image();
	nav6.src = 'images/faq_on.gif';
	var nav7 = new Image();
	nav7.src = 'images/location_on.gif';
	var nav8 = new Image();
	nav8.src = 'images/contact_on.gif';
}

// Set name of current window so that it can be used as target when flowing to another window.
name = 'mainwindow';

// Determine if Netscape.
var isNav = (navigator.appName.indexOf("Netscape") !=-1);

// Turn on mousemove and mouseup events for Netscape.
if (isNav){
	document.captureEvents(Event.MOUSEMOVE);
	document.captureEvents(Event.MOUSEUP);
}

// OPEN NEW WINDOW IN CURRENT WINDOW:
// document.location does not work on all browsers; instead open in current window
function opennext(windowname) {
	var window_width = window.outerWidth;
	var window_height = window.outerHeight;
	var window_xpos = window.pageXOffset;
	var window_ypos = window.pageYOffset;
	var properties="width=" + window_width + ",height=" + window_height + ",left=" + window_xpos + ",top=" + window_ypos + ",toolbar=yes,scrollbars=yes,menubar=yes,resizable=yes";
	// open the new window in the same place as the current window
	nextwindow = window.open(windowname, "mainwindow", properties);
}

// ROLLOVERS:
// Determine x,y position of mouse and derive number of navigation image to display (number after "nav" above. 
// Entire set of "buttons" is one image, and just switches out entire image so that one button appears to be "on".
// Formula is x - 87/36 * y for 2.4166667, x - 53/124 * y for 0.4274194
// Vertical boundary is the slanted line from top left to bottom left and top right to bottom right of buttons
function navswitch(e,imgName) {
	pos_max = new Array (701,654,608,561,514,467,420,373);
	left_pos_max = new Array ();
	x_position = (isNav) ? e.pageX : event.clientX
	y_position = (isNav) ? e.pageY : event.clientY
	x_plus_y = x_position + (2.4857143 * y_position);
	vertical_boundary_x_plus_y = x_position - (0.4274194 * y_position);
	
	if (vertical_boundary_x_plus_y < 304 || vertical_boundary_x_plus_y > 406 || y_position > 149 || x_position < 310 || x_position > 457 || x_plus_y < 0 ) {
		image_suffix = '0';
	}
	else {
		for (i=0; i<8; i++) {
			if (x_plus_y > pos_max[i]) {
				image_suffix = 8 - i; 
				break;
			}
		}
	}
	
	if (document.images) {
		document[imgName].src = eval('nav' + image_suffix + '.src');
		}
	return true;
}

// NAVIGATION:
// Determine x,y position of mouse and derive number of navigation image to display (number after "nav" above. 
// Entire set of "buttons" is one image, and just switches out entire image so that one button appears to be "on".
function urlselect(e) {
	pos_max = new Array (701,654,608,561,514,467,420,373);
	url_name = new Array ('contact','location','faq','history','photographs','technique','about','index');
	x_position = (isNav) ? e.pageX : event.clientX
	y_position = (isNav) ? e.pageY : event.clientY
	x_plus_y = x_position + (2.4857143 * y_position);
	vertical_boundary_x_plus_y = x_position - (0.4262295 * y_position);
	
	
	if (vertical_boundary_x_plus_y < 304 || vertical_boundary_x_plus_y > 406 || y_position > 149 || x_position < 310 || x_position > 457 || x_plus_y < 0) {
	}
	else {
		for (i=0; i<8; i++) {
			if (x_plus_y > pos_max[i]) {
				break;
			}
		}
		opennext(url_name[i] + '.asp');
	}
	return true;
}

// Determine x,y position values when mouse moves, and call nav image switcher
function handlerMM(e){
	Xmm = (isNav) ? e.pageX : event.clientX;
	Ymm = (isNav) ? e.pageY : event.clientY;
	navswitch(e, 'nav');
	// The following are to display x,y positions of mouse for debugging.
	//document.dataholder.mmX.value=Xmm;
	//document.dataholder.mmY.value=Ymm;
}

// Determine x,y position values on mouse up, and determine url
function handlerMU(e){
	Xmu = (isNav) ? e.pageX : event.clientX;
	Ymu = (isNav) ? e.pageY : event.clientY;
	urlselect(e);
	// The following are to display x,y positions of mouseup for debugging.
	//document.dataholder.muX.value=Xmu;
	//document.dataholder.muY.value=Ymu;
}

// Call handler function when mouse moves. This determines rollover image to use based on mouse position.
document.onmousemove = handlerMM;

// Call handler function on mouse up. This determines url of page to display.
document.onmouseup = handlerMU;

// End -->
