<!--

luggage_tag_blank_price_each = new Array (0.65,0.95,1.05,1.15,1.50,1.95,2.50,0.00);
luggage_tag_blank_quantity = new Array (9999,499,399,199,99,24,12,5);
luggage_tag_brass_price_each = new Array (7.50,7.95,9.95,0.00);
luggage_tag_brass_quantity = new Array (9999,15,9,2);
luggage_tag_metallic_look_price_each = new Array (4.95,5.95,6.25,6.95,0.00);
luggage_tag_metallic_look_quantity = new Array (9999,24,12,6,0);
luggage_tag_semi_rigid_price_each = new Array (0.50,0.85,0.95,1.10,1.50,1.95,2.50,0.00);
luggage_tag_semi_rigid_quantity = new Array (9999,499,399,199,99,50,24,0);

name_tag_acrylic_dome_price_each  = new Array (0.99,1.30,1.75,1.95,0.00);
name_tag_acrylic_dome_quantity = new Array (9999,250,50,25,0);
name_tag_acrylic_dome_large_price_each  = new Array (1.05,1.45,1.95,2.05,0.00);
name_tag_acrylic_dome_large_quantity = new Array (9999,250,50,25,0);
name_tag_blank_price_each = new Array (0.65,0.70,0.85,0.95,1.05,1.10,1.20,1.35,0.00);
name_tag_blank_quantity = new Array (9999,1000,750,500,299,199,50,25,14);
// unique = 0 , all the same = 1
name_tag_printed_price_each = new Array (
  new Array (3.95,4.50,4.95,5.35,5.75,6.95,7.95,8.95,9.95,0.00),
  new Array (2.95,3.50,3.95,4.75,4.95,5.95,6.95,7.95,9.95,0.00));
name_tag_printed_quantity = new Array (9999,199,99,74,49,24,15,9,5,1);
name_tag_oval_price_each = new Array (4.95,5.50,5.95,6.35,6.75,7.95,8.95,9.95,11.95,0.00);
name_tag_oval_quantity = new Array (9999,199,99,74,49,24,15,9,5,1);
name_tag_windowed_price_each = new Array (
  new Array (3.10,3.27,3.60,3.92,4.51,5.32,7.32,0.00),
  new Array (0.39,0.50,0.56,0.75,1.14,1.37,2.27,0.00));
name_tag_windowed_quantity = new Array (99999,749,499,349,249,149,99,49);

name_tag_acrylic_dome_custom_printed_price_each = new Array (
  new Array (4.55,5.15,5.65,6.05,6.55,7.80,8.90,9.90,10.95,0.00),
  new Array (3.55,4.15,4.65,5.45,5.75,6.80,7.90,8.90,10.95,0.00));
name_tag_acrylic_dome_custom_printed_quantity = new Array (9999,199,99,74,49,24,15,9,5,1);

options_acrylic_dome_price_each = new Array (0.60,0.65,0.70,0.70,0.80,0.85,0.95,0.95,1.00,0.00);
options_acrylic_dome_quantity = new Array (9999,199,99,74,49,24,15,9,5,1);
options_badge_holder_1810_1000_price = new Array (0,0.45,0.35,0.28,0.23);
options_badge_holder_1810_1200_price = new Array (0,0.45,0.35,0.28,0.23);
options_badge_holder_1815_1200_price = new Array (0,0.42,0.29,0.26,0.20);
options_badge_holder_1815_1300_price = new Array (0,0.42,0.29,0.26,0.20);
options_badge_holder_quantity = new Array (0,500,1000,2500,5000);

options_fastener_magnetic_back_fastener_price_each = new Array (0.45,0.50,0.55,0.65,0.70,0.78,1.00,0.00);
options_fastener_magnetic_back_fastener_quantity = new Array (9999,2500,1000,500,249,99,49,4);

addon_fastener_magnetic_back_fastener_price_each = new Array (0.90,1.00,1.10,0.00);
// addon_fastener_magnetic_back_fastener_quantity = new Array (9999,99,49,1);
addon_fastener_magnetic_back_fastener_quantity = new Array (9999,99,49,1);

