// Pop up a full screen window, IE only.
var winhandle = null;
function popUp(aURL) {
	if ((winhandle != null) && (! winhandle.closed)){
		winhandle.resizeTo(aWidth, aHeight);
		winhandle.location.replace(aURL);
	} else {
		winhandle=window.open(aURL, "", "directories=no,fullscreen=no,height=900,left=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no,top=0,width=1024");
	}
	winhandle.focus();
}

function popUpSmall(sLink) {
	if ((winhandle != null) && (! winhandle.closed)){
		winhandle.resizeTo(aWidth, aHeight);
//		winhandle.location.replace(aURL);
	} else {
		winhandle=window.open(sLink, "", "directories=no,fullscreen=no,height=900,left=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no,top=0,width=700");
	}
	winhandle.focus();
}

function popUpSmallWindow(sLink) {
	if ((winhandle != null) && (! winhandle.closed)){
		winhandle.resizeTo(aWidth, aHeight);
//		winhandle.location.replace(aURL);
	} else {
		winhandle=window.open(sLink, "", "height=900,width=700, location=yes, menubar=yes,resizable=yes,scrollbars=yes,directories=yes,toolbar=yes");
	}
	winhandle.focus();
}

function writeLine(str){
	document.write(str + "\n");
}

function writeTable(imageNames) {

	writeLine("<table border=\"0\" width=\"100%\">");

	var i = 0;
	var j = 0;
	var numberOfColumns = 5;
	var index = 0;
	var imgPath = "Products/Catalog/";

	for (i=0; i < Math.ceil(imageNames.length / numberOfColumns ); i++) {
		writeLine("<tr height=100>");
		for (j=0; j < numberOfColumns ; j++) {
			index = i*numberOfColumns+j;
			if (index<imageNames.length){
				writeLine("<td align=\"center\">" + 
					"<a target=\"_blank\" href=\"\" onclick=\"popUp('" + imgPath + "viewdetail.htm??"+ index+ "');return false;\">" + 
					"<img border=\"0\" src=\""+ imgPath + "thumbs/" + imageNames[index][0] + ".jpg\"></a><br>");
				/*if (imageNames[index].length > 1){
					writeLine(imageNames[index][1]);
				}*/
				writeLine("</td>");
			} else {
				writeLine("<td align=\"center\"></td>");
			}
		}
		writeLine("</tr>");
	}
	
	writeLine("</table>");
}
