// copyright Patrick Griffiths 

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfHover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfHover\\b"), "");
		}
	}
}

function fnMailTo(index,colour) {
	if (sUrl1[index] !='') {
		var sObfuscate = "<a";
		if (colour != "") 
			sObfuscate = sObfuscate += " style='color:" + colour + "'";
		sObfuscate += " href='mailto:" + sUrl1[index] + "@" + sUrl2[index] + "'>" + sName[index] + "</a>";
		document.write(sObfuscate);
	}
	else
		document.write(sName[index]);
}

function fnObfuscate(a,b,c) {
    	var sObfuscate = '<a href="mailto:' + a + '@' + b + '">' + c + '</a>';
	document.write(sObfuscate);
}

var wOpen = false;	
function OpenWindow(url,width,height,scroll,posn){
	if(wOpen) popup.close();	//ensure window opens the correct size
	var topPosn=0;
	var leftPosn=0;
	if (posn == "c") {
		topPosn=(screen.height - height)/2;
		leftPosn=(screen.width - width)/2;
	}
	var windowprops = "location=0,scrollbars=" + scroll + ",menubar=1,toolbar=1," + "resizable=1,left=" + leftPosn + ",top=" + topPosn + ",width=" + width + ",height=" + height;
	popup=window.open(url, "popup", windowprops);
	popup.focus();
	wOpen = true;
}

$(document).ready(function(){
	$("#nav")
	.superfish({
		animation : {opacity:"show",height:"show"},
		delay : 400
	});
});