options_fastener_worm_loop_price = new Array (0,0.11,0.09,0.07,0.05);
options_fastener_worm_loop_quantity = new Array (0,500,1000,2500,5000);
options_fastener_clear_loop_price = new Array (0,0.15,0.15,0.15,0.15,0.13,0.13,0.11,0.11,0.11,0.11);
options_fastener_clear_loop_quantity = new Array (0,100,150,200,250,300,350,400,450,500,1000);
options_image_maker_frame_price_each = new Array (1.15,1.20,1.30,1.40,1.50,1.65,1.65,1.95,1.95,0.00);
options_image_maker_frame_quantity = new Array (9999,199,99,74,49,24,15,9,5,1);
options_black_frame_price_each = new Array (1.25,1.35,1.45,1.55,1.65,1.75,1.85,2.25,2.25,0.00);
options_black_frame_quantity = new Array (9999,199,99,74,49,24,15,9,5,1);

function get_magnetic_fastener_addon(this_quantity) {
  mag_i = 0;
  mag_unit_price = 0.00; 
  for (mag_i=0; mag_i<=3; mag_i++) {
    if (this_quantity <= addon_fastener_magnetic_back_fastener_quantity[mag_i]) { 
	  mag_unit_price = addon_fastener_magnetic_back_fastener_price_each[mag_i] - 0;
	}
  }
  return mag_unit_price;
}

