function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}



function readCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}


function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
    }
    return [curleft,curtop];
}

function titleMouseOver(element){

    outPoint.innerHTML = "<span>"+element+"</span>";
}

/* swap base font size */
function fontSize(val){
    document.getElementById("body_sctn").style.fontSize = val+'em';
    SetCookie("fontSize",document.getElementById("body_sctn").style.fontSize,365);
    return false;
}

function initialFontSize(){
    document.getElementById("body_sctn").style.fontSize = readCookie("fontSize");
}


function setUnderline(){
	if (readCookie("fontsize") != "") {
		if (readCookie("fontsize")=='1em') {
			document.getElementById("small").setAttribute("class","small underline");
			document.getElementById("small").setAttribute("className","small underline");
		} else {
			document.getElementById("small").setAttribute("class","small");
			document.getElementById("small").setAttribute("className","small");
		}
	 
		if (readCookie("fontsize")=='1.15em') {
			document.getElementById("mid").setAttribute("class","mid underline");
			document.getElementById("mid").setAttribute("className","mid underline");
		} else {
			document.getElementById("mid").setAttribute("class","mid");
			document.getElementById("mid").setAttribute("className","mid");
		}
	 
		if (readCookie("fontsize")=='1.25em') {
			document.getElementById("large").setAttribute("class","large underline");
			document.getElementById("large").setAttribute("className","large underline");
		} else	{
			document.getElementById("large").setAttribute("class","large");
			document.getElementById("large").setAttribute("className","large");
		}
	} else {
		document.getElementById("small").setAttribute("class","small underline");
		document.getElementById("small").setAttribute("className","small underline");	
	}
}




function zoomImg(img,flag){
    image = document.getElementById(img);
    if (flag == "CREATE"){
    var aElement=document.createElement("IMG");
    aElement.src = image.src;
    aElement.setAttribute("class", "zoomedImg");
    aElement.style.position = "absolute";
    aElement.style.left = findPos(image)[0];
    aElement.style.top = findPos(image)[1];    
    alert(findPos(image)[1]);
    aElement.setAttribute("className", "zoomedImg");    
    document.body.appendChild(aElement);
    }
}    


function directoronload(){
document.getElementById("directorInfo").innerHTML = document.getElementById("stephenwebster_info").innerHTML;
}


function directorSelector(director) {
document.getElementById("directorInfo").innerHTML = document.getElementById(director+"_info").innerHTML;
}




function externalLinks() {

 if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i];
if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
	 anchor.target = "_blank";
    }
}
}

window.onload=externalLinks;

