/*
 Do not remove or change this notice.
 overlibmws.js core module - Copyright Foteos Macrides 2002-2007. All rights reserved.
   Initial: August 18, 2002 - Last Revised: December 19, 2006
 This module is subject to the same terms of usage as for Erik Bosrup's overLIB,
 though only a minority of the code and API now correspond with Erik's version.
 See the overlibmws Change History and Command Reference via:
    http://www.macridesweb.com/oltest/
 Published under an open source license: http://www.macridesweb.com/oltest/license.html
 Give credit on sites that use overlibmws and submit changes so others can use them as well.
 You can get Erik's version via: http://www.bosrup.com/web/overlib/

 *********************************************************************************************
 I have simplified and reduced this script file by removing the script for most of the options
 George McSkimming
*/

// INIT -- Runtime variables.
var o3_offdelay=300,o3_offsetx=10,o3_offsety=10,o3_width=200,o3_status="",o3_frame=self,
o3_delay=500,OLdelayid=0,OLshowid=0,OLndt=0,over=null,hpos=true,vpos=true,OLx=0,OLy=0,OLallowmove=0,
OLv,PopUpText="",PopUpTitle="",
OLua=navigator.userAgent.toLowerCase(),
OLns4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4),
OLns6=(document.getElementById)?1:0,
OLie4=(document.all)?1:0,
OLgek=(OLv=OLua.match(/gecko\/(\d{8})/i))?parseInt(OLv[1]):0,
OLmac=(OLua.indexOf('mac')>=0)?1:0,
OLsaf=(OLua.indexOf('safari')>=0)?1:0,
OLkon=(OLua.indexOf('konqueror')>=0)?1:0,
OLkht=(OLsaf||OLkon)?1:0,
OLopr=(OLua.indexOf('opera')>=0)?1:0,
OLop7=(OLopr&&document.createTextNode)?1:0;
if(OLopr){OLns4=OLns6=0;if(!OLop7)OLie4=0;}
var OLieM=((OLie4&&OLmac)&&!(OLkht||OLopr))?1:0,
OLie5=0,OLie55=0;OLie7=0;if(OLie4&&!OLop7){
if((OLv=OLua.match(/msie (\d\.\d+)\.*/i))&&(OLv=parseFloat(OLv[1]))>=5.0){
OLie5=1;OLns6=0;if(OLv>=5.5)OLie55=1;if(OLv>=7.0)OLie7=1;}if(OLns6)OLie4=0;}
if(OLns4)window.onresize=function(){location.reload();}
var OLchkMh=1,OLdw;
if(OLns4||OLie4||OLns6)OLmh();

