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 setHighslide() {
	if ($$('div#SITE_FACE img')) {
		var root = $$('div#SITE_FACE img')[0].getAttribute('src').split('images')[0];
		hs.graphicsDir = (root + 'highslide/graphics/');
	}

	if ($$('a.imageShow')) {
		$$('a.imageShow').each( function(aTag) {
			(new Image()).src = aTag.href;
			aTag.onclick = function() {
				return hs.expand(this);
			}
		} );
	}
}

function email(txt1, txt2) {
	var email = txt1 + "@" + txt2;
	document.write('<a href="mailto:' + email + '">' + email + '</a>');
	return;
}

function tableRowStyle() {
	if (!$$('table.alternately')) {
		return;
	}
	$$('table.alternately>tbody>tr:first-child').each( function(row) {
		row.addClassName('odd');
	} );

	var current = '';
	$$('table.alternately>tbody>tr').each( function(row) {
		if (row.hasClassName('odd')) {
			current = 'odd';
		} else {
			current = (current == 'odd') ? 'even' : 'odd';
			row.addClassName(current);
		}
	} );
}

Event.observe(window, "load", rollOver, false);
Event.observe(window, 'load', setHighslide, false);
Event.observe(window, "load", tableRowStyle, false);email
