function preselect() {
	localText = '';
	document.ppform.amount.options[0].selected = true;
   	document.ppform.on0.value = getPPOptions() + localText;
//	document.ppform.on0.value = document.ppform.amount.options[document.ppform.amount.selectedIndex].text;
	document.ppform.shipping.value = shippingArray[0];
}

function changePrice() {
	document.ppform.on0.value = getPPOptions();
	//document.ppform.on0.value = document.ppform.amount.options[document.ppform.amount.selectedIndex].text;
        document.ppform.shipping.value = shippingArray[document.ppform.amount.selectedIndex];
        document.ppform.shippingLocal.checked = false;
}

function getPPOptions() {
	    temp = "" + document.ppform.amount.options[document.ppform.amount.selectedIndex].text; // temporary holder
	    out = '£';
	    add = '';
	    while (temp.indexOf(out)>-1) {
	        pos= temp.indexOf(out);
	        temp = "" + (temp.substring(0, pos) + add + 
	        temp.substring((pos + out.length), temp.length));
	    }
	ppOptions = temp + ' (GBP)';
    return ppOptions
}


function checkLocal (){

	    if (document.ppform.shippingLocal.checked){
	    	localText = ' Local Pickup';
        	document.ppform.on0.value = getPPOptions() + localText;
//	        document.ppform.on0.value = document.ppform.amount.options[document.ppform.amount.selectedIndex].text + localText;
	    	document.ppform.shipping.value = 0;
	    }else{
	    localText = '';
       		document.ppform.on0.value = getPPOptions() + localText;
//	    	document.ppform.on0.value = document.ppform.amount.options[document.ppform.amount.selectedIndex].text + localText;
	    	if (document.ppform.flatRateShipping.value == 'true'){
	    	document.ppform.shipping.value = document.ppform.flatShippingCost.value;
	    	}else{
	    	document.ppform.shipping.value = shippingArray[document.ppform.amount.selectedIndex];
	    	}
	    }
}

function adjustVals (){
	if (document.ppform.localPickup.value == 'true' ){
	    if (document.ppform.shippingLocal.checked){
	    	document.ppform.shipping.value = 0;
	    }else{
	    	if (document.ppform.flatRateShipping.value == 'true'){
	    	document.ppform.shipping.value = document.ppform.flatShippingCost.value;
	    	}
	    }
	}else{
	    if (document.ppform.flatRateShipping.value == 'true'){
	    	document.ppform.shipping.value = document.ppform.flatShippingCost.value;
	    }
	}
}
function changeCurrencySign(sign) {
var add = "$";
	for (var i=0; i<document.ppform.amount.options.length; i++) {
	    out = "|"; // replace this
	    if (sign == "pounds"){
             add = "£"; // with this
            }
	    if (sign == "euros"){
             add = "€"; // with this
            }
	    if (sign == "yen"){
             add = "¥"; // with this
            }
	    if (sign == "dollars"){
             add = "$"; // with this
            }
            if (sign == ""){
             add = "und"; // with this
            }
	    temp = "" + document.ppform.amount.options[i].text; // temporary holder
	
	    while (temp.indexOf(out)>-1) {
	    pos= temp.indexOf(out);
	    temp = "" + (temp.substring(0, pos) + add + 
	    temp.substring((pos + out.length), temp.length));
	    }
	    document.ppform.amount.options[i].text = temp;	
	}
}
function createShipping(){
    shippingArray = [];   
}

function addShippingCost(cost){
    shippingArray.push(cost);
}
