if (navigator.appName=="Netscape") {
	document.write("<style type='text/css'>body {overflow-y:scroll;}<\/style>");
}
var userAgent = navigator.userAgent.toLowerCase();
var is_ie = (userAgent.indexOf('msie') != -1) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);

function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

function Scale(image, max_width, max_height) {
	var tempimage = new Image();
	tempimage.src = image.src;
	var tempwidth = tempimage.width;
	var tempheight = tempimage.height;
	if (tempwidth > max_width) {
		image.height = tempheight = Math.round(((max_width)/tempwidth) * tempheight);
		image.width = tempwidth = max_width;
	}

	if (max_height != 0 && tempheight > max_height)
	{
		image.width = Math.round(((max_height)/tempheight) * tempwidth);
		image.height = max_height;
	}
}

function Preview(image) {
	if (!is_ie || is_ie >= 7){
	$('lightbox').innerHTML = "<a onclick=\"Return();\"><img src=\"" + image.src + "\" /></a>";
	$('curtain').style.display = "block";
	$('lightbox').style.display = "block";
	}
}

function Return() {
	$('lightbox').style.display = "none";
	$('curtain').style.display = "none";
	$('lightbox').innerHTML = "";
}
