
/** FEATURE BEGIN: Leaftree navigation, editor:cls, date:27.NOV.2007  ***/
function draw_leaf_tree(){
	var base_dept="3001";
	var passed_base=false;
	
	// If the leaf_tree array exists and it has elements...
	if ((typeof(leaf_tree)!="nothing")&&(leaf_tree.length>0)){
	
		// Loop through the array backwards
		for (i=leaf_tree.length-1;i>=0;i--){
		
			// If we're past the base department...
			if (passed_base){

				//seperator - getting here only after 2 levels deep to created bullet
				document.write("&nbsp;»&nbsp;");
				//link and name
				document.write("<a href=\"" + leaf_tree[i].dept_link + "\" CLASS=\"leaftree\">" + leaf_tree[i].dept_name.toLowerCase() + "<\/a>");
				
			}else{
			
				// If we're on the base department...
				if (leaf_tree[i].dept_id==base_dept){
				
					passed_base=true;
					//HOME link and HOME name
					document.write("<a href=\"default.asp\" class=\"leaftree\" onClick=\"return(visitargs('default.asp','','URL'));\">home<\/a>");
					
				} //end if
			} //end if
		} // end for
	}// end if
} // end function

function draw_sku_option()
{
	if (product_var.length >= 1 ){
		if(product_var.length==1){
			document.write("<TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>");
			document.write("<TR VALIGN=TOP ><TD class=ProductAttrlabel>" + attr_label[0] + "</TD><TD>");
			document.write("&nbsp;" + product_var[0].attr_value1 + "</TD></TR>");
			document.write("<TR VALIGN=TOP ><TD class=ProductAttrlabel>" + attr_label[1] + "</TD><TD>");
			document.write("&nbsp;" + product_var[0].attr_value2 + "</TD></TR>");
			document.write("<TR><TD colspan=2>" + product_var[0].avail_msg + "</TD>");
			document.write("<INPUT TYPE=HIDDEN id=\"sku\" NAME=sku VALUE=\"" + product_var[0].sku + "\" >");
			document.write("</TR></TABLE></TD>");
		}else{	
			//see if select should be written
			var showSelect = false;
			var inc=0;
			//if at least available sku
			while(showSelect==false && inc<product_var.length)
			{
				if(product_var[inc].avail!=0) showSelect=true;
				inc++;
			}
			
			if(showSelect) //if at least one sku to show in select
			{
				document.write("<TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>");
				document.write("<TR VALIGN=TOP ><TD class=ProductAttrlabel ><b>Select From:</b><br></TD></TR><TR><TD>");
			
				//display select
				document.write("<SELECT class=ProductAttr NAME=sku  >");			
				i=0;
				labelstr="";
				
				//display options
				while (attr_label[i]!= "" && i < attr_values.length ) {
					labelstr=labelstr + attr_label[i] + " ";
					i++;
				}
				writeoption("",labelstr ,sel_values[0]);
				for (atn=0;atn< product_var.length ;atn++){
					if(product_var[atn].avail!=0)
					{
						if (useVariantPrice=="True"){
							if (on_sale=="True"){
								writeoption(product_var[atn].sku,(product_var[atn].attr_value1 + " - " + product_var[atn].attr_value2 + " - $"+ OKStrOfPenny(product_var[atn].price_sale)) + "" ,sel_values[0]);
							}else{
								writeoption(product_var[atn].sku,(product_var[atn].attr_value1 + " - " + product_var[atn].attr_value2 + " - $"+ OKStrOfPenny(product_var[atn].price_list)) + "" ,sel_values[0]);
							}
						}else{
							/*if (product_var[atn].avail_msg==""){
								product_var[atn].avail_msg="on back order";
							}*/
							writeoption(product_var[atn].sku,(product_var[atn].attr_value1 + " - " + product_var[atn].attr_value2) + "",sel_values[0]);
						}
					}
				}			
				document.write("</SELECT>");	
				document.write("</TD></TR></TABLE></TD>");
			}
			else
			{
				if (product_var[0].avail_msg==""){
					product_var[0].avail_msg="out of stock";
				}
				document.write("<TD>"+product_var[0].avail_msg);
				document.write("<INPUT TYPE=HIDDEN id=\"sku\" NAME=sku VALUE=\"" + product_var[0].sku + "\" >");
				document.write("</td>");
			}
			
		}
	}
} //end draw_sku_option