<!-- hide from older browsers

//==============================================================================

function calculate_dues ( )
   {
   var dues_due ;

   if ( ( ! document.apply.type[0].checked ) && ( ! document.apply.type[1].checked ) ) 
      { 
      alert ("Need to specify type of membership");
      dues_due = 0 ;
      } 

   else
      { 
      if ( document.apply.type[0].checked ) { dues_due = 18 ; }
      if ( document.apply.type[1].checked ) { dues_due =  6 ; }
      }

   return dues_due ;
   }

//------------------------------------------------------------------------------

function contest_details ( x )
   {
   if ( x == 0 )
      { document.getElementById('contest_generals').style.display = 'block' ;
        document.getElementById('contest_details').style.display  = 'none' ; }
   else
      { document.getElementById('contest_generals').style.display = 'none' ;
        document.getElementById('contest_details').style.display  = 'block' ; }
   }

//------------------------------------------------------------------------------

function dont_publish ( )
   {
   if ( document.apply.publish_name.checked )
      { document.apply.publish_city.checked = true ;
        document.apply.publish_state.checked = true ;
        document.apply.publish_country.checked = true ;
        document.apply.publish_job.checked = true ;
        document.apply.publish_email.checked = true ;
        document.apply.publish_work.checked = true ;
        document.apply.publish_bio.checked = true ; }
   }   

//------------------------------------------------------------------------------

function student_school ( )
   {
   if ( ! document.scifair.homeschooled.checked )
      {
      document.getElementById('input_school_name').style.display = 'block' ;
      document.scifair.school_name.blur ( ) ;
      document.scifair.school_name.disabled = false ;
      }
   else
      { 
      document.getElementById('input_school_name').style.display = 'none' ;
      document.scifair.school_name.focus ( ) ;
      document.scifair.school_name.disabled = true ;
      }
   }

//------------------------------------------------------------------------------

function get_member_type ( memtype )
   {
   if ( document.apply.type[0].checked )
      { document.getElementById('input_school_name').style.display = 'none' ;
        document.apply.school_name.blur ( ) ;
        document.apply.school_name.disabled = true ; }
   else
      { document.getElementById('input_school_name').style.display = 'block' ;
        document.apply.type[1].checked = true ;
        document.apply.school_name.focus ( ) ;
        document.apply.school_name.disabled = false ; }
   }

//------------------------------------------------------------------------------

function old_newsletters ( x )
   {
   if ( x == 0 )
      { document.getElementById('current_news').style.display = 'block' ;
        document.getElementById('old_news').style.display  = 'none' ; }
   else
      { document.getElementById('current_news').style.display = 'none' ;
        document.getElementById('old_news').style.display  = 'block' ; }
   }

//------------------------------------------------------------------------------

