// Change function
function change(img,on,msg)
{ 
	if(document.images)
	{
		var image = "/graphics/" + img + ((on)?'_on.gif':'_off.gif');
		document.images[img].src= image;
		status = msg;
		return true;
	}
}


function openWindowcenter(url, name, height, width) {
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  window.open(url, name, str);
}

function openWindowcenterscroll(url, name, height, width) {
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
    str += ",scrollbars=1"
  }
  window.open(url, name, str);
}

function popupScrollResize(url, name, height, width) {
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
	str += ",resizable=1";
    str += ",scrollbars=1";
  }
  window.open(url, name, str);
}


var hoverState = new Array();
function makeHoverMenu(item, subMenu) {
	hoverState[subMenu] = new Array();
	hoverState[subMenu]['menu'] = "out";
	hoverState[subMenu]['item'] = "out";
	Event.observe(item, 'mouseover', function(event) {
		showMenu(subMenu);
		hoverState[subMenu]['item'] = "over";
	});
	Event.observe(item, 'mouseout', function(event) {
		hoverState[subMenu]['item'] = "out";
		hideMenu(subMenu);
	});
	Event.observe(subMenu, 'mouseover', function(event) {
		showMenu(subMenu);
		hoverState[subMenu]['menu'] = "over";
	});
	Event.observe(subMenu, 'mouseout', function(event) {
		hoverState[subMenu]['menu'] = "out";
		hideMenu(subMenu);
	});
}
function showMenu(subMenu) {
	$$('.submenus').each(function(m) {m.style.display = "none";});
	$(subMenu).style.display = "block";
}
function hideMenu(subMenu) {
	setTimeout(function(){
		item = hoverState[subMenu]['item'];
		menu = hoverState[subMenu]['menu'];
		if (item == "out" && menu == "out") $(subMenu).style.display = "none";
	}, 750);
}


<!-- This function is creating validation errors -->

<!-- document.observe("dom:loaded", function() { -->
<!--	makeHoverMenu('link1','submenu1'); -->
<!--	makeHoverMenu('link2','submenu2'); -->
<!-- }); -->

