// Javascript hien thi Image dung kich co cua cua so Popup.
// Javascript open any Image with exactly size.
// Nguoi viet: Ngo Hong Vinh - Trung Tam dien toan, Truyen so lieu KV I (VDCI) -
// Ngo Hong Vinh - Vietnam Datacommunication
// vinhweb@vdc.com.vn

<!-- Begin
function openImage(ImageName) {

//alert (ImageName);
//return;

  		 		ngovinh=window.open("","Preview","status=no,resizable=no,width=90,height=110,top=10,left=10");
  	  // open the new window with just the title and status bar and name it 'ngovinh'
  ngovinh.document.writeln('<html>');
  ngovinh.document.writeln('<head>');
  ngovinh.document.writeln('<title>'+ImageName+'</title>');
  	  // put the name of the pic in the title bar
  ngovinh.document.writeln('</head>');

  if (navigator.appName == "Microsoft Internet Explorer")
  	  // in IE resizeTo give the outer of the window
  	  //alert (document.images[0].width);
     ngovinh.document.writeln('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" onLoad="window.resizeTo(document.images[1].width+120,document.images[1].height+ 140)">');
		      // resize the window to match the picture

   else
       ngovinh.document.writeln('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" onLoad="window.resizeTo(document.images[0].width,document.images[0].height+ 20)">');
          // resize the window to match the picture

  ngovinh.document.writeln("<div align=\"center\"\>");
  ngovinh.document.writeln("	<table border=\"0\" cellpadding=\"0\" style=\"border-collapse: collapse\" width=\"100%\" bordercolor=\"#000000\" id=\"table1\"\>");
  ngovinh.document.writeln("		<tr\>");
  ngovinh.document.writeln("			<td\>");
  ngovinh.document.writeln("			<table border=\"0\" cellpadding=\"0\" style=\"border-collapse: collapse\" width=\"100%\" bordercolor=\"#000000\" id=\"table3\"\>");
  ngovinh.document.writeln("				<tr\>");
  ngovinh.document.writeln("					<td background=\"images/gallery_02.gif\" height=\"50\" \>");
  ngovinh.document.writeln("<img border=\"0\" src=\"images/gallery_01.gif\"  height=\"50\"\>");
  ngovinh.document.writeln("					</td\><td background=\"images/gallery_02.gif\"\>&nbsp;</td\>");
  ngovinh.document.writeln("				</tr\>");
  ngovinh.document.writeln("			</table\>");
  ngovinh.document.writeln("			</td\>");
  ngovinh.document.writeln("		</tr\>");
  ngovinh.document.writeln("		<tr\>");
  ngovinh.document.writeln("			<td bgcolor=\"#005DAB\"\>");
  ngovinh.document.writeln("			<table border=\"1\" cellspacing=\"0\" style=\"border-collapse: collapse\" width=\"100%\" bordercolor=\"#80AACE\" id=\"table2\" cellpadding=\"3\"\>");
  ngovinh.document.writeln("				<tr\>");
  ngovinh.document.writeln("					<td\>");
  ngovinh.document.writeln("					<p align=\"center\"\>");

    ngovinh.document.writeln('<center><a href="/" onClick=window.close()><img src="'+ImageName+' " border="0" alt="Close window">');

  ngovinh.document.writeln("				</td\></tr\>");
  ngovinh.document.writeln("			</table\>");
  ngovinh.document.writeln("			</td\>");
  ngovinh.document.writeln("		</tr\>");
  ngovinh.document.writeln("		<tr\>");
  ngovinh.document.writeln("			<td\>");
  ngovinh.document.writeln("			<table border=\"0\" cellpadding=\"0\" style=\"border-collapse: collapse\" width=\"100%\" bordercolor=\"#000000\" id=\"table4\"\>");
  ngovinh.document.writeln("				<tr\>");
  ngovinh.document.writeln("					<td width=\"100%\" background=\"images/gallery_03.gif\"\>");
  //ngovinh.document.writeln("					<img border=\"0\" src=\"images/gallery_03.gif\" width=\"525\" height=\"46\"\>");
  ngovinh.document.writeln("					</td\><td background=\"images/gallery_04.gif\" height=\"46\" \>&nbsp;</td\>");
  ngovinh.document.writeln("				</tr\>");
  ngovinh.document.writeln("			</table\>");
  ngovinh.document.writeln("			</td\>");
  ngovinh.document.writeln("		</tr\>");
  ngovinh.document.writeln("	</table\>");
  ngovinh.document.writeln("</div\>");

  ngovinh.document.writeln("</body></html>");

// load the image in the window
  ngovinh.document.writeln('</body>');
  ngovinh.document.writeln('</html>');
  ngovinh.document.close();
  ngovinh.focus();  // place the window in front
  ngovinh.moveTo((screen.width- document.images[0].width)/3,(screen.height- document.images[0].height)/3);
}

//  End -->

