/*****************************************************************
*  popUpWin()
*  Questa Funzione visualizza il popup della registrazione
*  Richiamare le funzione in questo modo:
*  javascript:popUpWin('pagina.htm','nomeWin','width=500,height=550,scrollbars=yes');
****************************************************************/
function popUpWin(theURL,theName,theSize) 
{
  var arrayImpost = theSize.split("=");
  var winWidth = parseInt(arrayImpost[1]);
  var winHeight = parseInt(arrayImpost[2]);
  var screenWidth = ( screen.width - winWidth ) / 2;
  var screenHeight = ( screen.height - winHeight ) / 2;
  window.open(theURL,theName,theSize + ",screenX=" + screenWidth + ",screenY=" + screenHeight + ",left=" + screenWidth + ",top=" + screenHeight + ",location=no,status=no,directories=no,toolbar=no");
}

function OpenComWindow(id)
{
	var pageName = "showmedia.aspx?FileName=" + id;
	window.open(pageName,"mywindow","height=400,width=400,status=no,toolbar=no,menubar=no,location=no");
}

function TransformEnterKpress(evt,myObj)
{
	evt = (evt) ? evt : ((event) ? event : null);
	if (evt)
	{
		var charCode = (document.all) ? event.keyCode : evt.which;
		if (charCode == 13)
		{
			for (j = 0; j < document.forms[0].length; j++)
			{
				if (document.forms[0].elements[j].name == myObj.name)
				{
					document.forms[0].elements[j+1].focus();
					break;
				}
			}
			return false;
		}
	}
}

function BlockEnterKpress(evt,myObj)
{
	evt = (evt) ? evt : ((event) ? event : null);
	if (evt)
	{
		var charCode = (document.all) ? event.keyCode : evt.which;
		if (charCode == 13)
		{
			return false;
		}
	}
}

var WindowTemp;
function popup_open(popupfile, popupname, popupwidth, popupheight, resize, status, scroll, tool, menu)
{
	//titlebar=0;
	var winleft = (screen.width - popupwidth) / 2;
	var wintop = (screen.height - popupheight) / 2;
	var params = "width=" + popupwidth + ",height=" + popupheight + ",top=" + wintop + ",left=" + winleft + ",resizable=" + resize + ",status=" + status + ",scrollbars=" + scroll + ",toolbar=" + tool + ",location=0,directories=0,menubar=" + menu + "";
	if((navigator.appName.indexOf("Explorer")!=-1)&&(parseInt(navigator.appVersion.substring(0,1))<4))
	{
		newwin = window.open(popupfile,popupname,params);
	}
	else
	{
		if(WindowTemp)
		{
			if(!WindowTemp.closed)
			{
				WindowTemp.close();
				WindowTemp="";
			}
		}

		newwin = window.open(popupfile,popupname,params);
		WindowTemp = newwin;
		WindowTemp.name = "WindowTemp";
		newwin="";
	}
}

function PreloadImageMenu()
{
	var imgMenuPath = "/common/images/menu/";
	var arrSrcImage = new Array("m_iprint_notsel.gif","m_iprint_sel.gif","m_prodotti_notsel.gif","m_prodotti_sel.gif");
	var arrPreloadImages = new Array();

	for (i=0; i<arrSrcImage.length; i++)
	{
		arrPreloadImages[i] = new Image();
		arrPreloadImages[i].src = imgMenuPath + arrSrcImage[i];
	}
}

function RollOverMenu(imgObj, imgSrc)
{
	var imgMenuPath = "/common/images/menu/";
	imgObj.src = imgMenuPath + imgSrc;
}

function openRassegnaStampa(myurl, w, h)
{
	w=w+20;
	h=h+34;	
	popup_open(myurl, 'WindowTemp', w, h, 0, 0, 0, 0, 0);
}

function ReloadPageOpener(urlReload)
{
	window.opener.location = urlReload;
	//window.opener.reload();
}

