var win=null;

function ShowPic(pic,w,h)
	{
	settings='width='+w+',height='+h+',top=20,left=20,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(pic,'',settings);
	}
	
function InsPic(source, width, height)
	{
	//source=url to pic (string)
	//w=width of picture (100%)
	//h=height of picture (100%)
	var SizeChanged = Boolean(false);
	var WindowW = Number(width) + 20;
	var WindowH = Number(height) + 30;
	var MaxW = Number(300);
	var FileName;
	var Alt = String('Screenshot');
	var LinkEvents = String('OnMouseOver="window.status=\'Show picture in full size\';return true" OnFocusGet="window.status=\'Show picture in full size\';return true" OnMouseOut="window.status=\'\'";return true');
	if (navigator.appName == 'Microsoft Internet Explorer')
		MaxW = screen.width - 512;
	else
		MaxW = screen.width - 256;

	if (width > MaxW)
		SizeChanged = true;	

	while (width > MaxW)
		{
		width = width * .975;
		height = height * .975;
		}
		
	FileName = source.split('\\');
	FileName = FileName[FileName.length - 1].split('/');
	FileName = FileName[FileName.length - 1];

	if (SizeChanged == true)
		{
		document.writeln('<a href="javascript:ShowPic(\''+source+'\',\''+WindowW+'\',\''+WindowH+'\')"'+LinkEvents+'>');
		Alt = FileName + ' (' + width + 'x' + height + ') - Click to see in full size';
		}
	else
		Alt = FileName + ' (' + width + 'x' + height + ')';
	
	document.writeln('<img src="'+source+'" border=0 alt="'+Alt+'" width="'+width+'" height="'+height+'">');
	
	if (SizeChanged == true)
		document.writeln('</a>');
	}