// JavaScript Document


var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=auto,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function CambiaNoIMG(item)
{
	controllo=""
		//alert("ciao")

		img2="img/non_disponibile.jpg"
		//alert(img2 +" -" + item )
		document.getElementById(item).src=img2
	
}

function ctrl_foto(nome,item,maxAlt,mazLag)
{
//alert("entro")
if (maxAlt == null ){maxAlt=1500}
if (mazLag == null ){mazLag=700}

altezza=document.getElementById(nome+item).height
larghezza= document.getElementById(nome+item).width

//alert("larghezza:"  + larghezza)
//alert(altezza)
// altezza= document.images[item].height
// larghezza= document.images[item].width


 
 if (altezza > maxAlt)
		 {
			//alert("Altezza:"  + altezza)
		 	altezza = parseInt(maxAlt)
			//document.images[item].height = altezza
			document.getElementById(nome+item).height=altezza

		 }
 
	else
	{
		
		 if (larghezza > mazLag)
			 {
			
					 	//alert("larghezza:"  + larghezza)
						larghezza = mazLag
				//		document.images[item].width = larghezza
						document.getElementById(nome+item).width=larghezza
						//alert("ok")
			 }
		
	}	


}
