var pictureDialog = null;

try
{
	pictureDialog = new TPictureDialog();
}
catch(pDException)
{
	// seems that type TPictureDialog does not exist
}

function showPicture(event,fileID,languageID)
{
	if (event && fileID && languageID && pictureDialog)
	{
		pictureDialog.alignmentOffsetX = 0;
		pictureDialog.alignmentOffsetY = 0;
		pictureDialog.location.picture = '/tools/filestream/filestream.php?fileID='+fileID+'&image=1';
		pictureDialog.location.closeButton = '/images/close.png';
		pictureDialog.location.progressIcon = '/images/progress.gif';
		pictureDialog.show(event);
	}
}

function DoCommand(formid,command,parameter)
{
	document.forms[formid].index_command.value = command;
	document.forms[formid].index_command_param.value = parameter;
	document.forms[formid].submit();
}

function SetWindowDimension(w,h)
{
	var alternateset = true;

	var x = Math.round((screen.availWidth / 2)-(w / 2));
	var y = Math.round((screen.availHeight / 2)-(h / 2));
	if (x < 0) { x = 0; } 
	if (y < 0) { y = 0; }

	window.moveTo(x,y);
					
	if (document.body)
	{	
		if (document.body.offsetWidth)
		{
			window.resizeTo(w, h);
			
			w = w+(w-document.body.offsetWidth);
			h = h+(h-document.body.offsetHeight);

			window.resizeTo(w, h);
			alternateset = false;
		}
	}
					
	if (alternateset)
	{
		document.innerWidth = w;
		document.innerHeight = h;
	}
}