// generic js functions

//general browser detection for future use
var n = navigator;
var ua = n.userAgent.toLowerCase();
var win = ua.indexOf('win') > 0;
var mac = ua.indexOf('mac') > 0;
var oth = (win == false && mac == false) ? true : false;

if (mac && ua.indexOf('msie') > 0) {
	document.location = "browser_warn.php";
}

function imageSwitch(id, newSrc) {
	var d = document;
	if (d.images && d.images[id]) {
		d.images[id].src = newSrc;
	}
}

function openWindow(page, title, w, h, scroll) {
 	var pop = window.open(page, title, 'toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=' + scroll + ', width=' + w + ', height=' + h + ',resizable=0');
}

function centerWindow(w, h) {
	var sw = screen.width
	var sh = screen.height
	var l = Math.round((sw/2) - (w/2))
	var t = Math.round((sh/2) - (h/2))
	window.moveTo(l, t)
}

function setDisplay(id, display) {
	var d = document;
	if (d.getElementById) {
		var e = d.getElementById(id);
		e.style.display = display;
	}
}

function toggleDisplay(id) {
	var d = document;
	if (d.getElementById) {
		var e = d.getElementById(id);
		var cd = e.style.display;
		if (cd == "" || cd == "none") {
			var nd = "block";
		} else {
			var nd = "none";
		}
		e.style.display = nd;
	}
}
