function checkForm()
{
   if(processForm() == true)
   {
      writePrintOrder();
   }
}




function writePrintOrder()
{
   //grab all form info again
   var myname   = top.topframe.document.mailorderform.myname_box.value;
   var company  = top.topframe.document.mailorderform.company_box.value;
   var address1 = top.topframe.document.mailorderform.address1_box.value;
   var address2 = top.topframe.document.mailorderform.address2_box.value;
   var city     = top.topframe.document.mailorderform.city_box.value;
   var state    = top.topframe.document.mailorderform.state_box.value;
   var zip      = top.topframe.document.mailorderform.zip_box.value;
   var country  = top.topframe.document.mailorderform.country_box.value;
   var email    = top.topframe.document.mailorderform.email_box.value;

   // Add line break to company ===============================
   if (company.length > 0) { company = "<BR>" + company }

   // Add line break to address2 ===============================
   if (address2.length > 0) { address2 = "<BR>" + address2 }

   // If USA, eliminate country from printout and my address ===================
   joecountry = "<BR>USA";
   if ((country.toUpperCase() == "USA")||(country.toUpperCase() == "US")||(country.toUpperCase() == "UNITED STATES")||(country.toUpperCase() == "UNITED STATES OF AMERICA")||(country.toUpperCase() == "U.S.")||(country.toUpperCase() == "U.S.A.")) { country = ""; joecountry = "";}

   // Generate Date ===============================
   datenow = new Date();
   var yy = datenow.getYear();
   var thisyear = (yy < 1000) ? yy + 1900 : yy;
   var montharray = new Array; montharray[0] = "January "; montharray[1] = "February "; montharray[2] = "March "; montharray[3] = "April "; montharray[4] = "May "; montharray[5] = "June "; montharray[6] = "July "; montharray[7] = "August "; montharray[8] = "September "; montharray[9] = "October "; montharray[10] = "November "; montharray[11] = "December ";
   printdate = (montharray[datenow.getMonth()]) + datenow.getDate() + ", " + thisyear;

   // write the print page
   top.topframe.document.clear();
   top.topframe.document.open();
   top.topframe.document.writeln("<HTML><HEAD><TITLE>PageTutor Order</TITLE>");

   top.topframe.document.writeln("<STYLE TYPE=\"text/css\">");
   top.topframe.document.writeln("body  { font:normal 10pt verdana,arial\; }");
   top.topframe.document.writeln("table { font:normal 10pt verdana,arial\; }");
   top.topframe.document.writeln("ul    { font:normal 10pt verdana,arial\; }");
   top.topframe.document.writeln("</STYLE>");


   top.topframe.document.writeln("</HEAD>");
   top.topframe.document.writeln("<BODY BGCOLOR=\"#FFFFFF\" onLoad=\"self.focus()\">");
   top.topframe.document.writeln("<IMG SRC=\"ptlogo_membership2.gif\" WIDTH=\"320\" HEIGHT=\"42\" ALT=\"\" BORDER=\"0\">");
   top.topframe.document.writeln("<P><BIG><B>Mail/Post Order</B></BIG>");
   top.topframe.document.writeln("<BR>Order date: " + printdate);
   top.topframe.document.writeln("<P>My order...");

   //start itemized table-------------------------------------
   top.topframe.document.writeln("<P><UL>");
   top.topframe.document.writeln("<TABLE CELLSPACING=\"1\" CELLPADDING=\"0\" BORDER=\"0\">");
   top.topframe.document.writeln("<TR><TD COLSPAN=\"2\"><B>Product code: " + cd_3digit + "</B></TD></TR>");
   top.topframe.document.writeln("<TR><TD COLSPAN=\"2\"><IMG SRC=\"dotblack.gif\" WIDTH=\"100%\" HEIGHT=\"1\" ALT=\"\" BORDER=\"0\"></TD></TR>");
   top.topframe.document.writeln("<TR><TD>Lifetime Membership </TD><TD ALIGN=\"right\">" + cd_life + "</TD></TR>");
   top.topframe.document.writeln("<TR><TD>PageTutor Manual \& Companion CD\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;</TD><TD ALIGN=\"right\">" + cd_ptbook + "</TD></TR>");
   top.topframe.document.writeln("<TR><TD>Javascr"+"ipt Tutor book </TD><TD ALIGN=\"right\">" + cd_jsbook + "</TD></TR>");
   //top.topframe.document.writeln("<TR><TD COLSPAN=\"2\"><IMG SRC=\"dotblack.gif\" WIDTH=\"100%\" HEIGHT=\"1\" ALT=\"\" BORDER=\"0\"></TD></TR>");
   //top.topframe.document.writeln("<TR><TD>SubTotal </TD><TD ALIGN=\"right\">" + cd_subtotal + "</TD></TR>");
   top.topframe.document.writeln("<TR><TD>Shipping </TD><TD ALIGN=\"right\">" + cd_ship + "</TD></TR>");
   top.topframe.document.writeln("<TR><TD COLSPAN=\"2\"><IMG SRC=\"dotblack.gif\" WIDTH=\"100%\" HEIGHT=\"1\" ALT=\"\" BORDER=\"0\"></TD></TR>");
   top.topframe.document.writeln("<TR><TD><B>TOTAL </B></TD><TD ALIGN=\"right\"><B>" + cd_total + "</B></TD></TR>");
   top.topframe.document.writeln("</TABLE>");
   top.topframe.document.writeln("</UL>");
   //end itemized table---------------------------------------

   top.topframe.document.writeln("<P>My information...");
   top.topframe.document.writeln("<P><UL><BIG>" + myname + company);
   top.topframe.document.writeln("<BR>" + address1 + address2);
   top.topframe.document.writeln("<BR>" + city + " " + state + " " + zip);
   top.topframe.document.writeln("<BR>" + country + "</BIG>");
   top.topframe.document.writeln("<BR>\&nbsp\;<BR>Email: <BIG>" + email + "</BIG>");
   top.topframe.document.writeln("</UL>");
   top.topframe.document.writeln("<P>Enclosed is remittance of<B> $" + cd_total + "</B> in US Dollars.");
   top.topframe.document.writeln("<BR><I>You are welcome to pay with a personal check, cashier\'s check, money order or cash. If you are ordering a membership, your password will be emailed to you when your order is processed.</I>");
   top.topframe.document.writeln("<HR><P>Print this out, include your payment and drop it in the mail.<BR>Make checks payable to Joe Barta.");
   top.topframe.document.writeln("<P>Mail to:<P><UL><BIG>Joe Barta<BR>1209 E 357th Street<BR>Eastlake OH 44095" + joecountry + "</BIG></UL>");

   top.topframe.document.writeln("</BODY></HTML>");
   top.topframe.document.close();
}


