function printProducts(version) {
	var strHTML;
	var noTotal = products.length;
	var noOfItem = 4;

	strHTML = '<table cellspacing="0" cellpadding="2" border="0" width="550">'
	for(i=0; i<noTotal; i++) {
		strHTML+= '<tr>';
		for(j=0; j<noOfItem; j++) {
			if(i+j<noTotal) {
				strHTML+= '<td width="130" align="center"><a href="#" onClick="MM_pop_up_window_2(' + (i+j) + ', ' + version + ')"><img onmouseout=this.filters.alpha.opacity=80 onmouseover=this.filters.alpha.opacity=100 src="' + products[i+j].pics + '" style="FILTER: alpha(opacity=80)" border="0" alt="'
				if(version==0) {
					strHTML+= products[i+j].descEng
				} else {
					strHTML+= products[i+j].descChi
				}
				strHTML+= '"></a></td>'
			}
		}
		
		strHTML+= '</tr>'
		strHTML+= '<tr>';
		for(j=0; j<noOfItem; j++) {
			if(i+j<noTotal) {
				strHTML+= '<td align="center" valign="top" class="picsDesc" height="60">'
				if(version==0) {
						strHTML+= products[i+j].productCode + '<br>' + products[i+j].descEng + '<br> '
				} else {
					strHTML+= products[i+j].productCode + '<br>' + products[i+j].descChi + '<br> '
				}
				strHTML+= '</td>'
			}
			
		}
		strHTML+= '</tr>'
		i = i+j-1;
	}
	strHTML+= '</table>'
	
	document.writeln(strHTML);
}

function MM_pop_up_window_2(i, version) {
	var pageWidth = 460;
	var pageHeight = 430;
	var strHTML;
	
	var newwin = window.open("","","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,directories=0,copyhistory=0,width=" + pageWidth + ",height=" + pageHeight); 
	newwin.moveTo(0,0);
	newwin.document.open();
	
	strHTML = '<html>'
	strHTML+= '<head>'
	strHTML+= '  <title>Product Description</title>'
	strHTML+= '  <META http-equiv=Pragma content=no-cache>'
	strHTML+= '  <META http-equiv=Content-Type content="text/html; charset=big5">'
	strHTML+= '  <Link href="../css/global.css" rel=stylesheet type=text/css>'
	strHTML+= '</head>'
	strHTML+= '<body class="regYellow" topMargin="3" leftMargin="3" rightMargin="3">'
	strHTML+= '<table cellspacing="0" cellpadding="0" border="0" width="450">'
	strHTML+= '  <tr>'
	strHTML+= '    <td align="center" colspan="2"><img src="' + products[i].picsSrc + '"></td>'
	strHTML+= '  </tr>'
	if(version==1) {
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" width="100">產品編號 :</td>'
		strHTML+= '    <td class="content" width="350">' + products[i].productCode + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc">產品名稱 :</td>'
		strHTML+= '    <td class="content">' + products[i].descChi + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
//		strHTML+= '  <tr>'
//		strHTML+= '    <td class="picsDesc" valign="top">產品簡介 :</td>'
//		strHTML+= '    <td class="content">' + products[i].dtlChi + '</td>'
//		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">產品規格 :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].dimenChi + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">烹調時間 :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].cookChi + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">成份 :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].ingredChi + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">包裝規格 :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].packSizeChi + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">存放限期 :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].shelfChi + '</td>'
		strHTML+= '  </tr>'
	} else {
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" width="100">Product Code :</td>'
		strHTML+= '    <td class="content" width="350">' + products[i].productCode + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc">Product Name :</td>'
		strHTML+= '    <td class="content">' + products[i].descEng + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">Product Details :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].dtlEng + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">Dimension :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].dimenEng + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">Cook Time :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].cookEng + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">Ingredients :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].ingredEng + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">Pack Size :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].packSizeEng + '</td>'
		strHTML+= '  </tr>'
		strHTML+= '  <tr><td colspan="2" height="5"></td></tr>'
		strHTML+= '  <tr>'
		strHTML+= '    <td class="picsDesc" valign="top">Shelf Life :</td>'
		strHTML+= '    <td class="content" valign="top">' + products[i].shelfEng + '</td>'
		strHTML+= '  </tr>'
	}
	strHTML+= '</table>'
	strHTML+= '</body>'
	strHTML+= '</html>'
	
	newwin.document.write(strHTML);
}