/*
**	Find all images with class "MO" and attach event handlers to them
*/
var preloaded = new Array();

function setMOhandler() {
	var x = document.getElementsByTagName('img');
	for (var i=0; i < x.length; i++) {
		if (x[i].className == 'MO') {
			// Preload
			var onImageSrc = x[i].src.replace('_n.', '_o.');
			preloaded[preloaded.length] = new Image();
			preloaded[preloaded.length-1].src = onImageSrc;
			//Attach event handlers
			x[i].onmouseover = MO_over;
			x[i].onmouseout = MO_out;
		}
	}
}
function MO_over() {
	this.src = this.src.replace('_n.', '_o.');
}
function MO_out() {
	this.src = this.src.replace('_o.', '_n.');
}

function initFAQ() {
	var question;
	var entries = document.getElementsByTagName('div');
	for (var i = 0; i < entries.length; i++) {
		if (entries[i].className == 'answer') {
			entries[i].style.display = 'none';
		}
		if (entries[i].className == 'question') {
			question = entries[i].getElementsByTagName('a')[0];
			question.a = entries[i+3];
			question.q = entries[i];
			question.open = false;
			question.onclick = toggleQ;
		}
	}
}

function toggleQ () {
	if (this.open) {
		this.a.style.display = 'none';
		this.q.className = 'question';
		this.open = false;
		currentOpen = null;
	}
	else {
		if (currentOpen) {
			currentOpen.a.style.display = 'none';
			currentOpen.q.className = 'question';
			currentOpen.open = false;
		}
		this.a.style.display = 'block';
		this.q.className = 'questionopen';
		this.open = true;
		currentOpen = this;
	}
}

function setSubmit() {
	var a = document.getElementById('submit');
	a.onclick = function () {document.forms[0].submit()}
}
		
function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, true); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}