/** Feature BEGIN: Leaftree navigation, editor: cls. date:19.NOV.2007 ***/
function draw_leaf_tree(){
	var base_dept="10";
	var passed_base=false;
	
	// If the leaf_tree array exists and it has elements...
	if ((typeof(leaf_tree)!="nothing")&&(leaf_tree.length>0)){
	var not_first_time=false;
		// Loop through the array backwards
		for (i=leaf_tree.length-1;i>=0;i--){
			if(i!=leaf_tree.length-1)
			{
				if(leaf_tree[i].dept_name!="rti" && leaf_tree[i].dept_name!="rtistart" && leaf_tree[i].dept_name!="Navigation")
				{
					if(i==0)
					{
						//link and name
						document.write("<a href=\"" + leaf_tree[i].dept_link + "\" CLASS=\"leaftree\">" + leaf_tree[i].dept_name + "<\/a>");
					}
					else
					{
						if(not_first_time==false)
						{
							//link and name
							document.write("<a href=\"" + leaf_tree[i].dept_link + "\" CLASS=\"leaftree\"><b>" + leaf_tree[i].dept_name + "<b><\/a>");
							//seperator - getting here only after 2 levels deep to create dash
							document.write("<span class=leaftree_dash>&nbsp;>&nbsp;</span>");
						}
						else
						{
							//link and name
							document.write("<a href=\"" + leaf_tree[i].dept_link + "\" CLASS=\"leaftree\">" + leaf_tree[i].dept_name + "<\/a>");
							//seperator - getting here only after 2 levels deep to create dash
							document.write("<span class=leaftree_dash>&nbsp;>&nbsp;</span>");
							not_first_time=true;
						}
					}
				}
			}
		} // end for
	}// end if
} // end draw leaf 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{	
			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>");
			document.write("<SELECT class=ProductAttr NAME=sku  >");
			i=0;
			labelstr="";
			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 (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)) + " - " + product_var[atn].avail_msg + "" ,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)) + " - " + product_var[atn].avail_msg + "" ,sel_values[0]);
					}
				}else{
					if (product_var[atn].avail_msg==""){
						product_var[atn].avail_msg="";
					}
					writeoption(product_var[atn].sku,(product_var[atn].attr_value1 + " - " + product_var[atn].attr_value2) + " - " + product_var[atn].avail_msg + "",sel_values[0]);
				}
			}
			document.write("</SELECT></TD>");	
			document.write("</TR></TABLE></TD>");
		}
	}
} //end draw_sku_option

function shareproduct(PageURL,args,SURL) 
{ 

var plink;
var emailbody;
var url;
if (args.indexOf("=")<0 ||args.indexOf("&")<0 ){
args="";
}
	if (user_guid !=' ') 
	{
		PageURL =PageURL + '?s_id='+s_id+'&mscssid='+ user_guid+ '&dept_id='+dept_id+ '&pf_id='+pf_id+ '&'+ args ;
	}else{
		PageURL =PageURL + '?s_id='+s_id+'&dept_id='+dept_id+ '&pf_id='+pf_id+ '&'+ args ;
	}
	
	plink=i_jscript_uu_rootURL+"product.asp?s_id="+s_id+"&dept_id=" + dept_id + "&pf_id="+ pf_id +"&" ;
	emailbody="Dear #RecipientName#,<BR> #Text_field_3# <BR><BR>";
	if (product_image[0].image!=""){
	emailbody = emailbody + "<A HREF=\"#URL#\" ><img src=\""+i_jscript_uu_rootURL+"assets/product_images/"+product_image[0].image+"\" border=0 alt=\""+ product_name+"\" ></a>" ;
	}
	emailbody = emailbody + "<A HREF=\"#URL#\" >"+ product_name + "</a><BR>" ;
	emailbody = emailbody + "from #FromName#  at <A href=\"mailto:#FromEmail#\">#FromEmail# <BR>" ;
	window.location=PageURL +"referer="+escape(plink)+"&email_body="+escape(emailbody)+"&target="+ escape(window.location.href)+"&";
	//Note: This return is required as well
	// false tells the browser to ignore the default action entirely
	//usage Click Here II
	 return(false);
} //end shareproduct



