function cf(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if (i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

function calcTempDonation(){ 
	var tAmt = String(document.getElementById("p_amount").value);
	
	if ((tAmt == 0) || (tAmt == '') || (String(parseFloat(tAmt)) == 'NaN')) {
		totAmt = 0;	dAmt = "Please enter a valid donation amount!";
		document.getElementById("p_amount").focus();
		document.getElementById("btnSubmit").disabled = true;
	} else {
		oAmt = tAmt;
		if (tAmt.indexOf(".") > 0) { sAmt = tAmt.replace(".", ""); sAmt = (sAmt * 0.03) / 100; 
		} else { sAmt = ((tAmt * 100) * 0.03) / 100; }
		feeAmt = Math.round(sAmt * 100) / 100;
		totAmt = parseFloat(tAmt) + feeAmt;
		dAmt = "<br /><span style=\"font-size: 12px;\">PayPal Donation: <b>$" + cf(totAmt) + "</b></span><br /><span style=\"font-size: 11px; color: #FFFFFF;\">Donation + Fee: $" + cf(tAmt) + " + $" + cf(feeAmt) + " (3%)</span>";
	}
	
	document.getElementById("d_amount").innerHTML = dAmt;
}

function changeCountry(tValue) {
	var selSubmiss = document.getElementById(tValue.id);
	var selIdx = selSubmiss.selectedIndex;
	document.getElementById("cCountryName").value = selSubmiss[selIdx].innerHTML;
}

function showp(tValue) {

	var anchors = document.getElementsByTagName("div");
	for (var i=0; i < anchors.length; i++){
		var anchor = anchors[i];
		if (anchor.getAttribute("rel") == "mItem"){
			document.getElementById(anchor.getAttribute("id")).style.display = 'none';
		}
	}
	document.getElementById("mItem" + tValue).style.display = 'block';	
}

function selectSubmission(tValue) {
	var selSubmiss = document.getElementById(tValue.id);
	var selIdx = selSubmiss.selectedIndex;
	
	if (selIdx == 1) {
		document.getElementById("delegateSection").style.display = 'block';	
	} else {
		document.getElementById("delegateSection").style.display = 'none';
	}
}