// Setup global image containerimgData=new Array();// Basic X-Browser utilitiesfunction isUndefined(testVar) { var undefinedVar;return testVar===undefinedVar; }// Array extensionsif (!Array.prototype.push) Array.prototype.push = function() {	for (var i=0; i<arguments.length; i++) this[this.length] = arguments[i];	return this.length;}Array.prototype.find = function(value, start) {	start = start || 0;	for (var i=start; i<this.length; i++)		if (this[i]==value)			return i;	return -1;}Array.prototype.has = function(value) { return this.find(value)!==-1; }// Function mappingfunction map(list, function_ref) {	var result = [];	function_ref = function_ref || function(v) {return v};	for (var i=0; i < list.length; i++) result.push(function_ref(list[i], i, list));	return result;}function filter(list, function_ref) {	var result = [];	function_ref = function_ref || function(v) {return v};	map(list, function(v) { if (function_ref(v)) result.push(v) } );	return result;}// DOMfunction getElement(element) {	if (document.getElementById) {		if (typeof element == "string") {			element = document.getElementById(element);			if (element===null) throw 'cannot get element: element does not exist';		} else if (typeof element != "object") {			throw 'cannot get element: invalid datatype';		}	} else throw 'cannot get element: unsupported DOM';	return element;}function hasClass(element, className) {	return getElement(element).className.split(' ').has(className);}function getElementsByClass(className, tagName, parentNode) {	parentNode = !isUndefined(parentNode)? getElement(parentNode) : document;	if (isUndefined(tagName)) tagName = '*';	return filter(parentNode.getElementsByTagName(tagName), function(element) { return hasClass(element, className) });}// DOM Event handlingfunction addListenerToClass(event, function_ref, classID, tag, parentNode) {	var element_list = getElementsByClass(classID, tag, parentNode);	map(element_list, function(element) { addListenerToObject(event, element, function_ref) } );}function addListenerToObject(event, element, function_ref) {	element = getElement(element);	if (element.addEventListener) element.addEventListener(event,function_ref,false); // W3C DOM	else if (element.attachEvent) element.attachEvent('on'+event, function(){ function_ref(new W3CDOM_Event(element)) } ); //IE DOM	else element['on'+event] = function(){ function_ref(new W3CDOM_Event(element)) }; // Catch others}function W3CDOM_Event(currentTarget) {	this.currentTarget = currentTarget;	this.preventDefault = function() { window.event.returnValue = false; }	return this;}function openWindowFromEvent(features) {	return function(element) { openWindowFromLink(element.currentTarget, features); element.preventDefault(); }}function openPopupFromEvent(w, h, centered, min_w, min_h, features) {	return function(element) { openPopupFromLink(element.currentTarget, w, h, centered, min_w, min_h, features); element.preventDefault(); }}// Event mouseover/down handlingfunction imageMouseoverFromEvent() {	return function(element) { element.currentTarget.src = imgData[element.currentTarget.getAttribute('usemap')].src; element.preventDefault(); }}function imageMouseoutFromEvent() {	return function(element) { element.currentTarget.src = element.currentTarget.defaultImage; element.preventDefault(); }}function preloadActiveImages() {	var element_list = document.getElementsByTagName('img');	for (var i=0; i < element_list.length; i++) {		if (element_list[i].getAttribute('usemap')!==null) {			element_list[i].defaultImage=element_list[i].src;			addImage(element_list[i].getAttribute('usemap'));		}	}}function addImage(imagePath) {	if (isUndefined(imgData[imagePath])) {		imgData[imagePath]=new Image();		imgData[imagePath].src=imagePath;	}}// Standard window/popup handlingfunction openWindowFromLink(src, features) {	return openWindow(src.getAttribute('href'), (src.getAttribute('target') || '_blank'), features);}function openPopupFromLink(src, w, h, centered, min_w, min_h, features) {	return openPopup(src.getAttribute('href'), (src.getAttribute('target') || '_blank'), w, h, centered, min_w, min_h, features);}function openWindow(url, target, features) {	if (isUndefined(features)) features = '';	if (isUndefined(target)) target = '_blank';	var theWindow = window.open(url, target, features);	if (typeof theWindow.focus=="function" || typeof theWindow.focus=="object") theWindow.focus();	//return theWindow;}function openPopup(url, target, w, h, centered, min_w, min_h, features) {	if (isUndefined(min_w)) min_w = w;	if (isUndefined(min_h)) min_h = h;	if (isUndefined(features)) features = 'resizable=1,scrollbars=0';	w = (screen.availWidth>=w) ? w : min_w;	h = (screen.availHeight>=h) ? h : min_h;	features = 'width='+w+',height='+h+','+features;	if (centered) {		var x=(screen.availWidth-w)/2;		var y=((screen.availHeight-h)/2)-16;		if (x<0) x=0;		if (y<0) y=0;		features += ',top='+ y +',left='+ x +',screenY='+ y +',screenX='+ x;	}	return openWindow(url, target, features);}