// java2html.js
//
// Purpose: organize javascripts which is for html output

function menu_html(){
	document.write("<center>");
	document.write("<table width=800 cellspacing=0 cellpadding=0 border=0 bgcolor=white>");
	document.write("<tr>");
	document.write("  <td width=200 valign=top>");
	document.write("    <table width=200 cellspacing=0 cellpadding=0 border=0>");
	document.write("    <tr>");
	document.write("      <td valign=top align=center colspan=4 height=100>");
	document.write("        <div style=\"padding:0;width:200px; height:100px;\"><img src=img/BMGlogo.jpg border=0></div>");
	document.write("      </td>");
	document.write("    </tr>");
	// menu
	for(i=0;i<Menu_c.length;i++){
		document.write("   <tr>");
		document.write("     <td height=40 width=6 bgcolor=#404040 class=borderB>&nbsp</td><td width=14 bgcolor=#A9AAAE class=borderB>&nbsp</td>");
		document.write("     <td valign=center width=140 bgcolor=#A9AAAE class=borderBR>");
		document.write("       <a href=\""+Menu_c[i][1]+"\" class=menu onmouseover=changPT(\"menuPointer"+i+"\",\""+MenuPT_c[0]+"\") onmouseout=changPT(\"menuPointer"+i+"\",\""+MenuPT_c[1]+"\")>"+Menu_c[i][0]+"</a>");
		document.write("     </td>");
		document.write("     <td width=40 valign=center align=center bgcolor=#A9AAAE class=borderB>");
		document.write("        <div style=\"width:40px; height:40px;\"><img name=\"menuPointer"+i+"\" src="+MenuPT_c[1]+" border=0></div>");
		document.write("     </td>");
		document.write("   </tr>");
	}
	document.write("   </table>");
	document.write("  </td>");
	document.write("  <td valign=top width=600>");
	document.write("    <table width=600 cellspacing=0 cellpadding=0 border=0>");
	document.write("    <tr>");
	document.write("      <td valign=top height=60>");
	// top Link Icon
	document.write("        <table width=600 cellspacing=0 cellpadding=0 border=0><tr>");
	
	document.write("      		<td rowspan=2 valign=top width=400 height=100 style=\"padding-top:6;\"><img src=img/slogan.jpg></td>");
	document.write("      		<td colspan=2 valign=top width=200 height=20><img src=img/top_right.jpg></td>");
	document.write("      		</tr><tr>");
	document.write("      		<td valign=top width=100 height=80><a href=\"index.htm\"><img src=img/BMGhome.jpg border=0></a></td>");
	document.write("      		<td valign=top width=100 height=80><a href=\"mailto:info@greenfieldgolf.ca\"><img src=img/BMGcontact.jpg border=0></a></td>");

	
	document.write("        </tr></table>");
	document.write("      </td>");
	document.write("    </tr>");
	document.write("    <tr>");
	document.write("      <td valign=top width=600><div style=\"padding:0;width:600px;\">");
	// main Graphic
	if(isPic_c==1)
		mainPic_html(mainImage_c,"600","368",1);
	else
		mainPic_html(mainFlash_c,"600","368",0);

	document.write("      </div></td>");
	document.write("    </tr>");
	document.write("    </table>");
	document.write("  </td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("  <td colspan=2 width=800>");
	document.write("    <table width=800 cellpadding=0 cellspacing=0 border=0 bgcolor=white>");
	document.write("    <tr>");
	for(i=0;i<iconBottom_c.length;i++){
		document.write("<td align=center>");
		document.write("<a href=\""+iconBottom_c[i][1]+"\"  class=icon><img src="+iconBottom_c[i][0]+" border=0><br>"+iconBottom_c[i][2]+"</a>");
		document.write("</td>");
	}
	document.write("    </tr>");
	document.write("    </table>");
	document.write("  </td>");
	document.write("</tr>");
}

// mainPic_html: main graphic part of html code
// str = filename path [string]
//   w,h = width and height of this graphic or flash [string]
//   b = if true, is graphic, else is flash object
function mainPic_html(str,w,h,b){
	if(b==1){
		document.write("<img  width=\""+w+"\"height=\""+h+"\" border=0 src="+str+">");
	}
	else{ //flash
		if(str=="")
			document.write("<b>Flash object string missing!</b>");
		else{
			document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"");
			document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,42,0\"");
			document.write("id=\"main Graphic\" width=\""+w+"\"height=\""+h+"\"> ");
			document.write("<param name=\"movie\" value=\""+str+"\">");
			document.write("<param name=\"bgcolor\" value=#ffffff>");
			document.write("<param name=\"quality\" value=\"high\">");
			document.write("<param name=\"base\" value=\"swf/\">");
			document.write("<param name=\"allowscriptaccess\" value=\"samedomain\">");
			document.write("<embed type=\"application/x-shockwave-flash\"");
			document.write("pluginspage=\"http://www.macromedia.com/go/getflashplayer\"");
			document.write(" width=\""+w+"\"height=\""+h+"\"");
			document.write(" name=\"main Graphic\" src=\""+str+"\"");
			document.write(" bgcolor=#ffffff quality=\"high\"");
			document.write(" base=\"swf/\"");
			document.write(" swLiveConnect=\"true\" allowScriptAccess=\"samedomain\"></embed></object>");
		}
	}
}

// leftColumn_html: display Text at left column
// Note: News is fixed for all page (for now)
// des = ["",""] array
function leftColumn_html(des){
	document.write("  <td width=200 valign=top><div style=\"background-image: url(img/desbg.jpg); padding:10;width=200px;\">");
	for(i=0;i<des.length;i++){
		document.write("<font class=desTitle>"+des[i][0]+"</font><br>");
		document.write("<font class=desText>"+des[i][1]+"</font>");
	}
	document.write("  </div>");

	// left column News
	document.write("<div style=\"background-image: url(img/newsbg.jpg); padding:10;width=200px;height=300px;\">");
	for(i=0;i<des_news.length;i++){
		document.write("<font class=desText>"+des_news[i]+"</font><br>");
	}
	document.write("</div></td>");
}

// product_html: display products, used on most of product pages
// item = ["","","",""] array
function product_html(item){
document.write("  <td width=600 valign=top align=left>");
// insert items
document.write("	<table width=600 cellspacing=0 cellpadding=0 border=0>");
document.write("	<tr>");
document.write("        <td height=15>&nbsp;</td>");
document.write("	</tr>");
document.write("	<tr>");
var myCount=0;
for(i=0;i<item.length;i++){
	if(item[i][0]!="" || item[i][1]!=""){
		if(item[i][2].charAt(0) != '*'){
			var tmpURL=item[i][3];
			var newWindow="target=\"newWeb\"";
			if(myCount < 6){ // 3 item per row
				myCount++;
			}
			else{
				document.write("</tr>");
				document.write("<tr>");
				myCount=1;
			}

			if(tmpURL==""){
				tmpURL="javascript:alert('Sorry, no website available for this item yet, please check back later. Thank you.')";
				newWindow="";
			}

			document.write("<td width=100 height=170 valign=top align=center><a href=\""+tmpURL+"\" "+newWindow+"><img border=0 width=100 src="+item[i][0]+"></a><br><font class=desText>"+item[i][1]+"</font><br><font class=price>"+item[i][2]+"</font></td>");
		}
	}	
}
document.write("        </tr>");
document.write("	</table>");
document.write("  </td>");
}