function send_fair_report ( )
   {

   // Check

   var error_string_pre = "You still need to provide:" ;
   var error_string = "" ;
   var homeschooled = document.scifair.homeschooled.checked ;

   var prize_awarded_yes = document.scifair.type[0].checked ;
   var prize_awarded_no  = document.scifair.type[1].checked ;

   if ( document.scifair.judge_name.value == "" )
      { error_string = error_string + "\n  Judge's name" ; }

   if ( document.scifair.fair_name.value == "" )
      { error_string = error_string + "\n  Fair name" ; }

   if ( document.scifair.fair_location.value == "" )
      { error_string = error_string + "\n  Fair location" ; }

   if ( document.scifair.fair_city.value == "" )
      { error_string = error_string + "\n  Fair city" ; }

   if ( document.scifair.fair_state.value == "" )
      { error_string = error_string + "\n  Fair state" ; }

   if ( document.scifair.fair_date.value == "" )
      { error_string = error_string + "\n  Fair date" ; }

   if ( ( ! prize_awarded_yes ) && ( ! prize_awarded_no ) )
      { error_string = error_string + "\n  If prize was given" ; }

   if ( document.scifair.student_name.value == "" )
      { error_string = error_string + "\n  Student's name" ; }

   if ( document.scifair.grade.value == "" )
      { error_string = error_string + "\n  Student's grade" ; }

   if ( ! homeschooled )
      { 
      if ( document.scifair.school_name.value == "" )
         { error_string = error_string + "\n  Student's school" ; }
      }

   if ( document.scifair.school_city.value == "" )
      { error_string = error_string + "\n  Student's school city" ; }

   if ( document.scifair.school_state.value == "" )
      { error_string = error_string + "\n  Student's school state" ; }

   if ( document.scifair.exhibit_title.value == "" )
      { error_string = error_string + "\n  Exhibit title" ; }

   if ( document.scifair.exhibit_description.value == "" )
      { error_string = error_string + "\n  Exhibit description" ; }

   if ( error_string != "" )
      { error_string = error_string_pre + error_string ;
        alert ( error_string ) ; 
        return false ;
      } 

   // Print form to copy and send

   report = window.open ( "", "_blank" );

   report.document.write ( "<html>\n" );
   report.document.write ( "<head>\n" );
   report.document.write ( "  <title>Science Fair report</title>\n" );
   report.document.write ( "   <link rel=\"stylesheet\" type=\"text/css\" href=\"tcams.css\">\n" );
   report.document.write ( "   <script language=\"text/javascript\" src=\"tcams.js\"></script>\n" );
   report.document.write ( "</head>" );
   report.document.write ( "<body>" );

   report.document.write ( "Create a new e-mail message with your favorite program with the following information:<br/>\n" ) ;

   report.document.write ( "<hr align=\"left\" width=\"50%\"\>" ) ;
   report.document.write ( "<br/>\n" );
   report.document.write ( "<font color=\"blue\"><b>To:</b></font> sciencefair@twincitiesams.org<br/>\n" ) ;
   report.document.write ( "<br\>\n" ) ;
   report.document.write ( "<font color=\"blue\"><b>Subject:</b></font> Science Fair report from " + document.scifair.judge_name.value + "<br/>\n" ) ;
   report.document.write ( "<br\>\n" ) ;

   report.document.write ( "<b><u>Science fair information</u></b><br/>\n" ) ;
   report.document.write ( "Name: " + document.scifair.fair_name.value + "<br/>\n" ) ;
   report.document.write ( "Location: " + document.scifair.fair_location.value + "," ) ;
   report.document.write ( "&nbsp;" + document.scifair.fair_city.value + ", " + document.scifair.fair_state.value + "<br/>\n" ) ;
   report.document.write ( "Date: " + document.scifair.fair_date.value + "<br/>\n" ) ;

   report.document.write ( "<br\>\n" ) ;

   report.document.write ( "<b><u>Student information</u></b><br/>\n" ) ;

   report.document.write ( "Name: " + document.scifair.student_name.value + "<br/>\n" ) ;
   report.document.write ( "Grade " + document.scifair.grade.value + " " ) ;

   if ( document.scifair.homeschooled.checked ) { report.document.write ( "(homeschooled)" ) ; }
   else { report.document.write ( "at " + document.scifair.school_name.value ) ; }

   report.document.write ( " in " + document.scifair.school_city.value + ", " ) ;
   report.document.write ( document.scifair.school_state.value + "<br/>\n" ) ;

   report.document.write ( "<br\>\n" ) ;

   report.document.write ( "<b><u>Exhibit information</u></b><br/>\n" ) ;

   report.document.write ( "Prize " ) ;
   if ( prize_awarded_no ) 
      {
      report.document.write ( "<font color=\"red\"><b>not</b></font> " ) ;
      }
   report.document.write ( "given to student<br/>\n" ) ;

   report.document.write ( "Title: " + document.scifair.exhibit_title.value + "<br/>\n" ) ;
   report.document.write ( "Description: " + document.scifair.exhibit_description.value + "<br/>\n" ) ;

   report.document.write ( "<br\>\n" ) ;

   if ( document.scifair.comments.value != "" )
      {
      report.document.write ( "<b><u>Comments</u></b><br/> " + document.scifair.comments.value + "</p>\n" ) ;
      }

   report.document.write ( "</body>\n" ) ;
   report.document.write ( "</html>\n" ) ;

   }

