<!-- 



// The following functions are included in the script:
//      getTotal - main function executed when form is submitted
//      clearCredit - clear credit card info if NZ currency chosen
//      calcTotal - calculate cost and prepare info for order summary window
//      checkCerts - ensure necessary certificate fields are completed
//      checkDate - ensure proper date range
//      checkForm - ensure main entries on form are completed


// GLOBAL VARIABLES
    var goodForm = false; // indicates if form is correctly completed
    var goodYear = false; // check to see if year value is valid
    var lowYear = 1855; // earliest year for a certificate
    var highYear = 2001; // this year
    

    
 

// ***************** main function executed when form is submitted




function getTotal()	{
	alert ('Your order is about to be prepared.\nClick "OK" and wait for confirmation message.');
	calcTotal();
    if (goodForm == true) {
        document.mainForm.submit();
    } 
}




//CHANGES TOTAL BILLED TO CURRENCY FUNCTION ... Mod14

function currencyFormat () {
	total = (" " + total);	//converts integer to string for manipulation
	len = (total.length - 1);
	dotPosition = total.indexOf(".",0);
	centsDigits = (len - dotPosition);
	if (centsDigits == 1) {
		total = total + "0";	//add a trailing zero if cents are represented by only one digit
	} else if (centsDigits == 0){
		total = total + "00";	//add 2 trailing zeros if total is an integer and decimal point with no cents
	} else if (centsDigits << 0){
		total = total + ".00";	//add 2 trailing zeros plus decimal point 
	}
}
	
    
    



function indexCheck() {
    if (document.mainForm.Source_1.selectedIndex == 0) {
        alert("An index check is required if you do not know, or are uncertain about the index reference.\nA small fee will be added in accordance with the schedule above.");
    }
}






