function bubbleUp(theEl,theTag) {
	// Returns first tag of type "theTag" that contains theEl
	while(theEl.tagName!=theTag && theEl.tagName!="BODY") {
		theEl = theEl.parentNode;
	}
	if (theEl.tagName==theTag) return theEl;
	return false;
}

function lpSwitchPrice(theRadio,cartonQty) {
	// get the correct form
	theForm = bubbleUp(theRadio,"FORM");

	// get the product name
	theProdName = theForm.prodNameHolder.value;

	// figure out the correct price and name from radio buttons
	thePrice = 0;
	theRadio = theForm.priceType;
	if (theRadio[0].checked==true) {thePrice=theRadio[0].value; }
	if (theRadio[1].checked==true) {thePrice=theRadio[1].value; theProdName +=" (Carton of "+cartonQty+")";}

	// Fill in hidden fields
	theForm.PRICE0.value = thePrice;
	theForm.PRODNAME0.value = theProdName;
	theForm.OPT50.value = theProdName;
}