// JavaScript Document

function checkWebForm (theForm) {
	var error = "";
		
	// theForm.length - 2 to exclude the buttons.
	for (var i = 0; i < (theForm.length - 2); i++) {
		switch (i) {
			case 0:
				if (theForm [i].value == "") { error += "Please fill in YOUR NAME.\n"; }						
				break;
				
			case 1:
				if (theForm [i].value == "") { error += "Please fill in the EMAIL ADDRESS.\n"; }
				break;
				
			case 2:
				if (theForm [i].value == "") { error += "Please fill in the SUBJECT.\n"; }
				break;
				
			case 3:
				if (theForm [i].value == "") { error += "Please fill in the MESSAGE.\n"; }
				break;
		}
	}
	
	if (error != "") {
		alert (error);
		return false;
	}
	return true;
}

function validateRegister(theForm) {
	var error = "";
	
	for(var i = 0; i < (theForm.length - 2); i++) {
		switch(i) {
			case 0:
				if(theForm[i].value=="") { error += "Please enter a USERNAME.\n"; }
				break;
			case 1:
				if(theForm[i].value=="") { error += "Please enter a PASSWORD.\n"; }
				break;
			case 2:
				if(theForm[i].value=="") { error += "Please RETYPE the PASSWORD .\n"; }
				break;
			case 3:
				if(theForm[i].value=="") { error += "Please enter a FIRST NAME.\n"; }
				break;
			case 4:
				if(theForm[i].value=="") { error += "Please enter a LAST NAME.\n"; }
				break;
			case 11:
				if(theForm[i].value=="") { error += "Please enter a EMAIL ADDRESS.\n"; }
				break;
		}
	}
	
	if (error != "") {
		alert(error);
		return false;
	}
	return true;
}

function validateLogin(theForm) {
	var error = "";
	
	for(var i = 0; i < (theForm.length - 2); i++) {
		switch(i) {
			case 0:
				if(theForm[i].value=="") { error += "Please enter a USERNAME.\n"; }
				break;
			case 1:
				if(theForm[i].value=="") { error += "Please enter a PASSWORD.\n"; }
				break;
		}
	}
	
	if (error != "") {
		alert(error);
		return false;
	}
	return true;
}

