function getObject(objectID){
if(document.getElementById && document.getElementBId(objectID)){
return document.getElementById(objectID); // check W3C DOM
}else if(document.all && document.all(objectID)){
return document.all(objectID); // IE4
}else if(document.layers && document.layers[objectID]){
return document.layer[objectID]; // NN4
}else{
return false;
}
}
-----------------------------------------------
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;
var text = whichpic.getAttribute("title") ? whichpic.getAttribute("title") : "";
/*
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 = getObject("imagegallery");
//alert(gallery);
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 getObject(objectID){
if(document.getElementById && document.getElementById(objectID)){
return document.getElementById(objectID); // check W3C DOM
}else if(document.all && document.all(objectID)){
return document.all(objectID); // IE4
}else if(document.layers && document.layers[objectID]){
return document.layer[objectID]; // NN4
}else{
return false;
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(prepareGallery);