//SWAP IMAGE
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function swapImage() {
	strImage = (arguments[1]=='on')?'style/images/leftmenu_r.gif':'style/images/leftmenu.gif';
	MM_swapImage(arguments[0],'',strImage,1)
}

function MM_homeMenu(targ,selObj,restore){ //v3.0
	if (selObj.selectedIndex == 4 || selObj.selectedIndex == 0 ) {
			eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		}
		else {
			window.open(selObj.options[selObj.selectedIndex].value,'new')
		}
  if (restore) selObj.selectedIndex=0;
	return false;
}



// Exit disclaimer
var popupWidth;
var popupHeight;

// check type size
function textSizeDetect() {
	var intTextSize = (document.layers)?document.layers["textsizedetect"]:(document.all)?document.all["textsizedetect"]:(document.getElementById)?document.getElementById("textsizedetect"):"";

	if (intTextSize) {
		 intTextSize = intTextSize.offsetHeight
	}
	if (intTextSize>14){
		//set the height and width of the popup
		popupWidth=220;
		popupHeight=240;
	} else if (intTextSize>12){
		//set the height and width of the popup
		popupWidth=220;
		popupHeight=220;
	} else{
		popupWidth=220;
		popupHeight=200;
	
	}
}


// get all links with the class name disclaimer and add to them
// an onclick event going to the disclaimer, and an onKeyPress event 
// going to the onClick event
function doPopups() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("disclaimer")) {
      links[i].onclick = function() {
		textSizeDetect()
		window.open(this.href,'disclaimer','width='+popupWidth+',height='+popupHeight+',scrollbars=auto,resizable');
        return false;
      }
	  links[i].onkeypress = function(){
	  	verifyKey(this,'this.onclick();');
	  }
    }
  }
}
// Called in on index.asp
// window.onload = doPopups;






// Row rollovers for tables
function tableRollover(theparent){
	theparent.parentNode.style.backgroundColor='#F8F6F3';
	//theparent.parentNode.childNodes[0].style.backgroundColor='#F8F6F3';
}
function tableRollout(theparent){
	theparent.parentNode.style.backgroundColor='#FFFFFF';
	//theparent.parentNode.childNodes[0].style.backgroundColor='#FFFFFF';
}

// Keypress checker
function verifyKey(oElement,oEvent){
  if(oEvent.keyCode==13 && oElement.onclick){
     oEvent();
  }
}

// Set underline styles on buttons
function underlinebutton(target){
  var underline=target.style.textDecoration;
  if(underline==""){
	 target.style.textDecoration='underline';
     target.style.color='#C21D30';
  }else{
	 target.style.textDecoration='';
     target.style.color='#000';
  }
}



// set rolloverstate on tables
function tableLinkActive(){
  if (!document.getElementsByTagName) return;
  var tables = document.getElementsByTagName("table");
  for(var i=0;i<tables.length;i++){
    var table = tables[i];
    if(table.className=="news"||table.className=="documents"){
      var anchors=table.getElementsByTagName("a");
      for(var j=0;j<anchors.length;j++){
        var anchor = anchors[j];
        if(anchor.getAttribute("href")){
          anchor.onmouseover=new Function('tableRollover(this.parentNode);')
          anchor.onmouseout=new Function('tableRollout(this.parentNode);')
          anchor.onfocus=new Function('tableRollover(this.parentNode);')
          anchor.onblur=new Function('tableRollout(this.parentNode);')
	}
      }
    }
  }
}

// Set external links
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";
       var strTitle = anchor.getAttribute("title");
       if((strTitle=="")||(strTitle==null)){
          anchor.title = "Opens in a new browser window.";
       }else{
          if(strTitle.indexOf("browser window")<0){
             anchor.title = strTitle+". Opens in a new browser window.";
          }
       }
       var strTitle = "";
    }
  }
  // call table rollover function
  tableLinkActive();
}
window.onload=externalLinks;







//About Us image rotator
var randomlinks=new Array()

randomlinks[0]='<img alt="Iain Napier" title="Iain Napier" src="images/pictures/pho_napier.jpg" width="224" height="120">'
randomlinks[1]='<img alt="Gareth Davis" title="Gareth Davis" src="images/pictures/pho_davis.jpg" width="224" height="120">'
randomlinks[2]='<img alt="Robert Dyrbus" title="Robert Dyrbus" src="images/pictures/pho_dyrbus.jpg" width="224" height="120">'
randomlinks[3]='<img alt="Graham Blashill" title="Graham Blashill" src="images/pictures/pho_blashill.jpg" width="224" height="120">'
//randomlinks[4]='<img alt="David Cresswell" title="David Cresswell" src="images/pictures/pho_cresswell.jpg" width="224" height="120">'
//randomlinks[5]='<img alt="Anthony Alexander" title="Anthony Alexander" src="images/pictures/pho_alexander.jpg" width="224" height="120">'
randomlinks[4]='<img alt="Pierre Jungels" title="Pierre Jungels" src="images/pictures/pho_jungels.jpg" width="224" height="120">'
randomlinks[5]='<img alt="Ken Burnett" title="Ken Burnett" src="images/pictures/pho_burnett.jpg" width="224" height="120">'
randomlinks[6]='<img alt="Charles Knott" title="Charles Knott" src="images/pictures/pho_knott.jpg" width="224" height="120">'
randomlinks[7]='<img alt="Susan Murray" title="Susan Murray" src="images/pictures/pho_murray.jpg" width="224" height="120">'
randomlinks[8]='<img alt="Matthew Phillips" title="Matthew Phillips" src="images/pictures/pho_phillips.jpg" width="224" height="120">'
randomlinks[9]='<img alt="Alison Cooper" title="Alison Cooper" src="images/pictures/pho_cooper.jpg" width="224" height="120">'
randomlinks[10]='<img alt="Kathryn Brown" title="Kathryn Brown" src="images/pictures/pho_brown.jpg" width="224" height="120">'
randomlinks[11]='<img alt="Mark Williamson" title="Mark Williamson" src="images/pictures/pho_williamson.jpg" width="224" height="120">'
randomlinks[12]='<img alt="Michael Herlihy" title="Michael Herlihy" src="images/pictures/pho_herlihy.jpg" width="224" height="120">'

function randomlink(){

var add = randomlinks[Math.floor(Math.random()*randomlinks.length)]
return(add)
}