//------------------------------------------------------------------------------

function send_membership ( )
   {
   var membership_type = "" ;
   var memname = document.apply.name.value ;

   var snowfall = document.apply.snowfall.value ;
   var min = document.apply.Tmin.value ;
   var max = document.apply.Tmax.value ;

   var month_names = new Array ('January','February','March','April','May','June','July','August','September','October','November','December');

   var today = new Date ;
   var month = month_names[today.getMonth ( )] ;
   var date = today.getDate ( ) ;
   var year = today.getYear ( ) ;
   var todate ;
   var hour = today.getHours ( ) ;
   var minute = today.getMinutes ( ) ;
   var meridien = "am" ;
   
   if ( year < 2000 ) { year += 1900 } ; 
   if ( hour > 12 ) { hour -= 12 ; meridien = "pm" ; }
   if ( hour == 0 ) { hour = 12 ; }
   if ( minute < 10 ) { minute = "0" + minute }
   todate = month + " " + date + ", " + year + " " + hour + ":" + minute + " " + meridien ;

   printable = window.open ( "", "_blank" );

   printable.document.write ( "<html>\n" );
   printable.document.write ( "<head>\n" );
   printable.document.write ( "  <title>Twin Cities AMS Membership Information for " + memname + "</title>\n" );
   printable.document.write ( "   <link rel=\"stylesheet\" type=\"text/css\" href=\"tcams.css\">\n" );
   printable.document.write ( "   <script language=\"text/javascript\" src=\"tcams.js\"></script>\n" );
   printable.document.write ( "</head>" );
   printable.document.write ( "<body>" );

   printable.document.write ( "Create a new e-mail message with your favorite program with the following information:<br/>\n" ) ;
   printable.document.write ( "<hr align=\"left\" width=\"50%\"\>" ) ;
   printable.document.write ( "<br/>\n" );
   printable.document.write ( "<font color=\"blue\"><b>To:</b></font> newmember@twincitiesams.org<br/>\n" ) ;
   printable.document.write ( "<br\>\n" ) ;
   printable.document.write ( "<font color=\"blue\"><b>Subject:</b></font> Twin Cities AMS Information for " + memname + "<br/>\n" ) ;
   printable.document.write ( "<br\>\n" ) ;
   printable.document.write ( "<font color=\"blue\"><b>Body:</b></font><br\>\n" ) ;
   printable.document.write ( "<b>Twin Cities AMS information for " ) ;
   if ( document.apply.repeat.checked )
      {
      printable.document.write ( "returning" ) ;
      }
   else
      {
      printable.document.write ( "new" ) ;
      }
   printable.document.write ( " member " + memname + "</b><br/>\n" ) ;

   printable.document.write ( todate + "<br/>\n\n" ) ;
   printable.document.write ( "<br/>\n" ) ;

   if ( document.apply.repeat.checked )
      {
      printable.document.write ( "<b>Name:</b> " + memname + "<br/>\n" ) ;
      printable.document.write ( "My information is the same as last year's<br/><br/>" ) ;
      }

   else
      {
      printable.document.write ( "<b>Name:</b> " + memname + "<br/>\n" ) ;
      if ( document.apply.publish_name.checked )
         { printable.document.write ( "<font color=\"red\">&nbsp;&nbsp;&nbsp Don't list me on the web site</font><br/>\n" ) ; }

      if ( document.apply.type[0].checked )
         { membership_type = "Regular" ; }
      else
         { membership_type = "Student, attending school at " + document.apply.school_name.value ; }

      printable.document.write ( "<b>Member type:</b> " + membership_type + "<br/>\n" ) ;

      printable.document.write ( "<b>Address:</b> " +
                                 document.apply.address.value + ", " + 
                                 document.apply.city.value + ", " + 
                                 document.apply.state.value + " " + 
                                 document.apply.zip.value + " " + 
                                 document.apply.country.value + "</b><br/>\n" ) ;

      printable.document.write ( "<b>Telephone number</b>: " +
                                 document.apply.phone.value + "<br/>\n" ) ;

      printable.document.write ( "<b>E-mail address</b>: " +
                                 document.apply.email.value + "<br/>\n" ) ;

      if ( document.apply.publish_name.checked    || 
           document.apply.publish_city.checked    || 
           document.apply.publish_state.checked   || 
           document.apply.publish_country.checked || 
           document.apply.publish_email.checked   || 
           document.apply.publish_job.checked     || 
           document.apply.publish_work.checked    || 
           document.apply.publish_bio.checked )
         {

         printable.document.write ( "Don't publish my " ) ;
 
         if ( document.apply.publish_name.checked )    { printable.document.write ( " name, " ) ; }
         if ( document.apply.publish_city.checked )    { printable.document.write ( " city, " ) ; }
         if ( document.apply.publish_state.checked )   { printable.document.write ( " state, " ) ; }
         if ( document.apply.publish_country.checked ) { printable.document.write ( " country, " ) ; }
         if ( document.apply.publish_email.checked )   { printable.document.write ( " e-mail, " ) ; }
         if ( document.apply.publish_job.checked )     { printable.document.write ( " job, " ) ; }
         if ( document.apply.publish_work.checked )    { printable.document.write ( " work, " ) ; }
         if ( document.apply.publish_bio.checked )     { printable.document.write ( " bio, " ) ; }

         printable.document.write ( "<br/>\n" ) ;

         }

      }

   if ( document.apply.bio.value != "" )
      { printable.document.write ( "<b>A little about me:</b> " + document.apply.heard.value + "<br/>\n" ) ; }

   if ( document.apply.heard.value != "" )
      { printable.document.write ( "<b>How I heard about you:</b> " + document.apply.heard.value + "<br/>\n" ) ; }
  
   if ( document.apply.topics.value != "" )
      { printable.document.write ( "<b>Suggestions for meeting topics:</b> " + document.apply.topics.value + "<br/>\n" ) ; }
  
   if ( document.apply.ideas.value != "" )
      { printable.document.write ( "<b>Other ideas for the chapter:</b> " + document.apply.ideas.value + "<br/>\n" ) ; }

   printable.document.write ( "<b>Weather contest entry</b><br/>\n" ) ;
   if ( snowfall != "" ) { printable.document.write ( "&nbsp;&nbsp;&nbsp;<b>Snowfall:</b> "            + snowfall + " in<br/>\n"     ) ; }
   if ( min      != "" ) { printable.document.write ( "&nbsp;&nbsp;&nbsp;<b>Minimum temperature:</b> " + min      + "&deg; F<br/>\n" ) ; }
   if ( max      != "" ) { printable.document.write ( "&nbsp;&nbsp;&nbsp;<b>Maximum temperature:</b> " + max      + "&deg; F<br/>\n" ) ; }

   printable.document.write ( "<p>Your membership isn't official until we receive your dues" ) ;
   if ( ! document.apply.repeat.checked ) { printable.document.write ( " of $" + calculate_dues ( ) ) ; }
   printable.document.write ( "\n<br/>" ) ;

   printable.document.write ( "<hr align=\"left\" width=\"50%\"\>" ) ;

   printable.document.write ( "<p>You might want to print this page for your records</p>" ) ;

   printable.document.write ( "</body>\n" ) ;
   printable.document.write ( "</html>\n" ) ;

   }

