/*	
	OPEN NEW WINDOW
	To use instead of deprecated target attribute in XHTML
*/
function OpenWindow(url, win) {
	if (!win) {
		win ="_blank";
	}
	window.open(url, win);
}



/*	
	ADD FUNCTIONS TO WINDOW ONLOAD
	Load in all window.onLoad functions
*/
function AddFunctionToOnLoad(fn) {
	if (window.addEventListener){
		window.addEventListener("load", fn, false);
		return true;
	} else if (window.attachEvent){
		var ol = window.attachEvent("onload", fn);
		return ol;
	} else {
		return
	}
}



/*	
	SHOW FAQ ANSWERS
	Reveal Answers under the FAQ questions
*/
function addFAQModule() {
	var lmod						= document.getElementById('FAQ_Answer');
	var lin							= document.getElementById('FAQ_Question');
	
	if (lin != null && lmod != null) {
		lin.mod						= lmod;
		lin.onclick					= new Function("ShowHideElement(this.mod);");
		closebutton.onclick			= new Function("ShowHideElement(this.mod);");
	}
}

function ShowHideElement(e) {
	e.style.display					= (e.style.display  == 'block') ? 'none' : 'block';
}



/*	
	FILTER EVENTS CALENDAR AND LIST OF CALENDAR EVENTS
	Shows and hides elements based on class and element type.
*/
function FilterCalender(div, evt, el) {
	if (!evt) {
		return
	}
	
	var z = document.getElementById(div);
	
	if (z != null) {
		var x												= z.getElementsByTagName(el);
		var matchClassName									= 'event';
		var eventFocus										= evt;
		for (var i=0; i<x.length; i++) {
			var str											= x[i].className;
			if (str.search(matchClassName) != -1) {
				x[i].style.display							= (str.search(eventFocus) != -1) ? 'block' : 'none';
			}
		}
	}
}


AddFunctionToOnLoad(addFAQModule);
