// JavaScript Document

function selectPlanPrice(val)
{
	if (val == 'pro') 
	{
		document.getElementById('totalPriceID').innerHTML = 'Total - $149';
		document.getElementById('secondFinalTotalID').innerHTML = 'Total - $149';
		document.getElementById('totalPriceHidden').value = '149';
		document.getElementById('howManyPagesID').value = '';
		document.getElementById('finalAmtValID').value = '149';
		uncheckAll();

	} else if (val == 'standard')
	{
		document.getElementById('totalPriceID').innerHTML = 'Total - $75';
		document.getElementById('secondFinalTotalID').innerHTML = 'Total - $75';
		document.getElementById('totalPriceHidden').value = '75';
		document.getElementById('howManyPagesID').value = '';
		document.getElementById('finalAmtValID').value = '75';

		uncheckAll();
	} else if (val == 'high')
	{
		document.getElementById('totalPriceID').innerHTML = 'Total - $249';
		document.getElementById('secondFinalTotalID').innerHTML = 'Total - $249';
		document.getElementById('totalPriceHidden').value = '249';
		document.getElementById('howManyPagesID').value = '';
		document.getElementById('finalAmtValID').value = '249';

		uncheckAll();
	}
}



function changeTotalPrice(val)
{
	var totalValue =  parseInt(document.getElementById('totalPriceHidden').value);
	var numberOfPages =  val;
	
	var halfValue = totalValue / 2;

	var finalPrice = totalValue + ( halfValue * (numberOfPages-1));

	document.getElementById('totalPriceHidden').value = finalPrice;
	document.getElementById('totalPriceID').innerHTML = 'Total -$' + finalPrice;
	document.getElementById('secondFinalTotalID').innerHTML = 'Total - $' + finalPrice;
	document.getElementById('finalAmtValID').value = finalPrice;

}

function optionsAddedToFinal(val, n)
{
	
	if (document.forms['checkBoxesFormID'].options[n].checked == false)	
	{

		var totalValue =  parseInt(document.getElementById('totalPriceHidden').value);
	var fieldVal = parseInt(val);
	var finalPriceWithOptions = totalValue - fieldVal;
	document.getElementById('totalPriceHidden').value = finalPriceWithOptions;

	document.getElementById('totalPriceID').innerHTML = 'Total -$' + finalPriceWithOptions;
	document.getElementById('secondFinalTotalID').innerHTML = 'Total - $' + finalPriceWithOptions;
	document.getElementById('finalAmtValID').value = finalPriceWithOptions;
			
			} else {
var totalValue =  parseInt(document.getElementById('totalPriceHidden').value);
	var fieldVal = parseInt(val);
	var finalPriceWithOptions = totalValue + fieldVal;
	document.getElementById('totalPriceHidden').value = finalPriceWithOptions;

	document.getElementById('totalPriceID').innerHTML = 'Total -$' + finalPriceWithOptions;
	document.getElementById('secondFinalTotalID').innerHTML = 'Total - $' + finalPriceWithOptions;
	document.getElementById('finalAmtValID').value = finalPriceWithOptions;
	}

	

}

function uncheckAll()
{
	

	for (i=0;i<35;i++) {
       document.forms['checkBoxesFormID'].options[i].checked=false;
      
     }


}

function validateForm()
{

	
var email = document.getElementById('frmEmailPaymentID').value;
var frmNamePayment = document.getElementById('frmNamePayment').value;

if (frmNamePayment == '')
	{
	alert("Please enter Name");
	return false;
	}
if (email == '')
	{
	alert("Please enter valid email");
	return false;
	}
	
return true;
}