function Kate_PDP_zpf(a_product_ids,            // Array of recommended product IDs
                     zone,                  // Zone ID specified in the request (as entered on zone edit screen)
                     symbolic,              // Target type:
                                            //      _SP_  Specified Product ID
                                            //      _SC_  Specified Category ID
                                            //      _RVP_ Most Recently Viewed Product
                                            //      _RPP_ Most Recently Purchased Product
                                            //      _NR_  No Recommendations
                                            //      _LCP_ Last Carted Product
                                            //      _MPC_ Visitor's Most Popular Category
                                            //      _SS_  Specified Search Term
                     target_id,             // Target ID recommendations are based on
                     category,              // Category of Target ID - EPR Category ID if the Target ID is a product
                     rec_attributes,        // 2 dimensional array of attributes for each recommendation
                     target_attributes,     // Array of attribute for the target
                     target_header_txt,     // Header text (as entered on recommendation plan edit screen)
                     ab_test_id,            // String containing AB Test Name, a semicolon, AB test ID for the test element requested
                                            //      Null if no AB Test
                                            // 
                                            // The final 2 parameters are not standard parameters passed into zone population function
                                            // They ared added via the function calls at bottom of this file
                     div_id,                //      div id - must match desired div id in DW isml template
                     b_display_target)      //      indicates whether target will be displayed