function checkForm() {

// User identification

	var checkname = document.mainForm.Name.value;
	var checkemail = document.mainForm.email.value;

// Other variables
    
    var Comments = document.mainForm.Comments.value;
//  var checkcurrency = document.mainForm.Currency.selectedIndex;
//	var cardtype = document.mainForm.CardType.selectedIndex;
//	var cardholder = document.mainForm.NameOnCard.value;
//	var cardname = "";
//	var cardnum = document.mainForm.CardNumber.value;		
//	var cardexp = document.mainForm.ExpiryDate.value;    

// Notices to user

    var error = false; // if true, display errorNotice below
    var errorNotice = "ERROR(S) DETECTED.  Please correct before submitting:   \n\n"    // contains list of all errors detected

// Positioning variables

    var movetoCerts = false;
    var movetoContact = false;
    var movetoBilling = false;
    var movetoCurrency = false;

// Certificate variables

    // Certificate 1 
    surname1 = document.mainForm.Surname_1.value;
    year1 = document.mainForm.Year_1.value;
    district1 = document.mainForm.District_1.value;
    page1 = document.mainForm.Page_1.value;
    checkindex1 = false;

    // Certificate 2
    bmd2 = document.mainForm.BMD_2.selectedIndex;
    surname2 = document.mainForm.Surname_2.value;
    year2 = document.mainForm.Year_2.value;
    district2 = document.mainForm.District_2.value;
    page2 = document.mainForm.Page_2.value;
    checkindex2 = false;
    
    // Certificate 3
    bmd3 = document.mainForm.BMD_3.selectedIndex;
    surname3 = document.mainForm.Surname_3.value;
    year3 = document.mainForm.Year_3.value;
    district3 = document.mainForm.District_3.value;
    page3 = document.mainForm.Page_3.value;
    checkindex3 = false;
    
    // Certificate 4
    bmd4 = document.mainForm.BMD_4.selectedIndex;
    surname4 = document.mainForm.Surname_4.value;
    year4 = document.mainForm.Year_4.value;
    district4 = document.mainForm.District_4.value;
    page4 = document.mainForm.Page_4.value;
    checkindex4 = false;
    
    // Certificate 5
    bmd5 = document.mainForm.BMD_5.selectedIndex;
    surname5 = document.mainForm.Surname_5.value;
    year5 = document.mainForm.Year_5.value;
    district5 = document.mainForm.District_5.value
    page5 = document.mainForm.Page_5.value;
    checkindex5 = false;
    
    // Certificate 6
    bmd6 = document.mainForm.BMD_6.selectedIndex;
    surname6 = document.mainForm.Surname_6.value;
    year6 = document.mainForm.Year_6.value;
    district6 = document.mainForm.District_6.value
    page6 = document.mainForm.Page_6.value;
    checkindex6 = false;


// Determine Source variables

	if (document.mainForm.Source_1.selectedIndex == 0) {
		source1 = document.mainForm.Source_1.options[0].value;
	}
	else if (document.mainForm.Source_1.selectedIndex == 1) {
		source1 = document.mainForm.Source_1.options[1].value;
	}
	else if (document.mainForm.Source_1.selectedIndex == 2) {
		source1 = document.mainForm.Source_1.options[2].value;
	}

	if (document.mainForm.Source_2.selectedIndex == 0) {
		source2 = document.mainForm.Source_2.options[0].value;
	}
	else if (document.mainForm.Source_2.selectedIndex == 1) {
		source2 = document.mainForm.Source_2.options[1].value;
	}
	else if (document.mainForm.Source_2.selectedIndex == 2) {
		source2 = document.mainForm.Source_2.options[2].value;
	}

	if (document.mainForm.Source_3.selectedIndex == 0) {
		source3 = document.mainForm.Source_3.options[0].value;
	}
	else if (document.mainForm.Source_3.selectedIndex == 1) {
		source3 = document.mainForm.Source_3.options[1].value;
	}
	else if (document.mainForm.Source_3.selectedIndex == 2) {
		source3 = document.mainForm.Source_3.options[2].value;
	}

	if (document.mainForm.Source_4.selectedIndex == 0)	{
		source4 = document.mainForm.Source_4.options[0].value;
	}
	else if (document.mainForm.Source_4.selectedIndex == 1) {
		source4 = document.mainForm.Source_4.options[1].value;
	}
	else if (document.mainForm.Source_4.selectedIndex == 2) {
		source4 = document.mainForm.Source_4.options[2].value;
	}

	if (document.mainForm.Source_5.selectedIndex == 0)	{
		source5 = document.mainForm.Source_5.options[0].value;
	}
	else if (document.mainForm.Source_5.selectedIndex == 1) {
		source5 = document.mainForm.Source_5.options[1].value;
	}
	else if (document.mainForm.Source_5.selectedIndex == 2) {
		source5 = document.mainForm.Source_5.options[2].value;
	}

	if (document.mainForm.Source_6.selectedIndex == 0) {
		source6 = document.mainForm.Source_6.options[0].value;
	}
	else if (document.mainForm.Source_6.selectedIndex == 1) {
		source6 = document.mainForm.Source_6.options[1].value;
	}
	else if (document.mainForm.Source_6.selectedIndex == 2) {
		source6 = document.mainForm.Source_6.options[2].value;
	}

    
// ============== Check Certificate 1 ==============

    // Note: An entry in surname1 indicates user has started a valid certificate request.
    if (surname1 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 1: Enter the surname.\n")
    }
    
    // Check for valid entry for Year
    
    if (isNaN (year1)) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 1: Invalid year format.\n");
    }
    else if (year1 == "" ) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 1: Please enter the \'Year\'.\n");
    } 
    else if (year1 > highYear) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 1: The year you have chosen is in the future!.\n");
    }

    // Check for Registration District entry
    
    if (district1 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 1: Enter the \'Registration District\' name.\n")
    }

    
    // Check for Page number if Source is known
    
    if ((source1 == "Not found") && (Comments == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 1: Enter details of \'Index\' in the \'Comments\' field.\n")
    } 
    
    
    // Check for Comments if Source is unknown
    
    if ((source1 != "Not found") && (page1 == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 1: Enter the \'Page\' number.\n")
    }
    
    
 
    
// ============== Check Certificate 2 ==============

// Note: An entry in surname2 indicates user has started a valid certificate request.

if (bmd2 != 0) {
    if (surname2 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 2: Enter the surname.\n")
    }
    
    // Check for valid entry for Year
    
    if (isNaN (year2)) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 2: Invalid year format.\n");
    }
    else if (year2 == "" ) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 2: Please enter the \'Year\'.\n");
    } 
    else if (year2 > highYear) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 2: The year you have chosen is in the future!.\n");
    }

    // Check for Registration District entry
    
    if (district2 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 2: Enter the \'Registration District\' name.\n")
    }

    
    // Check for Page number if Source is known
    
    if ((source2 == "Not found") && (Comments == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 2: Enter details of \'Index\' in the \'Comments\' field.\n")
    } 
    
    
    // Check for Comments if Source is unknown
    
    if ((source2 != "Not found") && (page2 == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 2: Enter the \'Page\' number.\n")
    }
}

    
// ============== Check Certificate 3 ==============

// Note: An entry in surname3 indicates user has started a valid certificate request.

if (bmd3 != 0) {
    if (surname3 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 3: Enter the surname.\n")
    }
    
    // Check for valid entry for Year
    
    if (isNaN (year3)) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 3: Invalid year format.\n");
    }
    else if (year3 == "" ) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 3: Please enter the \'Year\'.\n");
    } 
    else if (year3 > highYear) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 3: The year you have chosen is in the future!.\n");
    }

    // Check for Registration District entry
    
    if (district3 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 3: Enter the \'Registration District\' name.\n")
    }

    
    // Check for Page number if Source is known
    
    if ((source3 == "Not found") && (Comments == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 3: Enter details of \'Index\' in the \'Comments\' field.\n")
    } 
    
    
    // Check for Comments if Source is unknown
    
    if ((source3 != "Not found") && (page3 == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 3: Enter the \'Page\' number.\n")
    }
}    
    
  
// ============== Check Certificate 4 ==============

// Note: An entry in surname4 indicates user has started a valid certificate request.

 if (bmd4 != 0) {
    if (surname4 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 4: Enter the surname.\n")
    }
    
    // Check for valid entry for Year
    
    if (isNaN (year4)) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 4: Invalid year format.\n");
    }
    else if (year4 == "" ) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 4: Please enter the \'Year\'.\n");
    } 
    else if (year4 > highYear) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 4: The year you have chosen is in the future!.\n");
    }

    // Check for Registration District entry
    
    if (district4 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 4: Enter the \'Registration District\' name.\n")
    }

    
    // Check for Page number if Source is known
    
    if ((source4 == "Not found") && (Comments == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 4: Enter details of \'Index\' in the \'Comments\' field.\n")
    } 
    
    
    // Check for Comments if Source is unknown
    
    if ((source4 != "Not found") && (page4 == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 4: Enter the \'Page\' number.\n")
    }
}
    
   
// ============== Check Certificate 5 ==============

// Note: An entry in surname5 indicates user has started a valid certificate request.
if (bmd5 != 0) {
    if (surname5 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 5: Enter the surname.\n")
    }
    
    // Check for valid entry for Year
    
    if (isNaN (year5)) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 5: Invalid year format.\n");
    }
    else if (year5 == "" ) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 5: Please enter the \'Year\'.\n");
    } 
    else if (year5 > highYear) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 5: The year you have chosen is in the future!.\n");
    }

    // Check for Registration District entry
    
    if (district5 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 5: Enter the \'Registration District\' name.\n")
    }

    
    // Check for Page number if Source is known
    
    if ((source5 == "Not found") && (Comments == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 5: Enter details of \'Index\' in the \'Comments\' field.\n")
    } 
    
    
    // Check for Comments if Source is unknown
    
    if ((source5 != "Not found") && (page5 == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 5: Enter the \'Page\' number.\n")
    }
}

// ============== Check Certificate 6 ==============

// Note: An entry in surname6 indicates user has started a valid certificate request.

if (bmd6 != 0) {
    if (surname6 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 6: Enter the surname.\n")
    }
    
    // Check for valid entry for Year
    
    if (isNaN (year6)) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 6: Invalid year format.\n");
    }
    else if (year6 == "" ) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 6: Please enter the \'Year\'.\n");
    } 
    else if (year6 > highYear) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 6: The year you have chosen is in the future!.\n");
    }

    // Check for Registration District entry
    
    if (district6 == "") {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 6: Enter the \'Registration District\' name.\n")
    }

    
    // Check for Page number if Source is known
    
    if ((source6 == "Not found") && (Comments == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 6: Enter details of \'Index\' in the \'Comments\' field.\n")
    } 
    
    
    // Check for Comments if Source is unknown
    
    if ((source6 != "Not found") && (page6 == "")) {
        error = true;
        movetoCerts = true;
        errorNotice += ("   - Certificate 6: Enter the \'Page\' number.\n")
    }
}

