var myImages = new Array();

function preloadImages() {
	if(document.images) {
		for( var j = 0; j < preloadImages.arguments.length; j++) {
			myImages[j] = new Image();
			myImages[j].src = preloadImages.arguments[j];
		}
	}
}
function changeImage(i, myImagesIndex) {
	try {
		i.src = myImages[myImagesIndex].src;
	}
	catch (e) {}
}
function openCenterWindow(url, title, width, height, menubar, status, scrollbars, resizable) {
	var left = Math.ceil((window.screen.availWidth - width) / 2);
	if (left < 0) {
		left = 0;
	}

	var top  = Math.ceil((window.screen.availHeight - height) / 2);
	if (top < 0) {
		top = 0;
	}

	if (width >= screen.width || height >= screen.height) {
		scrollbars = "yes";
	}

	var w = openWindow(left, top, url, title, width, height, menubar, status, scrollbars, resizable);
	return w;
}
function openWindow(left, top, url, title, width, height, menubar, status, scrollbars, resizable) {
	var w = window.open(url, title, "menubar=" + menubar + ",status="+ status + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",width=" + width + ",height=" + height + ",top=" + top + ",left=" + left);
	return w;
}
function validatelogin(form, lang) {
	if (!form.loginusername.value.length) {
		alert((lang == "en" ? "Please insert your username" : "Inserire l'utente"));
		form.loginusername.focus();
		return false;
	}
	if (!form.password.value.length) {
		alert((lang == "en" ? "Please insert your password" : "Inserire la password"));
		form.password.focus();
		return false;
	}
	return true;
}