// BEGIN PRODUCT VALIDATION -->
function validateAddItem(formName) {	
	var error = "";	
	var theForm = document.getElementById(formName);
	// If no tags are selected, quantity must at least be this or more.
	var t1_start = document.getElementById('t1_start');
	// Item ID
	var item_id = document.getElementById('item_ID');
	// Is Set? and Set Quantity.
	var is_set = document.getElementById('is_set').value;
	var set_num = Number(document.getElementById('set_num').value);
	// Quantity
	var qty = Number(document.getElementById('quantity').value);
	// Tier one for checking.
	var t1_start = Number(document.getElementById('t1_start').value);
	var t1_end = Number(document.getElementById('t1_end').value);
	var t1_price = Number(document.getElementById('t1_price').value);
	// Personality Boxes
	var p_box = document.getElementById('p_box');
	var p_box_style = document.getElementById('p_box_style');
	// Candle Labels
	var label_style = document.getElementById('label_style');
	var label_color = document.getElementById('label_color');
	// Tag check boxes
	var pb_tag = document.getElementById('add_p_box_tag');
	var mp_tag = document.getElementById('add_match_p_tag');
	var cp_tag = document.getElementById('add_cust_p_tag');
	var cph_tag = document.getElementById('add_cust_p_hang_tag');
	//var minRequired = Number(document.getElementById('minRequired').value);
	// Tag Options
	if(pb_tag != null && pb_tag.checked) {
		var pb_tag_names = document.getElementById('p_box_tag_names');
		var pb_tag_date = document.getElementById('p_box_tag_date');
	}
	if(mp_tag != null && mp_tag.checked) {
		var mp_tag_names = document.getElementById('match_p_names');
		var mp_tag_date = document.getElementById('match_p_date');
	}
	if(cp_tag != null && cp_tag.checked) {
		var cp_10_style = document.getElementById('10-Style');
		var cp_10_shape = document.getElementById('10-Shape');
		var cp_10_color = document.getElementById('10-Color');
		var cp_20_style = document.getElementById('20-Style');
		var cp_20_shape = document.getElementById('20-Shape');
		var cp_20_color = document.getElementById('20-Color');
		var cp_tag_names = document.getElementById('cust_p_names');
		var cp_tag_date = document.getElementById('cust_p_date');		
	}
	if(cph_tag != null && cph_tag.checked) {
		var cph_qty = document.getElementById('cust_p_hang_amount');
		var cph_10_style = document.getElementById('10-Style');
		var cph_10_shape = document.getElementById('10-Shape');
		var cph_10_color = document.getElementById('10-Color');
		var cph_20_style = document.getElementById('20-Style');
		var cph_20_shape = document.getElementById('20-Shape');
		var cph_20_color = document.getElementById('20-Color');
		var cph_tag_names = document.getElementById('cust_p_hang_names');
		var cph_tag_date = document.getElementById('cust_p_hang_date');
	}
	// Engraving & Engraving Plate Checkboxes
	var eng = document.getElementById('add_eng');
	var eng_plate = document.getElementById('add_eng_plate');
	if(eng != null && eng.checked) {
		var eng_style = document.getElementById('eng_style');
		var eng_line_one = document.getElementById('eng_line_one');
		var eng_line_one_two = document.getElementById('eng_line_one_two');
		var eng_line_two = document.getElementById('eng_line_two');
	}
	if(eng_plate != null && eng_plate.checked) {
		var eng_plate_style = document.getElementById('eng_plate_style');
		var eng_plate_color = document.getElementById('eng_plate_color');
		var eng_plate_line_one = document.getElementById('eng_plate_line_one');
		var eng_plate_line_one_two = document.getElementById('eng_plate_line_one_two');
		var eng_plate_line_two = document.getElementById('eng_plate_line_two');
	}
	// Personalized Favor Tags Page
	var style_selected = false;
	var styles = document.getElementsByName('styles[]');
	for(var i=0; i<styles.length;i++){
		if(styles[i].checked) {
			style_selected = true;
		}
	}
	
	var shape_selected = false;
	var shapes = document.getElementsByName('shapes[]');
	for(var i=0; i<shapes.length;i++){
		if(shapes[i].checked) {
			shape_selected = true;
		}
	}
	
	var color_selected = false;
	var colors = document.getElementsByName('colors[]');
	for(var i=0; i<colors.length;i++){
		if(colors[i].checked) {
			color_selected = true;
		}
	}
	
	var fc_20_pdesign_1 = document.getElementById('20-P Design 1');
	var fc_20_pdesign_2 = document.getElementById('20-P Design 2');
	var fc_20_ink_1 = document.getElementById('20-Ink 1');
	var fc_20_ink_2 = document.getElementById('20-Ink 2');
	var fc_20_thread = document.getElementById('20-Thread');
	var fc_20_font = document.getElementById('20-Font');
	var fc_20_initial_1 = document.getElementById('20-Initial 1');
	var fc_20_initial_2 = document.getElementById('20-Initial 2');
	
	var mb_30_tin_1 = document.getElementById('30-Tin 1');
	var mb_30_tin_2 = document.getElementById('30-Tin 2');
	var mb_30_tin_3 = document.getElementById('30-Tin 3');
	var mb_30_tin_candy = document.getElementById('30-Tin Candy');
	var mb_30_pp_candy = document.getElementById('30-PP Candy');
	
	var lc_30_event = document.getElementById('30-Event');
	var lc_30_city = document.getElementById('30-City');
	var lc_30_label_color_1 = document.getElementById('30-Label Color 1');
	var lc_30_label_color_2 = document.getElementById('30-Label Color 2');
	var lc_30_label_color_3 = document.getElementById('30-Label Color 3');
	var lc_30_font_color_1 = document.getElementById('30-Font Color 1');
	var lc_30_dolphin = document.getElementById('30-Dolphin Color');
	var lc_30_icon = document.getElementById('30-Icon Letter Color');
	var lc_30_argyle = document.getElementById('30-Argyle Color');
	var lc_30_stripe = document.getElementById('30-Stripe Color');
	var lc_30_monogra = document.getElementById('30-Monogra Color');
	var lc_30_mono = document.getElementById('30-Mono Background Color');
	var lc_30_motif = document.getElementById('30-Motif');
	
	var no_date = document.getElementById('Date');
	var no_name_s = document.getElementById('Names');
	var no_first = document.getElementById('First Name');
	var no_full = document.getElementById('Full Names');
	var no_last_i = document.getElementById('Last Initial');
	var no_initials = document.getElementById('Initials');
	var no_name = document.getElementById('Name');
	var no_name_initials = document.getElementById('Name/Initials');
	var no_names = document.getElementById('Name(s)');
	
	// New Form fields for tag admin 09-29-09
	var designStyle = document.getElementById('designStyle');
	var designShape = document.getElementById('designShape');
	var designColor = document.getElementById('designColor');
	var designBorder = document.getElementById('designBorder');
	
	// Now we have all the possible form items on the page.  Since we can't tell what is there initially, 
	// we have to test everything. I will go in the order of display on the change.
	
	if(p_box != null && p_box.value == "") { error += "Please select a Personality Box Type.\n"; }
	if(item_id != null && item_id.value.indexOf(',')==0) {
		error += "Please select an Item Detail.\n"; 
	}
	// Now we start to check quantity. First we see if the quantity box is empty, if not move on.
	if(document.getElementById('quantity').value == "") {
		if(is_set == "true") {
			error += "Please enter a Item Quantity. Minimum quantity of " + t1_start + " sets is required.\n";
		} else {
			error += "Please enter a Item Quantity. Minimum quantity of " + t1_start + " is required.\n";
		}
	} else {
		// Personalized Tag Page checks.
		if(styles.length != 0 && !style_selected) {
			error += "Please select a Tag Style.\n";
		}
		
		if(shapes.length != 0 && !shape_selected) {
			error += "Please select a Tag Shape.\n";
		}
		
		if(colors.length != 0 && !color_selected) {
			error += "Please select a Tag Color.\n";
		}
		
		if(qty < t1_start) {
			if(is_set == "true") {
				alert("Please enter a Item Quantity. Minimum quantity of " + t1_start + " sets is required."); return;
			} else {
				alert("Please enter a Item Quantity. Minimum quantity of " + t1_start + " is required."); return;
			}
		}
		
		if(p_box_style != null && p_box_style.value == "") { error += "Please select a Personality Design.\n"; }
		if(label_style != null && label_style.value == "") { error += "Please select a Label Style.\n"; }
		if(label_color != null && label_color.value == "") { error += "Please select a Label Color.\n"; }		
		
		// Now we check to see if any tags are added. If they are, then the quantity needs to be 24 or more.
		//if(qty < minRequired) { alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of " + minRequired + "."); return;}
		
		if(pb_tag != null && pb_tag.checked) {
			if(is_set == "true") {
				if((qty * set_num) < 24) {
					alert("Please enter a valid Item Quantity.pb_tag\nTags require a minimum quantity of " + (24 / set_num) + " sets."); return;
				}
			} else {
				if(qty < 24) { alert("Please enter a valid Item Quantity.pb_tag\nTags require a minimum quantity of 24.");  return; }
			}
		} else if(mp_tag != null && mp_tag.checked) {
			if(is_set == "true") {
				if((qty * set_num) < 24) {
					alert("Please enter a valid Item Quantity.mp_tag\nTags require a minimum quantity of " + (24 / set_num) + " sets."); return;
				}
			} else {
				if(qty < 24) { alert("Please enter a valid Item Quantity.mp_tag\nTags require a minimum quantity of 24.");  return; }
			}
		} else if(cp_tag != null && cp_tag.checked) {
			if(is_set == "true") {
				if((qty * set_num) < 24) {
					alert("Please enter a valid Item Quantity.cp_tag\nTags require a minimum quantity of " + (24 / set_num) + " sets."); return;
				}
			} else {
				if(qty < 24) { alert("Please enter a valid Item Quantity.cp_tag\nTags require a minimum quantity of 24.");  return; }
			}
		} else {
			if(cph_qty != null && cph_qty.value == "" && cph_tag.checked) { alert("Please enter a Custom Personality Hang Tag Quantity.\n"); return; }
			else {
				if(qty < t1_start) {
					if(is_set == "true") {
						alert("Please enter a Item Quantity.cph_tag\nTags require a minimum quantity of " + t1_start + " sets is required."); return;
					} else {						
						alert("Please enter a valid Item Quantity.cph_tag\nTags require a minimum quantity of " + t1_start + " is required.");  return;
					}
				}
			}
		}
	
		// Now we need to check the tag options, if a tag is selected.
		if(pb_tag != null && pb_tag.checked) {
			if(pb_tag_names != null && pb_tag_names.value == "") { error += "Please enter Personality Tag Names.\n"; }		
			if(pb_tag_date != null && pb_tag_date.value == "") { error += "Please enter Personality Tag Date.\n"; }
		}
		
		if(mp_tag != null && mp_tag.checked) {
			if(mp_tag_names != null && mp_tag_names.value == "") { error += "Please enter Matching Personality Tag Names.\n"; }		
			if(mp_tag_date != null && mp_tag_date.value == "") { error += "Please enter Matching Personality Tag Date.\n"; }
		}
		
		if(cp_tag != null && cp_tag.checked) {
			if(cp_10_style != null && cp_10_style.value == "") { error += "Please select Custom Personality Tag Style.\n"; }		
			if(cp_10_shape != null && cp_10_shape.value == "") { error += "Please select Custom Personality Tag Shape.\n"; }		
			if(cp_10_color != null && cp_10_color.value == "") { error += "Please select Custom Personality Tag Color.\n"; }		
			if(cp_20_style != null && cp_20_style.value == "") { error += "Please select Custom Personality Tag Style.\n"; }		
			if(cp_20_shape != null && cp_20_shape.value == "") { error += "Please select Custom Personality Tag Shape.\n"; }		
			if(cp_20_color != null && cp_20_color.value == "") { error += "Please select Custom Personality Tag Color.\n"; }		
			// New Fields for the admin tags.  09-29-09
			if(designStyle != null && designStyle.value == "") { error += "Please select a Style.\n"; }		
			if(designShape != null && designShape.value == "") { error += "Please select a Shape.\n"; }		
			if(designColor != null && designColor.value == "") { error += "Please select a Color.\n"; }
			if(designBorder != null && designBorder.value == "") { error += "Please select a Border.\n"; }
			// End
			if(cp_tag_names != null && cp_tag_names.value == "") { error += "Please enter Custom Personality Tag Names.\n"; }		
			if(cp_tag_date != null && cp_tag_date.value == "") { error += "Please enter Custom Personality Tag Date.\n"; }
		}
		
		if(cph_tag != null && cph_tag.checked) {
			if(cph_qty != null && cph_qty.value == "") { error += "Please enter a Custom Personality Hang Tag Quantity.\n"; }		
			if(cph_10_style != null && cph_10_style.value == "") { error += "Please select Custom Personality Hang Tag Style.\n"; }		
			if(cph_10_shape != null && cph_10_shape.value == "") { error += "Please select Custom Personality Hang Tag Shape.\n"; }		
			if(cph_10_color != null && cph_10_color.value == "") { error += "Please select Custom Personality Hang Tag Color.\n"; }		
			if(cph_20_style != null && cph_20_style.value == "") { error += "Please select Custom Personality Hang Tag Style.\n"; }		
			if(cph_20_shape != null && cph_20_shape.value == "") { error += "Please select Custom Personality Hang Tag Shape.\n"; }		
			if(cph_20_color != null && cph_20_color.value == "") { error += "Please select Custom Personality Hang Tag Color.\n"; }		
			if(cph_tag_names != null && cph_tag_names.value == "") { error += "Please enter Custom Personality Hang Tag Names.\n"; }		
			if(cph_tag_date != null && cph_tag_date.value == "") { error += "Please enter Custom Personality Hang Tag Date.\n"; }
		}
		if(eng != null && eng.checked) {
			if(eng_style != null && eng_style.value == "") { error += "Please select Style for Engraving.\n"; }
			if(eng_line_one != null && eng_line_one.value == "") { error += "Please fill in Line #1 for Engraving.\n"; }
			if(eng_line_one_two != null && eng_line_one.value == "") { error += "Please fill in Line #1(2) for Engraving.\n"; }
			if(eng_line_two != null && eng_line_two.value == "") { error += "Please fill in Line #2 for Engraving.\n"; }
		}
		if(eng_plate != null && eng_plate.checked) {
			if(eng_plate_style != null && eng_plate_style.value == "") { error += "Please select Style for Engraving Plate.\n"; }
			if(eng_plate_color != null && eng_plate_color.value == "") { error += "Please select Color for Engraving Plate.\n"; }
			if(eng_plate_line_one != null && eng_plate_line_one.value == "") { error += "Please fill in Line #1 for Engraving Plate.\n"; }
			if(eng_plate_line_one_two != null && eng_plate_line_one.value == "") { error += "Please fill in Line #1(2) for Engraving Plate.\n"; }
			if(eng_plate_line_two != null && eng_plate_line_two.value == "") { error += "Please fill in Line #2 for Engraving Plate.\n"; }
		}
		
		if(fc_20_pdesign_1 != null && fc_20_pdesign_1.value == "") { error += "Please select Personalized Item Design.\n"; }	
		if(fc_20_pdesign_2 != null && fc_20_pdesign_2.value == "") { error += "Please select Personalized Item Design.\n"; }	
		if(fc_20_ink_1 != null && fc_20_ink_1.value == "") { error += "Please select Personalized Item Ink.\n"; }	
		if(fc_20_ink_2 != null && fc_20_ink_2.value == "") { error += "Please select Personalized Item Ink.\n"; }	
		if(fc_20_thread != null && fc_20_thread.value == "") { error += "Please select Personalized Item Thread.\n"; }	
		if(fc_20_font != null && fc_20_font.value == "") { error += "Please select Personalized Item Font.\n"; }	
		if(fc_20_initial_1 != null && fc_20_initial_1.value == "") { error += "Please select Personalized Item Initial.\n"; }	
		if(fc_20_initial_2 != null && fc_20_initial_2.value == "") { error += "Please select Personalized Item Initial.\n"; }
		
		if(mb_30_tin_1 != null && mb_30_tin_1.value == "") { error += "Please select Tin Size and Color.\n"; }	
		if(mb_30_tin_2 != null && mb_30_tin_2.value == "") { error += "Please select Tin Size and Color.\n"; }	
		if(mb_30_tin_3 != null && mb_30_tin_3.value == "") { error += "Please select Tin Size and Color.\n"; }	
		if(mb_30_tin_candy != null && mb_30_tin_candy.value == "") { error += "Please select Candy.\n"; }	
		if(mb_30_pp_candy != null && mb_30_pp_candy.value == "") { error += "Please select Candy & Band Color.\n"; }
		
		if(lc_30_event != null && lc_30_event.value == "") { error += "Please select Event.\n"; }	
		if(lc_30_city != null && lc_30_city.value == "") { error += "Please select City.\n"; }	
		if(lc_30_label_color_1 != null && lc_30_label_color_1.value == "") { error += "Please select Label Color.\n"; }	
		if(lc_30_label_color_2 != null && lc_30_label_color_2.value == "") { error += "Please select Label Color.\n"; }	
		if(lc_30_label_color_3 != null && lc_30_label_color_3.value == "") { error += "Please select Label Color.\n"; }	
		if(lc_30_font_color_1 != null && lc_30_font_color_1.value == "") { error += "Please select Font Color.\n"; }	
		if(lc_30_dolphin != null && lc_30_dolphin.value == "") { error += "Please select Dolphin Color.\n"; }	
		if(lc_30_icon != null && lc_30_icon.value == "") { error += "Please select Icon Color.\n"; }	
		if(lc_30_argyle != null && lc_30_argyle.value == "") { error += "Please select Argyle Color.\n"; }	
		if(lc_30_stripe != null && lc_30_stripe.value == "") { error += "Please select Stripe Color.\n"; }	
		if(lc_30_monogra != null && lc_30_monogra.value == "") { error += "Please select Monogram Color.\n"; }	
		if(lc_30_mono != null && lc_30_mono.value == "") { error += "Please select Monogram Background Color.\n"; }	
		if(lc_30_motif != null && lc_30_motif.value == "") { error += "Please select Motif.\n"; }	
		
		if(no_date != null && no_date.value == "") { error += "Please enter a Date.\n"; }
		if(no_names != null && no_names.value == "") { error += "Please enter Name(s).\n"; }	
		if(no_first != null && no_first.value == "") { error += "Please enter the First Name.\n"; }	
		if(no_full != null && no_full.value == "") { error += "Please enter the Full Name.\n"; }	
		if(no_last_i != null && no_last_i.value == "") { error += "Please enter a Last Initial.\n"; }	
		if(no_initials != null && no_initials.value == "") { error += "Please enter Initials.\n"; }	
		if(no_name != null && no_name.value == "") { error += "Please enter a Name.\n"; }	
		if(no_name_initials != null && no_name_initials.value == "") { error += "Please enter Names or Initials"; }	
		if(no_name_s != null && no_name_s.value == "") { error += "Please enter Names.\n"; }
	}
	
	if(error != "") {
		alert(error);
	} else {
		theForm.submit();
	}
}
// END PRODUCT VALIDATION //-->