// ============ Check for Name, Email, and Currency ==============    
    
	if (checkname == "" ) {
        error = true;
        movetoContact = true;
  		goodForm = false;
        errorNotice += ("\n   - 'Contact Information': Enter your \'Name\'.\n")
		}

    if (checkemail == "" ) {
        error = true;
        movetoContact = true;
        goodForm = false;
        errorNotice += ("\n   - 'Contact Information': Enter your \'Email Address\'.\n")
		} 
	else {
	goodForm = true;
	}
    
    // Check for type of credit card
/*    
    if (document.mainForm.CardType.selectedIndex == 1) {
			cardname = document.mainForm.CardType.options[1].value;     // card is Visa
	}
    if (document.mainForm.CardType.selectedIndex == 2)	{
			cardname = document.mainForm.CardType.options[2].value;     // card is MC
    }

     	    
	if (checkcurrency == 0) {
        error = true;
        movetoCurrency = true;
        goodForm = false;
        errorNotice += ("\n   - 'Select Currency': Enter the \'Currency of Payment\'.\n")
	} else if  (checkcurrency == 3) {			// for New Zealand customers
			billingNotice = ("Payment by cheque in New Zealand dollars.\n");
            goodForm = true;
	} else if (cardholder == "" || cardnum == "" || cardexp == "" || cardname == ""){
        if (cardholder == "") {
            error = true;
            movetoBilling = true;
            goodForm = false;
            errorNotice += ("\n   - Credit Card Order: Enter \'Name on Card\'.")
        } 
        if (cardname == "") {
            error = true;
            movetoBilling = true;
            goodForm = false;
            errorNotice += ("\n   - Credit Card Order: Enter \'Credit card type\'.")
        }
        if (cardexp == "") {
            error = true;
            movetoBilling = true;
            goodForm = false;
            errorNotice += ("\n   - Credit Card Order: Enter \'Expiry date\'.")
        } 
        if (cardnum == "") {
            error = true;
            movetoBilling = true;
            goodForm = false;
            errorNotice += ("\n   - Credit Card Order: Enter \'Card number\'.")
        } 
    } else {
        billingNotice = ("Bill to " + cardholder + "\n" + cardname + " #: " + cardnum + "\nExpiration date: "  + cardexp + "\n");
        goodForm = true;
}

*/

