// created 041130, mod 041222, mod 081103, mod 081115, mod 081125, mod 081202

/*******************************************/
/*                                         */
/* Global Variables                        */
/*                                         */
/*******************************************/

var fraisDeBase = 15; // default value

/*******************************************/
/*                                         */
/* Following functions load calendar lists */
/* & sets & resets background colours of   */
/* input fields                            */
/*                                         */
/*******************************************/

/*******************************************/
/*                                         */
function loadList(list)                    // Receives a select object, as parameter
/*                                         */
/*******************************************/
{
  var listID = list.id; // ID of list is assigned to a var, because substr() is not a method of a SELECT object
  switch (listID.substr(0,2))
  {
    case "DD":
    if (list.length == 1)
    {
      var days = new Array();
      for (var i = 0 ; i < 31; i++)
      {
        if (i < 9)
	    {
          days[i] = "0" + (i + 1);
 	    }
	    else
	    {
          days[i] = i + 1;
	    }// end if
      }// end for
      loadElement(list, days);	
    }// endif
  	break;

    case "MM":
      if (list.length == 1)
      {
        // The '\' in some of the months' names is to give the Octal code for the accented characters 
        var months = new Array("jan","f\351v","mar","avr","mai","jui","juil","ao\373","sep","oct",
						 "nov","d\351c");
        loadElement(list, months);	
      }// endif
 	    break;

    case "KK": // This creates the age list on the Comeau & Paulin pages
      if (list.length == 1)
      {
        var age  = 0;
        var i     = 0;
        var ages = new Array();
        do
        {
          ages[i++] = age++;
        } while (age < 51)// end do/while
        loadElement(list,ages);	
      }// endif
    break;

    case "YY":
      if (list.length == 1)
      {
        var year  = 1801;
        var i     = 0;
        var years = new Array();
        do
        {
          years[i++] = year++;
        } while (year < 2010)// end do/while
        loadElement(list,years);	
      }// endif
    break;

    default:// "CARDS":
      if (list.length == 1)
      {
        var cardNum = 1;
        var i       = 0;
        var nums    = new Array();
        do
        {
   	      if (cardNum < 10) // one digit number
	      { 
            nums[i++] = "000" + cardNum++;
	      }
	      else if (cardNum < 100) // two digit number
 	      {
            nums[i++] = "00" + cardNum++;
	      } 
	      else if (cardNum < 1000) // three digit number
	      {
            nums[i++] = "0" + cardNum++;
	      }
	      else
	      {
            nums[i++] = cardNum++;
	      } // end nested if
        } while (cardNum < 1001)// end do/while
        loadElement(list,nums);	
      }// endif
    }// end switch
}// end loadList function

/*******************************************/
/*                                         */
function loadElement(listName,part)        // Receives a select object and an array, as parameters
/*                                         */
/*******************************************/
{
  for (var i=0; i < part.length; ++i)
  {
    addOption(listName,part[i],part[i]);
  }// end for
}// end loadElement function
  
/*******************************************/
/*                                         */
function addOption(selectbox,text,value)   // Receives a select object plus two array elements, as parameters
/*                                         */
/*******************************************/
{
  var optn = document.createElement("OPTION");
  optn.text = text;
  optn.value = value;
  selectbox.options.add(optn);
}// end addOption function

/*******************************************/
/*                                         */
function changeBGColor(elem)               // Receives an object of type="text" or type="select-of", as parameters
/*                                         */
/*******************************************/
{
  elem.style.backgroundColor="blanchedalmond";
}// end changeBGColor function

/*******************************************/
/*                                         */
function resetBGColor(elem)                // Receives an object of type="text" or type="select-of", as parameters
/*                                         */
/*******************************************/
{
  elem.style.backgroundColor="white";
}// end resetBGColor function

/*** End of functions which load calendar lists and sets & resets input fields background colours ***/  
  
// This function sets the value of the Inscription Costs for the Paulin page at 15.00 
// when the value is "----", or 10.00 if otherwise

/*******************************************/
/*                                         */
function dispFrais()
/*                                         */
/*******************************************/
{
  var cardNumber = document.forms[0].cardNum.selectedIndex;

  //	alert("Value of cardNum is = " + cardNumber);

  if (cardNumber == 0)
  {
    fraisDeBase = 15;
  }
  else
  {
  fraisDeBase = 10;
  }// endif

  // formatting FraisDeBase
  var tot = new NumberFormat(fraisDeBase);
  tot.setPlaces(2);
  document.forms["CalcBookCost"].fraisInscription.value = tot.toFormatted();
	 
  }// end dispFrais function

/*******************************************/
/*                                         */
function calcRefCostUS()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	

	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// emd loop
	
	if (numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		cost = numBooks * 14.95;
		var costs = new NumberFormat(cost);
		costs.setPlaces(2);
		document.forms[0].bookCost.value = costs.toFormatted();
		
		shipCosts = numBooks * 4.95;
		var shipCost = new NumberFormat(shipCosts);
		shipCost.setPlaces(2);
		document.forms[0].shippingCost.value = shipCost.toFormatted();
		
		total = cost+shipCosts;
		var tot = new NumberFormat(total);
		tot.setPlaces(2);
		document.forms[0].total.value = tot.toFormatted();
	}// endif
	
    document.forms[0].eMail.disabled = false;
}// end calcRefCostUS function 

/*******************************************/
/*                                         */
function calcRefCostCdn()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// end loop
	
	if (numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		cost = numBooks * 19.95;
		var costs = new NumberFormat(cost);
		costs.setPlaces(2);
		document.forms[0].bookCost.value = costs.toFormatted();
		
		shipCosts = numBooks * 4.95;
		var shipCost = new NumberFormat(shipCosts);
		shipCost.setPlaces(2);
		document.forms[0].shippingCost.value = shipCost.toFormatted();
		
		total = cost+shipCosts;
		var tot = new NumberFormat(total);
		tot.setPlaces(2);
		document.forms[0].total.value = tot.toFormatted();
	}// endif
	
    document.forms[0].eMail.disabled = false;
}// end calcRefCostCdn function

/*******************************************/
/*                                         */
function clearRefBoxes()
/*                                         */
/*******************************************/
{
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
				element.checked = false;
			}// endif
		}// endif
	}// end loop
	
	var controlIndex;
	var element;
	var numberOfControls = document.CalcRefBookCost.length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.CalcRefBookCost[controlIndex];
		if (element.type == "text")
		{
			element.value = "";
		}// endif
	}// end loop
}// end clearRefBoxes function

/*******************************************/
/*                                         */
function calcCostUS()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// end loop
	
	if (numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		
		switch (numBooks)
		{
			case 1:
				cost = 29.95;
				break;
			case 2:
				cost = 49.95;
				break;
			case 3:
				cost = 79.95;
				break;
			case 4:
				cost = 99.95;
				break;
			default:
				cost = 99.95 + (numBooks - 4) * 24.95;
		}// end switch
		
		var costs = new NumberFormat(cost);
		costs.setPlaces(2);
		document.forms[0].bookCost.value = costs.toFormatted();
		
		shipCosts = numBooks * 4.95;
		var shipCost = new NumberFormat(shipCosts);
		shipCost.setPlaces(2);
		document.forms[0].shippingCost.value = shipCost.toFormatted();
		
		total = cost + shipCosts;
		var tot = new NumberFormat(total);
		tot.setPlaces(2);
		document.forms[0].total.value = tot.toFormatted();
	}// endif
	
    document.forms[0].eMail.disabled = false;
}// end calcCostUS function

