function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

// Special changeImages for Netscape in this project
if (document.layers) nn=1;
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=3) {
			if (nn) {
				document.layers[changeImages.arguments[i]].document.images[changeImages.arguments[i+1]].src = changeImages.arguments[i+2];
			} else {
				document[changeImages.arguments[i+1]].src = changeImages.arguments[i+2];
			}
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		for (var i=0; i<preloadImages.arguments.length; i++) {
			img = newImage(preloadImages.arguments[i]);
		}
		preloadFlag = true;
	}
}

function loadQA() {
	var randomnum = Math.floor(Math.random()*6);
	if (randomnum > 6) {
		randomnum = 6;
	}
	var picture = '<img src="../images/qa' + randomnum + '.jpg" alt="Q&amp;A" border="0">';
	document.writeln(picture);
}

function popImg(fileName, winWidth, winHeight, windowName) {
	var screen_width, screen_height;
	var win_top, win_left;
	var imgWin;
	var oldBrowser = parseInt(navigator.appversion) <3;
   
	screen_height	= 0;
	screen_width	= 0;
	win_top			= 0;
	win_left		= 0;

	if (window.innerWidth) 
		screen_width = window.innerWidth;
	if (window.innerHeight)
		screen_height = window.innerHeight;

	win_top  = screen_height - winHeight - 20;
	win_left = screen_width  - winWidth  - 20;
	
	winWidth += 50;
	winHeight += 70;
	
	extras = '';
	if (winHeight > 600) {
		winHeight = 600;
		extras = 'scrollbars,';
	}

	imgWin = window.open("", "myWin", extras+"height="+winHeight+",width="+winWidth+",screenX="+win_left+",left="+win_left+",screenY="+win_top+",top="+win_top);
    if (!imgWin.opener) {
        imgWin.opener = window
    }

	imgWin.document.open("text/html","replace");
	imgWin.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"');
	imgWin.document.writeln('        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">');
	imgWin.document.writeln('<html lang="en">');
	imgWin.document.writeln('<head>');
	imgWin.document.writeln('	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">');
	imgWin.document.writeln('	<title>TransCanada Annual Report 2002</title>');
	imgWin.document.writeln('<style type="text/css"><!--');
	imgWin.document.writeln('img.img {display:block;}');
	imgWin.document.writeln('--></style>');
	imgWin.document.writeln('</head>');
	imgWin.document.writeln('<body bgcolor="#FFFFFF">');
	imgWin.document.writeln('<div align="center">');
	imgWin.document.writeln('<table border="0" cellpadding="0" cellspacing="0">');
	imgWin.document.writeln('<tr>');
	imgWin.document.writeln('<td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>');
	imgWin.document.writeln('</tr>');
	imgWin.document.writeln('<tr>');
	imgWin.document.writeln('<td width="1" bgcolor="#FFFFFF">&nbsp;</td>');
	imgWin.document.writeln('<td><a href="javascript:window.close();"><img src="'+fileName+'" border="0" alt="Close Window"></a></td>');
	imgWin.document.writeln('<td width="1" bgcolor="#FFFFFF">&nbsp;</td>');
	imgWin.document.writeln('</tr>');
	imgWin.document.writeln('<tr>');
	imgWin.document.writeln('<td colspan="3" bgcolor="#FFFFFF"><!--- <div align="center"><a href="javascript:window.close();"><img src="../images/close_window.gif" alt="" width="195" height="17" border="0"></a></div> ---></td>');
	imgWin.document.writeln('</tr>');
	imgWin.document.writeln('</table>');
	imgWin.document.writeln('</div>');
	imgWin.document.writeln('</body>');
	imgWin.document.writeln('</html>');
	imgWin.document.close();
	if (!oldBrowser) imgWin.focus();
}

function closeImgWin() {
   document.all['myWin'].close();
}

