/////////////////////////////////////////////////////////////////////////
//
// This code copyright Brainwaave Interactive
// Canon v4
// Modified: 7th February, 2002
// By: webmaster@brainwaave.com.au
//
/////////////////////////////////////////////////////////////////////////

var img_src = new Array;
var current_img = '';
var first = true;
var popup_width = 173;

var over_ref, popup_ref, popup_o_ref;
var menu_top = 125;

function doMouseOver(the_item) {

	if (document.images && the_item.constructor == String) {
		if (current_img) doMouseOut(current_img);
//		document.all["div"+the_item].style.visibility = "visible";
		if (!img_src[the_item]) img_src[the_item] = document.images[the_item].src;
		document.images[the_item].src = over_src[the_item].src;
		current_img = the_item;
	}
}

function doMouseOut(the_item) {
//window.status = the_item;
	if (document.images && the_item.constructor == String) {
//		document.all["div"+the_item].style.visibility = "hidden";
		document.images[the_item].src = img_src[the_item];
		current_img = '';
	}
}

function doMenuMouseOver(menu, item_num, sub_menu, sub_item_num) {
	clearTimeout(mouseout_timeout);
//	window.status = "mouseover menu: "+menu+", item_num:"+item_num+", sub_menu:"+sub_menu;
	if (first) {
		over_ref = getRef("menuOver");
//	alert(over_ref);
		popup_ref = getRef("popup");
		popup_o_ref = getRef("popupOver");
		over_ref.top = menu_top;
		popup_ref.top = menu_top;
		popup_o_ref.top = menu_top;

		first = false;
	}
	else delayedMouseOut();
//window.status = the_item;//alert(the_item+': top='+offsets[the_item]+' bottom='+(offsets[the_item+1]-1));
/*	if (document.images && the_item.constructor == String) {
		if (current_img) doMouseOut(current_img);
//		document.all["div"+the_item].style.visibility = "visible";
		if (!img_src[the_item]) img_src[the_item] = document.images[the_item].src;
		document.images[the_item].src = over_src[the_item].src;
		current_img = the_item;
	}
	else*/ if (document.all || document.layers) {
//		if (current_img) doMouseOut(current_img);
//		var over_ref = getRef("menuOver");
		if (document.layers && over_ref) {
			over_ref.clip.left = 0;
			over_ref.clip.top = offsets[menu][item_num];
			over_ref.clip.bottom = offsets[menu][item_num+1];
			over_ref.clip.right = (sub_menu != null ? 146:146);
			if (sub_menu>=0) {
				popup_ref.clip.top = 0;
				popup_ref.clip.right = (sub_menu+1)*popup_width;
				popup_ref.clip.bottom = offsets[sub_menu+1][offsets[sub_menu+1].length-1]+1;
				popup_ref.clip.left = sub_menu*popup_width;

				popup_ref.left = 147-sub_menu*popup_width;
				popup_ref.top = menu_top+offsets[menu][item_num]+2;
				popup_ref.visibility="visible";
				
				if (sub_item_num>=0) {
					popup_o_ref.clip.top = offsets[sub_menu+1][sub_item_num];
					popup_o_ref.clip.right = (sub_menu+1)*popup_width;
					popup_o_ref.clip.bottom = offsets[sub_menu+1][sub_item_num+1]+1;
					popup_o_ref.clip.left = sub_menu*popup_width;
					
					popup_o_ref.left = 147-sub_menu*popup_width;
					popup_o_ref.top = menu_top+offsets[menu][item_num]+2;
					popup_o_ref.visibility="visible";
				
				}
			
			}
		}
		else if (document.all && over_ref) {
//alert(over_ref.clip);
			over_ref.clip = makeClip(offsets[menu][item_num],(sub_menu != null ? 146:146),offsets[menu][item_num+1],0);
//alert(over_ref.clip);
			if (sub_menu>=0) {
				popup_ref.clip = makeClip(0,(sub_menu+1)*popup_width,offsets[sub_menu+1][offsets[sub_menu+1].length-1]+1,sub_menu*popup_width);
				popup_ref.left = 147-sub_menu*popup_width;
				popup_ref.top = menu_top+offsets[menu][item_num]+2;
				popup_ref.visibility="visible";
				
				if (sub_item_num>=0) {
					popup_o_ref.clip = makeClip(offsets[sub_menu+1][sub_item_num],(sub_menu+1)*popup_width,offsets[sub_menu+1][sub_item_num+1]+1,sub_menu*popup_width);
					popup_o_ref.left = 147-sub_menu*popup_width;
					popup_o_ref.top = menu_top+offsets[menu][item_num]+2;
					popup_o_ref.visibility="visible";
				
				}
			}
		}
		over_ref.visibility="visible";
	}
}
var mouseout_timeout;
function doMenuMouseOut() {
	mouseout_timeout = setTimeout("delayedMouseOut()", 500);
//window.status = the_item;
/*	if (document.images && the_item.constructor == String) {
//		document.all["div"+the_item].style.visibility = "hidden";
		document.images[the_item].src = img_src[the_item];
		current_img = '';
	}
	else if (document.all || document.layers) {
		var the_ref=getRef("menuOver");
		the_ref.visibility="hidden";
	}
*/}

function delayedMouseOut() {
	over_ref.visibility="hidden";
	popup_ref.visibility="hidden";
	popup_o_ref.visibility="hidden";
}

function getRef(the_menu) {
	if (document.layers) return document.layers[the_menu];
	else return (document.all[the_menu] ? document.all[the_menu].style:null);

}

function makeClip(top, right, bottom, left) {
//alert(left+","+top+"\n"+right+","+bottom); 
	return "rect("+top+" "+right+" "+bottom+" "+left+")";
}

var product_finder_window = null;

function launchProductFinder() {
	var window_height = 430;
	var window_width = 320;
	var title_bar_height = 25;
	var footer_height = 30;
//	product_finder_window = window.open('/product_finder/product_finder_set.asp?w='+window_width+'&h='+window_height+'&t='+title_bar_height+'&f='+footer_height, 'ProductFinder', 'toolbar=no,menubar=no,scrollbars=auto,resizable=no,status=no,location=no,directories=no,copyhistory=no,dependent=1,height='+window_height+',width='+window_width);
	product_finder_window = window.open('/product_finder/product_finder_set.asp?w='+window_width+'&h='+window_height+'&t='+title_bar_height+'&f='+footer_height, 'ProductFinder', 'toolbar=yes,menubar=yes,scrollbars=auto,resizable=yes,status=yes,location=yes,height='+window_height+',width='+window_width);
	product_finder_window.focus();
}