// Positioning - if an error occurs in a particular field, move the user to that area to make the amendments    

//alert ("movertoCerts is "  + movetoCerts + "\nmovetoContact is " + movetoContact + "\nmovetoBilling is " + movetoBilling +"\nmovetoCurrency is "+ movetoCurrency + ".");

if ((movetoCerts == false) && (movetoContact == false) && (movetoBilling == false) && (movetoCurrency == true)) {
    window.location="#currency";
    } else if ((movetoCerts == false) && (movetoContact == false) && (movetoBilling == true)) {
    window.location="#billing";
    } else if ((movetoCerts == false) && (movetoContact == true)) {
    window.location="#contact";
    } else if (movetoCerts == true) {
    window.location="#certs";
    } else {
    window.location = "#review";
    }

// Display the error notices if there are any

    if (error) {
    alert (errorNotice);
	goodForm = false;
    }
       
          
    
} //close function checkForm()






// ***************** clear credit card info if NZ currency chosen
/*
function clearCredit (){
	if (document.mainForm.Currency.selectedIndex == 3) {
	alert ("You have chosen to pay using New Zealand Dollars.  This payment can only be made by cheque.  Credit card information should remain blank.");
	document.mainForm.NameOnCard.value = "";
	document.mainForm.CardType.selectedIndex = 0;
	document.mainForm.CardNumber.value = "";
	document.mainForm.ExpiryDate.value = "";
	}
}









function nzcredit (){
	alert("New Zealand residents wishing to pay by credit card must make prior arrangement.  If you have already done so, please note there will be a 3.9% bank fee added to your order.");
	document.mainForm.Currency.options[3].selected =true;
}


*/








