//<!-- Copyright (c) 1999-2005 UniteU Technologies Inc.  All rights reserved.   //-->
// ************************************************************************************
// ****    DO NOT MODIFY THIS FILE!!!  **************************************************
// **************************************************************************************
//This file will be re-generated any time the site is upgrade, any changes will be lost.
//	Also, This folder is NOT included in Transfers.  Please make your own js file.
//<% version = " 4.92 07/27/05 " %>
//<!--
function display_spanner_links(intCurrentPage,intMaxPages,spanner_links){document.write(" Page: "+ intCurrentPage + " of " + intMaxPages + " <BR> Select page <B> &lt; </B>" + spanner_links + "<B> &gt; </B><BR>");}
function display_dept(){if(dept_depts.length>0){display_dept_gen(dept_depts);}}  
function display_label(pf_id,label){document.write("<TD>" + label + "</TD>");}
function display_products(){if (Dept_products.length>0){display_products_gen(Dept_products);}}

function display_product_link(purl,pname,short_desc,price_str,s_id,dept_id,pf_id,basket_enable){
	document.write("<a HREF=\"" + purl + "\" class=\"deptlinkP\" target=\"_top\">" + pname + "</a>&nbsp;" + short_desc );
	document.write(price_str);
}

function OKStrOfPenny(X) { 
	var T, S=new String(Math.round(X))
	while (S.length<3) S='0'+S
	return S.substr(0, T=(S.length-2)) + '.' + S.substr(T, 2);
}

function Display_sku(pf_name,pf_id,dept_id,sku,price_level,price_level2,price_level3,AvailabilitySTR,attr_value1,attr_value2,attr_value3,attr_value4,attr_value5,enable_basket,available){
 	document.write(attr_value1 +" "+ attr_value2 +"SKU:"+ sku );
	document.write(AvailabilitySTR);

	document.write("</TD><TD>$"+ OKStrOfPenny(price_level) +"</TD><TD>");
	
	onc ="return(visitargs('shopper_lookup.asp','target=xt_orderform_additem.asp&addto=1&auto_reg=1&pf_id="+ pf_id +"&dept_id="+ dept_id +"&attr_value1="+attr_value1+"&attr_value2="+attr_value2+"&attr_value3="+attr_value3+"&attr_value4="+attr_value4+"&attr_value5="+attr_value5+"'));"
	document.write("<A href=\"#\" onclick=\""+ onc +"\" ><b>Order Now</b></font></A>");
	document.write("</TD><TD>");
	onc="return(visitargs('product.asp','pf_id="+ pf_id +"&dept_id="+ dept_id +"&attr_value1="+attr_value1+"&attr_value2="+attr_value2+"&attr_value3="+attr_value3+"&attr_value4="+attr_value4+"&attr_value5="+attr_value5+"'));"
	document.write("<A href=\"#\" onclick=\""+ onc +"\" ><b>More Info</b></font></A>");
	document.write("</TD><TD>"); 
}

