function OpenPictureByAddress(ImageAddress)
{
	tmpImg = new Image();
	tmpImg.src = ImageAddress;
	newWindow=window.open(ImageAddress,'ImagePreview','scrollbars=yes,toolbar=no,width=' + tmpImg.width + ',height=' + tmpImg.height);
	newWindow.document.write('<html><head><title>ImagePreview<\/title><\/head><body background="' + ImageAddress + '" style="background-repeat: no-repeat"><\/body><\/html>');
	newWindow.resizeBy(tmpImg.width - newWindow.document.body.clientWidth, tmpImg.height-newWindow.document.body.clientHeight);
	newWindow.focus();
	
}
function OpenFileManager(serverFoder,managerType,managerRequests,RelatedScript)
{
	
	window.open(serverFoder + '/MainControls/RavianFileManager.aspx?ManagerType=' + managerType + '&PS=' + RelatedScript + managerRequests,'ImageManager','width=550,height=400,scrollbars=no');
	//ShowPopup(serverFoder + '/MainControls/RavianFileManager.aspx?ManagerType=' + managerType + '&PS=' + RelatedScript + managerRequests,'ImageManager',500,500,'no','true');
}

function ShowFullSizeImage(imgUrl)
{
	newWindow = window.open(imgUrl,'ImagePreview','scrollbars=no,toolbar=no,status=no,width=1,height=1');
	newWindow.document.write('<html><head><title>ImagePreview<\/title><script type="text/javascript">var resizeInterval;function MoveToCenter(){window.moveTo((screen.availWidth - document.body.clientWidth)/2, (screen.availHeight - document.body.clientHeight)/2);}function ResizeStep(width, height, step){var widthFull = false;var heightFull = false;var widthChange;var heightChange;if(document.body.clientWidth + step < width){widthChange = step;}else{widthChange = width - document.body.clientWidth;widthFull = true;}if(document.body.clientHeight + step < height){heightChange = step;}else{heightChange = height - document.body.clientHeight;heightFull = true;}window.resizeBy(widthChange, heightChange);MoveToCenter();if(widthFull && heightFull){clearInterval(resizeInterval);}}function Resize(width, height, step, delay){resizeInterval = setInterval(\'ResizeStep(\' + width + \',\' + height + \',\' + step + \')\', delay);}<\/script><\/head><body style="margin:0"><img  src="' + imgUrl + '" onreadystatechange="if(this.readyState == \'complete\' || this.readyState == \'4\'){Resize(this.width, this.height, 5, 10)}" /><\/body><\/html>');
}


function MoveToCenter()
{
	window.moveTo((screen.availWidth - document.body.clientWidth)/2, (screen.availHeight - document.body.clientHeight)/2);
}
var resizeInterval;
function ResizeStep(width, height, step)
{
	var widthFull = false;
	var heightFull = false;
	var widthChange;
	var heightChange;
	if(document.body.clientWidth + step < width)
	{
		widthChange = step;
	}
	else
	{
		widthChange = width - document.body.clientWidth;
		widthFull = true;
	}
	if(document.body.clientHeight + step < height)
	{
		heightChange = step;
	}
	else
	{
		heightChange = height - document.body.clientHeight;
		heightFull = true;
	}
	window.resizeBy(widthChange, heightChange);
	MoveToCenter();
	if(widthFull && heightFull)
	{
		clearInterval(resizeInterval);
	}
}
function Resize(width, height, step, delay)
{
	resizeInterval = setInterval('ResizeStep(' + width + ',' + height + ',' + step + ')', delay);
}