function show_image(path,w,h)
{
  var generator=window.open('','show_window','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+(w+50)+', height='+(h+70)+', top='+Math.floor((screen.height-700)/2)+', left='+Math.floor((screen.width-900)/2));

  window.status = 'Anteprima Immagine Visualizzata!';
   
  generator.document.write('<html><head><title>Visualizzatore Immagini</title>');
  generator.document.write('<link rel="stylesheet" href="../../css.css">');
  generator.document.write('</head><body align="center">');
  generator.document.write('<p align="center"><img src="'+path+'" width="'+w+'" height="'+h+'">');
  generator.document.write('<br><br><input class="sbutton" type="button" name="close" value="Chiudi" onclick="javascript:self.close()"></p>');
  generator.document.write('</body></html>');
  generator.document.close();
  return false;
}

function show_text(path,w,h)
{
  var left,top,generator;
  
  left=(screen.width-w) /2;
  top =(screen.height-h)/3;

  generator=window.open('','show_window','width='+w+', height='+h+', top='+top+', left='+left);  
   
  generator.document.write('<html><head><title>Visualizzatore Percorsi</title>');
  generator.document.write('<link rel="stylesheet" href="../css.css">');
  generator.document.write('</head><body><table width="100%" height="100%" border="1" bordercolor="#333333"><tr><td>');
  generator.document.write('<p align="center" class="descrizione">'+path);
  generator.document.write('<br><br><input class="sbutton" type="button" name="close" value="Chiudi" onclick="javascript:self.close()"></p>');
  generator.document.write('</td></tr></table></body></html>');
  generator.document.close();
  return false;
}

function show_mini(page,subdir)
{
	var sub,i,h,w;
	h=screen.height-200;
	w=screen.width-100
	sub='';
	for (i=0;i<subdir;i++)
	{ sub=sub+'../'; }	
	window.open(sub+page,'show_mini','toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+Math.floor((screen.height-h)/4)+', left='+Math.floor((screen.width-w)/2));
	return false;
}
function show_sondaggio(page,elem,subdir)
{
	var sub,w,h,w;
	w=350;
    if (elem <= 0) h = 300;
    else h=elem*44+100;
	sub='';
	for (i=0;i<subdir;i++)
	{ sub=sub+'../'; }	
	window.open(sub+page,'show_sondaggio'+subdir,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top=100, left=100');
}

function show_custom(link,w,h)
{
	var left,top,extra,name;

    extra = 'scrollbars=yes, ';
    w += 20;

    if (h>720)
    { h = 720; }

	left=(screen.width-w) /2;
	top =(screen.height-h)/3;

    name = link;
    name = name.replace('.','_');
    name = name.replace('-','_');
    name = name.substr(0,name.indexOf("_"));

	window.open(link, name, extra + 'left='+left+', top='+top+', height='+h+',width='+w);

    return false;
}

function show_refresh(href)
{
	if (window.opener && !window.opener.closed) 
	{
		if ((href=='') || (href==null)) window.opener.location.reload();
		else window.opener.location.href=href;		
	}
	self.close();
}
