

window.addEvent('load',init); 


function init(){
	domRollover();
	contentChange();
}

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr = document.getElementsByTagName('img');
	var imgPreload = new Array();
	var imgSrc = new Array();
	var imgClass = new Array();
	for (i=0; i < imgarr.length; i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i] = imgarr[i].getAttribute('src'); 
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}

function contentChange() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById || operaVersion <7) return;
	
	var links = $$('a');
	var contentDiv;
	for (j=0; j < links.length; j++){
		if (links[j].className.indexOf('content') != -1){
			links[j].onclick = function(){
				for (k=0; k < links.length; k++){ // go through links with class content and set them to invisible (before setting the new one visible)
					if (links[k].className.indexOf('content') != -1) {
						$(links[k].className.match(/content (\S+)/)[1]).setStyle('display', 'none');
					}
				}
				
				if (this.id != "next-page" && this.id != "prev-page") {
					$$('li.selected').each(function(link, i){ // clear the previously selected li
						link.className = "";
					});
					
					if (this.parentNode.parentNode.className != "accordion") { // if you've clicked on a toggler
						$$('ul.accordion').each(function(link, i2){    // set the first li in each ul to be selected
							link.getElementsByTagName('li')[0].className = "selected";
						});
					} else { // if you've clicked on any other link, make the parent li of that link selected
						this.parentNode.className = "selected";
					}
				}
				$(this.className.match(/content (\S+)/)[1]).setStyle('display', 'block');
				
				return false;
			}
		}
	}
}


