function zoom(chemin,titolo){
	i1 = new Image;
	i1.src = chemin;
	codice_popup= '<html><head><title>' + titolo + ' </title></html>';
	codice_popup= codice_popup+ '<body topmargin=0 leftmargin=0 onclick="javascript:window.close()">';
	codice_popup= codice_popup+ '<center>';
	codice_popup= codice_popup+ '<img src="'+chemin+'" name=zoom onLoad="window.resizeTo(document.zoom.width,document.zoom.height + 67 )">';
	codice_popup= codice_popup+ '</center></body></html>';

	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=1,top=0,left=0');
	popupImage.document.open();
	popupImage.document.write(codice_popup);
	popupImage.document.close();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function openImage(path ,w, h) {
	window.open(path, Math.round(Math.random()*1000), 'width='+w+',height='+h,'scrollbars=1','resizable=1');
}

function openAbaco(path ,w, h) {
	window.open(path, Math.round(Math.random()*1000) );
}

function openImageFlex(path,w,h,res)
{
	if (w > (screen.width-30)) w=screen.width-30;
	if (h > (screen.height-80)) h=screen.height-70;
		//alert('w='+w+' e screen.width = '+screen.width);
		//alert('h='+h+' e screen.height = '+screen.height);
	window.open(path, Math.round(Math.random()*1000), 'left=5,top=5,width='+w+',height='+h+',scrollbars='+res+',resizable='+res);
}

function openwindowmio(path,nome,w,h,res)
{
	if (w > (screen.width-30)) w=screen.width-30;
	if (h > (screen.height-80)) h=screen.height-70;
		//alert('w='+w+' e screen.width = '+screen.width);
		//alert('h='+h+' e screen.height = '+screen.height);
	window.open(path, nome, 'left=5,top=5,width='+w+',height='+h+',scrollbars='+res+',resizable='+res);
}

function printableWindow(myURL)
{
	popupWin = window.open(myURL, 'printable', 'menubar,scrollbars,resizable,width=700,height=600,left=10,top=10')
}

function mioresizeWindow(larghezza,height)
{
	//leftpos=window.screen.width-larghezza-20;
	leftpos=5
	//controllo che non sia troppo largo
	if (larghezza > (screen.width-20)) larghezza=screen.width-20;
	if (height > (screen.height-40)) height=screen.height-40;

	window.moveTo(leftpos,1);
	if (document.layers)
	{
		// resizeTo sets inner size, so use this instead
		window.outerWidth = larghezza;
		window.outerHeight = height;
	}
	else
		window.resizeTo(larghezza,height);
}
function openeresizenotebook(id,valore) {
ceccato=valore;
larghezza=346;
altezza=400;
leftpos=window.screen.width-larghezza-20;
caddy = window.open("/officebit/prodotti/notebook.php?it="+id+"&ch="+ceccato,"notebook","left="+leftpos+",top=1,scrollbars=yes,width="+larghezza+",height="+altezza)
caddy.focus();
}


//Per prendere il submit sul form nel quale c'è il focus, che sia la ricerca, il login o la ricerca prodotti
var chk_fuoco = '';
function checkEnter(e){ 
	var characterCode 
	if(e && e.which){ 
		e = e
		characterCode = e.which 
	}
	else{
		e = event
		characterCode = e.keyCode
	}
	if(characterCode == 13){ 

		if(chk_fuoco=="ricercaGenerale")
		document.ricerca_sito.submit();
		if(chk_fuoco=="prodotti")
		document.ricerca_prodotti.submit();
		if(chk_fuoco=="login")
		{
			//alert("ci sono");
			document.loginformheader.submit();
		}	
	}
}