function calcTotal()	{

//	VARIABLES
    
    var page1 = document.mainForm.Page_1.value;
    var page2 = document.mainForm.Page_2.value;
    var page3 = document.mainForm.Page_3.value;
    var page4 = document.mainForm.Page_4.value;
    var page5 = document.mainForm.Page_5.value;
    var page6 = document.mainForm.Page_6.value;
	
	var cert_qty = 0;				// total quantity of certificates
	var certtype = "";				// whether transcription or certificate
	var nocert = "No specified";	// if no BMD is selected, this is the value given to the blank field

	var currency = "NZD";
	var USDI = 7;
	var CADI = 9.5;
	var NZDI = 9.5;
	var AUDI = 9.5;
	var USDT = 11;
	var CADT = 14.5;
	var NZDT = 16;
	var AUDT = 14;
	var USDC = 28;
	var CADC = 36;
	var NZDC = 50;
	var AUDC = 36;
    var surcharge = 0;		//Mod10	
   
    var checkref = 0;				// will the index be checked?
	var refcheckval = 2.00;			// cost of index check in NZ dollars ***
	var refcheckvalUS = 1.00;	// cost of index check in US dollars ***
	var refcheckvalCAD = 1.50;	// cost of index check in CDN dollars ***
	var refcheckvalAUD = 1.50;	// cost of index check in AU dollars ***
	var checkrefyes = "\tIndex check required - fee added below.\n";	// for status window output

//	var cardholder = document.mainForm.NameOnCard.value;	// persons's name on card
//	var cardname = "";										// visa-mc etc.
//	var cardnum = document.mainForm.CardNumber.value;		
//	var cardexp = document.mainForm.ExpiryDate.value;
	total = 0;						// set inital amount payable to zero

    checkForm();

   
//  Determine whether B, M, or D

	if (document.mainForm.BMD_1.selectedIndex == 0) {
		bmd1 = document.mainForm.BMD_1.options[0].value;
	}
	else if (document.mainForm.BMD_1.selectedIndex == 1) {
		bmd1 = document.mainForm.BMD_1.options[1].value;
	}
	else if (document.mainForm.BMD_1.selectedIndex == 2) {
		bmd1 = document.mainForm.BMD_1.options[2].value;
	}


	if (document.mainForm.BMD_2.selectedIndex == 0) {
		bmd2 = nocert;
	}
	else if (document.mainForm.BMD_2.selectedIndex == 1) {
		bmd2 = document.mainForm.BMD_2.options[1].value;
	}
	else if (document.mainForm.BMD_2.selectedIndex == 2) {
		bmd2 = document.mainForm.BMD_2.options[2].value;
	}
	else if (document.mainForm.BMD_2.selectedIndex == 3) {
		bmd2 = document.mainForm.BMD_2.options[3].value;
	}

	if (document.mainForm.BMD_3.selectedIndex == 0) {
		bmd3 = nocert;
	}
	else if (document.mainForm.BMD_3.selectedIndex == 1) {
		bmd3 = document.mainForm.BMD_3.options[1].value;
	}
	else if (document.mainForm.BMD_3.selectedIndex == 2) {
		bmd3 = document.mainForm.BMD_3.options[2].value;
	}
	else if (document.mainForm.BMD_3.selectedIndex == 3) {
		bmd3 = document.mainForm.BMD_3.options[3].value;
	}

	if (document.mainForm.BMD_4.selectedIndex == 0)	{
		bmd4 = nocert;
	}
	else if (document.mainForm.BMD_4.selectedIndex == 1) {
		bmd4 = document.mainForm.BMD_4.options[1].value;
	}
	else if (document.mainForm.BMD_4.selectedIndex == 2) {
		bmd4 = document.mainForm.BMD_4.options[2].value;
	}
	else if (document.mainForm.BMD_4.selectedIndex == 3)
		{bmd4 = document.mainForm.BMD_4.options[3].value;
	}

	if (document.mainForm.BMD_5.selectedIndex == 0)	{
		bmd5 = nocert;
	}
	else if (document.mainForm.BMD_5.selectedIndex == 1) {
		bmd5 = document.mainForm.BMD_5.options[1].value;
	}
	else if (document.mainForm.BMD_5.selectedIndex == 2) {
		bmd5 = document.mainForm.BMD_5.options[2].value;
	}
	else if (document.mainForm.BMD_5.selectedIndex == 3) {
		bmd5 = document.mainForm.BMD_5.options[3].value;
	}

	if (document.mainForm.BMD_6.selectedIndex == 0) {
		bmd6 = nocert;
	}
	else if (document.mainForm.BMD_6.selectedIndex == 1) {
		bmd6 = document.mainForm.BMD_6.options[1].value;
	}
	else if (document.mainForm.BMD_6.selectedIndex == 2) {
		bmd6 = document.mainForm.BMD_6.options[2].value;
	}
	else if (document.mainForm.BMD_6.selectedIndex == 3) {
		bmd6 = document.mainForm.BMD_6.options[3].value;
	}

// Determine Source variables

	if (document.mainForm.Source_1.selectedIndex == 0) {
		source1 = document.mainForm.Source_1.options[0].value;
	}
	else if (document.mainForm.Source_1.selectedIndex == 1) {
		source1 = document.mainForm.Source_1.options[1].value;
	}
	else if (document.mainForm.Source_1.selectedIndex == 2) {
		source1 = document.mainForm.Source_1.options[2].value;
	}
	else if (document.mainForm.Source_1.selectedIndex == 3) {
		source1 = document.mainForm.Source_1.options[3].value;
	}
    else if (document.mainForm.Source_1.selectedIndex == 4) {
		source1 = document.mainForm.Source_1.options[4].value;
	}

	if (document.mainForm.Source_2.selectedIndex == 0) {
		source2 = document.mainForm.Source_2.options[0].value;
	}
	else if (document.mainForm.Source_2.selectedIndex == 1) {
		source2 = document.mainForm.Source_2.options[1].value;
	}
	else if (document.mainForm.Source_2.selectedIndex == 2) {
		source2 = document.mainForm.Source_2.options[2].value;
	}
	else if (document.mainForm.Source_2.selectedIndex == 3) {
		source2 = document.mainForm.Source_2.options[3].value;
	}
    else if (document.mainForm.Source_2.selectedIndex == 4) {
		source2 = document.mainForm.Source_2.options[4].value;
	}

	if (document.mainForm.Source_3.selectedIndex == 0) {
		source3 = document.mainForm.Source_3.options[0].value;
	}
	else if (document.mainForm.Source_3.selectedIndex == 1) {
		source3 = document.mainForm.Source_3.options[1].value;
	}
	else if (document.mainForm.Source_3.selectedIndex == 2) {
		source3 = document.mainForm.Source_3.options[2].value;
	}
	else if (document.mainForm.Source_3.selectedIndex == 3) {
		source3 = document.mainForm.Source_3.options[3].value;
	}
	else if (document.mainForm.Source_3.selectedIndex == 4) {
		source3 = document.mainForm.Source_3.options[4].value;
	}

	if (document.mainForm.Source_4.selectedIndex == 0)	{
		source4 = document.mainForm.Source_4.options[0].value;
	}
	else if (document.mainForm.Source_4.selectedIndex == 1) {
		source4 = document.mainForm.Source_4.options[1].value;
	}
	else if (document.mainForm.Source_4.selectedIndex == 2) {
		source4 = document.mainForm.Source_4.options[2].value;
	}
	else if (document.mainForm.Source_4.selectedIndex == 3)
		{source4 = document.mainForm.Source_4.options[3].value;
	}
    else if (document.mainForm.Source_4.selectedIndex == 4)
		{source4 = document.mainForm.Source_4.options[4].value;
	}

	if (document.mainForm.Source_5.selectedIndex == 0)	{
		source5 = document.mainForm.Source_5.options[0].value;
	}
	else if (document.mainForm.Source_5.selectedIndex == 1) {
		source5 = document.mainForm.Source_5.options[1].value;
	}
	else if (document.mainForm.Source_5.selectedIndex == 2) {
		source5 = document.mainForm.Source_5.options[2].value;
	}
	else if (document.mainForm.Source_5.selectedIndex == 3) {
		source5 = document.mainForm.Source_5.options[3].value;
	}
	else if (document.mainForm.Source_5.selectedIndex == 4) {
		source5 = document.mainForm.Source_5.options[4].value;
	}

	if (document.mainForm.Source_6.selectedIndex == 0) {
		source6 = document.mainForm.Source_6.options[0].value;
	}
	else if (document.mainForm.Source_6.selectedIndex == 1) {
		source6 = document.mainForm.Source_6.options[1].value;
	}
	else if (document.mainForm.Source_6.selectedIndex == 2) {
		source6 = document.mainForm.Source_6.options[2].value;
	}
	else if (document.mainForm.Source_6.selectedIndex == 3) {
		source6 = document.mainForm.Source_6.options[3].value;
	}
	else if (document.mainForm.Source_6.selectedIndex == 4) {
		source6 = document.mainForm.Source_6.options[4].value;
	}
    
    
    
// OPENING STATUS

	if (document.mainForm.Certificate_Type.selectedIndex == 0)	{
		certtype = document.mainForm.Certificate_Type.options[0].value;
	}
	else if (document.mainForm.Certificate_Type.selectedIndex == 1)	{
		certtype = document.mainForm.Certificate_Type.options[1].value;
	}
	else if (document.mainForm.Certificate_Type.selectedIndex == 2)	{
		certtype = document.mainForm.Certificate_Type.options[2].value;
	}	
	//else if (document.mainForm.Certificate_Type.selectedIndex == 3)	{
	//	certtype = document.mainForm.Certificate_Type.options[3].value;
	//}
	document.mainForm.OrderStatus.value = ("Scotland Order: " + certtype + " \n\n");


// DETERMINE CURRENCY OF PAYMENT
/*
	if (document.mainForm.Currency.selectedIndex == 0){
		currency = document.mainForm.Currency.options[0].value;
	}
	else if (document.mainForm.Currency.selectedIndex == 1)	{
		currency = document.mainForm.Currency.options[1].value;
	}
	else if (document.mainForm.Currency.selectedIndex == 2){
		currency = document.mainForm.Currency.options[2].value;
	}
	else if (document.mainForm.Currency.selectedIndex == 3) {
		currency = document.mainForm.Currency.options[3].value;
	}
	else if (document.mainForm.Currency.selectedIndex == 4) {
		currency = document.mainForm.Currency.options[4].value;
	}


*/


//	FIRST CERTIFICATE

	if (document.mainForm.Surname_1.value != "") {
		cert_qty = cert_qty + 1;
		document.mainForm.OrderStatus.value += (" - " + bmd1 + " certificate for " + document.mainForm.Given_1.value + " " + document.mainForm.Surname_1.value + ".\n");
		document.mainForm.OrderStatus.value += ("\tYear: " + document.mainForm.Year_1.value + "\n");
		document.mainForm.OrderStatus.value += ("\tRegistration District: " + document.mainForm.District_1.value + "\n");
		document.mainForm.OrderStatus.value += ("\tIndex: " + source1 + "\n");
		document.mainForm.OrderStatus.value += ("\tPage: " + page1 + "\n");
        if ((source1 == "Not found") || (page1 == "")) {
			document.mainForm.OrderStatus.value += (checkrefyes);
			checkref = checkref + 1;
		}
		document.mainForm.OrderStatus.value += ("\n");
	}


//	SECOND CERTIFICATE

	if (document.mainForm.Surname_2.value  != "") {
		cert_qty = cert_qty + 1;
		document.mainForm.OrderStatus.value += (" - " + bmd2 + " certificate for " + document.mainForm.Given_2.value + " " + document.mainForm.Surname_2.value + ".\n");
		document.mainForm.OrderStatus.value += ("\tYear: " + document.mainForm.Year_2.value + "\n");
		document.mainForm.OrderStatus.value += ("\tRegistration District: " + document.mainForm.District_2.value + "\n");
		document.mainForm.OrderStatus.value += ("\tIndex: " + source2 + "\n");
		document.mainForm.OrderStatus.value += ("\tPage: " + page2 + "\n");
        if ((source2 == "Not found") || (page2 == "")) {
			document.mainForm.OrderStatus.value += (checkrefyes);
			checkref = checkref + 1;
		}
		document.mainForm.OrderStatus.value += ("\n");
	}


//	THIRD CERTIFICATE

	if (document.mainForm.Surname_3.value  != "") {
		cert_qty = cert_qty + 1;
		document.mainForm.OrderStatus.value += (" - " + bmd3 + " certificate for " + document.mainForm.Given_3.value + " " + document.mainForm.Surname_3.value + ".\n");
		document.mainForm.OrderStatus.value += ("\tYear: " + document.mainForm.Year_3.value + "\n");
		document.mainForm.OrderStatus.value += ("\tRegistration District: " + document.mainForm.District_3.value + "\n");
		document.mainForm.OrderStatus.value += ("\tIndex: " + source3 + "\n");
		document.mainForm.OrderStatus.value += ("\tPage: " + page3 + "\n");
        if ((source3 == "Not found") || (page3 == "")) {
			document.mainForm.OrderStatus.value += (checkrefyes);
			checkref = checkref + 1;
		}
		document.mainForm.OrderStatus.value += ("\n");
	}


//	FOURTH CERTIFICATE

	if (document.mainForm.Surname_4.value  != "") {
		cert_qty = cert_qty + 1;
		document.mainForm.OrderStatus.value += (" - " + bmd4 + " certificate for " + document.mainForm.Given_4.value + " " + document.mainForm.Surname_4.value + ".\n");
		document.mainForm.OrderStatus.value += ("\tYear: " + document.mainForm.Year_4.value + "\n");
		document.mainForm.OrderStatus.value += ("\tRegistration District: " + document.mainForm.District_4.value + "\n");
		document.mainForm.OrderStatus.value += ("\tIndex: " + source4 + "\n");
		document.mainForm.OrderStatus.value += ("\tPage: " + page4 + "\n");
        if ((source4 == "Not found") || (page4 == "")) {
			document.mainForm.OrderStatus.value += (checkrefyes);
			checkref = checkref + 1;
		}
		document.mainForm.OrderStatus.value += ("\n");
	}


//	FIFTH CERTIFICATE

	if (document.mainForm.Surname_5.value  != "") {
		cert_qty = cert_qty + 1;
		document.mainForm.OrderStatus.value += (" - " + bmd5 + " certificate for " + document.mainForm.Given_5.value + " " + document.mainForm.Surname_5.value + ".\n");
		document.mainForm.OrderStatus.value += ("\tYear: " + document.mainForm.Year_5.value + "\n");
		document.mainForm.OrderStatus.value += ("\tRegistration District: " + document.mainForm.District_5.value + "\n");
		document.mainForm.OrderStatus.value += ("\tIndex: " + source5 + "\n");
		document.mainForm.OrderStatus.value += ("\tPage: " + page5 + "\n");
        if ((source5 == "Not found") || (page5 == "")) {
			document.mainForm.OrderStatus.value += (checkrefyes);
			checkref = checkref + 1;
		}
		document.mainForm.OrderStatus.value += ("\n");
	}


//	SIXTH CERTIFICATE

	if (document.mainForm.Surname_6.value  != "") {
		cert_qty = cert_qty + 1;
		document.mainForm.OrderStatus.value += (" - " + bmd6 + " certificate for " + document.mainForm.Given_6.value + " " + document.mainForm.Surname_6.value + ".\n");
		document.mainForm.OrderStatus.value += ("\tYear: " + document.mainForm.Year_6.value + "\n");
		document.mainForm.OrderStatus.value += ("\tRegistration District: " + document.mainForm.District_6.value + "\n");
		document.mainForm.OrderStatus.value += ("\tIndex: " + source6 + "\n");
		document.mainForm.OrderStatus.value += ("\tPage: " + page6 + "\n");
        if ((source6 == "Not found") || (page6 == "")) {
			document.mainForm.OrderStatus.value += (checkrefyes);
			checkref = checkref + 1;
		}
		document.mainForm.OrderStatus.value += ("\n");
	}

	document.mainForm.OrderStatus.value += ("\n");



// ADD COMMENTS TO ORDER STATUS WINDOW

	if (document.mainForm.Comments.value != "") {
		document.mainForm.OrderStatus.value += (" - Comments: " + document.mainForm.Comments.value + "\n\n");
	}



// SUMAMRY OF BILLING INFORMATION
/*
	if (document.mainForm.CardType.selectedIndex == 1) {
		cardname = document.mainForm.CardType.options[1].value;     // card is Visa
	}
	
	if (document.mainForm.CardType.selectedIndex == 2)	{
	cardname = document.mainForm.CardType.options[2].value;     // card is MC
	}

	if  (document.mainForm.Currency.selectedIndex == 3) {			// for New Zealand customers
		document.mainForm.OrderStatus.value += ("Payment by cheque in New Zealand dollars.\n\n");
	} else {            // for non=New Zealand currencies
		if (cardholder == "" || cardnum == "" || cardexp == "" || cardname == "") {
			document.mainForm.OrderStatus.value += ("NOTE: Your billing information is incomplete.\n\n");
		} else {
		document.mainForm.OrderStatus.value += ("Bill to " + cardholder + "\n" + cardname + " #: " + cardnum + "\nExpiration date: "  + cardexp + "\n\n");
		} 
	}
*/	
	
// CALCULATE TOTAL TO BE BILLED

	if (document.mainForm.Certificate_Type.selectedIndex == 1) {
		if (currency == "USD") {
    		total = ((cert_qty * USDC) + (checkref * refcheckvalUS) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " USD");
		} else if (currency == "AUD") {
    		total = ((cert_qty * AUDC) + (checkref * refcheckvalAUD) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " AUD");
		} else if (currency == "NZD") {
    		total = ((cert_qty * NZDC) + (checkref * refcheckval) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " NZD");
		} else if (currency == "CAD")	{	
    		total = ((cert_qty * CADC) + (checkref * refcheckvalCAD) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " CAD");
		}
	} else if (document.mainForm.Certificate_Type.selectedIndex == 2) {
		if (currency == "USD") {
    		total = ((cert_qty * USDI) + (checkref * refcheckvalUS) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " USD");
		} else if (currency == "AUD") {
    		total = ((cert_qty * AUDI) + (checkref * refcheckvalAUD) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " AUD");
		} else if (currency == "NZD") {
    		total = ((cert_qty * NZDI) + (checkref * refcheckval) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " NZD");
		} else if (currency == "CAD")	{	
    		total = ((cert_qty * CADI) + (checkref * refcheckvalCAD) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " CAD");
		}
	} else {
		if (currency == "USD") {
    		total = ((cert_qty * USDT) + (checkref * refcheckvalUS) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " USD");  
		}
		else if (currency == "AUD") {
    		total = ((cert_qty * AUDT) + (checkref * refcheckvalAUD) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " AUD");
		}
		else if (currency == "NZD") {
    		total = ((cert_qty * NZDT) + (checkref * refcheckval) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " NZD");
		}
		else if (currency == "CAD")	{	
    		total = ((cert_qty * CADT) + (checkref * refcheckvalCAD) + surcharge); 		//Mod10
		    currencyFormat();  //Mod14
	    	document.mainForm.TotalPayable.value = ("$" + total + " CAD");
		}
	}
}
// -->