// JavaScript Document
function draw_related(type,display,message){
	var prodlink="";
	var typematch=0;
	//page_option_4: 0=horizontal 1=vertical
	if(typeof type=="undefined"){
	type="0";
	}
	if (typeof display=="undefined"){
	display=page_option_4;
	}
	if (typeof message=="undefined"){
	message="";
	}
	if (nRelated>0){
		for (atn=0;atn< nRelated ;atn++){
			if (Related_prod[atn].crosstype==type){
				typematch=1;
			}
		}
	}
	if (typematch==1) {
	document.write(message);
	}
	
	if (nRelated>0){
		document.write("<Table border=0 cellpadding=2 cellspacing=2>");
		if (display!=1){document.write("<TR>");}
		for (atn=0;atn< nRelated ;atn++){
			if (Related_prod[atn].crosstype==type){
					prodlink="<A HREF=\"" + Related_prod[atn].link + "\" onclick=\"return(visitargs('product.asp','pf_id="+Related_prod[atn].pf_id+"','URL'));\">";
			
					if (display==1){
						document.write("<TR class=relProduct><TD class=relProduct WIDTH=\"100%\" VALIGN=TOP ALIGN=CENTER>");
					}else{
						document.write("<TD class=relProduct VALIGN=TOP ALIGN=CENTER>");
					}
					//product image & link
					if ((Related_prod[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[atn].name + "\" SRC=\"assets/product_images/" + Related_prod[atn].image + "\"><\/A>");
						}else{
							document.write("<img ALIGN=CENTER BORDER=0  VSPACE=0  HSPACE=0  ALT=\"" + Related_prod[atn].name + "\" SRC=\"assets/product_images/"+ Related_prod[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[atn].name + "<\/A>");
			
					//product price (if enabled)
					if ((page_option_5==1)&&(Related_prod[atn].list_price!="")){
						if (Related_prod[atn].on_sale!="False" && Related_prod[atn].sale_price!="" && Related_prod[atn].sale_price!="$0.00" && Related_prod[atn].sale_price!=Related_prod[atn].list_price){
							if(Related_prod[atn].list_price != ""){document.write("<font class=ListPricewSaleR>" + rel_list_pricelab + Related_prod[atn].list_price + " <\/font>");}
							document.write("<font class=SalePriceR>" + rel_sale_pricelab + Related_prod[atn].sale_price + " <\/B><\/font>");
						}else{
							if(Related_prod[atn].list_price != ""){document.write("<font class=ListPricewoSaleR>" + rel_our_pricelab + Related_prod[atn].list_price + " <\/font>");}
						}
					}
					document.write("<\/TD>");
					if (display==1){document.write("<\/TR>");}
				}	
		}
		if (display!=1){document.write("<\/TR>");}
		document.write("<\/Table>");
	}
}//end function draw_related