/*****************************
Copyright Jan 2006 Rozario Chivers
All rights reserved and that
A Web Standards runtime js include function
******************************/
function includeScript(includeName) {
	//get defensive
	if (!document.getElementsByTagName) return;
	//get a reference to the title tag
	var titleTag = document.getElementsByTagName("title");
	//create a script element
	jsTag=document.createElement("script"); 
	//for XHTML completeness (note: "language" is deprecated)
	jsTag.setAttribute("type", "text/javascript");
	//populate src with the include param
	jsTag.setAttribute("src",includeName);
	//append after title tag (note: it's the first index in the array)
	titleTag[0].parentNode.appendChild(jsTag);
}

//Onload limit breaker
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// Onload event limit breaker
// Copyright Rozario Chivers 2005
// All rights reserved and that

// Reference Serialisation / Deserialisation
// A little ugly to look at, but allows parameters to be passed
var execStr="";
window.onload = function(){eval(execStr);};
function addLoadFunction(execRefStr) {execStr+=execRefStr+";";}

//Show / hide elementById
function showHide(idRef) {
var contentRef = document.getElementById(idRef);
if(contentRef.style.display=="none" || contentRef.style.display=="") contentRef.style.display="block";
else
if(contentRef.style.display=="block") contentRef.style.display="none";
}

//Accessible new window
// usage : <a href="link" onclick="return spawn('URL', 'name', 'width=100, height=100')">Link</a>
// more accessible and allows right click link functionality to work (also works with no JS at all)
function spawn(URL,winName,features) {
/*features example - note you must pass in width & height first (IE 4+ Mac bug) width=620,height=460,directories=no,location=no,menubar=no,scrollbars=yes,toolbar=no,status=no,resizable=no,top=0,left=0*/
var newWindow=window.open(URL,winName,features);
newWindow.focus();
}