// JavaScript Document

function sIFRinit() {
	if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){
		sIFR.replaceElement("h1", named({sFlashSrc: "http://www.innovationnavigator.co.uk/bellgothic_light.swf", sColor:"#dc5800", sWmode: "transparent"}));
		sIFR.replaceElement("h2", named({sFlashSrc: "http://www.innovationnavigator.co.uk/bellgothic_light.swf", sColor:"#FFFFFF", sWmode: "transparent"}));
		sIFR.setup();
	}
}

function getY(oElement) {
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function newWindow() { 
	if(!document.getElementById('IETlink') || !document.getElementById('closeIET') || !document.getElementById('content') || !document.getElementById('IETinfo')) { return false;}
	var IET = document.getElementById('IETlink');
	var IETclose = document.getElementById('closeIET');
	var content = document.getElementById('content');
	var IETinfo = document.getElementById('IETinfo');
	IET.onclick = function () {
		IETinfo.style.display = "block";
		IETinfo.style.top = getY(content) - 50 + 'px';
		IETinfo.style.height = content.offsetHeight + 'px';
	}
	IETclose.onclick = function () {
		IETinfo.style.display = "none";
		return false;
	}
}

function initDOM() {
	// quit if this function has already been called
  	if (arguments.callee.done) return;

  	// flag this function so we don't do the same thing twice
  	arguments.callee.done = true;
	
  	sIFRinit();
	newWindow();
}

/* for Mozilla/Opera9 */
if (document.addEventListener) {
  document.addEventListener("DOMContentLoaded", initDOM, false);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
  document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
  var script = document.getElementById("__ie_onload");
  script.onreadystatechange = function() {
    if (this.readyState == "complete") {
      initDOM(); // call the onload handler
    }
  };
/*@end @*/

/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
  var _timer = setInterval(function() {
    if (/loaded|complete/.test(document.readyState)) {
      initDOM(); // call the onload handler
    }
  }, 10);
}

/* for other browsers */
window.onload = initDOM;