﻿
function DetectImageSize(picPath,picTitle)
{
    
  image_1 = new Image();
  image_1.src = picPath;
  var picName=image_1;
  picURL=picName.src;
  newWindow=window.open(picURL,'newWin','scrollbars=yes,toolbar=yes,width='+picName.width+',height='+picName.height);
  newWindow.document.write('<html><head><title>'+picTitle+'<\/title><\/head><body oncontextmenu="return false;" background="'+picURL+'"><\/body><\/html>');
  newWindow.resizeBy(picName.width-newWindow.document.body.clientWidth,picName.height-newWindow.document.body.clientHeight);
  newWindow.focus();
} 

function openWindow(filename, winname, width, height, feature) {
	var features, top, left;
	var reOpera = /opera/i ;
	var winnameRequired = ((navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4) || reOpera.test(navigator.userAgent));
	
	left = (window.screen.width - width) / 2;
	top = (window.screen.height - height) / 2;	
	if(feature == '')
		features = "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left;
	else
		features = "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + "," + feature;
	//if(!winnameRequired)	winname = "";
	void(window.open(filename,winname,features));
}