{
	   //var html = zone + "_zp: No recommendations returned";
	   var html = " ";

	   if (symbolic !== '_NR_')
	   {
	      // !!CLIENT DEPENDENT!! - use the correct attribute for description (array indices are zero based so first attribute is index 0)
	      var i_description = 0;
	      // !!CLIENT DEPENDENT!! - use the correct attribute for image (array indices are zero based so first attribute is index 0)
	      var i_image_url   = 2;
	      // !!CLIENT DEPENDENT!! - image prefix
	      var image_prefix  = '';

	      var i_href        = undefined;
	      var i_score       = undefined;
	      var i_price       = undefined;

	      var div_recs    = '<div class="io_test_recs"\>';
	      var n_recs      = 3;
	      //var div_title   = '<div class="io_recs_title">' + target_header_txt + '<\/div>';	   
	      var div_title   = '<div class="io_pdp_recs_title" Align="center">' + target_header_txt + '<\/div>';	      
	      var div_table   = '<div class="io_recs_table">';
	      var image_table = '<TABLE CELLSPACING="2" CELLPADDING="0" Align="center" style="border-color:white;"><TR>';
	      var lines       = [];
	      var width       = 100 / n_recs;
	      
	      lines.push('<div class="io_recs_title">' + target_header_txt + '<\/div>');
	      lines.push('<ul>');

	      // if true display the target (first) as well as the recommendations
	     // if (b_display_target)
	      //{
	      //   rec_attributes.unshift(target_attributes);         // push target onto front of rec_attributes array
	      //   n_recs++;
	      //}

	      // Recommendations
	      for (var ii=0; ii < n_recs; ii++)
	      {
	    	 try{
			         var rec_prod_id       = b_display_target ? (ii == 0 ? target_id : a_product_ids[ii - 1]) : a_product_ids[ii];
		
			         var selected_href     = image_prefix + rec_attributes[ii][1];                                                // - not passed - href for image
		
			         var image_description = rec_attributes[ii][i_description];                 // product description
			         var image_url         = image_prefix + rec_attributes[ii][i_image_url];    // image url
		
			         var alt_description   = image_description;
			         if (!image_description)
			         {
			            alt_description   = 'No Image Available';
			            image_description   = '&nbsp;';
			         }
		
			         var attr_1     = rec_attributes[ii][0] ? rec_attributes[ii][0] : '-';
			         var attr_2     = rec_attributes[ii][1] ? rec_attributes[ii][1] : '-';
			         var attr_3     = rec_attributes[ii][2] ? rec_attributes[ii][2] : '-';
			         var attr_4     = rec_attributes[ii][3] ? rec_attributes[ii][3] : '-';
			         var attr_5     = rec_attributes[ii][4] ? rec_attributes[ii][4] : '-';
			         var attr_6     = rec_attributes[ii][5] ? rec_attributes[ii][5] : '-';
			         var attr_7     = rec_attributes[ii][6] ? rec_attributes[ii][6] : '-';
			         var attr_8     = rec_attributes[ii][7] ? rec_attributes[ii][7] : '-';
			         var attr_9     = rec_attributes[ii][8] ? rec_attributes[ii][8] : '-';
			         var attr_10    = rec_attributes[ii][9] ? rec_attributes[ii][9] : '-';
			         var attr_11    = rec_attributes[ii][10] ? rec_attributes[ii][10] : '-';
			         var attr_12    = rec_attributes[ii][11] ? rec_attributes[ii][11] : '-';
			         var attr_13    = rec_attributes[ii][12] ? rec_attributes[ii][12] : '-';
			         var attr_14    = rec_attributes[ii][13] ? rec_attributes[ii][13] : '-';
			         var attr_15    = rec_attributes[ii][14] ? rec_attributes[ii][14] : '-';
			         
		
		
			         // Display image and it's description
			         lines.push('<li><div class="image recommendation_image"><A HREF="' + selected_href +'&navid=xsellPDPCTL'+'"><IMG SRC="' + image_url + '" + ALT="' + alt_description + '" + TITLE="' + alt_description + '"><\/IMG><\/A><\/div>');
			         lines.push('<div class="name"><A STYLE="text-decoration:none" HREF="' + selected_href +'&navid=xsellPDPCTL'+'" + TITLE="' + alt_description + '">' + image_description + '<\/A><\/div><\/li>');
		//	         lines.push('<TD ALIGN="center"><div class="image recommendation_image"><A HREF="' + selected_href +'&navid=xsellPDPCTL'+'"><IMG SRC="' + image_url + '" + ALT="' + alt_description + '" + WIDTH=128 + height=128 + style="border: medium none; cursor: pointer; padding-bottom: 5px; padding-top: 5px;" /></div>');
		//	         lines.push('<div class="name"><A STYLE="text-decoration:none" HREF="' + selected_href +'&navid=xsellPDPCTL'+'">' + image_description + '<\/A></div><\/TD>');
	    	 }   	 
	    	 catch(e){break;}
	    }

	      // make a text string
	      //html = lines.join("\n") + '<\/TR\><\/TABLE\><\/div\><\/div\>';
	      lines.push('<\/ul>');
	      html = lines.join("\n");
	   }
	   else
	   {   jQuery("div.productRecommendation").hide();
	   }

	   document.getElementById(div_id).innerHTML= html;
}
function Kate_ATC_zpf(a_product_ids,            // Array of recommended product IDs
        zone,                  // Zone ID specified in the request (as entered on zone edit screen)
        symbolic,              // Target type:
                               //      _SP_  Specified Product ID
                               //      _SC_  Specified Category ID
                               //      _RVP_ Most Recently Viewed Product
                               //      _RPP_ Most Recently Purchased Product
                               //      _NR_  No Recommendations
                               //      _LCP_ Last Carted Product
                               //      _MPC_ Visitor's Most Popular Category
                               //      _SS_  Specified Search Term
        target_id,             // Target ID recommendations are based on
        category,              // Category of Target ID - EPR Category ID if the Target ID is a product
        rec_attributes,        // 2 dimensional array of attributes for each recommendation
        target_attributes,     // Array of attribute for the target
        target_header_txt,     // Header text (as entered on recommendation plan edit screen)
        ab_test_id,            // String containing AB Test Name, a semicolon, AB test ID for the test element requested
                               //      Null if no AB Test
                               // 
                               // The final 2 parameters are not standard parameters passed into zone population function
                               // They ared added via the function calls at bottom of this file
        div_id,                //      div id - must match desired div id in DW isml template
        b_display_target)      //      indicates whether target will be displayed