/*******************************************/
/*                                         */
function calcCostCdn()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	

	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// end loop

	if (numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		
		switch (numBooks)
		{
			case 1:
				cost = 34.95;
				break;
			case 2:
				cost = 59.95;
				break;
			case 3:
				cost = 95.95;
				break;
			case 4:
				cost = 119.95;
				break;
			default:
				cost = 119.95 + (numBooks - 4) * 29.95;
		}// end switch
		
		var costs = new NumberFormat(cost);
		costs.setPlaces(2);
		document.forms[0].bookCost.value = costs.toFormatted();
		
		shipCosts = numBooks * 4.95;
		var shipCost = new NumberFormat(shipCosts);
		shipCost.setPlaces(2);
		document.forms[0].shippingCost.value = shipCost.toFormatted();
		
		total = cost+shipCosts;
		var tot = new NumberFormat(total);
		tot.setPlaces(2);
		document.forms[0].total.value = tot.toFormatted();
	}// endif
	
    document.forms[0].eMail.disabled = false;
}// end calcCostCdn function

/*******************************************/
/*                                         */
function clearBoxes()                      //This function is used by Doiron Family page & Seconde Nation's pages
/*                                         */
/*******************************************/
{
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	

	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "text")
		{
			element.value = "";
		}// endif
	}// end loop
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "select-one")
		{
			element.selectedIndex = 0;
		}// endif
	}// loop	
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
				element.checked = false;
			}// endif
		}// endif
	}// end loop
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "select-one")
		{
			element.selectedIndex = 0;
		}// endif
	}// loop	
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "text")
		{
			element.value = "";
		}// endif
	}// end loop
}// end clearBoxes function

/*******************************************/
/*                                         */
function clearPaulinBoxes()                //This function is used by Paulin Family page
/*                                         */
/*******************************************/
{
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	

	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "text")
		{
			element.value = "";
		}// endif
	}// end loop
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "select-one")
		{
			element.selectedIndex = 0;
		}// endif
	}// loop

    disableCardNums();	
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
				element.checked = false;
			}// endif
		}// endif
	}// end loop
	
	document.forms[0].eMail.disabled = true;
	
}// end clearPaulinBoxes function

/*******************************************/
/*                                         */
function clearComeauBoxes()                //This function is used by Comeau Family page
/*                                         */
/*******************************************/
{
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	

	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "text")
		{
			element.value = "";
		}// endif
	}// end loop
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "select-one")
		{
			element.selectedIndex = 0;
		}// endif
	}// loop	
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
				element.checked = false;
			}// endif
		}// endif
	}// end loop
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "select-one")
		{
			element.selectedIndex = 0;
		}// endif
	}// loop	
	
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;	
	
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "text")
		{
			element.value = "";
		}// endif
	}// end loop
}// end clearComeauBoxes function