// CHECKBOX AS RADIO GROUP FUNCTION //-->
function checkTags(ch_box) {
	var pb_tag = document.getElementById('add_p_box_tag');
	var mp_tag = document.getElementById('add_match_p_tag');
	var cp_tag = document.getElementById('add_cust_p_tag');
	var cph_tag = document.getElementById('add_cust_p_hang_tag');
	var tag_option = document.getElementById('add_tag_option');

	if(pb_tag != null && pb_tag != ch_box) {
		pb_tab.checked = false;
		if($('p_box_tag_names') != null)
			$('p_box_tag_names').disabled = true;
		if($('p_box_tag_date') != null)
			$('p_box_tag_date').disabled = true;
	}
	if(tag_option != null) {
		if (tag_option.checked) {
			if($('tag_option1') != null)
				$('tag_option1').disabled = false;
			if($('tag_option2') != null)
				$('tag_option2').disabled = false;
		} else {
			if($('tag_option1') != null)
				$('tag_option1').disabled = true;
			if($('tag_option2') != null)
				$('tag_option2').disabled = true;
		}
	}
	if(mp_tag != null && mp_tag != ch_box) {
		mp_tag.checked = false;
		if($('match_p_names') != null)
			$('match_p_names').disabled = true;
		if($('match_p_date') != null)
			$('match_p_date').disabled = true;
	}
	if(cp_tag != null && cp_tag != ch_box) {
		cp_tag.checked = false;
		if($('10-Style') != null)
			$('10-Style').disabled = true;
		if($('10-Shape') != null)
			$('10-Shape').disabled = true;
		if($('10-Color') != null)
			$('10-Color').disabled = true;
		if($('20-Style') != null)
			$('20-Style').disabled = true;
		if($('20-Shape') != null)
			$('20-Shape').disabled = true;
		if($('20-Color') != null)
			$('20-Color').disabled = true;
		if($('cust_p_names') != null)			
			$('cust_p_names').disabled = true;
		if($('cust_p_date') != null)
			$('cust_p_date').disabled = true;
		if($('line1') != null)
			$('line1').disabled = true;
		if($('line2') != null)
			$('line2').disabled = true;
		if($('line3') != null)
			$('line3').disabled = true;
	}
	if(cph_tag != null && cph_tag != ch_box) {
		cph_tag.checked = false;
		$('cust_p_hang_amount').disabled = true;
		if($('10-Style') != null)
			$('10-Style').disabled = true;
		if($('10-Shape') != null)
			$('10-Shape').disabled = true;
		if($('10-Color') != null)
			$('10-Color').disabled = true;
		if($('20-Style') != null)
			$('20-Style').disabled = true;
		if($('20-Shape') != null)
			$('20-Shape').disabled = true;
		if($('20-Color') != null)
			$('20-Color').disabled = true;
		if($('cust_p_hang_names') != null)			
			$('cust_p_hang_names').disabled = true;
		if($('cust_p_hang_date') != null)
			$('cust_p_hang_date').disabled = true;
		if($('line1') != null)
			$('line1').disabled = true;
		if($('line2') != null)
			$('line2').disabled = true;
		if($('line3') != null)
			$('line3').disabled = true;
	}
	
	if(ch_box == pb_tag) {
		if(ch_box.checked == true) {
			if($('p_box_tag_names') != null)
				$('p_box_tag_names').disabled = false;
			if($('p_box_tag_date') != null)
				$('p_box_tag_date').disabled = false;
		} else {
			if($('p_box_tag_names') != null)
				$('p_box_tag_names').disabled = true;
			if($('p_box_tag_date') != null)
				$('p_box_tag_date').disabled = true;
		}
	}
	
	if(ch_box == mp_tag) {
		if(ch_box.checked == true) {
			if($('match_p_names') != null)
				$('match_p_names').disabled = false;
			if($('match_p_date') != null)
				$('match_p_date').disabled = false;
		} else {
			if($('match_p_names') != null)
				$('match_p_names').disabled = true;
			if($('match_p_date') != null)
				$('match_p_date').disabled = true;
		}
	}
	
	if(ch_box == cp_tag) {
		if(ch_box.checked == true) {
			if($('10-Style') != null)
				$('10-Style').disabled = false;
			if($('10-Shape') != null)
				$('10-Shape').disabled = false;
			if($('10-Color') != null)
				$('10-Color').disabled = false;
			if($('20-Style') != null)
				$('20-Style').disabled = false;
			if($('20-Shape') != null)
				$('20-Shape').disabled = false;
			if($('20-Color') != null)
				$('20-Color').disabled = false;
			if($('cust_p_names') != null)			
				$('cust_p_names').disabled = false;
			if($('cust_p_date') != null)
				$('cust_p_date').disabled = false;
			if($('line1') != null)
				$('line1').disabled = false;
			if($('line2') != null)
				$('line2').disabled = false;
			if($('line3') != null)
				$('line3').disabled = false;
			// New fields for the admin tags 09-29-09
			if($('line4') != null)
				$('line4').disabled = false;
			if($('designStyle') != null)
				$('designStyle').disabled = false;
			if($('designBorder') != null)
				$('designBorder').disabled = false;
			if($('designFont') != null)
				$('designFont').disabled = false;
			if($('designShape') != null)
				$('designShape').disabled = false;
			if($('designColor') != null)
				$('designColor').disabled = false;
			if($('tags_stickers_tag') != null)
				$('tags_stickers_tag').disabled = false;
			if($('tags_stickers_sticker') != null)
				$('tags_stickers_sticker').disabled = false;
			if($('left_init') != null)
				$('left_init').disabled = false;
			if($('right_init') != null)
				$('right_init').disabled = false;
			if($('center_init') != null)
				$('center_init').disabled = false;
			if($('brides_init') != null)
				$('brides_init').disabled = false;
			if($('grooms_init') != null)
				$('grooms_init').disabled = false;
			if($('gfn_init') != null)
				$('gfn_init').disabled = false;
			if($('bfn_init') != null)
				$('bfn_init').disabled = false;
			if($('last_init') != null)
				$('last_init').disabled = false;
			if($('initials') != null)
				$('initials').disabled = false;
			if($('initial') != null)
				$('initial').disabled = false;
			if($('paste_here') != null)
				$('paste_here').disabled = false;
			if($('tag_surcharge') != null)
				$('tag_surcharge').disabled = false;
			if($('tag_printname') != null)
				$('tag_printname').disabled = false;
			// End new fields
		} else {
			if($('10-Style') != null)
				$('10-Style').disabled = true;
			if($('10-Shape') != null)
				$('10-Shape').disabled = true;
			if($('10-Color') != null)
				$('10-Color').disabled = true;
			if($('20-Style') != null)
				$('20-Style').disabled = true;
			if($('20-Shape') != null)
				$('20-Shape').disabled = true;
			if($('20-Color') != null)
				$('20-Color').disabled = true;
			if($('cust_p_names') != null)			
				$('cust_p_names').disabled = true;
			if($('cust_p_date') != null)
				$('cust_p_date').disabled = true;
			if($('line1') != null)
				$('line1').disabled = true;
			if($('line2') != null)
				$('line2').disabled = true;
			if($('line3') != null)
				$('line3').disabled = true;
			// New fields for the admin tags
			if($('line4') != null)
				$('line4').disabled = true;
			if($('designStyle') != null)
				$('designStyle').disabled = true;
			if($('designBorder') != null)
				$('designBorder').disabled = true;
			if($('designFont') != null)
				$('designFont').disabled = true;
			if($('designShape') != null)
				$('designShape').disabled = true;
			if($('designColor') != null)
				$('designColor').disabled = true;
			if($('tags_stickers_tag') != null)
				$('tags_stickers_tag').disabled = true;
			if($('tags_stickers_sticker') != null)
				$('tags_stickers_sticker').disabled = true;
			if($('left_init') != null)
				$('left_init').disabled = true;
			if($('right_init') != null)
				$('right_init').disabled = true;
			if($('center_init') != null)
				$('center_init').disabled = true;
			if($('brides_init') != null)
				$('brides_init').disabled = true;
			if($('grooms_init') != null)
				$('grooms_init').disabled = true;
			if($('gfn_init') != null)
				$('gfn_init').disabled = true;
			if($('bfn_init') != null)
				$('bfn_init').disabled = true;
			if($('last_init') != null)
				$('last_init').disabled = true;
			if($('initials') != null)
				$('initials').disabled = true;
			if($('initial') != null)
				$('initial').disabled = true;
			if($('paste_here') != null)
				$('paste_here').disabled = true;
			if($('tag_surcharge') != null)
				$('tag_surcharge').disabled = true;
			if($('tag_printname') != null)
				$('tag_printname').disabled = true;
			// End
		}
	}
	
	if(ch_box == cph_tag) {
		if(ch_box.checked == true) {
			$('cust_p_hang_amount').disabled = false;
			if($('10-Style') != null)
				$('10-Style').disabled = false;
			if($('10-Shape') != null)
				$('10-Shape').disabled = false;
			if($('10-Color') != null)
				$('10-Color').disabled = false;
			if($('20-Style') != null)
				$('20-Style').disabled = false;
			if($('20-Shape') != null)
				$('20-Shape').disabled = false;
			if($('20-Color') != null)
				$('20-Color').disabled = false;
			if($('cust_p_hang_names') != null)			
				$('cust_p_hang_names').disabled = false;
			if($('cust_p_hang_date') != null)
				$('cust_p_hang_date').disabled = false;
			if($('line1') != null)
				$('line1').disabled = false;
			if($('line2') != null)
				$('line2').disabled = false;
			if($('line3') != null)
				$('line3').disabled = false;
		} else {
			$('cust_p_hang_amount').disabled = true;
			if($('10-Style') != null)
				$('10-Style').disabled = true;
			if($('10-Shape') != null)
				$('10-Shape').disabled = true;
			if($('10-Color') != null)
				$('10-Color').disabled = true;
			if($('20-Style') != null)
				$('20-Style').disabled = true;
			if($('20-Shape') != null)
				$('20-Shape').disabled = true;
			if($('20-Color') != null)
				$('20-Color').disabled = true;
			if($('cust_p_hang_names') != null)			
				$('cust_p_hang_names').disabled = true;
			if($('cust_p_hang_date') != null)
				$('cust_p_hang_date').disabled = true;
			if($('line1') != null)
				$('line1').disabled = true;
			if($('line2') != null)
				$('line2').disabled = true;
			if($('line3') != null)
				$('line3').disabled = true;
		}
	}
}
// END CHECKBOX FUNCTION //-->

