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("azlist")) return false;

  var gallery = document.getElementById("azlist");

  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;

  }

}





//E/"Win only allows the :hover pseudo-class to be applied to a link — so the li:hover that makes the sub-menus appear means nothing to IE."

//A tiny jot of JavaScript is required to kick IE back into action

//by nick rigby, see http://www.alistapart.com/articles/horizdropdowns/

startList = function() {

if (document.all&&document.getElementById) {

navRoot = document.getElementById("azlist");

for (i=0; i<navRoot.childNodes.length; i++) {

node = navRoot.childNodes[i];

if (node.nodeName=="LI") {

node.onmouseover=function() {

this.className+=" over";

  }

  node.onmouseout=function() {

  this.className=this.className.replace(" over", "");

   }

   }

  }

 }

}



//päiväys

function updated() {

if (!document.getElementById) return false;

if (!document.getElementById("date")) return false;

var paivays = document.getElementById("date");

var txt = document.createTextNode("Päivitetty 8.11.2009");

paivays.appendChild(txt);

}



function addLoadEvent(func) {

  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      oldonload();

      func();

    }

  }

}





addLoadEvent(prepareGallery);

addLoadEvent(startList);

addLoadEvent(updated);