var name=""
var address=""
var city=""
var state=""
var zip=""
var month=""
var day=""
var year="10"
var cs=0 // Number of Care and Share CDs ordered
var emailMe=""
var comments=""
var randNum=0
var sent=0
function selectUse()
{
if (sent>0) printPage() 
else valandsend()
}
// the 'printPage' function must be  located in the html page to print it 
// function printPage() { print(document); }

function valandsend()
{
with (document)
{
name=form1.Name.value
address=form1.Address.value
city=form1.City.value
state=form1.State.value
zip=form1.Zip.value
cs=form1.careAndShare.value
month=form1.Month.value
day=form1.Day.value
emailMe=form1.emailNews.value
comments=form1.Comments.value
}
if (name==""||address==""||city==""||state==""||zip==""||month==00||day==00||cs==0) emptyError()
else sendit()
}
function sendit()
{
alert("Thank You! Your E-mail program will now start.\nJust press the SEND button there.\nThis information will be E-mailed to purchase@151st.org\nYou will receive a conformation email as soon as your order is processed.")
var usr="purchase"
var at="@"
var dom="151st"
var dot=".org"
var csText = ""
var waText = ""
var hdText = ""
randNum=Math.round((Math.random()*998)+1)
document.form1.refNum.value=randNum+"-"+month+day+year
if (cs>0) 
{
	csText ="Caring and Sharing="+cs+"---"
}
if (comments=="")
{
	comments="None"
}
self.location="mailto:"+usr+at+dom+dot+"?subject=On-line Order #"+randNum+"-"+month+day+year+"&body=Name: "+name+"----Address: "+address+"----City: "+city+"----State: "+state+"----Zip: "+zip+"----CDs Ordered: "+csText+"-Email News?= "+emailMe+"----Comments: "+comments;
switchImage("printMessage","images/order_print_message_on.gif")
switchImage("dualbutton","images/printbutton.gif")
sent++
}
function emptyError()
{
window.alert('All fields marked with a * are required.')
sent=0
}
function resetForm()
{
with (document)
{
form1.Name.value=""
form1.Address.value=""
form1.City.value=""
form1.State.value=""
form1.Zip.value=""
form1.careAndShare.value=0
form1.Month.value="00"
form1.Day.value="00"
form1.refNum.value="Ref. Num. will appear here when sending."
form1.emailNews.value="Yes"
form1.Comments.value=""
}
switchImage("printMessage","images/order_print_message_off.gif")
switchImage("dualbutton","images/sendbutton.gif")
sent=0
}
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;	  
    }
  }
}
function changed()
{
	if (sent>0) setFields()
}
function setFields()
{
with (document)
{
form1.Name.value=name
form1.Address.value=address
form1.City.value=city
form1.State.value=state
form1.Zip.value=zip
form1.careAndShare.value=cs
form1.Month.value=month
form1.Day.value=day
form1.refNum.value=randNum+"-"+month+day+year
form1.emailNews.value=emailMe
form1.Comments.value=comments
}
	window.alert('Once sent, no changes should be made on this form.\nIf you need to change the information you have sent,\nplease email us at purchase@151st.org')
}