function update_item_data(thisForm) {
  unit_price = 0.00;
  extended_price = 0.00;
  i = 0;
  ii = 0;
  quantity_range = 0;
  quantity = validate_quantity(thisForm.cart_item_quantity.value); 

  if (thisForm.name_of_product.value == 'Luggage Tag - Blank') {
    for (i=0; i<=7; i++) {
      if (quantity <= luggage_tag_blank_quantity[i]) { 
	    unit_price = luggage_tag_blank_price_each[i];
	  }
    }
	if ((thisForm.tag_color[0].checked) || (thisForm.tag_color[1].checked)) { // black or red selected
	  if (unit_price == 0.00) {
   	    if (quantity > 0) {
          alert("Minimum order is 6 for Black or Red");
	      quantity = 6; 
          unit_price == 2.50
	    }
	  }
	}
    else if (quantity < 500) { 
      if (quantity > 0) { 
        alert("Minimum order is 500 for colors other than Red or Black");
        unit_price = 0.65;
	    quantity = 500;
	  }
	}
  }
  else if (thisForm.name_of_product.value == 'Luggage Tag - Brass') {
    for (i=0; i<=3; i++) {
      if (quantity <= luggage_tag_brass_quantity[i]) { 
	    unit_price = luggage_tag_brass_price_each[i];
	  }
    }
	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 3");
	    quantity = 3; 
        unit_price = 9.95;
	  }
	}
  }
  else if (thisForm.name_of_product.value == 'Luggage Tag - Metallic Look') {
    for (i=0; i<=4; i++) {
      if (quantity <= luggage_tag_metallic_look_quantity[i]) { 
	    unit_price = luggage_tag_metallic_look_price_each[i]; 
	  }
    }
  }
  else if (thisForm.name_of_product.value == 'Luggage Tag - Semi Rigid') {
    for (i=0; i<=7; i++) {
      if (quantity <= luggage_tag_semi_rigid_quantity[i]) { 
	    unit_price = luggage_tag_semi_rigid_price_each[i]; 
	  }
    }
  }
  else if (thisForm.name_of_product.value == 'Name Tag - Acrylic Dome') {
    for (i=0; i<=4; i++) {
      if (quantity <= name_tag_acrylic_dome_quantity[i]) { 
	    unit_price = name_tag_acrylic_dome_price_each[i];
	  }
    }
	if (quantity > 0) {
      if (thisForm.fastener_style[1].checked) { // Magnetic Option
	    unit_price = unit_price + get_magnetic_fastener_addon(quantity) - 0;
	  }
    }
  }
  else if (thisForm.name_of_product.value == 'Name Tag - Acrylic Dome Large') {
    for (i=0; i<=4; i++) {
      if (quantity <= name_tag_acrylic_dome_large_quantity[i]) { 
	    unit_price = name_tag_acrylic_dome_large_price_each[i];
	  }
    }
	if (quantity > 0) {
      if (thisForm.fastener_style[1].checked) { // Magnetic Option
	    unit_price = unit_price + get_magnetic_fastener_addon(quantity) - 0;
	  }
    }
  }
  else if (thisForm.name_of_product.value == 'Name Tag - Blank') {
    for (i=0; i<=8; i++) {
      if (quantity <= name_tag_blank_quantity[i]) { 
	    unit_price = name_tag_blank_price_each[i]; 
	  }
    }
	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 15");
	    quantity = 15; 
        unit_price == name_tag_blank_price_each[7];
	  }
	}
	if (quantity > 0) {
      if (thisForm.fastener_style[1].checked) { // Magnetic Option
	    unit_price = unit_price + get_magnetic_fastener_addon(quantity) - 0;
	  }
    }
  }
  else if (thisForm.name_of_product.value == 'Name Tag - Printed') {
	index = 0; // personalized
    if (thisForm.tag_style[1].checked) {
	  index = 1; // all the same
	}
    for (i=0; i<=9; i++) {
      if (quantity <= name_tag_printed_quantity[i]) { 
	    unit_price = name_tag_printed_price_each[index][i];
		ii = i;
	  }
    }
	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 2");
	    quantity = 2; 
        unit_price = name_tag_printed_price_each[index][8];
	  }
	}
	if (quantity > 0) {
      if (thisForm.photo_id[0].checked) { 
	    unit_price = unit_price + 2.00;
	  }
      if (thisForm.fastener_style[0].checked) { // Magnetic Option
	    unit_price = unit_price + get_magnetic_fastener_addon(quantity) - 0;
	  }
      if (thisForm.additional_options[0].checked) { // Image Maker Frame Gold
	    unit_price = unit_price + (options_image_maker_frame_price_each[ii] - 0);
	  }
      if (thisForm.additional_options[1].checked) { // Image Maker Frame Silver
	    unit_price = unit_price + (options_image_maker_frame_price_each[ii] - 0);
	  }
      if (thisForm.additional_options[2].checked) { // Black Frame
	    if (thisForm.tag_size[2].checked) { // Black frame not available for Credit Card size tags
		  alert("Black Frames are not available in this size. Please select another size or frame option.");
		  thisForm.additional_options[2].checked.value = false;
		  thisForm.additional_options[4].checked.value = true;
		} else {
	      unit_price = unit_price + (options_black_frame_price_each[ii] - 0);
		}
	  }
      if (thisForm.additional_options[3].checked) { // Acrylic Dome
	    unit_price = unit_price + (options_acrylic_dome_price_each[ii] - 0);
	  }
    }
  }
  else if (thisForm.name_of_product.value == 'Name Tag - Acrylic Dome Custom Printed') {
	index = 0; // personalized
    if (thisForm.tag_style[1].checked) {
	  index = 1; // all the same
	}
    for (i=0; i<=9; i++) {
      if (quantity <= name_tag_acrylic_dome_custom_printed_quantity[i]) { 
	    unit_price = name_tag_acrylic_dome_custom_printed_price_each[index][i];
		ii = i;
	  }
    }
	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 2");
	    quantity = 2; 
        unit_price = name_tag_acrylic_dome_custom_printed_price_each[index][8];
	  }
	}
	if (quantity > 0) {
      if (thisForm.fastener_style[1].checked) { 
	    unit_price = unit_price + get_magnetic_fastener_addon(quantity) - 0;
	  }
    }
  }
  else if (thisForm.name_of_product.value == 'Name Tag - Oval') {
    for (i=0; i<=9; i++) {
      if (quantity <= name_tag_oval_quantity[i]) { 
	    unit_price = name_tag_oval_price_each[i];
        ii = i;

	  }
    }
	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 2");
	    quantity = 2; 
        unit_price = name_tag_oval_price_each[8];
	  }
	}
	if (quantity > 0) {
      if (thisForm.fastener_style[0].checked) { 
	    unit_price = unit_price + get_magnetic_fastener_addon(quantity) - 0;
	  }
	}
	if (quantity > 0) {
      if (thisForm.additional_options[0].checked) { 
	    unit_price = unit_price + options_black_frame_price_each[ii];
	  }
	}
  }
  else if (thisForm.name_of_product.value == 'Name Tag - Windowed') {
    for (i=0; i<=7; i++) {
      if (quantity <= name_tag_windowed_quantity[i]) { 
	    unit_price = name_tag_windowed_price_each[0][i]; 
		ii = i;
	  }
    }
	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 50");
	    quantity = 50; 
		ii=6;
        unit_price = name_tag_windowed_price_each[0][ii];
	  }
	}
	if (quantity > 0) {
      if (thisForm.fastener_style[2].checked) { // magnetic fastener
	    unit_price = unit_price + get_magnetic_fastener_addon(quantity) - 0;
	  }
      if (thisForm.additional_colors[1].checked) { 
	    unit_price = unit_price + (name_tag_windowed_price_each[1][ii] - 0);
	  }
	}
  }
  else if (thisForm.name_of_product.value == 'Badge Holder Model 1810_1000 Horizontal Top Load') { 
    quantity = options_badge_holder_quantity[thisForm.quantity.selectedIndex];
    unit_price = options_badge_holder_1810_1000_price[thisForm.quantity.selectedIndex];
  }
  else if (thisForm.name_of_product.value == 'Badge Holder Model 1810_1200 Vertical Top Load') { 
    quantity = options_badge_holder_quantity[thisForm.quantity.selectedIndex];
    unit_price = options_badge_holder_1810_1200_price[thisForm.quantity.selectedIndex];
  }
  else if (thisForm.name_of_product.value == 'Badge Holder Model 1815_1200 Horizontal Top Load') { 
    quantity = options_badge_holder_quantity[thisForm.quantity.selectedIndex];
    unit_price = options_badge_holder_1815_1200_price[thisForm.quantity.selectedIndex];
  }
  else if (thisForm.name_of_product.value == 'Badge Holder Model 1815_1300 Vertical Top Load') { 
    quantity = options_badge_holder_quantity[thisForm.quantity.selectedIndex];
    unit_price = options_badge_holder_1815_1300_price[thisForm.quantity.selectedIndex];
  }
  else if (thisForm.name_of_product.value == 'Fastener - Magnetic Back') { 
    for (i=0; i<=7; i++) {
      if (quantity <= options_fastener_magnetic_back_fastener_quantity[i]) { 
	    unit_price = options_fastener_magnetic_back_fastener_price_each[i]; 
	  }
    }
	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 5");
	    quantity = 5; 
        unit_price == options_fastener_magnetic_back_fastener_price_each[6];
	  }
	}
  }
  else if (thisForm.name_of_product.value == 'Fastener - Pin Back Adapter') { 
    unit_price = thisForm.cart_item_unit_price.value; 
  }
  else if (thisForm.name_of_product.value == 'Fastener - Slip on Pocket Clip') { 
    unit_price = thisForm.cart_item_unit_price.value; 
  }
  else if (thisForm.name_of_product.value == 'Fastener - Colored Worm Loop') { 
    quantity = options_fastener_worm_loop_quantity[thisForm.quantity.selectedIndex];
    unit_price = options_fastener_worm_loop_price[thisForm.quantity.selectedIndex];
  }
  else if (thisForm.name_of_product.value == 'Fastener - Clear Worm Loop') { 
    quantity = options_fastener_clear_loop_quantity[thisForm.quantity.selectedIndex];
    unit_price = options_fastener_clear_loop_price[thisForm.quantity.selectedIndex];
  }
  else if (thisForm.name_of_product.value == 'Option - Image Maker Frame') {
    for (i=0; i<=9; i++) {
      if (quantity <= options_image_maker_frame_quantity[i]) { 
	    unit_price = options_image_maker_frame_price_each[i]; 
	  }
    }
  	if (unit_price == 0.00) {
   	  if (quantity > 0) {
        alert("Minimum order is 2");
	    quantity = 2; 
        unit_price = options_image_maker_frame_price_each[8];
	  }
	}
  }
  
  extended_price = variable_round(unit_price * quantity,2);
  if (quantity > 0) {
    thisForm.cart_item_total.value = format_to_dollars(extended_price);
  } else {
    thisForm.cart_item_total.value = '0.00';
  }
  
  extended_price = variable_round(extended_price,2);
  extended_price = format_to_dollars(extended_price);
  thisForm.cart_item_extended_price.value = extended_price;

  unit_price = variable_round(unit_price,2);
  unit_price = format_to_dollars(unit_price);
  thisForm.cart_item_unit_price.value = unit_price;

  thisForm.cart_item_quantity.value = quantity;
}
//-->