function display_dept_2nd(display_dept_gen){  
	if (display_dept_gen.length >= 1){
		var n_dept=0;
		var atn; 
		
		document.write(s_top_HTML);
		document.write(style_UL_open);	
		for (atn=0;atn< display_dept_gen.length ;atn++){
			if (n_dept==0 || d_display_type!=4){document.write(style_LI_1_open + style_font_2_open);}
			n_dept=n_dept+1 ;
			if (s_image_align=="CENTER"){             
				document.write("<TABLE width=100% BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" ALIGN=CENTER > <TR><TD ALIGN=CENTER >"+ style_font_2_open);
			}
			if (display_dept_gen[atn].dept_image_1_file!="" && s_image_src == "PRODUCT"){
				document.write("<A HREF=\"#\" onClick=return(visitargs('dept.asp','dept_id=" + display_dept_gen[atn].dept_id +"&','URL')); class=\"deptlinkM\" target=_top >");
				document.write("<IMG ALIGN="+ s_image_align +" ");
				if(s_image_width==""){
					if (display_dept_gen[atn].dept_image_1_width!=""){
						document.write(" WIDTH="+ display_dept_gen[atn].dept_image_1_width +" ");				
					}
				}else{
					document.write(" WIDTH ="+ s_image_width + " ");
				}
				document.write(" BORDER=0  VSPACE=5  HSPACE=5  ALT=\""+ display_dept_gen[atn].dept_name +"\" ");  	
				document.write(" SRC=\"assets/product_images/"+ display_dept_gen[atn].dept_image_1_file +"\"></A>");  	
				if (s_image_align=="CENTER"){ 
					document.write(" </TD></TR> <TR><TD ALIGN=CENTER >"+ style_font_2_open);
				}		
			}
			if (display_dept_gen[atn].dept_disable_name=="" || display_dept_gen[atn].dept_disable_name < 2){
				if (display_dept_gen[atn].dept_display_type==1 || display_dept_gen[atn].dept_display_type==4){
					document.write("<A HREF=\"#\" onClick=return(visitargs('dept.asp','dept_id="+ display_dept_gen[atn].dept_id +"&','URL')); class=\"deptlinksub\" target=_top >"+ display_dept_gen[atn].dept_name +"</A>");
				}else if (display_dept_gen[atn].dept_display_type==2){
					document.write("<A HREF=\"#\" onClick=return(visitargs('frameset.asp','target="+ display_dept_gen[atn].dept_hyperlink +"&','URL')); class=\"deptlinksub\" target=_top >"+ display_dept_gen[atn].dept_name +"</A>");	
				}else{
					document.write("<A HREF=\"#\" onClick=return(visitargs('"+ display_dept_gen[atn].dept_hyperlink +"','','URL')); class=\"deptlinkP\" target=_top >"+ display_dept_gen[atn].dept_name +"</A>");							
				}
			}
			document.write(display_dept_gen[atn].dept_short_description);
		
			if (display_dept_gen[atn].attached_depts!=null && display_dept_gen[atn].attached_depts.length>0){
				document.write("2ndlevelDEPT");
				//display_dept_gen(display_dept_gen[atn].attached_depts);
			}
			if (s_image_align=="CENTER"){document.write(" </TABLE>");}
			if (d_display_type==4){
				if (n_dept==dept_cols){
					n_dept=0;
					document.write(style_LI_1_close);
				}else{
					document.write(style_font_2_close +"</TD><TD>" + style_font_2_open);
				}
			}else{
				document.write(style_LI_1_close);
			}
				
		} //end loop
		document.write(style_UL_close);
	}
}//end display_dept_2nd

function display_dept_gen(display_dept_gen){  
	if (display_dept_gen.length >= 1){
		var n_dept=0;
		var atn; 
		document.write(s_top_HTML);
		document.write(style_UL_open);	
		   
		for (atn=0;atn< display_dept_gen.length ;atn++){
			if (n_dept==0 || d_display_type!=4){document.write(style_LI_1_open + style_font_2_open);}
			n_dept=n_dept+1 ;
			if (s_image_align=="CENTER"){             
				document.write("<TABLE width=100% BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" ALIGN=CENTER > <TR><TD ALIGN=CENTER >"+ style_font_2_open);
			}
			if (display_dept_gen[atn].dept_image_1_file!="" && (s_image_src == "PRODUCT" || s_image_src == "IMAGE" )){
				document.write("<A HREF=\"#\" onClick=return(visitargs('dept.asp','dept_id=" + display_dept_gen[atn].dept_id +"&','URL')); class=\"deptlinkM\" target=_top >");
				document.write("<IMG ALIGN="+ s_image_align +" ");
				if(s_image_width==""){
					if (display_dept_gen[atn].dept_image_1_width!=""){
						document.write(" WIDTH="+ display_dept_gen[atn].dept_image_1_width +" ");				
					}
				}else{
					document.write(" WIDTH ="+ s_image_width + " ");
				}
				document.write(" BORDER=0  VSPACE=5  HSPACE=5  ALT=\""+ display_dept_gen[atn].dept_name +"\" ");  	
				if (s_image_src=="PRODUCT"){
					document.write(" SRC=\"assets/product_images/"+ display_dept_gen[atn].dept_image_1_file +"\"></A>");  	
				}else{
					document.write(" SRC=\"assets/images/"+ display_dept_gen[atn].dept_image_1_file +"\"></A>");  				    
				}
				if (s_image_align=="CENTER"){ 
					document.write(" </TD></TR> <TR><TD ALIGN=CENTER >"+ style_font_2_open);
				}		
			}
			if(display_dept_gen[atn].dept_disable_name=="" || display_dept_gen[atn].dept_disable_name < 2){
				if (display_dept_gen[atn].dept_display_type==1 || display_dept_gen[atn].dept_display_type==4){
					document.write("<A HREF=\"#\" onClick=return(visitargs('dept.asp','dept_id="+ display_dept_gen[atn].dept_id +"&','URL')); class=\"deptlinkM\" target=_top >"+ display_dept_gen[atn].dept_name +"</A>");
				}else if (display_dept_gen[atn].dept_display_type==2){
					document.write("<A HREF=\"#\" onClick=return(visitargs('frameset.asp','target="+ display_dept_gen[atn].dept_hyperlink +"&','URL')); class=\"deptlinksub\" target=_top >"+ display_dept_gen[atn].dept_name +"</A>");	
				}else{
					document.write("<A HREF=\"#\" onClick=return(visitargs('"+ display_dept_gen[atn].dept_hyperlink +"','','URL')); class=\"deptlinkP\" target=_top >"+ display_dept_gen[atn].dept_name +"</A>");							
				}
			}
			document.write(display_dept_gen[atn].dept_short_description);
			
			if (display_dept_gen[atn].attached_products!=null && display_dept_gen[atn].attached_products.length>0){
				display_products_gen(display_dept_gen[atn].attached_products,1);
			}
			if (display_dept_gen[atn].attached_depts!=null && display_dept_gen[atn].attached_depts.length>0){
				display_dept_2nd(display_dept_gen[atn].attached_depts);
			}
			if  (s_image_align=="CENTER"){document.write(" </TABLE>");}
			if(d_display_type==4){
				if (n_dept==dept_cols){
					n_dept=0;
					document.write(style_LI_1_close);
				}else{
					document.write(style_font_2_close +"</TD><TD>" + style_font_2_open);
				}
			}else{
				document.write(style_LI_1_close);
			}	
		} //end loop
		document.write(style_UL_close);
	}
} //end display_dept_gen 

function display_products_gen(Dept_products_gen,p_display_type){ 
	if (p_display_type==null){p_display_type=display_type;}
	if (Dept_products_gen.length >= 1){
		var n_product=0;
		var atn;      
		document.write(p_top_HTML);
		document.write(style_UL_open);	
		for (atn=0;atn< Dept_products_gen.length ;atn++){
			if (n_product==0 || p_display_type != 4){document.write(style_LI_2_open + style_font_2_open);}
			if (page_option_5==1){
				if  (p_image_align=="CENTER"){          
					document.write("<TABLE width=100% BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" ALIGN=CENTER > <TR><TD ALIGN=CENTER >" + style_font_2_open);                    
				}
				if (Dept_products_gen[atn].image!=""){
					document.write("<A HREF=\"#\" onClick=return(visitargs('product.asp','dept_id="+ Dept_products_gen[atn].dept_id +"&pf_id="+Dept_products_gen[atn].pf_id +"&"+ ptargetc +"','URL'));  target=_top >");
					document.write("<IMG ALIGN="+ p_image_align +" ");
					if(p_image_width==""){
						if (Dept_products_gen[atn].image_width!=""){
							document.write(" WIDTH="+Dept_products_gen[atn].image_width +" ");				
						}
					}else{
						document.write(" WIDTH ="+ p_image_width + " ");
					}
					document.write(" BORDER=0  VSPACE=5  HSPACE=5  ALT=\""+ Dept_products_gen[atn].name +" \" ");  	
					document.write(" SRC=\"assets/product_images/"+ Dept_products_gen[atn].image +"\"></A>");  	
					if  (p_image_align=="CENTER"){ 
						document.write(" </TD></TR> <TR><TD ALIGN=CENTER >"+ style_font_2_open);
					}
				}
				display_product_link("product.asp?s_id="+ s_id +"&dept_id="+ Dept_products_gen[atn].dept_id +"&pf_id="+ Dept_products_gen[atn].pf_id +"&"+ ptargetc,Dept_products_gen[atn].name,Dept_products_gen[atn].short_desc,Dept_products_gen[atn].price_str,s_id,Dept_products_gen[atn].dept_id,Dept_products_gen[atn].pf_id,Dept_products_gen[atn].enable_basket);
			     
				if (page_option_4== 1 && Dept_products_gen[atn].enable_basket==1 ){
					document.write("<A HREF=\"#\" onClick=return(visitargs('product.asp','dept_id="+ Dept_products_gen[atn].dept_id +"&pf_id="+Dept_products_gen[atn].pf_id +"&"+ ptargetc +"','URL'));  target=_top >");
					if (p_buy_target== "PRODUCT BUY"){
						document.write(" <img SRC=\"assets/images/"+ p_buy_image +"\" ");	
						if (p_buy_image_width!=""){
							document.write(" WIDTH = \""+ p_buy_image_width +"\" ");
						}
						document.write("BORDER=\"0\" ALT=\""+ p_buy_image_alt +"\" ALIGN =\""+ p_buy_image_align +"\">");
					}
					document.write(p_buy_HTML +" </a>");    
				}
                draw_ave_rating(Dept_products_gen[atn]); //Average Rating BTalma Oct 08
				document.write("<TABLE BORDER=0 BORDERCOLOR=white ><TR> ");
				if(Dept_products_gen[atn].attr_label1!=""){	
					display_label(Dept_products_gen[atn].pf_id,Dept_products_gen[atn].attr_label1);
					display_label(Dept_products_gen[atn].pf_id,Dept_products_gen[atn].attr_label2);
					display_label(Dept_products_gen[atn].pf_id,Dept_products_gen[atn].attr_label3);
					display_label(Dept_products_gen[atn].pf_id,Dept_products_gen[atn].attr_label4);
					display_label(Dept_products_gen[atn].pf_id,Dept_products_gen[atn].attr_label5);			        			        			        
				}
				document.write("</TR><TR><TD> ");
				var skun;
				for (skun=0;skun< Dept_products_gen[atn].skus.length ;skun++){
					document.write("<TR><TD>"); 
					if(Dept_products_gen[atn].onsale){
						Display_sku(Dept_products_gen[atn].name,Dept_products_gen[atn].pf_id,Dept_products_gen[atn].dept_id,Dept_products_gen[atn].skus[skun].sku,Dept_products_gen[atn].skus[skun].price_list,Dept_products_gen[atn].skus[skun].price_sale,Dept_products_gen[atn].skus[skun].price_MSRP,Dept_products_gen[atn].skus[skun].avail_msg,Dept_products_gen[atn].skus[skun].attr_value1,Dept_products_gen[atn].skus[skun].attr_value2,Dept_products_gen[atn].skus[skun].attr_value3,Dept_products_gen[atn].skus[skun].attr_value4,Dept_products_gen[atn].skus[skun].attr_value5,Dept_products_gen[atn].enable_basket,Dept_products_gen[atn].skus[skun].avail);
					}else{
						Display_sku(Dept_products_gen[atn].name,Dept_products_gen[atn].pf_id,Dept_products_gen[atn].dept_id,Dept_products_gen[atn].skus[skun].sku,Dept_products_gen[atn].skus[skun].price_list," ",Dept_products_gen[atn].skus[skun].price_MSRP,Dept_products_gen[atn].skus[skun].avail_msg,Dept_products_gen[atn].skus[skun].attr_value1,Dept_products_gen[atn].skus[skun].attr_value2,Dept_products_gen[atn].skus[skun].attr_value3,Dept_products_gen[atn].skus[skun].attr_value4,Dept_products_gen[atn].skus[skun].attr_value5,Dept_products_gen[atn].enable_basket,Dept_products_gen[atn].skus[skun].avail);
					} 
					document.write("</TD></TR>");     	   	
				}
				document.write("</TABLE>"); 
				if( p_image_align=="CENTER"){document.write(" </TABLE>");}
				n_product=n_product+1;
				if(p_display_type==4){
					if (n_product==dept_cols){
						n_product=0;
						document.write(style_LI_2_close);
					}else{
						document.write(style_font_2_close +" </TD><TD>" +style_font_2_open);
					}
				}else{
					document.write(style_LI_2_close);
				}			
			}
		} //end for loop
		document.write(style_UL_close);	
	}else{
		document.write(style_font_1_open + p_no_product_HTML + style_font_1_close);
	}
} //end display_products_gen

function display_spanner(){
	if(intMaxPages>1){
		var spanner_links="";
		var item;
		for (item=1;item <= intMaxPages ;item++){	
			if (item !=intCurrentPage){
				spanner_links=spanner_links + " <A HREF=\"\" onClick=return(visitargs('dept.asp','dept_id="+ dept_id +"&page="+ item +"','URL'));  target=_top >"+ item +"</A> "
			}else{
				spanner_links=spanner_links +" <B> "+ item +"</B>"
			}
		}
		display_spanner_links(intCurrentPage,intMaxPages,spanner_links);	
	}
} //end display_spanner

function draw_ave_rating(Dept_product){
    tmp_avg = Dept_product.ave_rating;
    if (tmp_avg!=0){
        tmp_img = (Dept_product.ave_rating_img);
        tmp_alt_img = (Dept_product.ave_rating_alt_img);
        document.write ("<br><span class=prod_rating>");

        if (tmp_img!=""){
                for (rcount=1;rcount <= tmp_avg;rcount++){
                    document.write ("<img src=\"" + tmp_img + "\" border=0 />");
                }
                    if (tmp_alt_img!=""){
                        tmp_scale = Dept_product.ave_rating_scale;
                        for (rcount = (tmp_avg+1);rcount <= tmp_scale;rcount++){
                            document.write ("<img src=\"" + tmp_alt_img + "\" border=0 />");
                        }
                    }
                    document.write(" Avg. Rating</span>");
        }else{
            document.write(" Avg. Rating: " + tmp_avg + "</span>");
        }
    }
} //end draw_ave_rating

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// structs
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ProdSku(){
	this.sku
	this.attr_value1
	this.attr_value2
	this.attr_value3
	this.attr_value4
	this.attr_value5
	this.price_list
	this.price_sale
	this.price_MSRP
	this.avail
	this.avail_msg
}

function Products(){
	this.pf_id
	this.dept_id
	this.name
	this.short_desc
	this.pvendor_code
	this.porder_code
	this.image
	this.image_width
	this.enable_basket
	this.onsale
	this.price_str_list
	this.price_str_sale
	this.price_str_msrp
	this.price_str
	this.attr_label1
	this.attr_label2
	this.attr_label3
	this.attr_label4
	this.attr_label5
	this.info_attributes
    this.ave_rating   // Average Rating Info Added Oct 08 by BTalma
    this.ave_rating_scale
    this.ave_rating_img
    this.ave_rating_alt_img
	this.skus
	this.packageT	
}

function departments(){
	this.dept_id
	this.dept_name
	this.dept_short_description
	this.dept_display_type
	this.dept_hyperlink
	this.dept_list_2_levels
	this.dept_list_product_levels
	this.dept_disable_name
	this.dept_image_1_file
	this.dept_image_1_width
	this.attached_depts
	this.attached_products
}

function PackageChild(){
    this.pf_id
    this.group
    this.allowed_qty
    this.price
    this.def_sku
    this.rule
}
function PackageGroup(){
    this.group
	this.children
}

//-->	
