﻿function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function changeBgImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeBgImages.arguments.length; i+=2) {
			var item = document.getElementById(changeBgImages.arguments[i]);
			if (item) item.style.backgroundImage = "url(" + changeBgImages.arguments[i+1] + ")";
		}
	}
}

var preloadFlag = false;

function displayImageWindow(imageid, resolution, width, height) {
	var scroll = "no";

	if (width > (screen.width - 50)) {
		width = (screen.width - 50);
		scroll = "yes";
	}
	if (height > (screen.height - 50)) {
		height = (screen.height - 50);
		scroll = "yes";
	}
	
	var left = new Number((screen.width - width) / 2).toFixed(0);
	var top = new Number((screen.height - height) / 2).toFixed(0) - 20;
	
	window.open("fullview.aspx?id=" + imageid + "&res=" + resolution, "_blank", "left = " + left + ", top = " + top + 
		", location = no, resizable = no, scrollbars = " + scroll + ", status = no, toolbar = no, width = " + width + ", height = " + height);
}