//------------------------------------------------------------------------------

function show_last_modified ( )
   { 
   var month_names = new Array ('January','February','March','April','May','June','July','August','September','October','November','December') ;
   var day_names = new Array ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday') ;

   var date_lastmod = new Date(document.lastModified) ;
   var dow = day_names[date_lastmod.getDay ( )] ;
   var month = month_names[date_lastmod.getMonth ( )] ;
   var date = date_lastmod.getDate ( ) ;
   var year = date_lastmod.getYear ( ) ;
       if ( year < 2000) { year += 1900; }

   document.write ( "This page was updated on " + dow + ", " + month + " " + date + ", " + year ) ;
   }

function show_past_events ( x )
   {
   if ( x == 0 )
      { document.getElementById('future_events').style.display = 'block' ;
        document.getElementById('past_events').style.display   = 'none' ; }
   else
      { document.getElementById('future_events').style.display = 'none' ;
        document.getElementById('past_events').style.display   = 'block' ; }
   }

//------------------------------------------------------------------------------

function verify_apply ( mode )
   {
   var error_string_pre = "You still need to provide:" ;
   var error_string = "" ;

   var bday_m = document.apply.bday_m.value ;
   var bday_d = document.apply.bday_d.value ;

   var dew ;
   var max ;
   var min ;
   var snowfall ;
   var storm ;

   var temp_only = false ;

   snowfall = document.apply.snowfall.value ;
   min = document.apply.Tmin.value ;
   max = document.apply.Tmax.value ;

   if ( document.apply.repeat.checked )

      {
      if ( document.apply.name.value == "" )
         { error_string = error_string + "\n  Name" ; }
      }

   else

      {

      if ( ! ( document.apply.type[0].checked || document.apply.type[1].checked ) )
      { error_string = error_string + "  Membership type" ; }
      if ( document.apply.type[1].checked && ( document.apply.school_name.value == "" ) )
         { error_string = error_string + "\n  School name" ; }
      if ( document.apply.name.value == "" )
         { error_string = error_string + "\n  Name" ; }
      if ( bday_m == "" )
         { error_string = error_string + "\n  Birth month" ; }
      if ( bday_d == "" )
         { error_string = error_string + "\n  Birth day" ; }
      if ( document.apply.address.value == "" )
         { error_string = error_string + "\n  Address" ; }
      if ( document.apply.city.value == "" )
         { error_string = error_string + "\n  City" ; }
      if ( document.apply.state.value == "" )
         { error_string = error_string + "\n  State" ; }
      if ( document.apply.zip.value == "" )
         { error_string = error_string + "\n  Postal code" ; }
      if ( document.apply.phone.value == "" )
         { error_string = error_string + "\n  Telephone number" ; }
      if ( document.apply.email.value == "" )
         { error_string = error_string + "\n  E-mail address" ; }

      if ( ( ( ( bday_m == "April" ) || ( bday_m == "June" ) || ( bday_m == "September" ) || ( bday_m == "November" ) ) && ( bday_m > 30 ) ) ||
           ( ( ( bday_m == "February" )                                                                               ) && ( bday_m > 29 ) ) )
         { error_string = error_string + "\n  You appear to have a nonexistant birthday: " + bday_m + " " + bday_d + "." ; }

      }

   if ( ( max != "" ) && ( storm != "" ) && ( dew > max ) )
      { if ( error_string == "" )
           { temp_only = true ;
             error_string = "Your min temperature is warmer than than your max temperature" ; }
        else
           { error_string = error_string + "\n and your min temperature is warmer than than your max temperature" ; }
      }

   if ( error_string != "" )
      { if ( ! temp_only ) { error_string = error_string_pre + error_string ; } 

        alert ( error_string ) ; 
     
        return false ;
      } 

   else 
      { 
      if ( mode != "print" ) { document.apply.submit ( ) ; }
      }

   return true ;
   }

//==============================================================================

//-->

