var suffix1 = "_off.";
var suffix2 = "_on.";

function rollOver() {
	var images = $$("img").concat($$("input")); 

	var tmp = new Object();
	images.each( function(obj, index) {
		obj.galleryImg = false;
		if(obj.getAttribute("src") && obj.getAttribute("src").indexOf(suffix1)!=-1)
		{
			obj.onmouseover = function() {
				this.setAttribute("src", this.getAttribute("src").replace(suffix1, suffix2));
			}
			obj.onmouseout = function() {
				this.setAttribute("src", this.getAttribute("src").replace(suffix2, suffix1));
			}
			tmp[index] = new Image();
			tmp[index].src = obj.src.replace(suffix1, suffix2);
		}
	} );
}

function mailto(txt1, txt2) {
	var email = txt1 + "@" + txt2;
	document.write('<a href="mailto:' + email + '">' + email + '</a>');
	return;
}

function popupMenu() {
	for (var i=0; i<10; i++) {
		if ($('PARENT' + i)) {
			$('PARENT' + i).onmouseover = function() {
				var num = this.getAttribute('id').replace('PARENT', '');
				$('POPUP' + num).style.display = 'block';
			}
			$('PARENT' + i).onmouseout = function() {
				var num = this.getAttribute('id').replace('PARENT', '');
				$('POPUP' + num).style.display = 'none';
			}
		}
	}

	$$('ul.popupMenu').each( function(menu) {
		menu.onmouseover = function() {
			this.style.display = 'block';
		}
		menu.onmouseout = function() {
			this.style.display = 'none';
		}
	} );
}

Event.observe(window, "load", rollOver, false);
Event.observe(window, "load", popupMenu, false);
