//xt-hardwire alternative message for the gift wrapping service

function confirmService(itemForm)
{
	var prMessage = requiredProperty;
	var prIDs = "";
	if(itemForm.properties) {
		prIDs = itemForm.properties.value;
	}
	if (prIDs != "") {
		var properties = prIDs.split(",");
		var productName = itemForm.elements["item_name"].value;
		for ( var i = 0; i < properties.length; i++) {
			var prID = properties[i];
			var prRequired = itemForm.elements["property_required_" + prID].value;
			if(prRequired == 1) {
				var prValue = "";
				var prControl = itemForm.elements["property_control_" + prID].value;
				if (prControl == "LISTBOX") {
					prValue = itemForm.elements["property_" + prID].options[itemForm.elements["property_" + prID].selectedIndex].value;
				} else if (prControl == "RADIOBUTTON") {
					var radioControl = itemForm.elements["property_" + prID];
					if (radioControl.length) {
						for ( var ri = 0; ri < radioControl.length; ri++) {
							if (radioControl[ri].checked) {
								prValue = radioControl[ri].value;
								break;
							}
						}
					} else {
						if (radioControl.checked) {
							prValue = radioControl.value;
						}
					}
				} else if (prControl == "CHECKBOXLIST") {
					if (itemForm.elements["property_total_" + prID]) {
						var totalOptions = parseInt(itemForm.elements["property_total_" + prID].value);
						for ( var ci = 1; ci <= totalOptions; ci++) {
							if (itemForm.elements["property_" + prID + "_" + ci].checked) {
								prValue = 1;
								break;
							}
						}
					} 
				} else {
					prValue = itemForm.elements["property_" + prID].value;
				}
				if(prValue == "") {
					var propertyName = itemForm.elements["property_name_" + prID].value;
					prMessage = prMessage.replace("\{property_name\}", propertyName);
					prMessage = prMessage.replace("\{product_name\}", productName);
					alert(prMessage);	
					if (prControl != "RADIOBUTTON" && prControl != "CHECKBOXLIST") {
						itemForm.elements["property_" + prID].focus();
					}
					return false;
				}
			}
		}
	}

	if (confirmAdd == "1") {
		return confirm("add this service to you order.");
	} else {
		return true;
	}
}
