function so_clearInnerHTML(obj) {
	// perform a shallow clone on obj
	nObj = obj.cloneNode(false);
	// insert the cloned object into the DOM before the original one
	obj.parentNode.insertBefore(nObj,obj);
	// remove the original object
	obj.parentNode.removeChild(obj);
}

/* Requiers Prototype */
function calculateTotal()
{               
	//get a handle on user quantity input
	var qPhHandle = $("quantity-ph");
	var qBtvHandle = $("quantity-btv");
	var qTufHandle = $("quantity-tuf");
	var country = $("country");

	//set currency value
	var exchangeRate = 1;
    var pricePh = 25;
    var priceBtv = 25;
    var priceTuf = 25;
    var postage = (country.value == "CAN") ? 2 : 2;
	var shipping1 = (country.value == "CAN") ? 8 : 10;
	
	//if user inputs a character, number = 0 else take absolute value of integer
	var qph  = isNaN(qPhHandle.value)  ? 0 : Math.floor(Math.abs(qPhHandle.value));
	var qbtv = isNaN(qBtvHandle.value) ? 0 : Math.floor(Math.abs(qBtvHandle.value));
	var qtuf = isNaN(qTufHandle.value) ? 0 : Math.floor(Math.abs(qTufHandle.value));
	
	//correct input field
	qPhHandle.value = qph;
	qBtvHandle.value = qbtv;
	qTufHandle.value = qtuf;
	
	//calculate totals
	var tnph  = (country.value == "CAN") ? qph * pricePh  : qph * pricePh  * exchangeRate;
	var tnbtv = (country.value == "CAN") ? qbtv * priceBtv : qbtv * priceBtv * exchangeRate;
	var tntuf = (country.value == "CAN") ? qtuf * priceTuf : qtuf * priceTuf * exchangeRate;
	
	//Calculate and Print "Paradox & Healing" Price
	so_clearInnerHTML($("totalPrice-ph"));
	var p = document.createTextNode(Number(tnph).toFixed(2));
	// append price to an already existing element.
	$("totalPrice-ph").appendChild(p);
	
	//Calculate and Print "Braving the Void" Price
	so_clearInnerHTML($("totalPrice-btv"));
	var p = document.createTextNode(Number(tnbtv).toFixed(2));
	// append price to an already existing element.
	$("totalPrice-btv").appendChild(p);
	
	//Calculate and Print "The Unbroken Field" Price
	so_clearInnerHTML($("totalPrice-tuf"));
	var p = document.createTextNode(Number(tntuf).toFixed(2));
	// append price to an already existing element.
	$("totalPrice-tuf").appendChild(p);
	
	//calculates and prints shipping 1
	var i = shipping1;
	so_clearInnerHTML($("shipping1"));
	var p = document.createTextNode(i.toFixed(2));
	// append price to an already existing element.
	$("shipping1").appendChild(p);
	
	//calculates and prints shipping 2
	var i = postage * (qph + qbtv + qtuf -1);
	so_clearInnerHTML($("shipping2"));
	var p = document.createTextNode(i.toFixed(2));
	// append price to an already existing element.
	$("shipping2").appendChild(p);
	
	//calculates and prints grand total
	var t = Number(tnph) + Number(tnbtv) + Number(tntuf) + Number(shipping1) + Number(i.toFixed(2));
	so_clearInnerHTML($("total"));
	var p = document.createTextNode(t.toFixed(2));
	// append price to an already existing element.
	$("total").appendChild(p);
}