//<!-- 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.
//<!--
function draw_image_1(){
	if (product_image[0].image!="" && product_image[0].image_show==1){
		document.write("<IMG ALT=\"" + product_name + "\" ALIGN=\"" + product_image[0].align + "\" BORDER=0 SRC=\"assets/product_images/" + product_image[0].image + "\" usemap=\"#" + pf_id + "\" ");
		if (product_image[0].width!="") {
			document.write("WIDTH =" +product_image[0].width);
		}
		document.write(" BORDER=0  VSPACE=0  HSPACE=0>");
	}
}

function draw_image_2(){
	 if (product_image[1].scr=="PRODUCT" && product_image[1].image!="" ) { 
		if (product_image[1].image_show=="TARGET REG" || product_image[1].image_show=="TARGET" ){
			if (product_image[1].image_show=="TARGET REG"){
				if (user_guid==""){
					document.write("<A HREF=\"shopper_lookup.asp?target=" + product_image[1].target + "&\" onClick=return(visitargs('shopper_lookup.asp',\"target=" + product_image[1].target + "&\")); target=\"_top\" >");
				}else {
					document.write("<A HREF=\"" + product_image[1].target + "\" onClick=return(visitargs('" + product_image[1].target + "')); target=\"_top\" >");
				}
			}else {
				document.write("<a HREF=\"" + product_image[1].target + "\" target=\"_top\">");
			}
			document.write("<img ALIGN =" + product_image[1].align + " "); 
			if (product_image[1].width!=""){document.write("WIDTH =" + product_image[1].width + " ");}
			document.write(" BORDER=0  VSPACE=5  HSPACE=5 ALT=\"" + product_image[1].alt_text + "\" ");         
			document.write(" SRC=\"assets/product_images/" + product_image[1].image +"\"></a>");
		}else{
			document.write("<img ALIGN =\"" + product_image[1].align + "\" "); 
			if (product_image[1].width!=""){document.write("WIDTH =" + product_image[1].width + " ");}
			document.write(" BORDER=0  VSPACE=5  HSPACE=5 ALT=\"" + product_image[1].alt_text + "\" ");         
			document.write(" SRC=\"assets/product_images/" + product_image[1].image +"\">");
		}  		
	}
}