function checkEng(chk_box) {
	// Engraving
	var eng = document.getElementById('add_eng');
	var eng_style = document.getElementById('eng_style');
	var eng_line_one = document.getElementById('eng_line_one');
	var eng_line_one_two = document.getElementById('eng_line_one_two');
	var eng_line_two = document.getElementById('eng_line_two');
	// Engraving Plates
	var eng_plate = document.getElementById('add_eng_plate');
	var eng_plate_color = document.getElementById('eng_plate_color');
	var eng_plate_style = document.getElementById('eng_plate_style');
	var eng_plate_line_one = document.getElementById('eng_plate_line_one');
	var eng_plate_line_one_two = document.getElementById('eng_plate_line_one_two');
	var eng_plate_line_two = document.getElementById('eng_plate_line_two');
	
	if(eng != null) {
		if(eng.checked == true) {
			eng_style.disabled = false;
			eng_style.selectedIndex = 0;
			if(eng_line_one != null) {
				eng_line_one.disabled = false;
				eng_line_one.value = '';
			}
			if(eng_line_one_two != null) {
				eng_line_one_two.disabled = false;
				eng_line_one_two.value = '';
			}
			if(eng_line_two != null) {
				eng_line_two.disabled = false;
				eng_line_two.value = '';
			}
		} else {
			eng_style.disabled = true;
			eng_style.selectedIndex = 0;
			if(eng_line_one != null) {
				eng_line_one.disabled = true;
				eng_line_one.value = '';
			}
			if(eng_line_one_two != null) {
				eng_line_one_two.disabled = true;
				eng_line_one_two.value = '';
			}
			if(eng_line_two != null) {
				eng_line_two.disabled = true;
				eng_line_two.value = '';
			}
		}
	}
	
	if(eng_plate != null) {
		if(eng_plate.checked == true) {
			eng_plate_color.disabled = false;
			eng_plate_color.selectedIndex = 0;
			//eng_plate_style.disabled = false;
			//eng_plate_style.selectedIndex = 0;
			if(eng_plate_line_one != null) {
				eng_plate_line_one.disabled = false;
				eng_plate_line_one.value = '';
			}
			if(eng_plate_line_one_two != null) {
				eng_plate_line_one_two.disabled = false;
				eng_plate_line_one_two.value = '';
			}
			if(eng_plate_line_two != null) {
				eng_plate_line_two.disabled = false;
				eng_plate_line_two.value = '';
			}
		} else {
			eng_plate_color.disabled = true;
			eng_plate_color.selectedIndex = 0;
			//eng_plate_style.disabled = true;
			//eng_plate_style.selectedIndex = 0;
			if(eng_plate_line_one != null) {
				eng_plate_line_one.disabled = true;
				eng_plate_line_one.value = '';
			}
			if(eng_plate_line_one_two != null) {
				eng_plate_line_one_two.disabled = true;
				eng_plate_line_one_two.value = '';
			}
			if(eng_plate_line_two != null) {
				eng_plate_line_two.disabled = true;
				eng_plate_line_two.value = '';
			}
		}
	}
}