//CALL FROM "ONMOUSEOVER" EVENT IN HTML FILE
function overlib(intext,intitle){
PopUpText=intext;PopUpTitle=intitle;o3_delay=500;hpos=true;/*right*/ vpos=true;/*below*/
if(!(over=OLmkLyr()))return false; // create the DIV container (if it doesn't already exist)
if(!o3_delay){return OLmain();}else{OLdelayid=setTimeout("OLmain()",o3_delay);
if(o3_status!=""){self.status=o3_status;return true;}else if(!(OLop7&&event&&event.type=='mouseover'))return false;}
}
// Clears popups if appropriate
function nd(time){OLallowmove=0;if(over)OLhideObject(over);return false;}
// Gets object referenced by its id or name
function OLgetRef(l,d){var r=OLgetRefById(l,d);return (r)?r:OLgetRefByName(l,d);}
// OVERLIB MAIN FUNCTION SET
function OLmain(){o3_delay=0;OLdoLyr();OLallowmove=0;OLdisp(o3_status);}
// Makes the DIV container
function OLmkLyr(id,f,z){
id=(id||'overDiv');f=(f||o3_frame);z=(z||1000);var fd=f.document,d=OLgetRefById(id,fd);
if(!d){if(OLns4)d=fd.layers[id]=new Layer(1024,f);else if(OLie4&&!document.getElementById){
fd.body.insertAdjacentHTML('BeforeEnd','<div id="'+id+'"></div>');d=fd.all[id];
}else{d=fd.createElement('div');if(d){d.id=id;fd.body.appendChild(d);}}if(!d)return null;
if(OLns4)d.zIndex=z;else{var o=d.style;o.position='absolute';o.visibility='hidden';o.zIndex=z;}}
return d;
}
// Creates and writes layer content
function OLdoLyr(){
var DivContent='<table cellspacing="0" width="200"><tr><td class="caption">'+PopUpTitle+
  '</td></tr><tr><td class="message">'+PopUpText+'</td></tr></table>';
if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);OLlayerWrite(DivContent);o3_width=(OLns4?over.clip.width:over.offsetWidth);

}
// Displays layer
function OLdisp(s){
if(!OLallowmove){OLplaceLayer();if(OLndt)OLshowObject(over);else OLshowid=setTimeout("OLshowObject(over)",1);OLallowmove=1;}
OLndt=0;if(s!="")self.status=s;
}
// Decides placement of layer.
function OLplaceLayer(){
var snp,X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0,
o=OLfd(),nsb=(OLgek>=20010505&&!o3_frame.scrollbars.visible)?1:0;
if(!OLkht&&o&&o.clientWidth)iWd=o.clientWidth; else if(o3_frame.innerWidth){SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth));
if(SB>20)SB=20;iWd=o3_frame.innerWidth;}pgLeft=(OLie4)?o.scrollLeft:o3_frame.pageXOffset;
if(!hpos&&OLx-pgLeft<iWd/2&&OLx-pWd-o3_offsetx<pgLeft+LM)hpos=true;else if(hpos&&OLx-pgLeft>iWd/2&&OLx+pWd+o3_offsetx>pgLeft+iWd-SB)hpos=false;
X=(!hpos)?OLx-o3_offsetx-pWd:OLx+o3_offsetx;
if(X+pWd>pgLeft+iWd-SB)X=iWd+pgLeft-pWd-SB;
if(X-LM<pgLeft)X=pgLeft+LM;
pgTop=OLie4?o.scrollTop:o3_frame.pageYOffset;
if(!OLkht&&!nsb&&o&&o.clientHeight)iHt=o.clientHeight;else if(o3_frame.innerHeight)iHt=o3_frame.innerHeight;
pHt=OLns4?over.clip.height:over.offsetHeight;
if(!vpos&&OLy-pgTop<iHt/2&&OLy-pHt-o3_offsety<pgTop)vpos=true;else
if(vpos&&OLy-pgTop>iHt/2&&OLy+pHt+o3_offsety+((OLns4||OLkht)?17:0)>pgTop+iHt-BM)vpos=false;
Y=(!vpos)?OLy-(pHt+o3_offsety+BM):OLy+o3_offsety+TM;
if(Y+pHt+BM>pgTop+iHt)Y=pgTop+iHt-pHt-BM;if(Y-TM<pgTop)Y=pgTop+TM;OLrepositionTo(over,X,Y);
if(OLns6&&o3_frame.innerHeight){iHt=o3_frame.innerHeight;OLrepositionTo(over,X,Y);}
}
// Chooses body or documentElement
function OLfd(f){
var fd=((f)?f:o3_frame).document,fdc=fd.compatMode,fdd=fd.documentElement;
return (!OLop7&&fdc&&fdc!='BackCompat'&&fdd&&fdd.clientWidth)?fd.documentElement:fd.body;
}
// Seeks REFerence by id
function OLgetRefById(l,d){
l=(l||'overDiv');d=(d||o3_frame.document);var j,r;
if(OLie4&&d.all)return d.all[l];if(d.getElementById)return d.getElementById(l);
if(d.layers&&d.layers.length>0){if(d.layers[l])return d.layers[l];
for(j=0;j<d.layers.length;j++){r=OLgetRefById(l,d.layers[j].document);if(r)return r;}}
return null;
}
// Seeks REFerence by name
function OLgetRefByName(l,d){
d=(d||o3_frame.document);var j,r,v=OLie4?d.all.tags('iframe'):
OLns6?d.getElementsByTagName('iframe'):null;
if(typeof d.images!='undefined'&&d.images[l])return d.images[l];
if(typeof d.anchors!='undefined'&&d.anchors[l])return d.anchors[l];
if(v)for(j=0;j<v.length;j++)if(v[j].name==l)return v[j];
if(d.layers&&d.layers.length>0)for(j=0;j<d.layers.length;j++){
r=OLgetRefByName(l,d.layers[j].document);
if(r&&r.length>0)return r;else if(r)return [r,d.layers[j]];}
return null;
}
// Gets x or y location of object
function OLpageLoc(o,t){
var l=0;while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){l+=o['offset'+t];o=o.offsetParent;}l+=o['offset'+t];
return l;}

