// Course registration and payment routine

//global parameters
var mbr_amt=0, guest_amt= 0, total=0;
var guest_choice = false;

function Dollar (val) {  // force to valid dollar amount
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  // for old Netscape browsers
  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function CalcTotalMbr (obj1) {
//find out totals
 var val=0 ;
 
{ 
//check membership level 
for (j=0; j<obj1.memlevel.length; j++) {  // run all options
    if (obj1.memlevel[j].checked) 
     {val = obj1.memlevel[j].value;}       // selected value (default)
}

switch(val)
{
case (val = "90"):
  mbr_amt= 90;
  obj1.item_name.value = "Envisioning Enlightened Appearance - Course Registration. Deposit $90";
  break    
case (val = "275"):
   mbr_amt= 275
  obj1.item_name.value = "Envisioning Enlightened Appearance - Course Registration. Full course fee $275";
  break
default:
   mbr_amt= 90
  obj1.mbr_item_name.value = "Envisioning Enlightened Appearance - Course Registration. Deposit $90";
}//end of switch

 total = (mbr_amt*1) ;
obj1.amount.value = Dollar (total);

}//end of membership check


}


function ReadForm (obj1){
//I added this function so that you can see how the information is passed in the button code
//to PayPal and listed in the transaction details as well as email out the information.
//You could do this in the script you send the information to.

obj1.on0.value= "Entries";

obj1.amount.disabled = false;
total = (mbr_amt*1);
obj1.amount.value = Dollar (total);   
//obj1.on0.value= "Entries";
//obj1.os0.value = "Name: "+ obj1.first_name.value + " " + obj1.last_name.value + ", " +
//obj1.address1.value + obj1.address2.value + ", " + obj1.city.value + " " + obj1.state.value + " " + obj1.zip.value + obj1.country.value +
//" Phone: " + obj1.night_phone_a.value + "-" +obj1.night_phone_b.value+"-" +obj1.night_phone_c.value +
//" Email: " + obj1.email.value;

//add the gift recipient information
//if (obj1.gift.checked){
//obj1.os0.value = obj1.os0.value + " Gift To: " + obj1.rec_first_name.value + " " + obj1.rec_last_name.value + ", " +
//obj1.rec_address.value + ", " + obj1.rec_city.value + " " + obj1.rec_state.value + " " + obj1.rec_zip.value;
//}

}//end of readform