// CANDY SUBCALCULATION //-->
function calcCandySub(is_tin) {
	if(is_tin) {
		var t1_start = Number(document.getElementById('t1_start').value);
		var t1_price = Number(document.getElementById('t1_price').value);
		var t2_price = Number(document.getElementById('t2_price').value);
		
		var tin1_size = document.getElementById('30-Tin 1');
		var tin2_size = document.getElementById('30-Tin 2');
		var tin3_size = document.getElementById('30-Tin 3');
	} else {
		var t1_start = Number(document.getElementById('t1_start').value);
		var t1_price = Number(document.getElementById('t1_price').value);
	}
	
	// Quantity
	var qty = Number(document.getElementById('quantity').value);
	if(qty < t1_start) {
		alert("Please enter a valid Item Quantity. Minimum order of " + t1_start + " orders.");  return;
	} else {
		if(is_tin) {
			var subtotal = parseFloat("0.00");
			if(tin1_size != null) {
				if(tin1_size.value == "") {
					alert("Please select a Tin Size.\n"); return;
				} else {
					if(tin1_size.value.indexOf('Large') != -1) {
						subtotal = (qty * t2_price);
					} else {
						subtotal = (qty * t1_price);
					}
				}
			}
			
			if(tin2_size != null) {
				if(tin2_size.value == "") {
					alert("Please select a Tin Size.\n"); return;
				} else {
					if(tin2_size.value.indexOf('Large') != -1) {
						subtotal = (qty * t2_price);
					} else {
						subtotal = (qty * t1_price);
					}
				}
			}
			
			if(tin3_size != null) {
				if(tin3_size.value == "") {
					alert("Please select a Tin Size.\n"); return;
				} else {
					if(tin3_size.value.indexOf('Large') != -1) {
						subtotal = (qty * t2_price);
					} else {
						subtotal = (qty * t1_price);
					}
				}
			}
			
			var ttl_str = '<table width="95%" align="center" cellpadding="0" cellspacing="0" border="0">' +
					  '    <tr>' +
					  '        <td width="50%" align="left"><b>Item Subtotal:</b></td>' + 
					  '        <td width="50%" align="right">$' + subtotal.toFixed(2) + '</td>' + 
					  '    </tr>' +
					  '</table>';
		
			Dialog.alert(ttl_str, {windowParameters: {width: 200, className: "alphacube"}})
		} else {
			var subtotal = parseFloat("0.00");
			subtotal = (qty * t1_price);				
			// Store favor subtotal.
			var ttl_str = '<table width="95%" align="center" cellpadding="0" cellspacing="0" border="0">' +
					  '    <tr>' +
					  '        <td width="50%" align="left"><b>Item Subtotal:</b></td>' + 
					  '        <td width="50%" align="right">$' + subtotal.toFixed(2) + '</td>' + 
					  '    </tr>' +
					  '</table>';
		
			Dialog.alert(ttl_str, {windowParameters: {width: 200, className: "alphacube"}})
		}
	}
	
}
// END CANDY SUBCALC //-->

