// JavaScript Document /* this document contains  *  1. external link opens in new window*  2. expandable menu *  3. dom rollover function*  4. window load event function to load it all**//**********************************************************************************************************//* this opens the link in a new window */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"; }}// =========================================================================//                          Cookie functions // =========================================================================/* This function is used to set cookies */function setCookie(name,value,expires,path,domain,secure) {  document.cookie = name + "=" + escape (value) +    ((expires) ? "; expires=" + expires.toGMTString() : "") +    ((path) ? "; path=" + path : "") +    ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");}/* This function is used to get cookies */function getCookie(name) {	var prefix = name + "=" 	var start = document.cookie.indexOf(prefix) 	if (start==-1) {		return null;	}		var end = document.cookie.indexOf(";", start+prefix.length) 	if (end==-1) {		end=document.cookie.length;	}	var value=document.cookie.substring(start+prefix.length, end) 	return unescape(value);}/* This function is used to delete cookies */function deleteCookie(name,path,domain) {  if (getCookie(name)) {    document.cookie = name + "=" +      ((path) ? "; path=" + path : "") +      ((domain) ? "; domain=" + domain : "") +      "; expires=Thu, 01-Jan-70 00:00:01 GMT";  }}/**********************************************************************************************************///this does the DOM rollover --to use place this code class inside the IMG tag --- class="domroll images/button_aboutsub_f2.gif"function domRollover() {	if (navigator.userAgent.match(/Opera (\S+)/)) {		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);	}	if (!document.getElementById||operaVersion <7) return;	var imgarr=document.getElementsByTagName('img');	var imgPreload=new Array();	var imgSrc=new Array();	var imgClass=new Array();	for (i=0;i<imgarr.length;i++){		if (imgarr[i].className.indexOf('domroll')!=-1){			imgSrc[i]=imgarr[i].getAttribute('src');			imgClass[i]=imgarr[i].className;			imgPreload[i]=new Image();			if (imgClass[i].match(/domroll (\S+)/)) {				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]			}			imgarr[i].setAttribute('xsrc', imgSrc[i]);			imgarr[i].onmouseover=function(){				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])			}			imgarr[i].onmouseout=function(){				this.setAttribute('src',this.getAttribute('xsrc'))			}		}	}}/**********************************************************************************************************///this does the gallery image selectingfunction showPic(whichpic) {  if (!document.getElementById("placeholder")) return true;  var source = whichpic.getAttribute("href");  var placeholder = document.getElementById("placeholder");  placeholder.setAttribute("src",source);  if (!document.getElementById("description")) return false;  if (whichpic.getAttribute("title")) {    var text = whichpic.getAttribute("title");  } else {    var text = "";  }  var description = document.getElementById("description");  if (description.firstChild.nodeType == 3) {    description.firstChild.nodeValue = text;  }  return false;}function prepareGallery() {  if (!document.getElementsByTagName) return false;  if (!document.getElementById) return false;  if (!document.getElementById("imagegallery")) return false;  var gallery = document.getElementById("imagegallery");  var links = gallery.getElementsByTagName("a");  for ( var i=0; i < links.length; i++) {    links[i].onclick = function() {      return showPic(this);    }  }}function initAll() {var allLinks = document.getElementsByTagName("a");for (var i=0; i<allLinks.length; i++) {if (allLinks[i].className.indexOf("menuLink") > -1) {allLinks[i].onclick = toggleMenu;		}	}}function toggleMenu() {var startMenu = this.href.lastIndexOf("/")+1;var stopMenu = this.href.lastIndexOf(".");var thisMenuName = this.href.substring(startMenu, stopMenu);var thisMenu = document.getElementById(thisMenuName).style;thisMenu.display = (thisMenu.display == "block") ? "none" : "block";return false;}/*********************************************************************************************************/// this function  loads all the window events at once. just add the new function load to the bottom list.function addLoadEvent(func) {	var oldonload = window.onload;	if (typeof window.onload != 'function') {		window.onload = func;		} else {			window.onload = function() {				oldonload();				func();				}			}	}addLoadEvent(externalLinks);addLoadEvent(domRollover);addLoadEvent(initAll);addLoadEvent(prepareGallery);