function popHash(str) {
	var hash = '';
	for(var x=0; x<str.length; x++) {
		hash += str.charCodeAt(x);
	}
	return hash;
}

function pop(url, width, height, scroll, wname) {

	var scrW = window.opera ? document.body.clientWidth : screen.width;
	var scrH = window.opera ? document.body.clientHeight : screen.height;

	var xp = parseInt((scrW - width)/2);
	var yp = parseInt((scrH - height)/2);

	var sc = scroll ? 'yes' : 'no';

	var opts = 'width=' + width;
	opts += ',height=' + height;
	opts += ',left=' + xp;
	opts += ',top=' + yp;
	opts += ',screenX=' + xp;
	opts += ',screenY=' + yp;
	opts += ',toolbar=no';
	opts += ',location=no';
	opts += ',directories=no';
	opts += ',status=no';
	opts += ',menubar=no';
	opts += ',scrollbars=' + sc;
	opts += ',resizable=yes';

	if(!wname) {
		var wn = popHash(url);
	}
	else {
		var wn = wname;
	}

	var re = /.jpg|.jpeg|.gif|.png/;

	if(re.test(url)) {
		var html = '<html><head><title>' + document.title + '</title></head><body style="margin:0px; padding:0px"><img alt="" title="" src=' + url + ' width=' + width + ' height=' + height + ' border="0" onclick="self.close()" style="display:block; cursor:pointer;"></body></html>';
		var win = window.open('', wn, opts);
		win.document.open();
		win.document.clear();
		win.document.write(html);
		win.document.close();
	}
	else {
		var win = window.open(url, wn, opts);
	}

	if(win && win.top) {
		win.focus();
	}
}


function openWindow(pUrl, pTarget, pParameter, pSrcHandle, pWidth, pHeight) {

  return pop(pUrl, pTarget, pParameter, pSrcHandle, pWidth, pHeight);

}
