// PageBuilder, Copyright 2001, Phil Groom <www.groomsville.co.uk>
// Linkware: if you use this script in part or in whole, please provide a link from your site to mine.
// May be freely adapted for use on other websites provided that this source is acknowledged.
// Disclaimer: No warranty is offered and no liability is accepted. Use entirely at your own risk. May not be sold.

// Form Validation Script modified from a script provided by Paul McFedries <www.mcfedries.com>
function NewPage(frm)
{
var gpb = "Groomsville PageBuilder\n \nSorry, you haven't "
var pta = "Please try again..."
var badEmail = "entered a valid email address.\nIt should be something like\n \"yourname@wherever.com\" " 
var nohtm = "Groomsville PageBuilder\n \n You appear to be trying to use HTML tags in "
   if (frm.YourName.value == "")
   {
   alert( gpb + "included your name. " + pta);
   frm.YourName.focus();
   return false;
   }
   if (frm.email.value == "")
   {
   alert( gpb + "included your email address. " + pta);
   frm.email.focus();
   return false;
   }
   if (frm.email.value.indexOf("@") == -1)
   {
   alert( gpb + badEmail + pta);
   frm.email.focus();
   return false;
   }
   if (frm.email.value.indexOf(".") == -1)
   {
   alert( gpb + badEmail + pta);
   frm.email.focus();
   return false;
   }
   if (frm.email.value.indexOf("<") != -1)
   {
   alert(nohtm + "an email entry field: this won't work. " + pta);
   frm.email.focus();
   return false;
   }
if (frm.phone.value.length < 4)
   {
   alert( gpb + "included a valid phone number. It won't be used on the website, but we need it in case we need to contact you about your page. " + pta);
   frm.phone.focus();
   return false;
   }
   if (frm.YourTitle.value == "")
   {
   alert( gpb + "included a title for your page. " + pta);
   frm.YourTitle.focus();
   return false;
   }
   if (frm.YourTitle.value.indexOf("<") != -1)
   {
   alert(nohtm + "your title: this won't work. " + pta);
   frm.YourTitle.focus();
   return false;
   }
   
NewWindow = window.open('','MyWin','scrollbars=yes,toolbar=no,status=no,menubar=yes,location=no,resizeable=yes');
data0 = document.NewPageForm.YourTitle.value;
data1 = "<TABLE WIDTH=\"100%\" BORDER=0 BGCOLOR=\"#CCCCFF\" CELLPADDING=0 CELLSPACING=0><TR><TD WIDTH=\"80%\" BGCOLOR=\"#FFFFFF\">";
data1 += "<TABLE BORDERCOLOR=black BORDER=2 CELLPADDING=5 CELLSPACING=4 WIDTH=\"100%\"><TR><TD BGCOLOR=\"#FFFF33\" NOWRAP><FONT FACE=\"Charcoal, Chicago, Helvetica, Arial, sans-serif\" SIZE=+4 COLOR=\"#FF0033\">";
data1 += document.NewPageForm.YourTitle.value + "</FONT></TD></TR></TABLE></TD><TD>";
data1 += "<A HREF=\"absmac/index.htm\" onmouseover=\"absmac.src='images/absfree.gif'; return true\" onmouseout=\"absmac.src='images/absmac2.gif'; return true\" onclick=\"self.location='absmac/index.htm'; return true\" TARGET=_parent><IMG SRC=\"images/absmac2.gif\" onclick=\"self.location='absmac/index.htm'; return true\" WIDTH=114 HEIGHT=60 BORDER=0 ALT=\"Absolutely Mac\" ALIGN=right NAME=\"absmac\"></A></TD></TR></TABLE>";
data2 = "<BR CLEAR=all>";
data2 += "<TABLE ALIGN=center CELLPADDING=10 CELLSPACING=0 BORDER=0 BGCOLOR=white WIDTH=75%><TR><TD VALIGN=top COLSPAN=2>";
data3 = "<B>This page was written by: </B>" + document.NewPageForm.YourName.value + ",";
data4 = " email: <A HREF=\"mailto:" + document.NewPageForm.email.value + "\">" + document.NewPageForm.email.value + "</A>";
data4 += "</TD></TR><TR><TD VALIGN=top WIDTH=50%><B>" + document.NewPageForm.Header1.value + "</B><BR>" + document.NewPageForm.Para1.value;
data4 += "<P>" + document.NewPageForm.Para2.value + "</TD><TD VALIGN=top><B>" + document.NewPageForm.Header2.value + "</B><BR>" + document.NewPageForm.Para3.value;
data4 += "<P>" + document.NewPageForm.Para4.value + "</TD></TR><TR><TD COLSPAN=2><HR><B>" + document.NewPageForm.Header3.value + "</B>";
data4 += "<BR>" + document.NewPageForm.Para5.value + "</TD></TR></TABLE><P><CENTER><a href=\"http://www.apple.com\" TARGET=_blank><img SRC=\"images/mademac.gif\" BORDER=0></a><P><SMALL>Created using <A HREF=\"pagebuilder.htm\">PageBuilder</A> &#169; 2001 Phil Groom</SMALL></CENTER><HR>";
NewWindow.document.write("<HTML><HEAD><TITLE>Groomsville - " + data0 + "</TITLE></HEAD><BODY BGCOLOR=#CCCCFF>" + data1 + data2 + data3 + data4 + "</BODY></HTML>");
}


function Validate(frm)
{
var gpb = "Groomsville PageBuilder\n \nSorry, you haven't "
var pta = "Please try again..."
var badEmail = "entered a valid email address.\nIt should be something like\n \"yourname@somedomain.somewhere\" " 

   if (frm.YourName.value == "")
   {
   alert( gpb + "included your name. " + pta);
   frm.YourName.focus();
   return false;
   }
   if (frm.email.value == "")
   {
   alert( gpb + "included your email address. " + pta);
   frm.email.focus();
   return false;
   }
   if (frm.email.value.indexOf("@") == -1)
   {
   alert( gpb + badEmail + pta);
   frm.email.focus();
   return false;
   }
   if (frm.email.value.indexOf(".") == -1)
   {
   alert( gpb + badEmail + pta);
   frm.email.focus();
   return false;
   }
if (frm.phone.value.length < 4)
   {
   alert( gpb + "included a valid phone number. It won't be used on the website, but we need it in case we need to contact you about your page. " + pta);
   frm.phone.focus();
   return false;
   }
   if (frm.YourTitle.value == "")
   {
   alert( gpb + "included a title for your page. " + pta);
   frm.YourTitle.focus();
   return false;
   }
   }
