/* jat 1/21/08 - removing borders around table */
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;

	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%\" class=\"SubHeadbgcolor\"><tr><td>");
		document.write("<table cellpadding=\"10\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"relatedtablebgcolor\"><tr><td class=relatedCartLabels>");
		document.write(message);
		document.write("</td></tr><tr><td>");
	}

	if (Related_prod.length>0){
		document.write("<Table border=0 cellpadding=2 cellspacing=2>");
		document.write("<TR valign=\"bottom\">");
		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){
					if (user_guid !=' '){
							prodlink="<A HREF=\"" + Related_prod[itematn].related[atn].link +"s_id=" + i_jscript_uu_sid +  "&mscssid="+ user_guid+ "&\">";
					}
					else{
							prodlink="<A HREF=\"" + Related_prod[itematn].related[atn].link +"s_id=" + i_jscript_uu_sid +  "&\">";
					}
				if (display==1){
					document.write("<TD class=relProduct WIDTH=\"100%\" VALIGN=TOP>");
				}else{
					document.write("<TD class=relProduct VALIGN=TOP>");
				}
				//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><br/>");
				//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!="" && Related_prod[itematn].related[atn].sale_price!="$0.00" && Related_prod[itematn].related[atn].sale_price!=Related_prod[itematn].related[atn].list_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("</TD>");
				if (display==1){document.write("</TR>");}
			}
		}
		if (display!=1){
			if((itematn+1)%3==0&&(itematn+1)!=packages_array[itematn].children.length)
			{
				document.write("</TR>");
			}
		}
		document.write("</Table>");
		}
	}
	if (typematch==1) {
		document.write("</TD></TR></TABLE>");
	}
}//end function draw_related