/*
imgDisplay
this file will create a window and write the HTML inside it to display an image
-afshin
*/

function htmlText(strTitle,strImgLocation,strHeight,strWidth,strAlt, bgColor)
{
	var strDisplayHTML = '';
	strDisplayHTML += '<html>\n';
	strDisplayHTML += '<head>\n';
	strDisplayHTML += '	<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />\n';
	strDisplayHTML += '	<title>' + strTitle + '</title>\n';
	strDisplayHTML += '	<style type="text/css">\n';
	strDisplayHTML += '		BODY\n';
	strDisplayHTML += '		{\n';
	strDisplayHTML += '		    BACKGROUND-COLOR: ' + bgColor + ';\n';
	strDisplayHTML += '		    MARGIN: 0px;\n';
	strDisplayHTML += '		    PADDING-BOTTOM: 0px;\n';
	strDisplayHTML += '		    PADDING-LEFT: 0px;\n';
	strDisplayHTML += '		    PADDING-RIGHT: 0px;\n';
	strDisplayHTML += '		    PADDING-TOP: 0px\n';
	strDisplayHTML += '		}\n';
	strDisplayHTML += '		#displayPic\n';
	strDisplayHTML += '		{\n';
	strDisplayHTML += '		    POSITION: absolute;\n';
	strDisplayHTML += '		    LEFT: 0px;\n';
	strDisplayHTML += '		    TOP: 0px;\n';
	strDisplayHTML += '		    Z-INDEX:  1\n';
	strDisplayHTML += '		}\n';
	strDisplayHTML += '	</style>\n';
	strDisplayHTML += '</head>\n';
	strDisplayHTML += '<body marginwidth="0" leftmargin="0" rightmargin="0" marginheight="0" topmargin="0">\n';
	strDisplayHTML += '<div id="displayPic">\n';
	strDisplayHTML += '<img src="' + strImgLocation + '" height="' + strHeight + '" width="' + strWidth + '" alt="' + strAlt + '" hspace="0" vspace="0" border="0" />\n';
	strDisplayHTML += '</div>\n';
	strDisplayHTML += '</body>\n';
	strDisplayHTML += '</html>\n';
	return strDisplayHTML;
}

var imgPopWin;

function imgPop(htmlTitle,imgLocation,imgAlt,imgWidth,imgHeight, bgColor)
{
	var strBGColor = !bgColor?'#ffffff':bgColor;
	if (imgPopWin&&imgPopWin.open&&true)
	{
		imgPopWin.close();
		imgPopWin=null;
	}
	imgPopWin = window.open('','imgPop','width=' + imgWidth + ',height=' + imgHeight + ',toolbars=no,scrollbars=no');
	imgPopWin.document.write(htmlText(htmlTitle,imgLocation,imgHeight,imgWidth,imgAlt,strBGColor));
	imgPopWin.focus();
}
