// Acrobat Popup
function acrobatPopup() {
	window.open('http://www.adobe.com/products/acrobat/readstep2.html','acrobat','width=770,height=450,top=10,left=10,scrollbars=yes,resizable=yes');
}

// Apply To PDF Links
function stopFileOpeningInBrowser() {
	bid=whichBrowser();
	if (navigator.userAgent.indexOf("Mac") != -1) {
		alert('To download this PDF please CTRL click \non the link and choose \'Save Link As...\' \nor \'Download Linked File As...\'');
	} else {
		alert('To download this newsletter PDF please right \nclick on the link and choose \'Save Target As...\'');
	}
	return false;
}

function whichBrowser(){ //v3.0 by Jake Collins, Telaworks.com
	this.ver=navigator.appVersion;
	this.name=navigator.appName;
	this.nav=eval(this.name == "Netscape");
	this.ie=eval(this.ver.indexOf("MSIE")>-1);
	this.ie4=eval(this.ver.indexOf("MSIE 4")>-1);
	this.ie5=eval(this.ver.indexOf("MSIE 5")>-1);
	this.ie6=eval(this.ver.indexOf("MSIE 6")>-1);
	this.ie7=eval(this.ver.indexOf("MSIE 7")>-1);
//	this.dom=eval(document.getElementById); //Might Break Old Browsers
	this.mac=eval(this.ver.indexOf("Mac")>-1);
	this.win=eval(this.ver.indexOf("Win")>-1);
	this.antiqueCssWin=eval(this.win&&(this.nav&&!(eval(parseInt(this.ver,10)>=5))));
	this.antiqueCssMac=eval(this.mac&& ( (this.nav&&!(eval(parseInt(this.ver,10)>=5))) || (this.ie&&!(this.ie5 || this.ie6)) ) );
	return this
}

//Cookie Functions
function cookieSet(sName,sValue) {
	document.cookie = sName + "=" + sValue + "; path=/; domain=" + location.hostname + ";";
}

function cookieVal(cookieName) { // Reads the cookie
	thisCookie = document.cookie.split("; ");
		for (i=0; i<thisCookie.length; i++) {
			if (cookieName == thisCookie[i].split("=")[0]) {
				return thisCookie[i].split("=")[1]
			}
		}
	return false
}

function tmpCookiesEnabledCheck() { // See if the browser will accept cookies
	document.cookie = "cCookiesEnabled=yes;path=/;domain=" + location.hostname + ";";
	return eval(cookieVal('cCookiesEnabled') == 'yes')
}

// Various print methods for various browsers
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function printPage() {
  if (pr) // NS4, IE5
    window.print()
  else if (da && !mac) // IE4 (Windows)
    vbPrintPage()
  else // other browsers
    alert("Sorry, your browser doesn't support this feature.\nPlease choose \"Print\" from your browser menu.");
  return false;
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}

// Standard Functions
function findObj(n, d) { //v3.0
  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=findObj(n,d.layers[i].document); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// Swap Image & Menu Colours
function swapRug(id,src,display) { //v1.0
	image = document.getElementById(id);
	image.setAttribute("src", src);
	document.getElementById('sideBar').className = 'sideBarBackground' + display;
	document.getElementById("innerMenu").className = 'innerMenuBackground' + display;
	//document.getElementById("innerMenu").className  = opacityClass;
}

// Swap Image & Menu Colours For Abstract Matters
function swapRugAbstract(id,src,display,fig) { //v1.0
	image = document.getElementById(id);
	image.setAttribute("src", src);
	document.getElementById('sideBar').className = 'sideBarBackground' + display;
	document.getElementById("innerMenu").className = 'innerMenuBackground' + display;
	document.getElementById("figText").innerHTML = fig;
	//document.getElementById("innerMenu").className  = opacityClass;
}
		
// Define menu content
var myMenu = new loopSlideOutMenu("menu", "left", 0, 0, 220, 460);
		
// Load menu content
function init() {
window.setTimeout('loopSlideOutMenu.pageLoad(\'menu\')', 100);
setHeight();
window.onresize = function onresize() { 
	if (browser == "Internet Explorer") {
		window.setTimeout("setHeight()", 100);
	}
		else {
		setHeight();
		}
	}
}

// Collections Text Hover
function textHover(id) {
	var hoverVar = 'hover' + id; 
	document.getElementById(hoverVar).className = 'textHoverOn';	
}

function textHoverOff(id) {
	var hoverVar = 'hover' + id; 
	document.getElementById(hoverVar).className = 'textHoverOff';	
}

//Flash Fix
/*****************************************************************
* Flash Fix script
* Fixes embedded object activation issues in Internet Explorer
*****************************************************************/

flashfix = function() {
theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;
}
} 

if (window.attachEvent)
window.attachEvent("onload", flashfix)
else
window.onload=flashfix;