﻿window.onload = function() {
	if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.indexOf("MSIE 6.0") > -1 || navigator.appVersion.indexOf("MSIE 5.5") > -1)) {
		var src = "";
		var objsImg = document.getElementsByTagName("IMG");
		for (var i = 0; i < objsImg.length; i++) {
			src = objsImg[i].src;
			if (/NSHT\.png$/.test(src)) {
				objsImg[i].src = "/i/_.gif";
				objsImg[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', src='" + src + "')";
			}
		}
	}
}

var currentSite = 0;
function showSite(id) {
	document.getElementById("t" + currentSite).style.display = "none";
	currentSite = id;
	document.getElementById("t" + currentSite).style.display = "";
}

function popup(url, preferredWidth, preferredHeight, windowName, forceScroll) { 
	var usedWidth = Math.min(preferredWidth, screen.width-80);
	var usedHeight = Math.min(preferredHeight, screen.height-120);
	if (windowName == null) windowName = "w" + Math.round(Math.random() * 10000);
	window.open(url, windowName, "width=" + usedWidth + ", height=" + usedHeight + ", top=" + (screen.height/2 - usedHeight/2 - 20) + ", left=" + (screen.width/2 - usedWidth/2) + ", location=no, menubar=no, resizable=yes, status=no, toolbar=no, scrollbars=" + (forceScroll || (usedWidth < preferredWidth || usedHeight < preferredHeight) ? "yes" : "no"));
}

function viewLargeImage(title, path, width, height) {
	var preferredWidth = width + 20;
	var preferredHeight = height + 20;
	popup("http://www.sperrinsheritage.com/_ViewImage.ashx?title=" + encodeURIComponent(title) + "&path=" + encodeURIComponent(path) + "&width=" + width + "&height=" + height, preferredWidth, preferredHeight);
}