// PRODUCT SUBCALCULATION //-->
function calcProdSub() {
	var error = "";
	var t_count = document.getElementById('tier_count');
	
	switch(Number(t_count.value)) {
		case 1:
			var t1_start = Number(document.getElementById('t1_start').value);
			var t1_end = Number(document.getElementById('t1_end').value);
			var t1_price = Number(document.getElementById('t1_price').value);
			break;
		case 2:
			var t1_start = Number(document.getElementById('t1_start').value);
			var t1_end = Number(document.getElementById('t1_end').value);
			var t1_price = Number(document.getElementById('t1_price').value);
			var t2_start = Number(document.getElementById('t2_start').value);
			var t2_end = Number(document.getElementById('t2_end').value);
			var t2_price = Number(document.getElementById('t2_price').value);
			break;
		case 3:
			var t1_start = Number(document.getElementById('t1_start').value);
			var t1_end = Number(document.getElementById('t1_end').value);
			var t1_price = Number(document.getElementById('t1_price').value);
			var t2_start = Number(document.getElementById('t2_start').value);
			var t2_end = Number(document.getElementById('t2_end').value);
			var t2_price = Number(document.getElementById('t2_price').value);
			var t3_start = Number(document.getElementById('t3_start').value);
			var t3_end = Number(document.getElementById('t3_end').value);
			var t3_price = Number(document.getElementById('t3_price').value);
			break;
		case 4:
			var t1_start = Number(document.getElementById('t1_start').value);
			var t1_end = Number(document.getElementById('t1_end').value);
			var t1_price = Number(document.getElementById('t1_price').value);
			var t2_start = Number(document.getElementById('t2_start').value);
			var t2_end = Number(document.getElementById('t2_end').value);
			var t2_price = Number(document.getElementById('t2_price').value);
			var t3_start = Number(document.getElementById('t3_start').value);
			var t3_end = Number(document.getElementById('t3_end').value);
			var t3_price = Number(document.getElementById('t3_price').value);
			var t4_start = Number(document.getElementById('t4_start').value);
			var t4_end = Number(document.getElementById('t4_end').value);
			var t4_price = Number(document.getElementById('t4_price').value);
			break;
	}
	
	// Get all possible tag prices.
	var pbt_price = Number(document.getElementById('pbt_price').value);
	var pbt_price_each = Number(document.getElementById('pbt_price_each').value);
	var mst_price = Number(document.getElementById('mst_price').value);
	var mpt_price = Number(document.getElementById('mpt_price').value);
	var cpt_price = Number(document.getElementById('cpt_price').value);
	var cpht_price = Number(document.getElementById('cpht_price').value);
	var eng_price = Number(document.getElementById('eng_price').value);
	var eng_plate_price = Number(document.getElementById('eng_plate_price').value);
	if(document.getElementById('tag_surcharge') != null && document.getElementById('tag_surcharge').disabled == false){
		var tag_surcharge = Number(document.getElementById('tag_surcharge').value);
	}
	// Is Set? and Set Quantity.
	var is_set = document.getElementById('is_set').value;
	var set_num = Number(document.getElementById('set_num').value);
	
	// Quantity
	var qty = Number(document.getElementById('quantity').value);
	// Bringing in some form items for validation.  Don't want to calculate a subtotal with incorrect 
	// quantities.
	// Tag check boxes
	var pb_tag = document.getElementById('add_p_box_tag');
	var mp_tag = document.getElementById('add_match_p_tag');
	var cp_tag = document.getElementById('add_cust_p_tag');
	var cph_tag = document.getElementById('add_cust_p_hang_tag');
	var cph_qty = document.getElementById('cust_p_hang_amount');
	// Engraving & Engraving Plate Checkboxes
	var eng = document.getElementById('add_eng');
	var eng_plate = document.getElementById('add_eng_plate');
	
	// Now we start to check quantity. First we see if the quantity box is empty, if not move on.
	if(document.getElementById('quantity').value == "") {
		if(is_set == "true") {
			alert("Please enter a Item Quantity. Minimum quantity of " + t1_start + " sets is required."); return;
		} else {
			alert("Please enter a Item Quantity. Minimum quantity of " + t1_start + " is required."); return;
		}
	} else {
		if(qty < t1_start) {
			if(is_set == "true") {
				alert("Please enter a Item Quantity. Minimum quantity of " + t1_start + " sets is required."); return;
			} else {
				alert("Please enter a Item Quantity. Minimum quantity of " + t1_start + " is required."); return;
			}
		}
		
		// Now we check to see if any tags are added. If they are, then the quantity needs to be 24 or more.
		if(pb_tag != null && pb_tag.checked) {
			if(is_set == "true") {
				if((qty * set_num) < 24) {
					alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of " + (24 / set_num) + " sets."); return;
				}
			} else {
				if(qty < 24) { alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of 24 items.");  return; }
			}
		} else if(mp_tag != null && mp_tag.checked) {
			if(is_set == "true") {
				if((qty * set_num) < 24) {
					alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of " + (24 / set_num) + " sets."); return;
				}
			} else {
				if(qty < 24) { alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of 24 items.");  return; }
			}
		} else if(cp_tag != null && cp_tag.checked) {
			if(is_set == "true") {
				if((qty * set_num) < 24) {
					alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of " + (24 / set_num) + " sets."); return;
				}
			} else {
				if(qty < 24) { alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of 24 items.");  return; }
			}
		} else {
			if(cph_qty != null && cph_qty.value == "" && cph_tag.checked) { alert("Please enter a Custom Personality Hang Tag Quantity.\n"); return; }
			else {
				if(qty < t1_start) {
					if(is_set == "true") {
						alert("Please enter a Item Quantity.\nTags require a minimum quantity of " + t1_start + " sets is required."); return;
					} else {						
						alert("Please enter a valid Item Quantity.\nTags require a minimum quantity of " + t1_start + " is required.");  return;
					}
				}
			}
		}
	}	
	// Now if the correct values are entered, proceed.  First we will figure the subtotal without tags included.
	// Need to find what tier the qty exists in.
	var subtotal = parseFloat("0.00");
	switch(Number(t_count.value)) {
		case 1:
			// Since we have gotten this far, obviously the qty is correct. So we simply figure the subtotal.
			subtotal = (qty * t1_price);
			break;
		case 2:
			if(qty >= t1_start && qty <= t1_end) {
				subtotal = (qty * t1_price);
			} else {
				subtotal = (qty * t2_price);
			}
			break;
		case 3:
			if(qty >= t1_start && qty <= t1_end) {
				subtotal = (qty * t1_price);
			} else if(qty >= t2_start && qty <= t2_end) {
				subtotal = (qty * t2_price);
			} else {
				subtotal = (qty * t3_price);
			}
			break;
		case 4:
			if(qty >= t1_start && qty <= t1_end) {
				subtotal = (qty * t1_price);
			} else if(qty >= t2_start && qty <= t2_end) {
				subtotal = (qty * t2_price);
			} else if(qty >= t3_start && qty <= t3_end) {
				subtotal = (qty * t3_price);
			} else {
				subtotal = (qty * t4_price);
			}
			break;
	}
	
	// Now check to see if any tags are selected.
	var tag_subtotal = parseFloat("0.00");
	if(pb_tag != null && pb_tag.checked) {
		if(is_set == "true") {
			tag_subtotal = ((qty * set_num) * pbt_price_each);
		} else {
			tag_subtotal = (qty * pbt_price);
		}
	} else if(mp_tag != null && mp_tag.checked) {
		if(is_set == "true") {
			tag_subtotal = ((qty * set_num) * mpt_price);
		} else {
			tag_subtotal = (qty * mpt_price);
		}
	} else if(cp_tag != null && cp_tag.checked) {
		if(is_set == "true") {
			tag_subtotal = ((qty * set_num) * cpt_price);
		} else {
			tag_subtotal = (qty * cpt_price);
		}
	} else if(cph_tag != null && cph_tag.checked) {
		var cph_qty = Number(document.getElementById('cust_p_hang_amount').value);
		tag_subtotal = (cph_qty * cpht_price);
	}
	
	// Added 10-21-2009 Check for surcharge in new tag_admin and add on accordingly.
	if(tag_surcharge != null && tag_surcharge > 0){
		tag_subtotal = tag_subtotal + tag_surcharge;
	}
	
	// Now figure engraving totals
	var eng_subtotal = parseFloat("0.00");
	var eng_plate_subtotal = parseFloat("0.00");
	if(eng != null && eng.checked) {
		eng_subtotal = eng_price;
	} else if(eng_plate != null && eng_plate.checked) {
		eng_plate_subtotal = eng_plate_price;
	}
	
	if(tag_subtotal == 0) {
		var total = subtotal;
		var ttl_str = '<table width="95%" align="center" cellpadding="0" cellspacing="0" border="0">' +
					  '    <tr>' +
					  '        <td width="80%" align="left"><b>Item Subtotal:</b></td>' + 
					  '        <td width="20%" align="right">$' + subtotal.toFixed(2) + '</td>' + 
					  '    </tr>';
					  
		if(eng_subtotal != 0) {
			total += eng_subtotal;
			ttl_str +=  '    <tr>' +
					    '        <td width="80%" align="left"><b>Engraving Subtotal:</b></td>' + 
					    '        <td width="20%" align="right">$' + eng_subtotal.toFixed(2) + '</td>' + 
					    '    </tr>';
		}
		if(eng_plate_subtotal != 0) {
			total += eng_plate_subtotal;
			ttl_str +=  '    <tr>' +
					    '        <td width="80%" align="left"><b>Engraving Plate Subtotal:</b></td>' + 
					    '        <td width="20%" align="right">$' + eng_plate_subtotal.toFixed(2) + '</td>' + 
					    '    </tr>';
		}
		
		   ttl_str += '    <tr>' +
					  '        <td width="100%" height="1" align="right" colspan="2" style="border-bottom:1px solid #666666;">&nbsp;</td>' +
					  '    </tr>' + 
					  '    <tr>' +
					  '        <td width="100%" height="1" align="right" colspan="2">&nbsp;</td>' +
					  '    </tr>' + 
					  '    <tr>' +
					  '        <td width="80%" align="left"><b>Total:</b></td>' + 
					  '        <td width="20%" align="right">$' + total.toFixed(2) + '</td>' + 
					  '    </tr>' +
					  '</table>';
		
		Dialog.alert(ttl_str, {windowParameters: {width: 260, className: "alphacube"}})
	} else {
		var total = subtotal + tag_subtotal;
		var ttl_str = '<table width="95%" align="center" cellpadding="0" cellspacing="0" border="0">' +
					  '    <tr>' +
					  '        <td width="80%" align="left"><b>Item Subtotal:</b></td>' + 
					  '        <td width="20%" align="right">$' + subtotal.toFixed(2) + '</td>' + 
					  '    </tr>' +
					  '    <tr>' +
					  '        <td width="80%" align="left"><b>Tag Subtotal:</b></td>' + 
					  '        <td width="20%" align="right">$' + tag_subtotal.toFixed(2) + '</td>' + 
					  '    </tr>';
		
		if(eng_subtotal != 0) {
			total += eng_subtotal;
			ttl_str +=  '    <tr>' +
					    '        <td width="80%" align="left"><b>Engraving Subtotal:</b></td>' + 
					    '        <td width="20%" align="right">$' + eng_subtotal.toFixed(2) + '</td>' + 
					    '    </tr>';
		}
		if(eng_plate_subtotal != 0) {
			total += eng_plate_subtotal;
			ttl_str +=  '    <tr>' +
					    '        <td width="80%" align="left"><b>Engraving Plate Subtotal:</b></td>' + 
					    '        <td width="20%" align="right">$' + eng_plate_subtotal.toFixed(2) + '</td>' + 
					    '    </tr>';
		}
		
		   ttl_str += '    <tr>' +
					  '        <td width="100%" height="1" align="right" colspan="2" style="border-bottom:1px solid #666666;">&nbsp;</td>' +
					  '    </tr>' + 
					  '    <tr>' +
					  '        <td width="100%" height="1" align="right" colspan="2">&nbsp;</td>' +
					  '    </tr>' + 
					  '    <tr>' +
					  '        <td width="80%" align="left"><b>Total:</b></td>' + 
					  '        <td width="20%" align="right">$' + total.toFixed(2) + '</td>' + 
					  '    </tr>' +
					  '</table>';
		
		Dialog.alert(ttl_str, {windowParameters: {width: 260, className: "alphacube"}})
	}
}
// END PRODUCT SUBCALCULATION //-->
