docobj = this; var varamt = 0.00; var dxtype=0; function SetDonorSchemeInfo(str) { errorlst= ''; if (isNaN(str.value)) { alert("number of students (or amount) must only have numbers 0-9 - you have entered " + str.value); document.forms['inpdata'].item_name.value="One Time"; document.forms['inpdata'].a3.value="0.00"; document.forms['inpdata'].t3.selectedIndex=2; document.forms['inpdata'].srt.value=1; SetCommonField('item_name', 'High School'); SetCommonField('item_number', 'HighSchool'); str.focus(); return; } else { if (str.name == "openamount") { document.forms['inpdata'].hsstudent.value = 0; document.forms['inpdata'].dipstudent.value = 0; document.forms['inpdata'].profstudent.value = 0; } } dxval = 0.00; varamt = 0.00; dxtype=0; if (Number(document.forms['inpdata'].openamount.value) > 0) { document.forms['inpdata'].hsstudent.value = 0; document.forms['inpdata'].dipstudent.value = 0; document.forms['inpdata'].profstudent.value = 0; if (document.forms['inpdata'].t3.selectedIndex == 1) { SetCommonField('item_name', 'One Time - 12 Month Donation'); SetCommonField('item_number', 'OneTime12Mth'); // alert ("this is a one time 12 month plan"); } else { SetCommonField('item_name', 'One Time Donation'); SetCommonField('item_number', 'OneTime'); } } if (Number(document.forms['inpdata'].profstudent.value) > 0) { dxtype=dxtype+1; SetCommonField('item_name', 'Professional Courses'); SetCommonField('item_number', 'Profession'); } if (Number(document.forms['inpdata'].dipstudent.value) > 0) { dxtype=dxtype+1; SetCommonField('item_name', 'Diploma Courses'); SetCommonField('item_number', 'Diploma'); } if (Number(document.forms['inpdata'].hsstudent.value) > 0) { dxtype=dxtype+1; SetCommonField('item_name', 'High School'); SetCommonField('item_number', 'HighSchool'); } if (Number(document.forms['inpdata'].openamount.value) == 0) { if (dxtype > 1) { SetCommonField('item_name', 'Multiple Sponsorships'); SetCommonField('item_number', 'Multiple'); document.forms['inpdata'].t3.selectedIndex=1; } if (dxtype == 1) { document.forms['inpdata'].t3.selectedIndex=0; } if (dxtype < 1) { document.forms['inpdata'].t3.selectedIndex=2; } } varamt = (240.00 * document.forms['inpdata'].hsstudent.value) + (600.00 * document.forms['inpdata'].dipstudent.value) + (2200.00 * document.forms['inpdata'].profstudent.value) + (document.forms['inpdata'].openamount.value * 1.00); // alert (varamt + "is the total committed amount"); document.forms['inpdata'].a3.value = varamt+ ".00"; SetDonorPlan (); return; } function SetDonorPlan () { // var form = window.document.EnrollmentForm; varamt = (240.00 * document.forms['inpdata'].hsstudent.value) + (600.00 * document.forms['inpdata'].dipstudent.value) + (2200.00 * document.forms['inpdata'].profstudent.value) + (document.forms['inpdata'].openamount.value * 1.00); if (varamt == 0) {varamt = 100.00;} varinstl = 1.0; var DonorPlan = document.forms['inpdata'].t3.selectedIndex; // alert("Selected Index = " + DonorScheme + "===" + document.forms['inpdata'].item_number.value); // document.forms['donorpay'].first_name.focus(); // alert("item name = " + document.forms['inpdata'].item_name.value ); switch (DonorPlan) { case 0: if (Number(document.forms['inpdata'].profstudent.value) > 0) { varinstl = 4.0; } if (Number(document.forms['inpdata'].dipstudent.value) > 0) { varinstl = 3.0; } if (Number(document.forms['inpdata'].hsstudent.value) > 0) { varinstl = 2.0; } break; case 1: if (Number(document.forms['inpdata'].profstudent.value) > 0) { varinstl = 4.0; } if (Number(document.forms['inpdata'].dipstudent.value) > 0) { varinstl = 3.0; } if (Number(document.forms['inpdata'].hsstudent.value) > 0) { varinstl = 2.0; } // alert ("monthly installment plan"); varinstl = 12.0 * varinstl; break; case 2: varinstl = 1.0; break; default: varinstl = 1.0; SetCommonField('item_name', 'One Time Donation'); SetCommonField('item_number', 'OneTime'); varamt="100.00"; break; } // alert("installments="+ varinstl + " , amount= " + varamt); document.forms['inpdata'].srt.value= varinstl; var decamt = Math.floor(varamt/varinstl) + (Math.ceil(((varamt/varinstl) - Math.floor(varamt/varinstl)) *100.00))/100.00; // alert ('installment='+ decamt); if (decamt == Math.round(decamt)) { document.forms['inpdata'].a3.value = decamt + '.00'; } else { document.forms['inpdata'].a3.value= decamt; } // Math.ceil(varamt/varinstl) + '.00'; } function SetFormField(xobj) { var objname = xobj.name; document.forms['donorpay'][objname].value=xobj.value; document.forms['onetime'][objname].value=xobj.value; // alert (document.forms['inpdata'][objname].value ); } function SetCommonField(xstr, xval) { var objname = xstr; // alert ('objname='+xstr); document.forms['donorpay'][objname].value=xval; document.forms['onetime'][objname].value=xval; // alert (document.forms['inpdata'][objname].value ); } function SendPayment() {// alert ("the number of installments are " + document.forms['inpdata'].srt.value); if (document.forms['inpdata'].srt.value==1) { document.forms['onetime'].amount.value = document.forms['inpdata'].a3.value; // alert ("the type of payment is onetime" ); document.forms['onetime'].submit(); } else { document.forms['donorpay'].srt.value = document.forms['inpdata'].srt.value; document.forms['donorpay'].a3.value = document.forms['inpdata'].a3.value; // alert ("the type of payment is multiple" ); document.forms['donorpay'].submit(); } window.close(); }