/* 
ccostruisce una pagina XHTML per l'inserimento dinamico dello zoom
delle foto e relative didascalie
*/
function creaPaginaImg(stFile,stTitle,stDesc,iW,iH)
{
var iWd=Number(iW);  //larghezza img+1px*2bordo +1px*2 padding
var iHt=Number(iH)+2;  //altezza img "
//alert(iWd+" "+iHt);
var stTmp="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" ";
    stTmp=stTmp +"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"+"\n";
		stTmp=stTmp+"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"it\" lang=\"it\">"+"\n";
		stTmp=stTmp+"<head>"+"\n"+"<style type=\"text/css\">"+"\n"+"#viewer{width:"+iWd+"px;";	
		stTmp=stTmp+"height:auto;margin:1px auto;padding:1px;border:1px solid #fefef8;min-height:"+iHt+"px !important;}";
		stTmp=stTmp+"#didascalia{width:"+iWd+"px;margin:2px auto;padding:0;border:0;font:0.88em Arial,sans-serif;text-align:left;}";
		stTmp=stTmp+"</style>"+"\n"+"<!--[if gte IE 5]><link rel=\"stylesheet\" type=\"text/css\" href=\"../stileIE.css\" />"
		stTmp=stTmp+"<![endif]-->"+"<title>"+stTitle+"</title>";
		stTmp=stTmp+"</head>"+"\n"+"<body style=\"background:#222;color:#fefef8;\">"+"\n"+"<div id=\"viewer\">"+"\n";
		stTmp=stTmp+"<img src=\""+stFile+"\" alt=\""+stTitle+"\" title=\""+stTitle+"\" "; 
		stTmp=stTmp+"style=\"border:0;margin:1px auto;float:left;\"";
		stTmp=stTmp+" width=\""+iW+"\" height=\""+iH+"\" />"+"\n"+"</div>";
		stTmp=stTmp+"<div id=\"didascalia\">"+"\n";
		stTmp=stTmp+"<p>"+stDesc+"</p>"+"\n"+"</div>"+"\n"+"</body></html>";

    return stTmp;
}


function showImg(stImg,iW,iH,stTitle,stDesc) 
{ 
var win;
var iL=+Number(iW)+30;
var iA=Number(iH)+50;
var stTmp;

//alert(stTmp);

stTmp="width="+String(iL)+",height="+String(iA)+",resizable=no,scrollbars=no";
	
		win = window.open("","Skeni",stTmp);


		stTmp=creaPaginaImg(stImg,stTitle,stDesc,iW,iH);  
//alert(String(win));
		win.document.open("text/html");

		win.document.write(stTmp);

		win.document.close();
		win.focus();
}
