function draw_related(type,display,message,rel_image_enable,rel_image_width,rel_list_pricelab,rel_sale_pricelab,rel_our_pricelab){
	var prodlink="";
	var typematch=0;
	var show_price=1;
	var itemsperrow = 2;
	var itemcounter = 0;

	if(typeof type=="undefined"){
	type="0";
	}
	if (typeof display=="undefined"){
	display=1;
	}
	if (typeof message=="undefined"){
	message="";
	}
	if (typeof rel_image_enable=="undefined"){
	rel_image_enable="PRODUCT";
	}
	if (typeof rel_image_width=="undefined"){
	rel_image_width="";
	}
	if (typeof rel_list_pricelab=="undefined"){
	rel_list_pricelab="Price ";
	}
	if (typeof rel_sale_pricelab=="undefined"){
	rel_sale_pricelab="Sale Price";
	}
	if (typeof rel_our_pricelab=="undefined"){
	rel_our_pricelab="Our Price";
	}

	if (Related_prod.length >0){
		for (itematn=0;itematn< Related_prod.length ;itematn++){
			for (atn=0;atn< Related_prod[itematn].related.length ;atn++){
				if (Related_prod[itematn].related[atn].crosstype==type){
					typematch=1;
				}
			}
		}
	}
	if (typematch==1) {
		document.write("<table cellpadding=\"1\" cellspacing=\"0\" border=\"0\" width=\"100%\" ><tr><td>");
		document.write("<table cellpadding=\"10\" cellspacing=\"0\" border=\"0\" width=\"100%\" ><tr><td>");
		//document.write(message);
		document.write("<img src='assets/images/btn_maywesuggest.jpg' border=0>");
		document.write("</td></tr><tr><td>");
	}

	var type_count = 0;

	if (Related_prod.length>0){
		for (itematn=0;itematn< Related_prod.length ;itematn++){
				document.write("<Table border=0 cellpadding=2 cellspacing=2>");
				if (display!=1){document.write("<TR>");}
				for (atn=0;atn< Related_prod[itematn].related.length ;atn++){
					if (Related_prod[itematn].related[atn].crosstype==type){
							prodlink="<A HREF=\"" + Related_prod[itematn].related[atn].link + "dl_id=61\">";
							if (display==1){
								document.write("<TR class=relProduct><TD class=relProduct WIDTH=\"100%\" VALIGN=bottom ALIGN=CENTER>");
							}else if (display==0 && itemcounter==itemsperrow){
								document.write("<TR class=relProduct><TD class=relProduct WIDTH=\"33%\" VALIGN=bottom ALIGN=CENTER>");
							}else{
								document.write("<TD class=relProduct VALIGN=bottom ALIGN=CENTER WIDTH=\"33%\">");
							}
							//product image & link
							if ((Related_prod[itematn].related[atn].image!="")&&(rel_image_enable!="NONE")){
								document.write(prodlink);
								if (rel_image_width !=""){
									document.write("<img ALIGN=CENTER WIDTH =\"" + rel_image_width + "\" BORDER=0  VSPACE=0  HSPACE=0  ALT=\"" + Related_prod[itematn].related[atn].name + "\" SRC=\"assets/product_images/" + Related_prod[itematn].related[atn].image + "\"><\/A>");
								}else{
									document.write("<img ALIGN=CENTER BORDER=0  VSPACE=0  HSPACE=0  ALT=\"" + Related_prod[itematn].related[atn].name + "\" SRC=\"assets/product_images/"+ Related_prod[itematn].related[atn].image +"\"><\/A>");
								}
								if (display==1){
									document.write("</TD></TR><TR class=relProduct><TD class=relProduct WIDTH=100% VALIGN=TOP ALIGN=CENTER>");
								}else{
									document.write("<BR>");
								}
							}

							//product name link
							document.write(prodlink + Related_prod[itematn].related[atn].name + "</A>");

							//product price (if enabled)
							if ((show_price==1)&&(Related_prod[itematn].related[atn].list_price!="")){
								if (Related_prod[itematn].related[atn].on_sale!="False" && Related_prod[itematn].related[atn].sale_price!=""){
									document.write("<font class=ListPricewSaleR>" + rel_list_pricelab + Related_prod[itematn].related[atn].list_price + " <\/font>");
									document.write("<font class=SalePriceR>" + rel_sale_pricelab + Related_prod[itematn].related[atn].sale_price + " </B><\/font>");
								}else{
									document.write("<font class=ListPricewoSaleR>" + rel_our_pricelab + Related_prod[itematn].related[atn].list_price + " <\/font>");
								}
							}
							
							document.write("<BR>");
							if (typeof Related_prod[itematn].related[atn].skus!="undefined" && Related_prod[itematn].related[atn].skus.length>0){
								if (Related_prod[itematn].related[atn].skus.length>1){
									//document.write(prodlink+"More Info</a>");
									document.write(prodlink+"<IMG SRC=\"assets/images/buy.gif\" ");
									document.write("BORDER=0 ALT=\"More Info\" ALIGN=CENTER ></a>");
								}else{
									if (Related_prod[itematn].related[atn].skus[0].avail>0){
										document.write('<FORM METHOD=POST NAME="relatedform'+atn+'" ACTION="shopper_lookup.asp">');
										document.write('<INPUT TYPE=HIDDEN NAME="target" VALUE="xt_orderform_additem.asp">');
										document.write('<INPUT TYPE=HIDDEN NAME="auto_reg" VALUE="1">');
										document.write('<INPUT TYPE="HIDDEN" NAME="s_id" VALUE="0">');
										document.write('<INPUT TYPE="HIDDEN" NAME="wish_id" VALUE="">');
										document.write('<INPUT TYPE="HIDDEN" NAME="order_sid" VALUE="">');
										document.write('<INPUT TYPE="HIDDEN" NAME="so_number" VALUE="">');
										document.write('<INPUT TYPE="HIDDEN" NAME="index" VALUE="">');
										document.write('<INPUT TYPE="HIDDEN" NAME="pf_id" VALUE="'+Related_prod[itematn].related[atn].pf_id+'">');
										document.write('<INPUT TYPE="HIDDEN" NAME="dept_id" VALUE="'+Related_prod[itematn].related[atn].dept_id+'">');
										document.write('<INPUT TYPE="HIDDEN" NAME="sku" VALUE="'+Related_prod[itematn].related[atn].skus[0].sku+'">');
										document.write('<INPUT TYPE=HIDDEN Name=returnpath Value="dept.asp?dept_id=' + dept_id + '&s_id='+ i_jscript_uu_sid +'&addfrom=product" >');
										//document.write('<INPUT TYPE=HIDDEN Name=returnpath Value="dept.asp?dept_id=' + dept_id + '&s_id='+ i_jscript_uu_sid +'&addfrom=product" >');
										document.write("<INPUT TYPE=Image  NAME=\"pbasket\" SRC=\"assets/images/btnaddbskt1.gif\" ");
										document.write("BORDER=0 ALT=\"Add to your shopping cart\" ALIGN=CENTER >");
										document.write("<INPUT TYPE=Image  NAME=\"wbasket\" SRC=\"assets/images/btnaddwish.gif\" ");
										document.write("BORDER=0 ALT=\"Add to your registry\" ALIGN=CENTER ></form>");
									}
								}
							}
							
							document.write("</TD>");
							//horizontal display
							if (display==0)
							{
								if ((type_count+1)%itemsperrow==0)
								{
										document.write("</tr>");
								}
							}
							//if (display==0 && itemcounter==itemsperrow){document.write("</TR>");}

							//vertical display
							if (display==1){document.write("</TR>");}
							//itemcounter=itemcounter+1;

						  type_count++;
						}
				}
				// if we do not have evenly divisible by items per row
				// account for missing cells and close row
				if (type_count%itemsperrow!=0)
				{
				  document.write("<td colspan=" + (itemsperrow - (type_count%itemsperrow)) + ">&nbsp;</td></tr>");
				}
				
				
				//if (display!=1){document.write("</TR>");}
				document.write("</Table>");
		}
	}
	if (typematch==1) {
		document.write("</TD></TR></TABLE></TD></TR></TABLE>");
	}
}//end function draw_related