function shareproduct(PageURL,args,SURL) 
{ 

var plink;
var emailbody;
var url;
if (args.indexOf("=")<0 ||args.indexOf("&")<0 ){
args="";
}
	if (user_guid !=' ') 
	{
		PageURL =PageURL + '?mscssid='+ user_guid+ '&dept_id='+dept_id+ '&pf_id='+pf_id+ '&'+ args ;
	}else{
		PageURL =PageURL + '?dept_id='+dept_id+ '&pf_id='+pf_id+ '&'+ args ;
	}
	
	plink=i_jscript_uu_rootURL+"product.asp?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



function draw_options(){
	i=0;
	while (attr_label[i]!= "") { 
		if (attr_label[i]!= "U_Prod_Xlink"){
			if (attr_values[i].length > 0){
				document.write("<TR VALIGN=TOP ><TD class=ProductAttrlabel >" + attr_label[i] + ":</TD><TD>");
			}
			if (attr_values[i].length==0){
				document.write("<INPUT TYPE=HIDDEN  NAME=\"attr_value" + (i+1) + "\" VALUE=\"\" >");
			}else if (attr_values[i].length==1){
				while (attr_values[i][0].indexOf("'")>0){
					attr_values[i][0]=attr_values[i][0].replace("'","&#39;");
				}
				document.write("<INPUT TYPE=HIDDEN  NAME=\"attr_value" + (i+1) + "\" VALUE='" + attr_values[i][0] + "' >");
				document.write(attr_values[i][0]);
				document.write("</TD>");
			}else if(attr_values[i].length >1) {
				document.write("<SELECT class=ProductAttr NAME=\"attr_value" + (i+1) + "\" onchange=return(argschange(\"" + (i+1) + "\")); >");
				for (atn=0;atn< attr_values[i].length ;atn++){
					writeoption(attr_values[i][atn],attr_values[i][atn],sel_values[i]);
				}
				document.write("</SELECT></TD>");
			}
			if (attr_values[i].length > 0){document.write("</TR>");}		
		}
		if (attr_label[i]== "U_Prod_Xlink" ){
			document.write("<TD><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 VALIGN=TOP ALIGN=CENTER >");	
			i_rows=0;
			for (atn=0;atn< U_Prod_Xlink.length ;atn++){
				if (i_rows ==0){document.write("<TR><TD></TD>");} 
				i_rows++ ;		
				document.write("<TD VALIGN=TOP CELLPADDING=1 WIDTH =60 ALIGN=CENTER >");
				document.write("<A HREF=\"#\" onClick=return(visitargs('product.asp','dept_id=" + U_Prod_Xlink[atn].dept_id + "&pf_id=" + U_Prod_Xlink[atn].pf_id + "&'));>");
				document.write("<img ALIGN =CENTER WIDTH =60 BORDER=0  VSPACE=0  HSPACE=0  ALT=\""+ U_Prod_Xlink[atn].name +"\"");  
				document.write("SRC=\"assets/product_images/"+ U_Prod_Xlink[atn].image + " \"> </A>");
				document.write("<SMALL>"+ U_Prod_Xlink[atn].name +"</SMALL> </TD>");
				if (i_rows == 4) {
					document.write("</TR>"); 
					i_rows=0;
				} 
			}
		}	
		i++;	
	}
} // end function draw_options

var extraWindow;
function createPopWindow()
{
  var tempWindow = window.open('','prints','height=325,width=325,top=0,left=0,scrollbars=no,resizable');
  tempWindow.document.write("<html><head><title>Product Image</title></head><body><table><tr><td id=\"pop_content\"></td></tr></table></body></html>");
  return tempWindow;
}
function simple_pop_args(product_name,image_name) 
{				
    if (extraWindow==null){
    extraWindow = createPopWindow();
    }
    var mycontentArea = extraWindow.document.getElementById('pop_content');
    mycontentArea.innerHTML = "<td><div style=\"position:absolute; top:0; left:0; width:350px; background-color: #ffffff;\"><FONT color=red><B> "+ product_name + " </B></FONT><BR><BR><img src=\"assets/product_images/" + image_name + "\"  border=\"0\"></div></td>";
		extraWindow.window.focus();
		extraWindow = null;
		//Note: This return is required as well
		// false tells the browser to ignore the default action entirely
	return;	
	}

function killWindow()
{
  extraWindow = null;
}

function draw_alu_swatch(){
		
		if (U_Prod_Xlink.length >= 1 ){
			document.write("<TD></TD><TD><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 VALIGN=TOP ALIGN=CENTER >");
	
			i_rows=0;
				for (atn=0;atn< U_Prod_Xlink.length ;atn++){
					if (i_rows ==0){
					document.write("<TR><TD></TD>");
					} 
				i_rows++ ;		
				document.write("<TD VALIGN=TOP CELLPADDING=1 ALIGN=CENTER >");
				document.write("<A HREF=\"javascript:simple_pop_args('" + U_Prod_Xlink[atn].name + "','" + U_Prod_Xlink[atn].image2 + "');\" >");
				document.write("<img ALIGN =CENTER BORDER=0  VSPACE=0  HSPACE=0  ALT=\""+ U_Prod_Xlink[atn].short_description +"\"");  
				document.write("SRC=\"assets/product_images/"+ U_Prod_Xlink[atn].image + " \"> </A>");
				document.write("</TD>");
					if (i_rows == 4) {
					document.write("</TR>"); 
					i_rows=0;
					} 
				}
		}
} // end function draw_alu_swatch

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 (product_var[atn].avail_msg != ""){product_var[atn].avail_msg=" - " + product_var[atn].avail_msg;}
					
                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{
					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 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 + "\">";
			
					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

function argschange(attr){
	// false tells the browser to ignore the default action entirely
	return(false);	
}
function popargs(dept_id,pf_id){
	// false tells the browser to ignore the default action entirely
	return(false);	
}
//--------------------------------
// Value Pairs
//--------------------------------

function addsku(sku){
	document.form1.sku[1].value= sku ;
	return(true);
}

function checkforrelated(pf_id){
var foundindex=-1;
	if (Related_prod.length>0){
		for (atni=0;atni< Related_prod.length ;atni++){
				if (Related_prod[atni].pf_id==pf_id){
					foundindex=atni;
					break;
				}
		}
		
	}
	return foundindex;
}

function display_rel_product(index,display){
var prodlink;
	prodlink="<A HREF=\"" + Related_prod[index].link + "\">";
	if (display==1){
		document.write("<TR class=relProduct><TD class=relProduct WIDTH=\"100%\" VALIGN=TOP ALIGN=CENTER>");
	}else{
		document.write("<TD class=relProduct VALIGN=CENTER ALIGN=CENTER>");
	}
	//product image & link
		if ((Related_prod[index].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[index].name + "\" SRC=\"assets/product_images/" + Related_prod[index].image + "\"><\/A>");
			}else{
				document.write("<img ALIGN=CENTER  BORDER=0  VSPACE=0  HSPACE=0  ALT=\"" + Related_prod[index].name + "\" SRC=\"assets/product_images/"+ Related_prod[index].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[index].name + "<\/A>");	
			//product price (if enabled)
			if ((page_option_5==1)&&(Related_prod[index].list_price!="")){
				if (Related_prod[index].on_sale!="False" && Related_prod[index].sale_price!=""){
					document.write("<font class=ListPricewSaleR><BR>Currently priced seperatly at " + Related_prod[index].list_price + " <\/font>");
					document.write("<font class=SalePriceR><BR>Currently priced seperatly on Sale at "  + Related_prod[index].sale_price + " <\/B><\/font>");
				}else{
					document.write("<font class=ListPricewoSaleR><BR>Currently priced seperatly at " + Related_prod[index].list_price + " <\/font>");
				}
			}
			document.write("<\/TD>");
			if (display==1){document.write("<\/TR>");}
}


function display_valuepair(message,display)
{
  var relprodindex="";
  if(packages_array.length>0)
  {
		document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"SubHeadbgcolor\"><tr><td><table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">");
	  document.write("<TR><TD class=\"relProductlabel\"");
	  if (display==0){document.write(" colspan=3");}
  	document.write(">" + message + "</TD></TR><TR valign=bottom>");	
  	for (atnp=0;atnp< packages_array.length ;atnp++)
  	{		
  		for (atn=0;atn< packages_array[atnp].children.length ;atn++)
  		{
  			document.write("<TD class=\"tablebgcolor\" align=\"center\">");	
  			document.write("<TABLE border=0 cellpadding=2 cellspacing=2 ALIGN=CENTER><TR valign=bottom>");
				relprodindex=checkforrelated(packages_array[atnp].children[atn].pf_id);
				if(relprodindex!=-1)
				{
					display_rel_product(relprodindex,display);
				}
				document.write("<TD class=relProduct VALIGN=CENTER ALIGN=CENTER>");
				
				document.write("<img src=\"assets/product_images/" + packages_array[atnp].children[atn].pf_id + "t.jpg\">");
				document.write("</TR><tr valign=bottom><td class=relProduct ALIGN=CENTER>");
				document.write(packages_array[atnp].children[atn].group +" for <BR> ");
				if (product_var.length == 0)
				{
					if (on_sale=="True")
					{
						document.write("$"+OKStrOfPenny(product_var[0].price_sale));
						document.write(" \+ $"+OKStrOfPenny(packages_array[atnp].children[atn].price)+"= $ " + OKStrOfPenny(Number(packages_array[atnp].children[atn].price) + Number(product_var[0].price_sale)));
					}else{
						document.write("$"+OKStrOfPenny(product_var[0].price_list));
						document.write(" \+ $"+OKStrOfPenny(packages_array[atnp].children[atn].price)+"= $ " + OKStrOfPenny(Number(packages_array[atnp].children[atn].price) + Number(product_var[0].price_list)));
					}
				}else{
					document.write("$"+OKStrOfPenny(packages_array[atnp].children[atn].price) + " more");
					
				}	
				document.write("<br><br>");
				document.write("<input type=hidden name=sku value=''>");
				document.write("<INPUT TYPE=Image  NAME=\"pbasket\" onclick=\"return(addsku('"+packages_array[atnp].children[atn].def_sku+"'));\" SRC=\"assets/images/" + button + "bskt1.gif\" ");
				document.write("BORDER=0 ALT=\"Add both to your shopping cart\" ALIGN=CENTER > ");		
				document.write("</TD></TR>");
				document.write("</TABLE></TD>");	
			  if (display==1){
			    document.write("</TR>");
			  }else if((atnp+1)%3==0&&(atnp+1)!=packages_array[atnp].children.length)
			  {
				  document.write("</TR>");
			  }
		  }
	  }
	  document.write("</TABLE></td></tr><tr><td height=\"10\" class=\"tablebgcolor\"></td></tr></table>");
  }	
}


//--------------------------------
// Structures
//--------------------------------
function PImage()
{
	this.image
	this.image_show
	this.align
	this.width
	this.alt_text
	this.scr
	this.target
}

function XLINK()
{
	this.pf_id
	this.dept_id
	this.name
	this.short_description
	this.image
	this.image2
}

function Sku()
{
	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
	this.vorder_code
	this.vvendor_code
}

function Attrbute()
{
	this.attname
	this.attvalue
}


function searchable_attr_struct(){
	this.sku
	this.name
	this.value
}

function PackageChild(){
    this.pf_id
    this.group
    this.allowed_qty
    this.price
    this.def_sku
    this.rule
}
function PackageGroup(){
    this.group
	this.children
}

//-->	