function submitPaymentsForm(){

	var f = document.forms['CheckoutForm'];
	// disable the submit button (not an actual submit button, but our button)
  
	if(getCheckedValue(document.forms['CheckoutForm'].elements['paymentOption'])==""){
		alert("Please select a payment option");
	}else{
		f.button.disabled = true;
  
  		var sel = getCheckedValue(document.forms['CheckoutForm'].elements['paymentOption'])

		if(getCheckedValue(document.forms['CheckoutForm'].elements['paymentOption'])=="PAYPAL_WPS"){
			document.forms['PayPalWPSForm'].submit();
		}else {
			f.button.disabled = false;
			//document.getElementById('button').disabled = true;
			//document.forms['CheckoutForm'].paymentOption.value = sel;
			//document.forms['CheckoutForm'].button.value = "Proceed To Payments";
			//document.forms['CheckoutForm'].submit();
		}
	}
}



function choose_plan(planname) {
	document.getElementById('shopping-cart-basic-td').style.backgroundColor = '#ffffff';
	document.getElementById('shopping-cart-advanced-td').style.backgroundColor = '#ffffff';
	document.getElementById('eshop-starter-td').style.backgroundColor = '#ffffff';
	document.getElementById('eshop-standard-td').style.backgroundColor = '#ffffff';
	document.getElementById('eshop-advanced-td').style.backgroundColor = '#ffffff';

	if(document.getElementById(planname+ '-td')) {
		document.getElementById(planname+ '-td').style.backgroundColor = '#eeeeee';
		document.getElementById(planname).checked = 'checked';
  	}
}

function submitForm(formName){
	var f = document.forms[formName];
	// disable the submit button (not an actual submit button, but our button)  
	f.button.disabled = true;
	document.forms[formName].submit();
}

function submitForm2(formName){
	var f = document.forms[formName];
	// disable the submit button (not an actual submit button, but our button)  
	f.btn.disabled = true;
	document.forms[formName].submit();
}


function submitPayPalDoSaleForm(){
	alert("called");
	var f = document.forms['PayPalDoSaleForm'];
	// disable the submit button (not an actual submit button, but our button)  
	alert("1");
	f.button.disabled = true;

	alert("2");
	document.forms['PayPalDoSaleForm'].submit();
}


function submitFormOrig(){

 var f = document.forms['CheckoutForm'];

  // disable the submit button (not an actual submit button, but our button)
  f.submitButton.disabled = true;
  
  
if(getCheckedValue(document.forms['CheckoutForm'].elements['paymentOption'])=="PayPalWPSOption"){
	document.forms['PayPalWPSForm'].submit();
}else{
	document.forms['CheckoutForm'].action="Go To Payments";
	document.forms['CheckoutForm'].submit();
}

}


function getCheckedValue(radioObj) {

	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}	