/*******************************************/
/*                                         */
function calcDoironCosts()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;
	var kidsTprice       = 10.99;
	var adultsTprice     = 11.99;
	var bigAdultsTprice  = 14.99;
	var hatsPrice        = 13.99;
	var HST              = .13;
	var grandTotal       = 0;
	var fraisAdult       = 20;
	var fraisKid         = 10;
	var fraisPin         = 5;
	var fraisCartes      = 5;
	var fraisDejeuners   = 5;	
	
	// calculating Book costs
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// loop

	if(numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		
		switch (numBooks)
		{
			case 1:
				cost = 34.95;
				break;
			case 2:
				cost = 59.95;
				break;
			case 3:
				cost = 99.95;
				break;
			case 4:
				cost = 119.95;
				break;
			default:
				cost = 119.95 + (numBooks - 4) * 29.95;
		}// end switch
		
		// formatting Book costs
        numToFormat(cost, document.forms(0).bookCost);
		
		// caluculating & formatting Shipping Costs (which aren't used in this application)
		shipCosts = numBooks * 0;
        numToFormat(shipCosts, document.forms(0).shippingCost);
		
		// calculating & formatting Total Genealogy costs
		total = cost + shipCosts - shipCosts;
        numToFormat(cost, document.forms(0).total);
		
   		// calculating & formatting Grand Total cost (grandTotal is used for the 1st time here)
   		grandTotal = total;
        numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif

/***************************************************************************/	

	// calculating Inscription Costs for Adults
	var numAdults = document.forms[0].numAdults.selectedIndex;
	if (numAdults > 0)
	{
	   numAdults = numAdults * fraisAdult;
			
		// formatting Total Adults Costs
        numToFormat(numAdults, document.forms(0).totAdultFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdultFrais.value = "";
       document.forms[0].totFraisInscription.value = "";
	}// endif
	
	// calculating Inscription Costs for Kids	
	var numKids = document.forms[0].numKids.selectedIndex;	
	
	if (numKids > 0)
	{
	   numKids = numKids * fraisKid;
			
		// formatting Total Kids Cost
        numToFormat(numKids, document.forms(0).totKidFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totKidFrais.value = "";
	}// endif
	
	// calculating Pin Costs	
	var numPins = document.forms[0].numPins.selectedIndex;	
	
	if (numPins > 0)
	{
	   numPins = numPins * fraisPin;
			
		// formatting Total Kids Cost
        numToFormat(numPins, document.forms(0).totPinFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totPinFrais.value = "";
	}// endif
	
	// calculating Cartes Costs	
	var numCartes = document.forms[0].numCartes.selectedIndex;	
	
	if (numCartes > 0)
	{
	   numCartes = numCartes * fraisCartes;
			
		// formatting Total Cartes Cost
        numToFormat(numCartes, document.forms(0).totCarteFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totCarteFrais.value = "";
	}// endif
	
	// calculating Dejeuner Costs	
	var numDejeuners = document.forms[0].numDejeuners.selectedIndex;	
	
	if (numDejeuners > 0)
	{
	   numDejeuners = numDejeuners * fraisDejeuners;
			
		// formatting Total Dejeuners Cost
        numToFormat(numDejeuners, document.forms(0).totDejeunersFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totDejeunersFrais.value = "";
	}// endif
	
	// calculating Total Inscription Costs
	var totFrais = 0;
	
	if (numAdults > 0 || numKids > 0 || numPins > 0 || numCartes > 0 || numDejeuners > 0)
	{
	   totFrais = numAdults + numKids + numPins + numCartes + numDejeuners;
	   
	   // formatting Total Inscription Costs
       numToFormat(totFrais, document.forms(0).totFraisInscription);

	   // calculating & formatting Grand Total cost
   	   grandTotal = grandTotal + totFrais;
       numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif

/***************************************************************************/	

	// calculating Souvenir purchases
	var totKids      = 0;
	var totAdults    = 0;
	var totBigAdults = 0;
	var totHats      = 0;
	var totHST       = 0;
	var totSales     = 0;
	var totSouvenirs = 0;
	
	// calculating Kid Ts
    totKids = 	   	   	document.forms[0].size2a4.selectedIndex;
	totKids = totKids + document.forms[0].size6a8.selectedIndex;
    totKids = totKids + document.forms[0].size10a12.selectedIndex;
    totKids = totKids + document.forms[0].size14a16.selectedIndex;	
	
	if (totKids > 0)
	{
   	   totKids = totKids * kidsTprice;
	   
	   // formatting Total Kids Ts
       numToFormat(totKids, document.forms(0).totKids);
	   
	   // calculating Total Sales
	   totSales = totKids;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totKids.value      = "";
       document.forms[0].totSales.value     = "";
       document.forms[0].HST.value          = "";
       document.forms[0].totSouvenirs.value = "";
	}// endif		
	
	// calculating Adults Ts
   	totAdults =    		  	document.forms[0].sizeP.selectedIndex;
	totAdults = totAdults + document.forms[0].sizeM.selectedIndex;
    totAdults = totAdults + document.forms[0].sizeG.selectedIndex;
    totAdults = totAdults + document.forms[0].sizeXG.selectedIndex;	
	
	if (totAdults > 0)
	{
   	   totAdults = totAdults * adultsTprice;
	   
	   // formatting Total Adults Ts
       numToFormat(totAdults, document.forms(0).totAdults);

	   // calculating Total Sales
	   totSales = totSales + totAdults;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdults.value = "";
	}// endif		
	
	// calculating Big Adults Ts
    totBigAdults = document.forms[0].sizeXXG.selectedIndex;
	totBigAdults = totBigAdults + document.forms[0].sizeXXXG.selectedIndex;	
	
	if (totBigAdults > 0)
	{
   	   totBigAdults = totBigAdults * bigAdultsTprice;
	   
	   // formatting Total Big Adults Ts
       numToFormat(totBigAdults, document.forms(0).totBigAdults);
	   
	   // calculating Total Sales
	   totSales = totSales + totBigAdults;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totBigAdults.value = "";
	}// endif
	
	// calculating Hats
    totHats = document.forms[0].sizeHat.selectedIndex;	
	
	if (totHats > 0)
	{
   	   totHats = totHats*hatsPrice;
	   
	   // formatting Total Hats
       numToFormat(totHats, document.forms(0).totHats);
	   
	   // calculating Total Sales
	   totSales = totSales + totHats;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totHats.value = "";
	}// endif
	
	// formatting Total Sales, calculating HST & Total Souvenirs Sales
	if (totSales > 0)
	{
       numToFormat(totSales, document.forms(0).totSales);

	   totHST = totSales * HST;
       numToFormat(totHST, document.forms(0).HST);
	   
	   totSouvenirs = totSales +  totHST;
       numToFormat(totSouvenirs, document.forms(0).totSouvenirs);
	}// endif   
	
	// calculating & formatting Grand Total cost
	if (totSouvenirs > 0)
	{
   	   grandTotal = grandTotal + totSouvenirs;
       numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif
}// end function calcDoironCosts

/*******************************************/
/*                                         */
function calcMalletCosts()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;
	var kidsTprice       = 10.99;
	var adultsTprice     = 11.99;
	var bigAdultsTprice  = 14.99;
	var hatsPrice        = 13.99;
	var HST              = .13;
	var grandTotal       = 0;
	var fraisFamille     = 35;
	var fraisAdult       = 20;
	var fraisEtudiant    = 15;
    var fraisCouple      = 30;
	var fraisSenior      = 15;
	
	// calculating Book costs
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// loop

	if(numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		
		switch (numBooks)
		{
			case 1:
				cost = 34.95;
				break;
			case 2:
				cost = 59.95;
				break;
			case 3:
				cost = 99.95;
				break;
			case 4:
				cost = 119.95;
				break;
			default:
				cost = 119.95 + (numBooks - 4) * 29.95;
		}// end switch
		
		// formatting Book costs
        numToFormat(cost, document.forms(0).bookCost);
		
		// caluculating & formatting Shipping Costs (which aren't used in this application)
		shipCosts = numBooks * 0;
        numToFormat(shipCosts, document.forms(0).shippingCost);
		
		// calculating & formatting Total Genealogy costs
		total = cost + shipCosts - shipCosts;
        numToFormat(cost, document.forms(0).total);
		
   		// calculating & formatting Grand Total cost (grandTotal is used for the 1st time here)
   		grandTotal = total;
        numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif

/***************************************************************************/	

	// calculating Inscription Costs for Family
	var numFamille = document.forms[0].numFamille.selectedIndex;
	if (numFamille > 0)
	{
	   numFamille = numFamille * fraisFamille;
			
		// formatting Total Family Costs
        numToFormat(numFamille, document.forms(0).totFamilleFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totFamilleFrais.value = "";
       document.forms[0].totFraisInscription.value = "";
	}// endif
	
	// calculating Inscription Costs for Couple
	var numCouple = document.forms[0].numCouple.selectedIndex;
	if (numCouple > 0)
	{
	   numCouple = numCouple * fraisCouple;
			
		// formatting Total Family Costs
        numToFormat(numCouple, document.forms(0).totCoupleFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totCoupleFrais.value = "";
	}// endif
	
	// calculating Inscription Costs for Adult
	var numAdults = document.forms[0].numAdults.selectedIndex;
	if (numAdults > 0)
	{
	   numAdults = numAdults * fraisAdult;
			
		// formatting Total Adults Costs
        numToFormat(numAdults, document.forms(0).totAdultFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdultFrais.value = "";
	}// endif
	
	// calculating Inscription Costs for Students	
	var numEtudiant = document.forms[0].numEtudiant.selectedIndex;	
	
	if (numEtudiant > 0)
	{
	   numEtudiant = numEtudiant * fraisEtudiant;
			
		// formatting Total Etudiant Cost
        numToFormat(numEtudiant, document.forms(0).totEtudiantFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totEtudiantFrais.value = "";
	}// endif
	
	// calculating Inscription Costs for Seniors
	var numSenior = document.forms[0].numSenior.selectedIndex;	
	
	if (numSenior > 0)
	{
	   numSenior = numSenior * fraisSenior;
			
		// formatting Total Senior Cost
        numToFormat(numSenior, document.forms(0).totSeniorFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totSeniorFrais.value = "";
	}// endif
	
	// calculating Total Inscription Costs
	var totFrais = 0;
	
	if (numAdults > 0 || numFamille > 0 || numEtudiant > 0 || numSenior > 0 || numCouple > 0)
	{
	   totFrais = numAdults + numFamille + numEtudiant + numSenior + numCouple;
	   
	   // formatting Total Inscription Costs
       numToFormat(totFrais, document.forms(0).totFraisInscription);

	   // calculating & formatting Grand Total cost
   	   grandTotal = grandTotal + totFrais;
       numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif

/***************************************************************************/	

	// calculating Souvenir purchases
	var totKids      = 0;
	var totAdults    = 0;
	var totBigAdults = 0;
	var totHats      = 0;
	var totHST       = 0;
	var totSales     = 0;
	var totSouvenirs = 0;
	
	// calculating Kid Ts
    totKids = 	   	   	document.forms[0].size2a4.selectedIndex;
	totKids = totKids + document.forms[0].size6a8.selectedIndex;
    totKids = totKids + document.forms[0].size10a12.selectedIndex;
    totKids = totKids + document.forms[0].size14a16.selectedIndex;	
	
	if (totKids > 0)
	{
   	   totKids = totKids * kidsTprice;
	   
	   // formatting Total Kids Ts
       numToFormat(totKids, document.forms(0).totKids);
	   
	   // calculating Total Sales
	   totSales = totKids;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totKids.value      = "";
       document.forms[0].totSales.value     = "";
       document.forms[0].HST.value          = "";
       document.forms[0].totSouvenirs.value = "";
	}// endif		
	
	// calculating Adults Ts
   	totAdults =    		  	document.forms[0].sizeP.selectedIndex;
	totAdults = totAdults + document.forms[0].sizeM.selectedIndex;
    totAdults = totAdults + document.forms[0].sizeG.selectedIndex;
    totAdults = totAdults + document.forms[0].sizeXG.selectedIndex;	
	
	if (totAdults > 0)
	{
   	   totAdults = totAdults * adultsTprice;
	   
	   // formatting Total Adults Ts
       numToFormat(totAdults, document.forms(0).totAdults);

	   // calculating Total Sales
	   totSales = totSales + totAdults;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdults.value = "";
	}// endif		
	
	// calculating Big Adults Ts
    totBigAdults = document.forms[0].sizeXXG.selectedIndex;
	totBigAdults = totBigAdults+document.forms[0].sizeXXXG.selectedIndex;	
	
	if (totBigAdults > 0)
	{
   	   totBigAdults = totBigAdults * bigAdultsTprice;
	   
	   // formatting Total Big Adults Ts
       numToFormat(totBigAdults, document.forms(0).totBigAdults);
	   
	   // calculating Total Sales
	   totSales = totSales + totBigAdults;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totBigAdults.value = "";
	}// endif
	
	// calculating Hats
    totHats = document.forms[0].sizeHat.selectedIndex;	
	
	if (totHats > 0)
	{
   	   totHats = totHats*hatsPrice;
	   
	   // formatting Total Hats
       numToFormat(totHats, document.forms(0).totHats);
	   
	   // calculating Total Sales
	   totSales = totSales + totHats;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totHats.value = "";
	}// endif
	
	// formatting Total Sales, calculating HST & Total Souvenirs Sales
	if (totSales > 0)
	{
       numToFormat(totSales, document.forms(0).totSales);

	   totHST = totSales * HST;
       numToFormat(totHST, document.forms(0).HST);
	   
	   totSouvenirs = totSales +  totHST;
       numToFormat(totSouvenirs, document.forms(0).totSouvenirs);
	}// endif   
	
	// calculating & formatting Grand Total cost
	if (totSouvenirs > 0)
	{
   	   grandTotal = grandTotal + totSouvenirs;
       numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif
}// end function calcMalletCosts

/*******************************************/
/*                                         */
function calcPaulinCosts()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;
	var kidsTprice       = 10.99;
	var adultsTprice     = 11.99;
	var bigAdultsTprice  = 14.99;
	var hatsPrice        = 13.99;
	var HST              = .13;
	var grandTotal       = 0;
	var fraisAdult       = 18;
	var fraisKid         = 10;
	var fraisPin         = 5;
	var fraisCartes      = 10;
	var inscrAvecCarte   = 10;
	var inscrSansCarte   = 15;	
	
	// calculating Book costs
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// loop

	if(numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		
		switch (numBooks)
		{
			case 1:
				cost = 34.95;
				break;
			case 2:
				cost = 59.95;
				break;
			case 3:
				cost = 99.95;
				break;
			case 4:
				cost = 119.95;
				break;
			default:
				cost = 119.95 + (numBooks - 4) * 29.95;
		}// end switch
		
		// formatting Book costs
        numToFormat(cost, document.forms(0).bookCost);
		
		// caluculating & formatting Shipping Costs (which aren't used in this application)
		shipCosts = numBooks * 0;
        numToFormat(shipCosts, document.forms(0).shippingCost);
		
		// calculating & formatting Total Genealogy costs
		total = cost + shipCosts - shipCosts;
        numToFormat(cost, document.forms(0).total);
		
   		// calculating & formatting Grand Total cost (grandTotal is used for the 1st time here)
   		grandTotal = total;
        numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif

/***************************************************************************/

    // calculating & formatting Total Cards Purchased
	var numCards = document.forms[0].numCards.selectedIndex;
	
	if (numCards > 0)
	{
	   numCards = numCards * fraisCartes; // numCards now has a $ value
			
       // formatting Total Cards Costs
       numToFormat(numCards, document.forms(0).totCarteFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totCarteFrais.value = "";
	}// endif

	// formatting Total Inscription Frais
	var totFrais = numCards;
    numToFormat(totFrais, document.forms(0).totFraisInscription);
	
    // calculating & formatting Grand Total cost 
    grandTotal = grandTotal + numCards;
    numToFormat(grandTotal, document.forms(0).grandTotal);

    // calculating & formatting Inscription with Cards
	var numAvecCards = document.forms[0].numAvecCarte.selectedIndex;
	
	if (numAvecCards > 0)
	{
	   numAvecCards = numAvecCards * inscrAvecCarte; // numAvecCards now has a $ value
			
       // formatting Total Inscription with Cards Costs
       numToFormat(numAvecCards, document.forms(0).totAvecCarte);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAvecCarte.value = "";
	}// endif

	// formatting Total Inscription Frais
	totFrais = totFrais + numAvecCards;
    numToFormat(totFrais, document.forms(0).totFraisInscription);
	
    // calculating & formatting Grand Total cost 
    grandTotal = grandTotal + numAvecCards;
    numToFormat(grandTotal, document.forms(0).grandTotal);

    // calculating & formatting Inscription without Cards
	var numSansCards = document.forms[0].numSansCarte.selectedIndex;
	
	if (numSansCards > 0)
	{
	   numSansCards = numSansCards * inscrSansCarte; // numSansCards now has a $ value
			
       // formatting Total Inscription without Cards Costs
       numToFormat(numSansCards, document.forms(0).totSansCarte);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totSansCarte.value = "";
	}// endif

	// formatting Total Inscription Frais
	totFrais = totFrais + numSansCards;
    numToFormat(totFrais, document.forms(0).totFraisInscription);
	
    // calculating & formatting Grand Total cost 
    grandTotal = grandTotal + numSansCards;
    numToFormat(grandTotal, document.forms(0).grandTotal);

	// calculating Supper Costs for Adults
	var numAdults = document.forms[0].numAdults.selectedIndex;
	
	if (numAdults > 0)
	{
	   numAdults = numAdults * fraisAdult; // numAdults has $ value
			
       // formatting Total Adults Supper Costs
       numToFormat(numAdults, document.forms(0).totAdultFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdultFrais.value = "";
	}// endif
	
    // formatting Total Inscription Frais
	totFrais = totFrais + numAdults;
    numToFormat(totFrais, document.forms(0).totFraisInscription);

    // calculating & formatting Grand Total cost
    grandTotal = grandTotal + numAdults;
    numToFormat(grandTotal, document.forms(0).grandTotal);

	// calculating Supper Costs for Kids	
	var numKids = document.forms[0].numKids.selectedIndex;	
	
	if (numKids > 0)
	{
	   numKids = numKids * fraisKid; // numKids has $ value
			
       // formatting Total Kids Supper Cost
       numToFormat(numKids, document.forms(0).totKidFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totKidFrais.value = "";
	}// endif

    // formatting Total Inscription Frais
	totFrais = totFrais + numKids;
    numToFormat(totFrais, document.forms(0).totFraisInscription);

    // calculating & formatting Grand Total cost
    grandTotal = grandTotal + numKids;
    numToFormat(grandTotal, document.forms(0).grandTotal);
	
	if (grandTotal > 0)
	{
	  enableEMailButton();
	}
	else
	{
	  disableEMailButton();
	}//endif
}// end function calcPaulinCosts

/*******************************************/
/*                                         */
function disableCardNums()
/*                                         */
/*******************************************/
{
   document.forms[0].CARD1.disabled=true;
   document.forms[0].CARD1.selectedIndex=0;
   document.forms[0].CARD2.disabled=true;
   document.forms[0].CARD2.selectedIndex=0;
   document.forms[0].CARD3.disabled=true;
   document.forms[0].CARD3.selectedIndex=0;
   document.forms[0].CARD4.disabled=true;
   document.forms[0].CARD4.selectedIndex=0;
   document.forms[0].CARD5.disabled=true;
   document.forms[0].CARD5.selectedIndex=0;
   document.forms[0].CARD6.disabled=true;
   document.forms[0].CARD6.selectedIndex=0;
   document.forms[0].CARD7.disabled=true;
   document.forms[0].CARD7.selectedIndex=0;
   document.forms[0].CARD8.disabled=true;
   document.forms[0].CARD8.selectedIndex=0;
   document.forms[0].CARD9.disabled=true;
   document.forms[0].CARD9.selectedIndex=0;
}// end disableCardNums function

/*******************************************/
/*                                         */
function loadPaulinCardNums()
/*                                         */
/*******************************************/
{
    // Initializing Card1 through 9 drop down lists dependant on number of numAvecCards
	var numAvecCards = document.forms[0].numAvecCarte.selectedIndex;

	switch (numAvecCards)
	{
	   case 1:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
		  break;
	   case 2:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
		  break;
	   case 3:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
	      loadList(document.forms[0].CARD3);
          document.forms[0].CARD3.disabled=false;
		  break;
	   case 4:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
	      loadList(document.forms[0].CARD3);
          document.forms[0].CARD3.disabled=false;
	      loadList(document.forms[0].CARD4);
          document.forms[0].CARD4.disabled=false;
		  break;
	   case 5:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
	      loadList(document.forms[0].CARD3);
          document.forms[0].CARD3.disabled=false;
	      loadList(document.forms[0].CARD4);
          document.forms[0].CARD4.disabled=false;
	      loadList(document.forms[0].CARD5);
          document.forms[0].CARD5.disabled=false;
		  break;
	   case 6:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
	      loadList(document.forms[0].CARD3);
          document.forms[0].CARD3.disabled=false;
	      loadList(document.forms[0].CARD4);
          document.forms[0].CARD4.disabled=false;
	      loadList(document.forms[0].CARD5);
          document.forms[0].CARD5.disabled=false;
	      loadList(document.forms[0].CARD6);
          document.forms[0].CARD6.disabled=false;
		  break;
	   case 7:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
	      loadList(document.forms[0].CARD3);
          document.forms[0].CARD3.disabled=false;
	      loadList(document.forms[0].CARD4);
          document.forms[0].CARD4.disabled=false;
	      loadList(document.forms[0].CARD5);
          document.forms[0].CARD5.disabled=false;
	      loadList(document.forms[0].CARD6);
          document.forms[0].CARD6.disabled=false;
	      loadList(document.forms[0].CARD7);
          document.forms[0].CARD7.disabled=false;
		  break;
	   case 8:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
	      loadList(document.forms[0].CARD3);
          document.forms[0].CARD3.disabled=false;
	      loadList(document.forms[0].CARD4);
          document.forms[0].CARD4.disabled=false;
	      loadList(document.forms[0].CARD5);
          document.forms[0].CARD5.disabled=false;
	      loadList(document.forms[0].CARD6);
          document.forms[0].CARD6.disabled=false;
	      loadList(document.forms[0].CARD7);
          document.forms[0].CARD7.disabled=false;
	      loadList(document.forms[0].CARD8);
          document.forms[0].CARD8.disabled=false;
		  break;
	   case 9:
	      loadList(document.forms[0].CARD1);
          document.forms[0].CARD1.disabled=false;
	      loadList(document.forms[0].CARD2);
          document.forms[0].CARD2.disabled=false;
	      loadList(document.forms[0].CARD3);
          document.forms[0].CARD3.disabled=false;
	      loadList(document.forms[0].CARD4);
          document.forms[0].CARD4.disabled=false;
	      loadList(document.forms[0].CARD5);
          document.forms[0].CARD5.disabled=false;
	      loadList(document.forms[0].CARD6);
          document.forms[0].CARD6.disabled=false;
	      loadList(document.forms[0].CARD7);
          document.forms[0].CARD7.disabled=false;
	      loadList(document.forms[0].CARD8);
          document.forms[0].CARD8.disabled=false;
	      loadList(document.forms[0].CARD9);
          document.forms[0].CARD9.disabled=false;
		  break;
	   case 0:
          disableCardNums();
		  break;
	}// end switch   
}// loadPaulinCardNums function

/*******************************************/
/*                                         */
function calcMcLaughlinCosts()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;
	var HST              = .13;
	var totFrais         = 0;
	var grandTotal       = 0;
	var fraisAdult       = 25;
	var fraisKid         = 15;
	var fraisBrunch      = 6;
	
	// calculating Book costs
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// loop

	if(numBooks > 0)
	{
		document.forms[0].numBooks.value = numBooks;
		
		switch (numBooks)
		{
			case 1:
				cost = 34.95;
				break;
			case 2:
				cost = 59.95;
				break;
			case 3:
				cost = 99.95;
				break;
			case 4:
				cost = 119.95;
				break;
			default:
				cost = 119.95 + (numBooks - 4) * 29.95;
		}// end switch
		
		// formatting Book costs
        numToFormat(cost, document.forms(0).bookCost);
		
		// caluculating & formatting Shipping Costs (which aren't used in this application)
		shipCosts = numBooks * 0;
        numToFormat(shipCosts, document.forms(0).shippingCost);
		
		// calculating & formatting Total Genealogy costs
		total = cost + shipCosts - shipCosts;
        numToFormat(cost, document.forms(0).total);
		
   		// calculating & formatting Grand Total cost (grandTotal is used for the 1st time here)
   		grandTotal = total;
        numToFormat(grandTotal, document.forms(0).grandTotal);
	}// endif

/***************************************************************************/

	// calculating Supper Costs for Adults
	var numAdults = document.forms[0].numAdults.selectedIndex;
	
	if (numAdults > 0)
	{
	   numAdults = numAdults * fraisAdult; // numAdults has $ value
			
       // formatting Total Adults Supper Costs
       numToFormat(numAdults, document.forms(0).totAdultFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdultFrais.value = "";
	}// endif
	
    // formatting Total Inscription Frais
	totFrais = totFrais + numAdults;
    numToFormat(totFrais, document.forms(0).totFraisInscription);

    // calculating & formatting Grand Total cost
    grandTotal = grandTotal + numAdults;
    numToFormat(grandTotal, document.forms(0).grandTotal);

	// calculating Supper Costs for Kids	
	var numKids = document.forms[0].numKids.selectedIndex;	
	
	if (numKids > 0)
	{
	   numKids = numKids * fraisKid; // numKids has $ value
			
       // formatting Total Kids Supper Cost
       numToFormat(numKids, document.forms(0).totKidFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totKidFrais.value = "";
	}// endif

    // formatting Total Inscription Frais
	totFrais = totFrais + numKids;
    numToFormat(totFrais, document.forms(0).totFraisInscription);

    // calculating & formatting Grand Total cost
    grandTotal = grandTotal + numKids;
    numToFormat(grandTotal, document.forms(0).grandTotal);

	// calculating Brunch Costs	
	var numBrunch = document.forms[0].numBrunch.selectedIndex;	
	
	if (numBrunch > 0)
	{
	   numBrunch = numBrunch * fraisBrunch; // numBrunch has $ value
			
       // formatting Total Brunch Cost
       numToFormat(numBrunch, document.forms(0).totBrunchFrais);
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totBrunchFrais.value = "";
	}// endif

    // formatting Total Inscription Frais
	totFrais = totFrais + numBrunch;
    numToFormat(totFrais, document.forms(0).totFraisInscription);

    // calculating & formatting Grand Total cost
    grandTotal = grandTotal + numBrunch;
    numToFormat(grandTotal, document.forms(0).grandTotal);

}// end function calcMcLaughlinCosts

/*******************************************/
/*                                         */
function calcComeauCosts()
/*                                         */
/*******************************************/
{
	var numBooks = 0;
	var controlIndex;
	var element;
	var numberOfControls = document.forms[0].length;
	var kidsTprice       = 10.99;
	var adultsTprice     = 11.99;
	var bigAdultsTprice  = 14.99;
	var hatsPrice        = 13.99;
	var HST              = .13;
	var grandTotal       = 0;
	var fraisAdult       = 18;
	var fraisKid         = 10;
	var fraisPin         = 10;
	var fraisCartes      = 5;	
	
	// calculating Book costs
	for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
	{
		element = document.forms[0][controlIndex];
		if (element.type == "checkbox")
		{
			if (element.checked == true)
			{
			   numBooks++;
			}// endif
		}// endif
	}// loop

	if (numBooks > 0)
	{
       document.forms[0].numBooks.value = numBooks;
       switch (numBooks)
       {
             case 1:
				cost = 34.95;
				break;
             case 2:
                cost = 59.95;
                break;
             case 3:
                cost = 99.95;
                break;
             case 4:
             	cost = 119.95;
                break;
             default:
                cost = 119.95 + (numBooks - 4) * 29.95;
       }// end switch
    
       // formatting Book costs
       var costs = new NumberFormat(cost);
       costs.setPlaces(2);
       document.forms[0].bookCost.value = costs.toFormatted();
        
       // caluculating & formatting Shipping Costs (which aren't used in this application)
       shipCosts = numBooks * 0;
       var shipCost = new NumberFormat(shipCosts);
       shipCost.setPlaces(2);
       document.forms[0].shippingCost.value = shipCost.toFormatted();
        
       // calculating & formatting Total Genealogy costs
       total = cost + shipCosts-shipCosts;
       var tot = new NumberFormat(total);
       tot.setPlaces(2);
       document.forms[0].total.value = tot.toFormatted();
    
       // calculating & formatting Grand Total cost
       grandTotal = grandTotal + total;
       var tot = new NumberFormat(grandTotal);
       tot.setPlaces(2);
       document.forms[0].grandTotalComeau.value = tot.toFormatted();
	}// endif

/***************************************************************************/
/*********
	// formatting Total Frais Inscription with value of fraisDeBase
    var basicFrais = new NumberFormat(fraisDeBase);
    basicFrais.setPlaces(2);
    document.forms[0].totFraisInscription.value = basicFrais.toFormatted();

    // calculating & formatting Grand Total cost 
	// IMPORTANT: To get the numeric value from the formatted object, use the ".num" property!)
    grandTotal = grandTotal + basicFrais.num;
    var tot = new NumberFormat(grandTotal);
    tot.setPlaces(2);
    document.forms[0].grandTotal.value = tot.toFormatted();

	// calculating Supper Costs for Adults
	var numAdults = document.forms[0].numAdults.selectedIndex;
	
	if (numAdults > 0)
	{
	   numAdults = numAdults * fraisAdult;
			
       // formatting Total Adults Supper Costs
       var tot = new NumberFormat(numAdults);
       tot.setPlaces(2);
       document.forms[0].totAdultFrais.value = tot.toFormatted();
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdultFrais.value = "";
	}// endif
	
	// calculating Supper Costs for Kids	
	var numKids = document.forms[0].numKids.selectedIndex;	
	
	if (numKids > 0)
	{
	   numKids = numKids * fraisKid;
			
       // formatting Total Kids Supper Cost
       var tot = new NumberFormat(numKids);
       tot.setPlaces(2);
       document.forms[0].totKidFrais.value = tot.toFormatted();
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totKidFrais.value = "";
	}// endif
*********/
	// calculating Pin Costs	
	var numPins = document.forms[0].numPins.selectedIndex;	
	
	if(numPins > 0)
	{
	   numPins = numPins * fraisPin;
			
		// formatting Total Pins Cost
    	var tot = new NumberFormat(numPins);
    	tot.setPlaces(2);
   		document.forms[0].totPinFrais.value = tot.toFormatted();
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totPinFrais.value = "";
	}// endif
/**********	
	// calculating Cartes Costs	
	var numCartes = document.forms[0].numCartes.selectedIndex;	
	
	if(numCartes > 0)
	{
	   numCartes = numCartes*fraisCartes;
			
		// formatting Total Cartes Cost
    	var tot = new NumberFormat(numCartes);
    	tot.setPlaces(2);
   		document.forms[0].totCarteFrais.value = tot.toFormatted();
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totCarteFrais.value = "";
	}// endif
**********/	

	// calculating Inscription and Total Supper Costs
	var totFrais = 0
	
	// The following variables in this "if-then-else's" condition contain the $ value of each category

//	if(numAdults > 0 || numKids > 0 || numPins > 0 || numCartes > 0)
	if (numPins > 0)
	{
	   // totFrais = totFrais + numAdults + numKids + numPins + numCartes;	   		
	   totFrais = totFrais + numPins;	   		

	   
	   // formatting Total Supper and Inscription Costs
       var tot = new NumberFormat(totFrais);
       tot.setPlaces(2);
   	   document.forms[0].totFraisInscriptionComeau.value = tot.toFormatted();   	
		
       // calculating & formatting Grand Total cost
       grandTotal = grandTotal + totFrais;
       var tot = new NumberFormat(grandTotal);
       tot.setPlaces(2);
       document.forms[0].grandTotalComeau.value = tot.toFormatted();
	}// endif

/***************************************************************************/	
/**** Not Currently used in Comeau Calcs
	// calculating Souvenir purchases
	var totKids = 0;
	var totAdults = 0;
	var totBigAdults = 0;
	var totHats = 0;
	var totHST = 0;
	var totSales = 0;
	var totSouvenirs = 0;
	
	// calculating Kid Ts
    totKids = 	   	    document.forms[0].size2a4.selectedIndex;
	totKids = totKids + document.forms[0].size6a8.selectedIndex;
    totKids = totKids + document.forms[0].size10a12.selectedIndex;
    totKids = totKids + document.forms[0].size14a16.selectedIndex;	
	
	if (totKids > 0)
	{
   	 	totKids = totKids*kidsTprice;
		
		// formatting Total Kids Ts
    	var tot = new NumberFormat(totKids);
    	tot.setPlaces(2);
   		document.forms[0].totKids.value = tot.toFormatted();
		
		// calculating Total Sales
		totSales = totKids;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totKids.value = "";
	}// endif
	
	// calculating Adults Ts
    totAdults =    		    document.forms[0].sizeP.selectedIndex;
	totAdults = totAdults + document.forms[0].sizeM.selectedIndex;
    totAdults = totAdults + document.forms[0].sizeG.selectedIndex;
    totAdults = totAdults + document.forms[0].sizeXG.selectedIndex;	
	
	if (totAdults > 0)
	{
   	 	totAdults = totAdults * adultsTprice;
		
		// formatting Total Adults Ts
    	var tot = new NumberFormat(totAdults);
    	tot.setPlaces(2);
   		document.forms[0].totAdults.value = tot.toFormatted();
		
		// calculating Total Sales
		totSales = totSales+totAdults;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totAdults.value = "";
	}// endif
	
	// calculating Big Adults Ts
   	totBigAdults = 	   		  	  document.forms[0].sizeXXG.selectedIndex;
	totBigAdults = totBigAdults + document.forms[0].sizeXXXG.selectedIndex;	
	
	if (totBigAdults > 0)
	{
   	 	totBigAdults = totBigAdults * bigAdultsTprice;
		
		// formatting Total Big Adults Ts
    	var tot = new NumberFormat(totBigAdults);
    	tot.setPlaces(2);
   		document.forms[0].totBigAdults.value = tot.toFormatted();
		
		// calculating Total Sales
		totSales = totSales+totBigAdults;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totBigAdults.value = "";
	}// endif
	
	// calculating Hats
    totHats = document.forms[0].sizeHat.selectedIndex;	
	
	if (totHats > 0)
	{
   	 	totHats = totHats * hatsPrice;
		
		// formatting Total Hats
    	var tot = new NumberFormat(totHats);
    	tot.setPlaces(2);
   		document.forms[0].totHats.value = tot.toFormatted();
		
		// calculating Total Sales
		totSales = totSales+totHats;
	}
	else // The false action clears the input text box if a value was assigned to it previously
	{	
       document.forms[0].totHats.value = "";
	}// endif
	
	// formatting Total Sales, calculating HST & Total Souvenirs Sales
	if (totSales > 0)
	{
    	var tot = new NumberFormat(totSales);
    	tot.setPlaces(2);
   		document.forms[0].totSales.value = tot.toFormatted();
		
		totHST = totSales * HST;
    	var tot = new NumberFormat(totHST);
    	tot.setPlaces(2);
   		document.forms[0].HST.value = tot.toFormatted();
	 	
		totSouvenirs = totSales + totHST;
    	var tot = new NumberFormat(totSouvenirs);
    	tot.setPlaces(2);
   		document.forms[0].totSouvenirs.value = tot.toFormatted();
	}// endif   
	
	// calculating & formatting Grand Total cost
	if (totSouvenirs > 0)
	{
     	grandTotal = grandTotal + totSouvenirs;
     	var tot = new NumberFormat(grandTotal);
     	tot.setPlaces(2);
     	document.forms[0].grandTotal.value = tot.toFormatted();
	}// endif
*******/
}// end function calcComeauCosts

/*******************************************/
/*                                         */
function displayDate()                     // Displays time, day & date in textarea
/*                                         */
/*******************************************/
  {
    var yourDate = new Date();
    var dateString = yourDate.toString();

    /********************************************/
    /*                                          */
    /* toString() provides date in this format  */
    /* for parsing by substr() method:          */
    /*                                          */
    /*    000000000011111111112222222222333     */
    /*    012345678901234567890123456789012     */
    /*    Fri Nov 28 17:10:11 UTC-0400 2008     */
    /*                                          */
    /* It was discovered that a date from 1 - 9 */
    /* affects the length of dateString by 1,   */ 
	/* therefore we test the length of          */
	/* dateString and substr() accordingly.     */
    /*                                          */
    /********************************************/
	
	if (dateString.length == 32)
	{	  
	  var journee = dateString.substr(0,3);
	  var mois    = dateString.substr(4,3);
	  var date    = dateString.substr(8,1);
	  var heure   = dateString.substr(10,2);
	  var minute  = dateString.substr(13,2);
	  var sec     = dateString.substr(16,2);
	  var diffGMT = dateString.substr(19,8);
	  var annee   = dateString.substr(28,4);
    }
	else
	{
	  var journee = dateString.substr(0,3);
	  var mois    = dateString.substr(4,3);
	  var date    = dateString.substr(8,2);
	  var heure   = dateString.substr(11,2);
	  var minute  = dateString.substr(14,2);
	  var sec     = dateString.substr(17,2);
	  var diffGMT = dateString.substr(20,8);
	  var annee   = dateString.substr(29,4);
	} // endif
	
	switch (dateString.substr(0,3))
	{
	  case "Sun":
	    journee = "dimanche";
		break;
		
	  case "Mon":
	    journee = "lundi";
		break;
		
	  case "Tue":
	    journee = "mardi";
		break;
		
	  case "Wed":
	    journee = "mercredi";
		break;
		
	  case "Thu":
	    journee = "jeudi";
		break;
		
	  case "Fri":
	    journee = "vendredi";
		break;
		
	  case "Sat":
	    journee = "samedi";
		break;
		
	  default:
	    journee = "ohoh";
	}// end switch
	
	switch (dateString.substr(4,3))
	{
	  case "Jan":
	    mois = "janvier";
		break;
		
	  case "Feb":
	    mois = "f\351vrier";
		break;
		
	  case "Mar":
	    mois = "mars";
		break;
		
	  case "Apr":
	    mois = "avril";
		break;
		
	  case "May":
	    mois = "mai";
		break;
		
	  case "Jun":
	    mois = "juin";
		break;
		
	  case "Jul":
	    mois = "juillet";
		break;
		
	  case "Aug":
	    mois = "ao\373t";
		break;
		
	  case "Sep":
	    mois = "septembre";
		break;
		
	  case "Oct":
	    mois = "octobre";
		break;
		
	  case "Nov":
	    mois = "novembre";
		break;
		
	  case "Dec":
	    mois = "d\351cembre";
		break;
		
	  default:
	    mois = "ohoh";
	
	}// end switch
	
	if (mois == "Apr" || mois == "Aug" || mois == "Oct"){
	  document.forms[0].dispDate.value = "Aujourd'hui, c'est " + heure + "hr:" + 
	                                      minute + ":" + sec + ", " + journee + ", le " + 
										  date + " d'" + mois + ", " + annee + ".";
	}else {
	  document.forms[0].dispDate.value = "Aujourd'hui, c'est " + heure + "hr:" + 
	                                      minute + ":" + sec + ", " + journee + ", le " + 
										  date + " de " + mois + ", " + annee + ".";
	}// endif

	// this subroutine called because the Family name is hidden and the "onchange" event never changes 
	// and is not copied from one hidden input to the others, so it is copied when the page is loaded or
	// the dispDate function is called. Also the numBooks is hidden and the its value is copied

    if (document.forms[0].name != "SecNatInputs")
	{
	  if (document.forms[0].name != "PaulinInputs")
	  {
//alert("The logic went here!!!");
	  copyIt(document.forms[0].Family, document.forms[0].cbxFamily, document.forms[0].cbcFamily);
	  disableEMailButton();
	  }//endif
	}//endif
  }// end function displayDate

/*******************************************/
/*                                         */
function disableEMailButton()
/*                                         */
/*******************************************/
{
  document.forms[0].eMail.disabled = true;
}//  
  
/*******************************************/
/*                                         */
function enableEMailButton()
/*                                         */
/*******************************************/
{
  document.forms[0].eMail.disabled = false;
}//  
  
/*******************************************/
/*                                         */
function numToFormat(num, whereToFormat)   // Receives a variable and object, as parameters
/*                                         */
/*******************************************/
{
  var number = new NumberFormat(num);
  number.setPlaces(2);
  whereToFormat.value = number.toFormatted();
} // end numToFormat function

/*******************************************/
/*                                         */
function advisePrint()
/*                                         */
/*******************************************/
{
  // The "\'s" in this instruction give the Octal code for the accented characters 
  alert("S\351lectionnez :\n\n\260   \47Fichier \55\55\76 Aper\347u avant impression\47 \/ \50\47File \55\55\76 Print Preview\47\51\n\260   de la deuxi\350me liste, choisissez :\n\260   la deuxi\350me option :\n\260  \47Le cadre s\351lectionn\351 seulement\47\/ \50\47Only the selected frame\47\51\n\navant d\47imprimer.\n\nSelect:\n\n\260   \47File \55\55\76 Print Preview\47\n\260   from the second list, chose:\n\260   the second option:\n\260  \47Only the selected frame\47\n\nbefore printing.");
//  window.print();

  if (document.forms[0].grandTotal.value > 0)
  {
    return;
  }
  else
  {
    alert("Vous n'avez pas de Grand total !\n\nYou do not have a Grand Total!");
  }//endif
}// end advisePrint function

/***************************************************/
/*                                                 */
function copyNames(firstName,lastName,whereToCopy) // Receives three objects, as parameters
/*                                                 */
/***************************************************/
{
  whereToCopy.value = firstName.value + " " + lastName.value;  
}// end copyNames function

/*****************************************************************/
/*                                                               */
function copyIt(whatToCopy, firstPlaceToCopy, secondPlaceToCopy) // Receives three objects, as parameters
/*                                                               */
/*****************************************************************/
{
//alert(whatToCopy.value);
  firstPlaceToCopy.value  = whatToCopy.value;  
  secondPlaceToCopy.value = whatToCopy.value;

}// end copyIt function

/*******************************************/
/*                                         */
function checkAccents(check)               // Receives an object, as parameters
/*                                         */
/*******************************************/
{
  //This function converts accented characters to their octal value to allow the 
  //accented characters to be read corretly when form info is emailed.
  
  var word = check.value;
  
  if (word > "")
  {
    //case "é"
	word = word.replace(/\351/g, "\351");
    //case "É"
	word = word.replace(/\311/g, "\311");
    //case "è"
	word = word.replace(/\350/g, "\350");
    //case "È"
	word = word.replace(/\350/g, "\350");
    //case "ë"
	word = word.replace(/\353/g, "\353");
    //case "Ë"
	word = word.replace(/\313/g, "\313");
    //case "ê"
	word = word.replace(/\352/g, "\352");
    //case "Ê"
	word = word.replace(/\312/g, "\312");
    //case "â"
	word = word.replace(/\342/g, "\342");
    //case "Â"
	word = word.replace(/\302/g, "\302");
    //case "à"
	word = word.replace(/\340/g, "\340");
    //case "À"
	word = word.replace(/\300/g, "\300");
    //case "ô"
	word = word.replace(/\364/g, "\364");
    //case "Ô"
	word = word.replace(/\324/g, "\324");
    //case "î"
	word = word.replace(/\356/g, "\356");
    //case "Î"
	word = word.replace(/\316/g, "\316");
    //case "ï"
	word = word.replace(/\357/g, "\357");
    //case "Ï"
	word = word.replace(/\317/g, "\317");
    //case "ç"
	word = word.replace(/\347/g, "\347");
    //case "Ç"
	word = word.replace(/\307/g, "\307");
    //case "û"
	word = word.replace(/\373/g, "\373");
    //case "Û"
	word = word.replace(/\333/g, "\333");
    //case "ù"
	word = word.replace(/\371/g, "\371");
    //case "Ù"
	word = word.replace(/\331/g, "\331");

   check.value = word;
 }// endif   
}// end checkAccents function

/*******************************************/
/*                                         */
function submitIT()                        // Used to submit (eMail) the forms
/*                                         */
/*******************************************/
{
//  if (document.forms[0].Family.value == "Paulin")
//  {
//    if (document.forms[0].conFirstName.value == "" || document.forms[0].conLastName.value == "")
//	{
//	  alert("Vous n'avez pas complèté l'information contact ! /\nYou have not completed the contact information!");
//	  parent.Body.location='PaulinGenealogy.html#CONTACT';
//	  document.forms[0].conFirstName.focus();
//	  return;
//	}
//	else
//	{
//	  // cookie written when PAULIN form is eMailed
//      set_Cookie('PaulinCookie', '10');
//	}// endif
//  }// endif
  
  document.forms[0].submit();

}// end submitIT function

/*******************************************/
/*                                         */
function submitSecNat()                    // Used to submit (eMail) SecNatInputs (Genealogy Information) form 
/*                                         */
/*******************************************/
{
  document.forms[0].submit();
}// end submitIT function


/*******************************************/
/*                                         */
function setupNumBooks()                   // Used to copy the value of numBooks to cbxnumBooks and cbcnumBooks
/*                                         */
/*******************************************/
{
  // Paulin form doesn't sell eBooks
  if (document.forms[0].Family.value != "Paulin")
  {
    copyIt(document.forms[0].numBooks, document.forms[0].cbxnumBooks, document.forms[0].cbcnumBooks);
    copyIt(document.forms[0].total,    document.forms[0].cbxtotal,    document.forms[0].cbctotal);
  }// endif
  
  // now that two above amounts copied, form can be emailed
  enableEMailButton();
} // end setupNumBooks function
