var myImgUrl = '';
var myWinAlert = '';
var imgWin = '';
var imgSheet = '';
var myTitle = '';
var myDescription = '';

function displaySheet(urlImg, itemTitle, itenDescription) {
	myImgUrl = urlImg; 
	if(itemTitle) {myTitle = itemTitle; }
        if(itenDescription) { myDescription = itenDescription; }
	imgSheet = new Image();
	imgSheet.onload = displayImages;
	imgSheet.onerror = displayDoc;
	myWinAlert = window.open('', 'ALERT', 'width=200,height=40,toolbar=no,location=no,menubar=no,resizable=yes');
	myWinAlert.document.open();
	myWinAlert.document.writeln('<html><body>Loading</body></html>');
	myWinAlert.document.close();
	myWinAlert.focus();
	imgSheet.src = urlImg;
	return; 
}

function displayImages () {
	var htmlWidth = imgSheet.width + 80;
	var htmlHeight = imgSheet.height + 150;
	var npw = 'width=' + htmlWidth + ',height=' + htmlHeight + ',toolbar=no,location=no,menubar=no,resizable=yes';
	if(imgWin) {
		imgWin.close();
	}	
	imgWin = window.open('', "SOLAR", npw);
	imgWin.document.open();
	imgWin.document.writeln('<html><head><title>' + myTitle + '</title><link href="../../../../include/solar.css" type="text/css" rel="stylesheet"><head><body><div class="PopUp"><span class="ContentBodyTitle">:: ' + myTitle + ' ::</span><br><img src="' + myImgUrl + '"><br>' + myDescription + '</div></body></html>');
	imgWin.document.close();
	imgWin.resizeTo(htmlWidth, htmlHeight);
	myWinAlert.close();
	imgWin.focus();
	return;
}

function displayDoc () {

	var htmlWidth = 500;
	var htmlHeight = 350;
	var npw = 'width=' + htmlWidth + ',height=' + htmlHeight + ',toolbar=no,location=no,menubar=no,resizable=yes';
	imgWin = window.open(myImgUrl, "SOLAR", npw).focus(); 
	myWinAlert.close();
	return;
}
