var newwindow = '';

function ViewImage(url)
{ 
  var img = new Image(); 
  img.onload = gotow;
  img.onerror = function () { alert('Cannot load '+this.src);};
  img.src = url;
}

function gotow()
{
  var img = this;
  var dx = img.width+40;
  var dy = img.height+40;

window.open(img.src, 'image', 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,fullscreen=no,channelmode=no,width='+dx+',height='+dy); 
}


function popUp(url)
{
	if (!newwindow.closed && newwindow.location)
	{
		newwindow.location.href = url;
	}
	else
	{
		newwindow=window.open(url,'name','width=165,height=125,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0');
		if (!newwindow.opener) newwindow.opener = self;
	}
	//if (window.focus) {newwindow.focus()}
	return false;
}



