function swapImage(imgN,imgU){
	if(document.images)document.images[imgN].src=imgU;
}
function openPopup(strUrl, strName, intWidth, intHeight) {
	// open a centered popup window
	var intLeft = parseInt((screen.availWidth - intWidth) / 2)
	var intTop = parseInt((screen.availHeight - intHeight) / 2)
	var strAttrib = 'height=' + intHeight + ',width=' + intWidth + ',screenX=' + intLeft + ',screenY=' + intTop + ',left=' + intLeft + ',top=' + intTop + ',scrollbars=1,toolbar=0,menubar=0,resizable=1,location=0'
	window.top.popDialog = window.open(strUrl, strName, strAttrib)
	// focus to popup
	window.top.popDialog.focus();
}
function openMenu(objLI) {
	// disable former active menu (if any)
	var colLIs = objLI.parentNode.childNodes;
	for (var i = 0; i < colLIs.length; i++) {
		if (colLIs[i].className == 'active') {
			colLIs[i].className = '';
		}
	}
	// enable this menuitem
	objLI.className = 'active';
}

var preloadImages = new Array();
function preloadImageArray(arrImagesUrls) {
	for (var i = 0; i < arrImagesUrls.length; i++) {
		var objImage = new Image();
		objImage.src = arrImagesUrls[i];
		preloadImages[preloadImages.length] = objImage;
	}
}
var currentImage = 0;
function rotateImages(strImageId, arrImageUrls) {
	var objImage = document.getElementById(strImageId);
	if (objImage) {
		currentImage++;
		if (currentImage >= arrImageUrls.length) {
			currentImage = 0;
		}
		if (arrImageUrls[currentImage] == '') {
			rotateImages(strImageId, arrImageUrls);
		} else {
			objImage.src = arrImageUrls[currentImage];
		}
	}
}



// call resize when document finishes loading
if (typeof(window.addEventListener) != 'undefined') {
	window.addEventListener('load', hm_onload, false);
	window.addEventListener('resize', hm_setResizeTimeout, false);
} else if (typeof(window.attachEvent) != 'undefined') {
	window.attachEvent('onload', hm_onload);
	window.attachEvent('onresize', hm_setResizeTimeout);
}

var hm_objRoot;
var hm_blnResizeContentDiv = true;
var hm_intResizeTimerId;
var hm_intOldWindowWidth = 0;
var hm_intOldWindowHeight = 0;
var hm_intScrollTimerId;

function hm_onload() {
	hm_objRoot = document.body;
	if (typeof(extraOnload) == 'function') {
		extraOnload();
	}
	hm_resize();
}

function hm_setResizeTimeout() {
	if (hm_blnResizeContentDiv && (hm_objRoot.clientWidth != hm_intOldWindowWidth || hm_objRoot.clientHeight != hm_intOldWindowHeight)) {
		window.clearTimeout(hm_intResizeTimerId);
		hm_intResizeTimerId = window.setTimeout(hm_resize, 200);
		hm_intOldWindowWidth = hm_objRoot.clientWidth;
		hm_intOldWindowHeight = hm_objRoot.clientHeight;
		window.status = hm_intOldWindowWidth
	}
}

function hm_resize() {
	if (!hm_blnResizeContentDiv) {
		return;
	}
	var blnIE = (navigator.userAgent.indexOf('MSIE') != -1);
	var objContentDiv = document.getElementById('content-page');
	var objFooter = document.getElementById('footer');
	var intFooterHeight = objFooter ? objFooter.offsetHeight : 0;
	var intHorizontalPadding = 195;
	var intVerticalPadding = 40;
	// do not correct padding for IE
	var intHorizontalPaddingCorrection = blnIE ? 0 : intHorizontalPadding;
	var intVerticalPaddingCorrection = blnIE ? 0 : intVerticalPadding;
	if (objContentDiv) {
		// find out offset of content
		var intContentOffsetTop = 0;
		var objOffset = objContentDiv;
		while (objOffset != null) {
			intContentOffsetTop += objOffset.offsetTop;
			objOffset = objOffset.offsetParent;
		}
		var intWidth = hm_objRoot.clientWidth - intHorizontalPaddingCorrection;
		if (intWidth > 0) objContentDiv.style.width = intWidth + 'px';
		var intHeight = hm_objRoot.clientHeight - intContentOffsetTop - intFooterHeight - intVerticalPaddingCorrection;
		if (intHeight > 0) objContentDiv.style.height = intHeight + 'px';
		
		if (typeof(extraResize) == 'function') {
			extraResize(intWidth, intHeight);
		}
	}
}

