/*
	Finestre ausiliarie()

	Author: Deiro Claudio
	Author Email: deiro@livio.it
*/

var popWnd = null;

function openAux(href, w, h)
{
	if (popWnd && !popWnd.closed) popWnd.close();
	
	var winWidth = w;
	var winHeight = h;
	var xPos = (screen.availWidth-winWidth)/2;
	var yPos = (screen.availHeight-winHeight)/2;

	popWnd = this.open(href, "_blank", "innerWidth=" + w + ",innerHeight=" + h + ",width=" + w + ",height=" + h + ",top=0,left=0,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=yes,top=" + yPos + ",left=" + xPos);
}

function openAuxTxt(href, w, h)
{
	if (popWnd && !popWnd.closed) popWnd.close();

	var winWidth = w;
	var winHeight = h;
	var xPos = (screen.availWidth-winWidth)/2;
	var yPos = (screen.availHeight-winHeight)/2;

	popWnd = this.open(href, "_blank", "innerWidth=" + w + ",innerHeight=" + h + ",width=" + w + ",height=" + h + ",top=0,left=0,titlebar=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes,status=yes,top=" + yPos + ",left=" + xPos);
}


function displayImage(pic, w, h, title)
{
	if (popWnd && !popWnd.closed) popWnd.close();

	var winWidth = w;
	var winHeight = h;
	var xPos = (screen.availWidth-winWidth)/2;
	var yPos = (screen.availHeight-winHeight)/2;

	popWnd = this.open("", "Inserzioni", "innerWidth=" + w + ",innerHeight=" + h + ",width=" + w + ",height=" + h + ",top=0,left=0,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no,top=" + yPos + ",left=" + xPos);

	if(popWnd != null)
	{
		var htmlString = "<html><head><title>" + title + "</title></head>"  
		htmlString += "<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>"
		htmlString += "<img src=" + pic + ">"
		htmlString += "</body></html>"

		popWnd.document.open()
		popWnd.document.write(htmlString)
		popWnd.document.close()

		popWnd.focus() //brings window to top
	}	
}

function popClose()
{
	if (popWnd && !popWnd.closed) popWnd.close();
}

window.onunload = popClose;
