/*
 * $Id: universal.js 852 2006-07-13 21:58:50Z tim $
 */

function addonload(func) {
	if (typeof window.addEventListener != 'undefined') {
		window.addEventListener('load', func, false);
	} else if (typeof window.attachEvent != "undefined") { // IE
		window.attachEvent('onload', func );
	} else {
		if (window.onload != null) {
			// maintain any other onload events
			var oldOnload = window.onload;
			window.onload = function (e) {
				oldOnload(e);
				func();
			};
		} else {
			window.onload = func;
		}
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images && (loaded == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			if (document[changeImages.arguments[i]]) {
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			} else {
				changeImages.arguments[i].src = changeImages.arguments[i+1];
			}
		}
	}
}
var loaded;
function preloadImages() {
	for (var i=0;i<preloadImages.arguments.length;i++) {
		newImage(preloadImages.arguments[i]);
	}
	loaded = true;
}

function popImage(img, alt) {
	url = '/imageviewer.php?pic='+img+'&alt='+alt;
	window.open(url, 'ImageZoom', 'width=435,height=495');
}

function toggleDiv(divName) {
	thisDiv = document.getElementById(divName);
	if (thisDiv) {
		if (thisDiv.offsetHeight > 0 || thisDiv.style.display == "block") {
			thisDiv.style.display = "none";
		}
		else {
			thisDiv.style.display = "block";
		}
	}
}
