function PrintMe()
{
  print()
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function ReturnValue()
{
   
//*HOW MANY SOFT COPIES?   

softquantity = document.form.SoftQuantity.value
//   if (softquantity == 0)
//    { 
//      alert("Please enter a quantity")
//      document.form.SoftQuantity.focus()
//    }

 books = 23.95
    
 if (softquantity >= 6 && softquantity <= 10)
 {
 
   books = 21.55
 
 }
 
 if (softquantity >= 11 && softquantity <= 25)
 {
 
   books = 19.15
 
 } 
 
 if (softquantity >=26)
 {
 
   books = 16.75
 
 }
 
 if (softquantity == 0)
 { 
  books = 0
  TotalSoftDollars = 0
 }
 else
 {
  TotalSoftDollars = books *  softquantity
 }
 
 //alert(TotalSoft)
 
 
 
 //*CHECK FOR HARDBACKS
 
 hardquantity = document.form.HardQuantity.value
   if (hardquantity == 0)
    {
      hardbooksdollars = 0
      //alert(hardbooksdollars)
    }
   else
    {
     hardbooksdollars = hardquantity * 35.00
     //alert(hardbooksdollars)
    } 
 
 
 
 //******************CHECK THE STATE
 
 TotalCopiesDollars = TotalSoftDollars + hardbooksdollars
 //alert(TotalCopiesDollars)
 TotalCopies = parseInt(softquantity) + parseInt(hardquantity)
 //alert(TotalCopies)
 
  state = document.form.State.options[document.form.State.selectedIndex].value
   if (state == "VA")
    {
     //alert(state)
      //SubHold1 = quantity * books
      //SubHold2 = SubHold1 * .05
      //SubTotal = SubHold1 + SubHold2
      SubTotal = TotalCopiesDollars + (TotalCopiesDollars * .05)
      //alert(SubTotal)
    }
    
   else
   {
      //SubTotal = quantity * books    
      SubTotal = TotalCopiesDollars
      //alert(SubTotal)
   }
    
//******************SHIPPING & HANDLING    
  
  ShipHand = ShipIt(TotalCopies)
  
  FinalTotal = SubTotal + ShipHand
    
  document.form.Total.value = "$" + RoundIt(FinalTotal)
  
  
  }
  
function RoundIt(number,X) 
{
 // rounds number to X decimal places, defaults to 2
  X = (!X ? 2 : X);
  return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

function ShipIt(amount)
{

 if (amount == 1)
  {
    return ShipCost = 4.95
  }

else
  {
   return ShipCost = ((3 * (amount - 1)) + 4.95)
  }
 
 }

  
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
function mailIt(form)
{
var State = document.form.State.options[document.form.State.selectedIndex].value
var MailState = document.form.MailState.options[document.form.MailState.selectedIndex].value
var Pay = document.form.CCard.options[document.form.CCard.selectedIndex].value
var FromName = document.form.FName.value + " " + document.form.MidName.value + " " + document.form.LastName.value
var message_body = 
("Spreading The Risks Order Request.") +
("\n\n*** Personal Info ***") +
("\nName: ") + FromName +
("\nAddress: ") + document.form.Address1.value +
("\nAddress: ") + document.form.Address2.value + 
("\nCity: ") + document.form.City.value +
("\nState: ") + State + 
("\nZip: ") + document.form.Zip.value + 
("\nCountry: ") + document.form.Country.value + 
("\nPhone: ") + document.form.Phone.value + 
("\nEmail: ") + document.form.Email.value + 
("\n\n*** Soft Order Quantity ***") +
("\nQuantity: ") + document.form.SoftQuantity.value +
("\n\n*** Hard Order Quantity ***") +
("\nQuantity: ") + document.form.HardQuantity.value +
("\n\n*** TOTAL ***") +
("\nTotal: ") + document.form.Total.value +
("\n\n*** Ship to Address ***") +
("\nName: ") + document.form.MailFName.value + " " + document.form.MailMidName.value + " " + document.form.MailLastName.value +
("\nAddress: ") + document.form.MailAddress1.value +
("\nAddress: ") + document.form.MailAddress2.value + 
("\nCity: ") + document.form.MailCity.value +
("\nState: ") + MailState + 
("\nZip: ") + document.form.MailZip.value + 
("\nCountry: ") + document.form.MailCountry.value +
("\n\n***Credit Card Information.***") +
("\nPayment Method: ") + Pay +
("\nAccount: ") + document.form.Account.value + 
("\nExpiration Date: ") + document.form.ExDate.value 

document.form.MessageBody.value = message_body
document.form.FromName.value = FromName
//alert (message_body)

document.form.submit()

}
