<!-- Popup Window -->

function openWin(url, width, height) {
	var win;
	var windowName;
	var params;
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=0,";
	params += "resizable=0,";
	params += "top=50,";
	params += "left=50,";
	params += "width="+width+",";
	params += "height="+height;
	win = window.open(url, windowName, params);
}


<!-- Input Box Clearer -->

function clearInputBox(txtBox) {
   try {
      txtBox.value = "";
   }
   catch (e) {
      // just catch the exception
   }
}

<!-- Window Closer -->

function closeWindow() {
self.close();
}

<!-- Comparison Table (Family Pages) -->

function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
		EventCache.add(obj, type, fn);
	}
	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}
	
var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
			listEvents.push(arguments);
		},
		flush : function(){
			var i, item;
			for(i = listEvents.length - 1; i >= 0; i = i - 1){
				item = listEvents[i];
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1], item[2], item[3]);
				};
				if(item[1].substring(0, 2) != "on"){
					item[1] = "on" + item[1];
				};
				if(item[0].detachEvent){
					item[0].detachEvent(item[1], item[2]);
				};
				item[0][item[1]] = null;
			};
		}
	};
}();
addEvent(window,'unload',EventCache.flush);

<!-- popupwindow functions -->
function popupwindow(file, width, height) {
/* this is where we take in the file information */
	var WIDTH_SPACE = 20;
	var HEIGHT_SPACE = 20;
	
	if (popupwindow.arguments[0] == null || popupwindow.arguments[0].length < 3) {
	   return false;
	}
	else if ((popupwindow.arguments[1] == null) || 
	    (popupwindow.arguments[1].length < 1) ||
	    (popupwindow.arguments[2] == null) ||
	    (popupwindow.arguments[2].length < 1)) {

	    var resultArray = calculateDimensions(popupwindow.arguments[0]);
	    openPopupWindow(popupwindow.arguments[0], getWidth(resultArray[0], WIDTH_SPACE), getHeight(resultArray[1], HEIGHT_SPACE));
	}
	else {
	    openPopupWindow(popupwindow.arguments[0], popupwindow.arguments[1], popupwindow.arguments[2]);
	}
}

function calculateDimensions(filename) {

	var matchparam = /(\d+)x(\d+)_/;
	var sizeArray = new Array(2);
	sizeArray[0] = 500;
	sizeArray[1] = 500;
	
	if (window.RegExp) {
		var regexp = new RegExp(matchparam);
		
		if (regexp.test(filename)) {
			filename.match(matchparam);
			sizeArray[0] = RegExp.$1;
			sizeArray[1] = RegExp.$2;
		}
	}
	
	return sizeArray;
}

function getWidth(w, space) {
	return parseInt(parseInt(w)+parseInt(space));
}

function getHeight(h, space) {
	return parseInt(parseInt(h)+parseInt(space));
}

function openPopupWindow(url, width, height)
{
	var newwindow = null;
	var name = "feature_ss";

	newwindow = window.open(url,name,"height="+height+",width="+width+",resizable=yes");
	if (window.focus) { newwindow.focus(); }
}
<!-- End popup window functions -->