function getObj(x) {
	if (typeof x != 'string') return x;
	else if (Boolean(document.getElementById)) return document.getElementById(x);
		else return null;
	}

function getParamsFromUrl () {
	var field  = window.location.search.substr(1).split('&');
	var params = new Array(); 
	for (var i=0; i<field.length; i++) {
		params[field[i].split('=')[0]] = unescape(field[i].split('=')[1]); 
		}
	return params;
	}

var imagePopupWindow;
function imagePopup (src,title,width,height) {
	if (imagePopupWindow) imagePopupWindow.close();
	var imageWidth = width;
	var imageHeight = height;
	if (width < 500)  width = 500;
	if (height < 400) height = 400;
	if (width > 800 || height > 600) var s = 'scrollbars=yes';
	else var s = 'scrollbars=no';
	if (width > 800)  width = 800;
	if (height > 600) height = 600;
	var p = 'toolbar=no,menubar=no,location=no,resizable=yes,directories=no,status=no,width=' + width + ',height=' + height + ',left=' + (screen.availWidth/2-width/2) + ',top=' + (screen.availHeight/2-height/2) + ',' + s;
	imagePopupWindow = window.open('PreviewImage.html?src='+escape(src)+'&title='+escape(title)+'&width='+imageWidth+'&height='+imageHeight,'',p);
	imagePopupWindow.focus();
	return false;
	}

function pagePopup (src,width,height) {
	var p = 'toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes,resizable=yes,status=yes,width=' + width + ',height=' + height + ',left=' + (screen.availWidth/2-width/2) + ',top=' + (screen.availHeight/2-height/2);
	var popup = window.open(src,'pagePopupTarget',p);
	popup.focus();
	return false;
	}
