// JavaScript Document

// Following code is for left navigation bar 

window.onload=show;
	function show(id) {
	var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
			if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
		}
	if (d) {d.style.display='block';}
	}
	
// Following code is for various popup windows in education section

function popUp() {
window.open( "/infoservice/images/education/dect1.gif", "myWindow", 
"status = 1, height = 375, width = 300, left = 100, top = 150, resizable = 1" )
}
	
function popUp1() {
window.open( "/infoservice/images/education/dect2.gif", "myWindow", 
"status = 1, height = 250, width = 410, left = 100, top = 150, resizable = 1" )
}
	
function popUp2() {
window.open( "/infoservice/images/education/dect3.gif", "myWindow", 
"status = 1, height = 300, width = 300, left = 100, top = 150, resizable = 1" )
}


// The following code is for site image galleries

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

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);
	}
    links[i].onkeypress = links[i].onclick;
  }
}

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;
}

addLoadEvent(prepareGallery);