// Moves layer
function OLmouseMove(e){
var e=(e||event);
OLx=(e.pageX||e.clientX+OLfd().scrollLeft);
OLy=(e.pageY||e.clientY+OLfd().scrollTop);
if((OLallowmove&&over)&&(o3_frame==self||over==OLgetRefById()))OLplaceLayer();
}

// Capture mouse and chain other scripts.
function OLmh(){
var fN,f,j,k,s,mh=OLmouseMove,w=(OLns4&&window.onmousemove),re=/function[ ]*(\w*)\(/;
OLdw=document;if(document.onmousemove||w){if(w)OLdw=window;f=OLdw.onmousemove.toString();
fN=f.match(re);if(!fN||fN[1]=='anonymous'||fN[1]=='OLmouseMove'){OLchkMh=0;return;}
if(fN[1])s=fN[1]+'(e)';else{j=f.indexOf('{');k=f.lastIndexOf('}')+1;s=f.substring(j,k);}
s+=';OLmouseMove(e);';mh=new Function('e',s);}
OLdw.onmousemove=mh;if(OLns4)OLdw.captureEvents(Event.MOUSEMOVE);
}
// Writes to layer
function OLlayerWrite(t){
t+="\n";if(OLns4){over.document.write(t);over.document.close();}else if(typeof over.innerHTML!='undefined')
{if(OLieM)over.innerHTML='';over.innerHTML=t;}else{var range=o3_frame.document.createRange();range.setStartAfter(over);
var domfrag=range.createContextualFragment(t);while(over.hasChildNodes()){over.removeChild(over.lastChild);}over.appendChild(domfrag);}
}
// Makes object visible
function OLshowObject(o){OLshowid=0;o=(OLns4)?o:o.style;o.visibility="visible";}
// Hides object
function OLhideObject(o){
if(OLshowid>0){clearTimeout(OLshowid);OLshowid=0;}
if(OLdelayid>0)clearTimeout(OLdelayid);OLdelayid=0;self.status="";
if(o3_frame!=self)o=OLgetRefById();if(o){if(o.onmouseover)o.onmouseover=null;
var os=(OLns4)?o:o.style;os.visibility="hidden";}
}
// Moves layer
function OLrepositionTo(o,xL,yL){o=(OLns4)?o:o.style;o.left=(OLns4?xL:xL+'px');o.top=(OLns4?yL:yL+'px');}

function popup(text, title) {overlib(text,title);}
function mailme(){window.open("mailto: origins@mcskimming.org.uk")}
function OpenNotes(f){window.open(f,"","height=500, width=800,top=150,left=50, scrollbars=yes, resizable=yes")}
function CloseNote(){if (history.length > 1){window.history.back();}else{window.close();}}
function OpenPDF(f){window.open(f,"","toolbars=no, scrollbars=yes, resizable=yes")}