{
var html = " ";

if (symbolic !== '_NR_')
{
// !!CLIENT DEPENDENT!! - use the correct attribute for description (array indices are zero based so first attribute is index 0)
var i_description = 0;
// !!CLIENT DEPENDENT!! - use the correct attribute for image (array indices are zero based so first attribute is index 0)
var i_image_url   = 2;
// !!CLIENT DEPENDENT!! - image prefix
var image_prefix  = '';

var i_href        = undefined;
var i_score       = undefined;
var i_price       = undefined;

var div_recs    = '<div class="io_test_recs"\>';
var n_recs      = 4;

var div_title   = '<div class="io_recs_title"><\/div>';
var div_table   = '<div class="io_recs_table">';
var image_table = '<TABLE CELLSPACING="2" CELLPADDING="0" Align="center" style="border-color:white;">';
var lines       = [];
var width       = 100 / n_recs;


// if true display the target (first) as well as the recommendations
if (b_display_target)
{
rec_attributes.unshift(target_attributes);         // push target onto front of rec_attributes array
n_recs++;
}
lines.push('<div class="io_recs_title">' + target_header_txt + '<\/div>');


// Recommendations
for (var ii=0; ii < n_recs; ii++)
{
	 try{
		var rec_prod_id       = b_display_target ? (ii == 0 ? target_id : a_product_ids[ii - 1]) : a_product_ids[ii];
		
		var selected_href     = image_prefix + rec_attributes[ii][1];                                               // - not passed - href for image
		
		var image_description = rec_attributes[ii][i_description];                 // product description
		var image_url         = image_prefix + rec_attributes[ii][i_image_url];    // image url
		
		var alt_description   = image_description;
		if (!image_description)
		{
		   alt_description   = 'No Image Available';
		   image_description   = '&nbsp;';
		}
		
		var attr_1     = rec_attributes[ii][0] ? rec_attributes[ii][0] : '-';
		var attr_2     = rec_attributes[ii][1] ? rec_attributes[ii][1] : '-';
		var attr_3     = rec_attributes[ii][2] ? rec_attributes[ii][2] : '-';
		var attr_4     = rec_attributes[ii][3] ? rec_attributes[ii][3] : '-';
		var attr_5     = rec_attributes[ii][4] ? rec_attributes[ii][4] : '-';
		var attr_6     = rec_attributes[ii][5] ? rec_attributes[ii][5] : '-';
		var attr_7     = rec_attributes[ii][6] ? rec_attributes[ii][6] : '-';
		var attr_8     = rec_attributes[ii][7] ? rec_attributes[ii][7] : '-';
		var attr_9     = rec_attributes[ii][8] ? rec_attributes[ii][8] : '-';
		var attr_10    = rec_attributes[ii][9] ? rec_attributes[ii][9] : '-';
		var attr_11    = rec_attributes[ii][10] ? rec_attributes[ii][10] : '-';
		var attr_12    = rec_attributes[ii][11] ? rec_attributes[ii][11] : '-';
		var attr_13    = rec_attributes[ii][12] ? rec_attributes[ii][12] : '-';
		var attr_14    = rec_attributes[ii][13] ? rec_attributes[ii][13] : '-';
		var attr_15    = rec_attributes[ii][14] ? rec_attributes[ii][14] : '-';
		
		
		
		// Display image and it's description
	
		lines.push('<li><div class="image recommendation_image"><A HREF="' + selected_href +'&navid=xsellCARTNEW'+'"><IMG SRC="' + image_url + '" + ALT="' + alt_description + '" + TITLE="' + alt_description + '"><\/IMG><\/A><\/div>');
	    lines.push('<div class="name"><A STYLE="text-decoration:none" HREF="' + selected_href +'&navid=xsellCARTNEW'+'" + TITLE="' + alt_description + '">' + image_description + '<\/A><\/div><\/li>');
		
		
		
		//lines.push('<\/TABLE><\/div><\/TD>');
	 } catch(e){break;}
}

// make a text string
html = lines.join("\n");
}
else
{
	jQuery("div.recomendationsContainer").hide();
}
	document.getElementById(div_id).innerHTML+= html;

}
// !!CLIENT DEPENDENT!! - add a function named ZoneID_zp (where ZoneID is the actual zone id) for all zones the Kate zpf should be called for 
function Product_zp(a,b,c,d,e,f,g,h,i)  
{
   Kate_PDP_zpf(a,b,c,d,e,f,g,h,i,'pdp_cross-sell',true);
}
function Cart_zp(a,b,c,d,e,f,g,h,i)  
{
   Kate_ATC_zpf(a,b,c,d,e,f,g,h,i,'cartrecommendations_cross-sell',false);
}
