// # init
	/*function init() {
		document.onResize = resized;
	}*/

// # resize
	function centerSmallWindow() {
		var tDiv = getElement("smallWindow");
		var tPageSize = getPageSize();
		var tX = Math.round((tPageSize.width - (smallWindowSize.width+smallWindowSize.borderSize*2))/2);
		var tY = Math.round((tPageSize.height - (smallWindowSize.height+smallWindowSize.borderSize*2))/2) + tPageSize.scroll - 25;
		var tBorderOffset = -smallWindowSize.borderSize;
		if (tX < tBorderOffset) tX = tBorderOffset;
		if (tY < tBorderOffset) tY = tBorderOffset;
		tDiv.style.left = tX;
		tDiv.style.top = tY;
	}
	function resized() {
		centerSmallWindow();
	}
	function scrolled() {
		centerSmallWindow();
	}

// # speific functions
	function showBanner(id_a, width_a, height_a, text_a) {
		var tUrl = "banners/"+id_a;
		if (!text_a) text_a = "&nbsp;";
		showSmallWindow(tUrl, width_a, height_a, "<i>"+text_a+"</i>");
	}
	function showLiveSite(url_a, width_a, height_a, hostName_a, hostUrl_a, text_a) {
		var tHost = "";
		var tText = "";
		if (hostName_a) {
			tHost = "<a class='smallWindowText' href='"+hostUrl_a+"'>"+hostName_a+"</a>";
			tText = "This site is hosted by "+tHost;
		}
		if (text_a) {
			tText += "<br><i>"+text_a+"</i>";
		}
		if (tText == "") tText = "&nbsp;";
		showSmallWindow(url_a, width_a, height_a, tText);
	}
	function showArchivedSite(id_a, width_a, height_a, liveUrl_a, text_a) {
		var tUrl = "../archive/"+id_a;
		var tText = "<b>note</b>: you are viewing an archived version of this site.";
		if (liveUrl_a) {
			tText += " <a class='smallWindowText' href='"+liveUrl_a+"' target='_blank'>click here for the live version.</a>";
		} else {
			tText += " there is no live version.";
		}
		if (text_a) {
			tText += "<br><i>"+text_a+"</i>";
		}
		showSmallWindow(tUrl, width_a, height_a, tText);
	}
	
	smallWindowSize = {
		borderSize:24, // # this is hard coded from the div
		width:100,
		height:100
	}
	function showSmallWindow(url_a, width_a, height_a, text_a) {
		if (!url_a) return;
		if (!text_a) text_a = "&nbsp;";
		
		var tDiv = getElement("smallWindow");
		var tIFrame = getElement("smallWindowIFrame");
		tIFrame.src = url_a;
		tIFrame.style.width = width_a;
		tIFrame.style.height = height_a;
		
		smallWindowSize.width = width_a;
		smallWindowSize.height = height_a;
		
		var tTextElement = getElement("smallWindowText");
		tTextElement.innerHTML = text_a;
		
		centerSmallWindow();
		
		showDiv(tDiv);
	}
	function hideSmallWindow(id_a, height_a, width_a) {
		var tDiv = getElement("smallWindow");
		hideDiv(tDiv);
		var tIFrame = getElement("smallWindowIFrame");
		tIFrame.src = "about:blank";
	}

// # Generic Functions
	function showDiv(id_a) {
		var tDiv = getElement(id_a);
		tDiv.style.visibility = "visible";
	}

	function hideDiv(id_a) {
		var tDiv = getElement(id_a);
		tDiv.style.visibility = "hidden";
	}

	function getElement(id_a) {
		if (typeof(id_a) == "string") {
			return document.getElementById(id_a);
		} else {
			return id_a;
		}
	}
	// # stole from panic.com
		function getPageSize() {
			var tObj = {};
			if (document.all) {
				// IE4+ or IE6+ in standards compliant 
				tObj.width  = (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth;
				tObj.height = (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
				tObj.scroll = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
			} else {
				// Non-IE
				tObj.width = window.innerWidth;
				tObj.height = window.innerHeight;
				tObj.scroll = window.pageYOffset;
			}
	
			// Core code from - quirksmode.org
		    if (window.innerHeight && window.scrollMaxY) {
		        tObj.scrollWidth = document.body.scrollWidth;
				tObj.scrollHeight = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
				tObj.scrollWidth = document.body.scrollWidth;
				tObj.scrollHeight = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				tObj.scrollWidth = document.body.offsetWidth;
				tObj.scrollHeight = document.body.offsetHeight;
			}
			return tObj;
		}
