//mchk makes sure when a workshop is selected that a payment method is also selected
var mchk = 0;

/*This function sets the price of the workshop and sets the description for the reciept.
  If an additional workshop is added (like maybe one for csfss2), make sure to add two lines like the ones between
  the dashes, under the switch(m) statement.
  ---------------------------------------------------------------------------------------------------------------
  case "BUTTON VALUE":
  desc = workshop[490000]
  ---------------------------------------------------------------------------------------------------------------
  The number inside the brackets will be determined by where you added it to the workshop descriptions at the top of the
  script.
*/
function WhitePrice(){
//m is a placeholder for the registration value
//c is the Standard Cost of the workshops
var ecom = document.whitepaper;
var c = 0;

if (ecom.memberdevcmsolution.checked == true) 
{
c = c + 19.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Developing Your Content-Management Solution, ";
}

if (ecom.memberoffshoreinfodev.checked == true) 
{
c = c + 151.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Information Development in China and India, ";
}

if (ecom.memberorgstructures.checked == true) 
{
c = c + 151.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Organizational Structure White Paper, ";
}

if (ecom.memberoutsourcebuscase.checked == true) 
{
c = c + 67.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Making a Business Case for Outsourcing, ";
}

if (ecom.memberratios.checked == true) 
{
c = c + 36.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Ratios White Paper, ";
}

if (ecom.membertranslation.checked == true) 
{
c = c + 151.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Translation and Localization White Paper, ";
}

if (ecom.memberucdbuscase.checked == true) 
{
c = c + 151.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Making a Business Case for User-Centered Design, ";
}

if (ecom.nonmemberdevcmsolution.checked == true) 
{
c = c + 27.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Developing Your Content-Management Solution, ";
}

if (ecom.nonmemberoffshoreinfodev.checked == true) 
{
c = c + 297.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Information Development in China and India (NM), ";
}

if (ecom.nonmemberorgstructures.checked == true) 
{
c = c + 297.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Organizational Structure White Paper (NM), ";
}

if (ecom.nonmemberoutsourcebuscase.checked == true) 
{
c = c + 97.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Making a Business Case for Outsourcing (NM), ";
}

if (ecom.nonmemberratios.checked == true) 
{
c = c + 52.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Ratios White Paper (NM), ";
}

if (ecom.nonmembertranslation.checked == true) 
{
c = c + 297.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Translation and Localization White Paper (NM), ";
}

if (ecom.nonmemberucdbuscase.checked == true) 
{
c = c + 297.50;
ecom.DESCRIPTION.value = ecom.DESCRIPTION.value+"Making a Business Case for User-Centered Design (NM), ";
}


ecom.AMOUNT.value = c;

if(mchk != 0){
	payment();
}
	else{
		alert("You must choose a payment method");
	}
}

//This function handles the payment method, whether they are going to use e-commerce or register via e-mail
function payment(){
var ecom = document.whitepaper;
for(i=0; i<ecom.METHOD.length; i++){

	if(ecom.METHOD[i].checked == true){
		break;
	}
}

if(ecom.NAME.value != null){
	if(ecom.METHOD[i].value=='CC'){
			ecom.action = "https://payments.verisign.com/payflowlink";
	}
		else{
			ecom.action="http://www.infomanagementcenter.com/cgi/merge.pl/emerge/whitepapers/text.html"
		}
	}
	else{
		alert("You must enter your name");
	}

ecom.submit()
}

/*function billing(){
var ecom = document.whitepaper;
var c = 0;
var result = 0;
if(ecom.samebill.checked == true){
	ecom.NAME.value = ecom.NAMETOSHIP.value;
	ecom.ADDRESS.value = ecom.ADDRESSTOSHIP.value;
	ecom.CITY.value = ecom.CITYTOSHIP.value;
	ecom.STATE.value = ecom.STATETOSHIP.value;
	ecom.ZIP.value = ecom.ZIPTOSHIP.value;
	ecom.COUNTRY.value = ecom.COUNTRYTOSHIP.value;
	ecom.EMAIL.value = ecom.EMAILTOSHIP.value;
	ecom.PHONE.value = ecom.PHONETOSHIP.value;
}
else{
	ecom.NAME.value = "";
	ecom.ADDRESS.value = "";
	ecom.CITY.value = "";
	ecom.STATE.value = "";
	ecom.ZIP.value = "";
	ecom.COUNTRY.value = "";
	ecom.EMAIL.value = "";
	ecom.PHONE.value = "";
}
}*/

function total(){
var ecom = document.whitepaper;
var c = 0;

if (ecom.memberdevcmsolution.checked == true) 
{
c = c + 19.50;
}

if (ecom.memberoffshoreinfodev.checked == true) 
{
c = c + 151.50;
}

if (ecom.memberorgstructures.checked == true) 
{
c = c + 151.50;
}

if (ecom.memberoutsourcebuscase.checked == true) 
{
c = c + 67.50;
}

if (ecom.memberratios.checked == true) 
{
c = c + 36.50;
}

if (ecom.membertranslation.checked == true) 
{
c = c + 151.50;
}

if (ecom.memberucdbuscase.checked == true) 
{
c = c + 151.50;
}

if (ecom.nonmemberdevcmsolution.checked == true) 
{
c = c + 27.50;
}

if (ecom.nonmemberoffshoreinfodev.checked == true) 
{
c = c + 297.50;
}

if (ecom.nonmemberorgstructures.checked == true) 
{
c = c + 297.50;
}

if (ecom.nonmemberoutsourcebuscase.checked == true) 
{
c = c + 97.50;
}

if (ecom.nonmemberratios.checked == true) 
{
c = c + 52.50;
}

if (ecom.nonmembertranslation.checked == true) 
{
c = c + 297.50;
}

if (ecom.nonmemberucdbuscase.checked == true) 
{
c = c + 297.50;
}

result = c.toFixed(2);

alert("Your current total is: $" + result);
}
