﻿// Created by: Alessandro Parodi
// 
function OpenNewsImage(imageUrl)
{
	window.open('ShowImage.htm?imageUrl=' + imageUrl,
		'_blank',
		'scrollbars=no,resizable=yes,status=no,location=no,toolbar=no');
}

function RenderImage()
{
	var url = document.URL;
	if(url.indexOf('?') != -1)
	{
		var queryString = url.substring(url.indexOf('?') + 1);
		var imageUrl = queryString.substring(queryString.indexOf('=') + 1);
		var img = document.getElementById('ph');
		if(img != null)
			img.src = imageUrl;
		else
			alert('An error occurred, the image cannot be shown.');
	}
	else
	{
		alert('An error occurred, the image cannot be shown.');
	}
};


function SetWindowSizeSize(img)
{
	var windowWidth = Math.min(img.width + 8, screen.availWidth);
	var windowHeight = Math.min(img.height + 56, screen.availHeight);
	window.resizeTo(
		windowWidth,
		windowHeight
	);
	window.moveTo(
		Math.floor((screen.availWidth - windowWidth) / 2),
		Math.floor((screen.availHeight - windowHeight) / 2)
	);
};