
    //
    // list of days to exclude from selection - holidays, first Thursdays, etc.
    // Note: elsewhere we are excluding Mondays and Tuesdays as the museum is closed those days.
    //
    var SAMholidays = [ '01/16/2012', '02/02/2012', '03/01/2012', '04/05/2012', '05/03/2012', '05/28/2012', '06/07/2012', '07/05/2012', '08/02/2012', '09/03/2012', '09/06/2012', '10/04/2012', '10/08/2012', '11/01/2012', '11/22/2012', '12/06/2012', '12/24/2012', '12/25/2012', '12/31/2012', '01/01/2013' ];

    var alertText = "<div style='border:1px solid #CCC; color:#F00; padding:5px; visibility:hidden; display:none'></div>";

    var isARTREACH = 0;
    var MAXCLASS = 35;		// maximum number of students per class

    var today = new Date();	// current date
    var currentTour = 0;	// Tour Index

    // plug in tour information here
    var progTITLE	= 0;	// arg0: program title (required)
    var progFULLTITLE	= 1;	// arg1: program full title (required)
    var progSUBTITLE	= 2;	// arg2: program sub title (optional)
    var progDESC	= 3;	// arg3: program description (optional)
    var progURL		= 4;	// arg4: URL for program description (optional)
    var progSITE	= 5;	// arg5: site (SAM/SAAM/OSP/ARTREACH) (required)
    var progPERMANENT	= 6;	// arg6: 1=standing/permanent program; 0=special ex/restricted times
    var progTEXT	= 7;	// arg7: grade text (required)
    var progTYPE	= 8;	// arg8: program type:	1=tour&workshop, 2=tour only, 3=artREACH, 4=self-guided visit
    var progOPTIONS	= 9;	// arg9: program options (array: ['select text', 'select val'] (optional)
    var progCLASSES	= 10;	// arg10: number of classes allowed per timeslot (required)
    var progSTART	= 11;	// arg11: start date (required - mm/dd/yyyy)
    var progEND		= 12;	// arg12: end date (required - mm/dd/yyyy)
    var progDATES	= 13;	// arg13: Date ranges (text descripion - should be present)
    var progNOTDATES	= 14;	// arg14: Days of the week withOUT tours (0=Sun, 1=Mon, ... 6=Sat); this is an array (should be present to block out days of week tour is NOT available)
    var progGRADES	= 15;	// arg15: Grade levels allowed (array) (required)
    var progTIMES	= 16;	// arg16: Time options (array)	[]=no choices, [0]=text box, ['v1','v2',...'vn']=select list (optional)
    var progMAXTIMES	= 17;	// arg17: number of time slots allowed per day 
    var progPRICE	= 18;	// arg18: pricing info (required)
    var progSOLDOUT	= 19;	// arg19: 0=available, 1=sold out (required)
    var progDAYSOLDOUT	= 20;	// arg20: specific additional dates not available (array of list in 'mm/dd/yyy' format) (optional)

    //
    //  Note about class sizes and tour times:
    //
    //	Tours and Workshops (progTYPE==1): As a whole, these currently allow up to two classes per day, on start time
    //
    //  Tours and DIY (progTYPE=2,4): varying numbers of classes per time slot (1-3), varying number of timeslots per day.
    //		If total number of kids <= MAXCLASS, then time ranking is relevant
    //		If total number of kids > MAXCLASS, <= (MAXCLASS * progCLASSES) * progMAXTIMES, allow entry, display number of classes (#kids/MAXCLASS);
    //			time ranking is irrelevant
    //		if total number of kids > (MAXCLASS * progCLASSES) * progMAXTIMES, error message
    //
    //  ArtReach (progTYPE == 3): max two classes
    //
    
    var tourData = [

      [
        'Gauguin &amp; Polynesia',
        'Gauguin &amp; Polynesia: an Elusive Paradise',
        '(tour + workshop)',
	'Discover the dynamic relationship between the work of European artist Paul Gauguin (1848-1903) and the Polynesian art he encountered when he moved to the South Pacific Islands in 1891. <em>Gauguin and Polynesia: An Elusive Paradise</em> is an ideal exhibition for classrooms studying cultural exchange and 19th century world history.',
	'DTtours/speExh.asp#gauguin',
	'SAM',
	'0',
	'<strong>Grades 3&ndash;12</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'02/14/2012',
	'04/29/2012',
	'Tuesday&ndash;Fridays',
	[0, 1, 6],
	['3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	1,
	[],
      ],
      [
        'Gauguin &amp; Polynesia',
        'Gauguin &amp; Polynesia: an Elusive Paradise',
        '(tour only)',
	'Discover the dynamic relationship between the work of European artist Paul Gauguin (1848-1903) and the Polynesian art he encountered when he moved to the South Pacific Islands in 1891. <em>Gauguin and Polynesia: An Elusive Paradise</em> is an ideal exhibition for classrooms studying cultural exchange and 19th century world history.',
	'DTtours/speExh.asp#gauguin',
	'SAM',
	'0',
	'<strong>Grades 3&ndash;12</strong>: Tour is 60 minutes, no art workshop.',
	2,
	[],
	1,
	'02/14/2012',
	'04/29/2012',
	'Tuesday&ndash;Fridays',
	[0, 1, 6],
	['3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '10:40am', '11am', '11:40am'],
	1,
	'Regular Price: $100 per class (one class=1&ndash;35 students)<br/>Reduced Price: $50 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Gauguin &amp; Polynesia',
	'Gauguin &amp; Polynesia: an Elusive Paradise',
	'(do-it-yourself)',
	'Explore the rich exhibition <em>Gauguin and Polynesia: An Elusive Paradise</em> at your own pace (without a docent). &ldquo;Do It Yourself&rdquo; tours allow educators to customize their museum experiences by leading their own activities the galleries. Contact the tour coordinator for a free educator pass to visit the galleries in advance of your class&rsquo;s visit.',
	'DTtours/speExh.asp#gauguin',
	'SAM',
	'0',
	'<strong>Grades 3&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	'02/14/2012',
	'04/25/2012',
	'Tuesday&ndash;Sundays',
	[1, 2],
	['3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[ '12pm',  '12:20pm',  '12:40pm',  '1pm',  '1:20pm',  '1:40pm',  '2pm',  '2:20pm',  '2:40pm',  '3pm',  '3:20pm',  '3:40pm'],
	6,
	'Regular Price: $40 per class (one class=1&ndash;35 students)<br/>Reduced Price: $20 per class (one class=1&ndash;35 students)',
	0,
	['04/26/2012', '04/27/2012', '04/28/2012', '04/29/2012'],
      ],

      [
        'Ancestral Modern',
        'Ancestral Modern: Australian Aboriginal Art from the Kaplan &amp; Levi Collection',
        '(tour only)',
	'Engage with the exuberant visual language of Australia! Learn how Australian Aboriginal people are using painting to revive and sustain the world&rsquo;s oldest living culture. This one-hour tour of the exhibition <em>Ancestral Modern: Australian Aboriginal Art from the Kaplan &amp; Levi Collection</em> will introduce students to a wide range of artists and artistic traditions a part of Australia&rsquo;s dynamic Aboriginal art movement.',
	'DTtours/speExh.asp#AncestralModern',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Tour is 60 minutes, no art workshop.',
	2,
	[],
	1,
	'06/06/2012',
	'08/30/2012',
	'Wednesdays or Thursdays',
	[0, 1, 2, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '11am', 'noon', '1pm'],
	1,
	'Regular Price: $100 per class (one class=1&ndash;35 students)<br/>Reduced Price: $50 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Ancestral Modern',
        'Ancestral Modern: Australian Aboriginal Art from the Kaplan &amp; Levi Collection',
	'(do-it-yourself)',
	'Explore the dynamic summer exhibition <em>Ancestral Modern: Australian Aboriginal Art from the Kaplan &amp; Levi Collection</em> at your own pace. Do-It-Yourself tours allow educators to customize their museum experiences by leading their own activities through the galleries without a docent. Contact the school tour coordinator for a free educator pass to visit the galleries in advance of your class&rsquo;s visit. ',
	'DTtours/speExh.asp#AncestralModern',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	'05/31/2012',
	'09/02/2012',
	'Wednesdays&ndash;Sundays',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '10:30am', '11am', '11:30am', '12pm', '12:30pm', 'other'],
	6,
	'Regular Price: $40 per class (one class=1&ndash;35 students)<br/>Reduced Price: $20 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Artistic Elements',
        'Artistic Elements',
        '(tour + workshop)',
	'<strong>For grades K-5:</strong> What are the different elements that make up a work of art? Students build visual vocabulary and learn about the elements of line, shape, color, value, form and texture while exploring art from around the globe. <br><br><strong>For grades 6-12:</strong> Explore the visual elements of works of art from around the world through narrative and descriptive writing. How do we describe what we see? What is the difference between description and interpretation? Use the elements of line, shape, color, value, form and texture as prompts for written and oral reflection on the role of art in our global society.',
	'DTtours/collection.asp#artistic',
	'SAM',
	'1',
	'<strong>Grades K&ndash;12</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'10/05/2011',
	'06/15/2012',
	'Wednesdays&ndash;Fridays',
	[0, 1, 2, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Families From Around the World',
        'Families From Around the World',
        '(tour + workshop)',
	'Visit the museum and explore the unique ways art teaches us about the common values and customs that families share. Traditions reflected in selected works of art include family portraits, celebrations, gift giving and storytelling.',
	'DTtours/collection.asp#families',
	'SAM',
	'1',
	'<strong>Grades K&ndash;3</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'10/05/2011',
	'06/15/2012',
	'Wednesdays&ndash;Fridays',
	[0, 1, 2, 6],
	['K', '1', '2', '3'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Living Histories: NW Native American Art',
        'Living Histories: Northwest Native American Art',
        '(tour + workshop)',
	'Native American art is a part of the continuing culture of the Pacific Northwest region. Study the history, stories and living traditions of Native Americans of the Northwest Coast through a rich collection of masks, carvings and woven treasures. Special emphasis is placed on Native American art as part of a continuing culture in our region.',
	'DTtours/collection.asp#Living',
	'SAM',
	'1',
	'<strong>Grades 2&ndash;12</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'10/05/2011',
	'06/15/2012',
	'Wednesdays&ndash;Fridays',
	[0, 1, 2, 6],
	['2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Global Perspectives',
        'Global Perspectives: SAM&rsquo; African Collection',
        '(tour + workshop)',
	'Experience the energy, history and deep meaning of SAM&rsquo;s African art collection through a new tour focused on economic trade and governance within the African continent. Students demonstrate learning through in-gallery writing and discussions.',
	'DTtours/collection.asp#african',
	'SAM',
	'1',
	'<strong>Grades 6&ndash;12</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'10/05/2011',
	'06/15/2012',
	'Wednesdays&ndash;Fridays',
	[0, 1, 2, 6],
	['6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'SAM Collections Downtown',
	'SAM Collections Downtown',
	'(do-it-yourself)',
	'Set your own pace through SAM\'s collections and installations by leading your class on a self-guided visit. We recommend exploring the museum\'s online collectino and contacting the <strong>Wyckoff Teacher Resource Center</strong> prior to visiting.  TRC staff can help you create a customized visit that aligns with your student learning objectives and makes the most of your museum experience.',
	'DTtours/collection.asp#selfguided',
	'SAM',
	'1',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	3,
	null,
	null,
	'Wednesdays&ndash;Sundays',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '10:30am', '11am', '11:30am', '12pm', 'other'],
	6,
	'Regular Price: $40 per class (one class=1&ndash;35 students)<br/>Reduced Price: $20 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Arts of Asia',
	'Arts of Asia: Exploring Matrials, Design and Motif',
	'(tour + workshop)',
	'Explore SAM&rsquo;s diverse collection of Asian art through writing and discussion. Focus on common materials and motifs in both historical and contemporary works of art from Japan, Korea, China, India and Central Asia. <br><br> Between December 7, 2011 and February 8, 2012, connect your exploration of Asian culture to local Seattle history through the exhibition <em>Painting Seattle: Kamekichi Tokita and Kenjiro Nomura</em>. Artists Tokita and Nomura were prominent figures in 1930s Seattle Japantown and were also incarcerated at the WWII relocation camp Mindoka. <br><br> From March 21, 2011-June 14, 2012 this tour of Asian art and culture will move its focus to Central Asia, featuring colorfully decorate ikat robes worn and traded for in 19th century Oasis cities and featured in the special exhibition <em>Colors of the Oasis: Central Asian Textiles</em>.',
	'SAAMtours.asp#artsofasia',
	'SAAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'12/07/2011',
	'06/14/2012',
	'Wednesdays or Thursdays',
	[0, 1, 2, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	0,
	['12/08/2011', '12/15/2011', '12/22/2011', '12/29/2011', '01/05/2012', '01/12/2012', '01/19/2012', '01/26/2012', '02/02/2012', '02/09/2012', '02/16/2012', '02/23/2012', '03/01/2012', '03/08/2012', '03/15/2012'],
      ],
      [
	'Tokita &amp; Nomura',
        'Painting Seattle: Kamekichi Tokita and Kenuro Nomura',
	'(do-it-yourself)',
	'Explore the rich exhibition <em>Painting Seattle: Kamekichi Tokita and Kenjiro Nomura</em> at your own pace (without a docent). &ldquo;Do It Yourself&rdquo; tours allow educators to customize their museum experiences by leading their own activities the galleries. Contact the tour coordinator for a free educator pass to visit the galleries in advance of your class&rsquo;s visit. If you would like to experience Painting Seattle with a docent we recommend signing up for the <em>Arts of Asia</em> school tour which includes content from this exhibition in addition to the museum&rsquo;s permanent collection.',
	'SAAMtours.asp#paintingseattle',
	'SAAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	'10/22/2011',
	'02/19/2012',
	'Wednesdays&ndash;Sundays',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '10:30am', '11am', '11:30am', '12pm', '12:30pm', 'other'],
	6,
	'Regular Price: $40 per class (one class=1&ndash;35 students)<br/>Reduced Price: $20 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Colors of the Oasis',
	'Colors of the Oasis',
	'(do-it-yourself)',
	'Discover the beautiful traditions of Central Sian Ikats by exploring the exhibition <em>Colors of the Oasis</em> at your own pace. Do-It-Yourself tours allow educators to customize their museum experiences by leading their own activities through the galleries without a docent. Contact the school tour coordinator for a free educator pass to visit the galleries in advance of your class&rsquo;s visit.',
	'SAAMtours.asp#oasis',
	'SAAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	'03/15/2012',
	'08/12/2012',
	'Wednesdays&ndash;Sundays',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '10:30am', '11am', '11:30am', '12pm', '12:30pm', 'other'],
	6,
	'Regular Price: $40 per class (one class=1&ndash;35 students)<br/>Reduced Price: $20 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Seattle Asian Art Museum',
	'Seattle Asian Art Museum',
	'(do-it-yourself)',
	'Set your own pace through SAAM\'s galleries by leading your class on a self-guided visit. The Wyckoff Teacher Resource Center offers a wide variety of resource materials to help you create a tailored visit that supports your classroom curriculum.',
	'SAAMtours.asp#doityourself',
	'SAAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	null,
	null,
	'Wednesdays&ndash;Sundays',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '11am', '12pm', '1pm', 'other'],
	4,
	'Regular Price: $40 per class (one class=1&ndash;35 students)<br/>Reduced Price: $20 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Where Earth Meets Art: Spring 2012',
	'Where Earth Meets Art',
	'(tour + workshop)',
	'Experience dynamic sculpture and native plant life in diverse ecosystems as you walk along the Olympic Sculpture Park\’s Z-shaped pathway.  Use inquiry-based discussions and activities to investigate the park and all it has to offer. A site for art and open green space is ideal for a variety of experiences and learning opportunities within the urban outdoor environment.',
	'OSPindex.asp#earth',
	'OSP',
	'1',
	'<strong>Grades K&ndash;8</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'03/07/2012',
	'06/14/2012',
	'Wednesdays&ndash;Thursdays',
	[0, 1, 2, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Beauty and the Beach: Spring 2012',
	'Beauty and the Beach',
	'(tour + workshop)',
	'Explore the shoreline of the Olympic Sculpture Park and discover a beautiful space that displays art while restoring a shoreline habitat for migrating juvenile salmon.  See the unique pocket beach featuring native shoreline plantings, marine life and works of art by Roy McMakin, Mark di Suvero and Louise Bourgeois.',
	'OSPindex.asp#beach',
	'OSP',
	'1',
	'<strong>Grades 6&ndash;12</strong>: 10:20am. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'03/07/2012',
	'06/14/2012',
	'Wednesdays&ndash;Thursdays',
	[0, 1, 2, 5, 6],
	['6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $200 per class (one class=1&ndash;35 students)<br/>Reduced Price: $100 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Olympic Sculpture Park',
	'Olympic Sculpture Park',
	'(do-it-yourself)',
	'Set your own pace through the Olympic Sculpture Park by leading your class on a self-guided visit.  We recommend exploring the museum\'s online collection and contacting The Wyckoff Teacher Resource Center prior to visiting.  TRC statff can help you create a customized visit that aligns your student learning objectives and make the most of your museum experience.',
	'OSPindex.asp#doityourself',
	'OSP',
	'1',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	3,
	null,
	null,
	'Tuesdays&ndash;Sundays',
	[1],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['11am', '12pm', '1pm', 'other'],
	6,
	'Regular Price: FREE',
	0,
	[],
      ],
      [
	'Elements of Art',
        'Art Goes to School: Elements of Art',
	'',
	'Bring SAM to your school!  This hour-long experience brings a professional Teaching Artist to your classroom to lead your students in a creative exploration of the elements of art.  Each lesson is tailored to the individual classroom\'s needs and includes inquiry-based discussion looking at works from SAM\'s collection, a creative making activity, group sharing and personal reflection designed to enhance student learning and build critical thinking skills.  Book three visits on one day and get one free visit that same day.',
	'artreach.asp',
	'ARTREACH',
	'0',
	'<strong>Grades K&ndash;12</strong>',
	3,		
	[],
	2,
	null,
	null,
	'Mondays or Tuesdays, between 9am&ndash;12pm',
	[0, 3, 4, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[0],
	1,
	'Regular Price: $125 per class (one class=1&ndash;35 students)<br/>Reduced Price: $63 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Asian Art Yesterday and Today',
        'Art Goes to School: Asian Art Yesterday and Today',
	'',
	'This hands-on workshop explores the arts of Asia across cultures, countries and time periods. From contemporary Korean art to ancient Indian sculpture, explore magnificent works of art from SAM’s global collection through looking exercises, discussion, art making and written reflection. Facilitated by a professional teaching artist, these workshops can be adapted to fit any classroom curriculum. ',
	'artreach.asp#luminous',
	'ARTREACH',
	'0',
	'<strong>Grades K&ndash;12</strong>',
	3,		
	[],
	2,
	'09/12/2011',
	'06/14/2012',
	'Mondays or Tuesdays, between 9am&ndash;12pm',
	[0, 3, 4, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[0],
	1,
	'Regular Price: $125 per class (one class=1&ndash;35 students)<br/>Reduced Price: $63 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Gauguin and Polynesia',
        'Art Goes to School: Gauguin and Polynesia',
	'',
	'Deepen your students’ learning by scheduling a <em>Gauguin and Polynesia</em> Art Goes to School workshop in your classroom either before, after, or independent of a museum visit.  These hour-long teaching artist visits explore works from the exhibition <em>Gauguin & Polynesia: An Elusive Paradise</em> and engage students in hands on activities and collaborative conversations. Offered in English and French.',
	'artreach.asp#gauguin',
	'ARTREACH',
	'0',
	'<strong>Grades K&ndash;12</strong>',
	3,		
	[],
	2,
	'02/06/2012',
	'06/15/2012',
	'Mondays or Tuesdays, between 9am&ndash;12pm',
	[0, 3, 4, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[0],
	1,
	'Regular Price: $125 per class (one class=1&ndash;35 students)<br/>Reduced Price: $63 per class (one class=1&ndash;35 students)',
	0,
	[],
      ]
    ]		// end of tourData array

    // Display list of offerings
    function loadData(){
        scroll(0,0);					// make sure we are at the top of the page!
	x = document.getElementById( 'tourListing' );
	if( x ){

	    var newList = "<h2>Art Goes to School</h2>";
	    for(i=0; i<tourData.length; i++){
		if( tourData[i][progSITE] == "ARTREACH" ){
		    if( tourData[i][progSOLDOUT]) strSoldOut = " <span style='color:#F00;font-size:9px'>SOLD OUT</span>";
		    else strSoldOut = "";
		    newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'>" + tourData[i][progTITLE] + " " + tourData[i][progSUBTITLE] + strSoldOut + "</p></a>";
		}
	    }

	    newList += "<h2><br/>SAM Downtown</h2>";	// location heading
	    var permanentFlag = 1;			// permanent vs special ex (transient) heading/grouping
	    for(i=0; i<tourData.length; i++){
		if( tourData[i][progSITE] == "SAM" ){
		    if( tourData[i][progSOLDOUT]) strSoldOut = " <span style='color:#F00;font-size:9px'>SOLD OUT</span>";
		    else strSoldOut = "";
		    if( i==0 & (tourData[i][progPERMANENT] == 0 ) )
			newList += "<h4>Special Exhibition</h4>";

		    if( tourData[i][progPERMANENT] == permanentFlag ){
			newList += "<h4>Permanent Collection</h4>";
			permanentFlag = 0;
		    }
		    newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'>" + tourData[i][progTITLE] + " " + tourData[i][progSUBTITLE] + strSoldOut + "</p></a>";
		}
	    }

	    permanentFlag = 1;				// reset for SAAM location
	    newList += "<h2><br/>Seattle Asian Art Museum</h2>";
	    for(i=0; i<tourData.length; i++){
		if( tourData[i][progSITE] == "SAAM" ){
		    if( tourData[i][progSOLDOUT]) strSoldOut = " <span style='color:#F00;font-size:9px'>SOLD OUT</span>";
		    else strSoldOut = "";
		    if( i==0 & (tourData[i][progPERMANENT] == 0 ) )
			newList += "<h4>Special Exhibition</h4>";
		    if( tourData[i][progPERMANENT] == permanentFlag ){
			newList += "<h4>Permanent Collection</h4>";
			permanentFlag = 0;
		    }
		    newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'>" + tourData[i][progTITLE] + " " + tourData[i][progSUBTITLE] + strSoldOut + "</p></a>";
		}
	    }

	    newList += "<h2><br/>Olympic Sculpture Park</h2>";
	    for(i=0; i<tourData.length; i++){
		if( tourData[i][progSITE] == "OSP" )
		newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'>" + tourData[i][progTITLE] + " " + tourData[i][progSUBTITLE] + "</p></a>";
	    }
	    x.innerHTML = newList;
	}
    }

    // load selected tour information
    function openTour( tourIndex ){
      currentTour = tourIndex;
      scroll(0,0);					// make sure we are at the top of the page!
      if( document.getElementById ){

	    x = document.getElementById( 'backButton' );
	    if( x ){
		x.style.visibility = "visible";
		x.style.display = "block";
	    }

	    x = document.getElementById( 'step1' );
	    if( x ){
		x.style.visibility = "hidden";
		x.style.display = "none";
	    }

	    x = document.getElementById( 'step2' );
	    if( x ){
		x.style.visibility = "visible";
		x.style.display = "block";
	    }

	    x = document.getElementById( 'tourTitle' );
	    if( x ){
		url = tourData[tourIndex][progURL];
		if( url != '' )
		    x.innerHTML = "<a href='" + url + "'><strong>" + tourData[tourIndex][progFULLTITLE] + "</strong> " + tourData[tourIndex][progSUBTITLE] + "</a>";
		else
		    x.innerHTML = "<strong>" + tourData[tourIndex][progFULLTITLE] + "</strong> " + tourData[tourIndex][progSUBTITLE];
	        document.tourForm.tourName.value = tourData[tourIndex][progTITLE] + " " + tourData[tourIndex][progSUBTITLE];
	    }

	    x = document.getElementById( 'tourDescription' );
	    if( x ){
		if( tourData[tourIndex][progDESC] != '' ){
		    x.innerHTML = tourData[tourIndex][progDESC];
		}
	    }

	if( tourData[tourIndex][progSOLDOUT] ){
	    // Tour is SOLD OUT!  Provide notice, and no other tour info
	    nDiv = document.getElementById( 'soldOut' );
	    if( nDiv ){
		nDiv.innerHTML = "<p class='compact2'>" + tourData[tourIndex][progFULLTITLE] + " " + tourData[tourIndex][progSUBTITLE] + "</p>";
		nDiv.innerHTML += "<h3 style='color:#FF0000'><strong><br>SOLD OUT</strong></h3>";
		nDiv.style.visibility = "visible";
		nDiv.style.display = "block";
	    }
	    // Hide initial options	
	    nDiv = document.getElementById( "tourListing" );
	    if( nDiv ){
		nDiv.style.visibility = "hidden";
		nDiv.style.display = "none";
	    }
	} else {
	    // Hide SOLD OUT text
	    nDiv = document.getElementById( 'soldOut' );
	    if( nDiv ){
		nDiv.style.visibility = "hidden";
		nDiv.style.display = "none";
	    }

	    // if this is an ART WORKSHOP/ARTREACH/ART Goes To School, set the flag (some special processing/formatting)
	    if( tourData[tourIndex][progSITE] == "ARTREACH" )
		 isARTREACH = 1;
	    else isARTREACH = 0;

	    // Tour text and grade information
	    x = document.getElementById( 'tourGrades' );
	    if( x ) x.innerHTML = tourData[tourIndex][progTEXT];

	    // Tour Options
	    x = document.getElementById( 'tourChoices' );
	    if( x ){
		tourOptionsCount = tourData[tourIndex][progOPTIONS].length;

		// Some tours have no options text, or just standard text.  Deal with those here.
		if( !tourOptionsCount ){
		    x.style.visibility = "hidden";
		    x.style.display = "none";
		} else if( tourOptionsCount == 1 ){
		    x.innerHTML = tourData[tourIndex][progOPTIONS][0][0];
		}

		// Tours with options may have varying time options as well.  Now it gets interesting...
		if( tourOptionsCount > 1 ){

		   // we DO have multiple program options;  first off, we aren't going to use the standard time div; hide it.
		    z = document.getElementById( 'tourTimes' );
		    if( z ){
			z.style.visibility="hidden";
			z.style.display="none";
		    }

		    // build each option with its (potential) time suboptions.
		    newHTML = "";
		    for( i=0; i<tourOptionsCount; i++ ){
			// Build radio button list of tour options

		        // default selection to first option
			if( i==0 ){
			    newHTML += "<input type='radio' name='tourChoice' checked value='" + tourData[tourIndex][progOPTIONS][i][1] + "' onClick='showTimeOptions(" + i + "," + tourOptionsCount + ")' >" + tourData[tourIndex][progOPTIONS][i][0] + "<br/><br/>";
			} else {
			    newHTML += "<input type='radio' name='tourChoice' value='" + tourData[tourIndex][progOPTIONS][i][1] + "' onClick='showTimeOptions(" + i + "," + tourOptionsCount + ")' >" + tourData[tourIndex][progOPTIONS][i][0] + "<br/><br/>";
			}


			// Make first set of options visible
			if( i==0 ){
			    newHTML += "<span id='timeOptions" + i + "' style='border:0px solid red;margin:0;padding:0;visibility:visible;display:block'>";
			} else {
			    newHTML += "<span id='timeOptions" + i + "' style='border:0px solid red;margin:0;padding:0;visibility:hidden;display:none'>";
			}
			newHTML += "<input type='hidden' name='tourTime'>";
			newHTML += "</span>";
		    }
		    x.innerHTML = newHTML;
		}
	    }

	    // Tour Dates
	    x = document.getElementById( 'tourDates' );
	    if( x ){
		// Format dates
		var d1 = null;
		var d2 = null;
		if( tourData[tourIndex][progSTART] != null ) d1 = new Date( tourData[tourIndex][progSTART] );
		if( tourData[tourIndex][progEND] != null ) d2 = new Date( tourData[tourIndex][progEND] );
		if( tourData[tourIndex][progSTART] == null && tourData[tourIndex][progEND] == null ){
			x.innerHTML = "Year round!";
		} else {
		    if( tourData[tourIndex][progSTART] == null ){
			x.innerHTML = "Ending " + tourData[tourIndex][progEND];
		    } else if(  tourData[tourIndex][progEND] == null ){
			x.innerHTML = "Starting " + tourData[tourIndex][progSTART];
		    } else {
			if( d1.getYear() == d2.getYear() ){
			    x.innerHTML = formatDate( d1, "NNN d" ) + "&ndash;" + formatDate( d2, "NNN d, yyyy" );
			} else {
			    x.innerHTML = formatDate( d1, "NNN d, yyyy" ) + "&ndash;" + formatDate( d2, "NNN d, yyyy" );
			}
		    }
		}
		x.innerHTML += "<br/>" + tourData[tourIndex][progDATES];
	    }

	    //
	    // Note - need to subtract one day from START, add one day to END for addDisabledDates()!
	    // d1 is START, d2 is END 
	    //
	    // Also Note - can't schedule less than four weeks (27 days) out.
	    //
	    var firstDate = new Date( today.getFullYear(), today.getMonth(), today.getDate() + 27 );
	    if( d1 != null ){
		d1.setDate( d1.getDate() - 1 );
		if( d1 < firstDate )
			d1 = firstDate;
	    }
	    else {
		// if no start date, go out four weeks
		d1 = firstDate;
	    }

	    //
	    // if we have an end date, set it.
	    //
	    if( d2 != null ){
		d2.setDate( d2.getDate() + 1);
	    }

	    for( i=0; i<6; i++ ){
		// disallow dates before tour start date, or after tour end date
		if( d1 != null ) eval("cal" + (i+1)).addDisabledDates( null, formatDate(d1, "yyyy-MM-dd") );
		if( d2 != null ) eval("cal" + (i+1)).addDisabledDates( formatDate(d2, "yyyy-MM-dd"), null );

		// eliminate days of week tour not offered
		switch( tourData[tourIndex][progNOTDATES].length ){
		    case 1:
			eval("cal" + (i+1)).setDisabledWeekDays( tourData[tourIndex][progNOTDATES][0] );
			break;
		    case 2:
			eval("cal" + (i+1)).setDisabledWeekDays( tourData[tourIndex][progNOTDATES][0], tourData[tourIndex][progNOTDATES][1] );
			break;
		    case 3:
			eval("cal" + (i+1)).setDisabledWeekDays( tourData[tourIndex][progNOTDATES][0], tourData[tourIndex][progNOTDATES][1], tourData[tourIndex][progNOTDATES][2] );
			break;
		    case 4:
			eval("cal" + (i+1)).setDisabledWeekDays( tourData[tourIndex][progNOTDATES][0], tourData[tourIndex][progNOTDATES][1], tourData[tourIndex][progNOTDATES][2], tourData[tourIndex][progNOTDATES][3] );
			break;
		    case 5:
			eval("cal" + (i+1)).setDisabledWeekDays( tourData[tourIndex][progNOTDATES][0], tourData[tourIndex][progNOTDATES][1], tourData[tourIndex][progNOTDATES][2], tourData[tourIndex][progNOTDATES][3], tourData[tourIndex][progNOTDATES][4] );
			break;
		    case 6:
			eval("cal" + (i+1)).setDisabledWeekDays( tourData[tourIndex][progNOTDATES][0], tourData[tourIndex][progNOTDATES][1], tourData[tourIndex][progNOTDATES][2], tourData[tourIndex][progNOTDATES][3], tourData[tourIndex][progNOTDATES][4], tourData[tourIndex][progNOTDATES][5] );
			break;
		}

		// if dates have been sold out or specifically excluded, add them here
		dayCount = tourData[tourIndex][progDAYSOLDOUT].length;
		for( j=0; j<dayCount; j++ ){
		    eval("cal" + (i+1)).addDisabledDates( tourData[tourIndex][progDAYSOLDOUT][j] );
		}
	    }

	    // Tour number of Classes
	    // if number of classes == 1, don't show second radio button
	    x = document.getElementById( 'tourClasses' );
	    if( x ){
		if( tourData[tourIndex][progCLASSES] == 1 ){
		    x.innerHTML = 'One class only <input type="hidden" name="tourNumberOfClasses" value="1">';
		} else {
		    x.innerHTML = '<input name="tourNumberOfClasses" type="radio" checked value="1" onclick="javascript:showClassCounts()" > 1 &nbsp;';
		    for( i=1; i < tourData[tourIndex][progCLASSES]; i++ ){
			x.innerHTML += '<input name="tourNumberOfClasses" type="radio" value="' + (i+1) + '" onclick="javascript:showClassCounts()" > ' + (i+1) + '&nbsp;';
		    }
		}

	    }

	    // Tour time options - one set of options per tour as a whole
	    x = document.getElementById( 'tourTimes' );
	    if( x ){
		tourTimeCount = tourData[tourIndex][progTIMES].length;
		if( tourTimeCount > 1 ){
		    //
		    //  If there is a list of time choices, create a select list
		    //
		    newHTML = "<table border='0' width='335px'>";
		    for( i=0; i<tourTimeCount; i++){

			if( i==0 )
			    newHTML += "<tr valign='bottom'><td width='200px'><strong>*Rank times<br/>(in order of preference)</strong></td><td align='right'>" + (i+1) + ". <select name='tourTime'  onchange='javascript:checkTime(this.options[this.selectedIndex].value)'>";
			else
			    newHTML += "<tr><td>&nbsp;</td><td align='right'>" + (i+1) + ". <select name='tourTime' onchange='javascript:checkTime(this.options[this.selectedIndex].value)' >";

			// start with blank option
			newHTML += '<option value=""></option>';

			// now plug in provided time options
			for( j=0; j<tourTimeCount; j++ ){
			    newHTML += '<option value="' + tourData[tourIndex][progTIMES][j] + '">' + tourData[tourIndex][progTIMES][j] + ' </option>';
			}
			newHTML += "</select></td></tr>";
		    }
		} else {
		    if( tourTimeCount == 1 ){
			//
			//  If there is a single value, that means open time choice
			//

			// ARTREACH offers two time blocks, one hour apart.
			if( tourData[tourIndex][progSITE] == "ARTREACH" ){
              		    newHTML = "<table border='0' width='335px'><tr><td><strong>*Start time choice</strong></td><td align='right'><input type='text' name='tourTime'></td></tr>";
			    newHTML += "<tr><td colspan='2'><em>Please select your start time between <strong>9am</strong> and <strong>noon</strong> to allow for teacher transportation time.</em><br/><em>If two classes, second class will start <strong>1 hour</strong> after this time.</em></td></tr></table>";
			} else {
              		    newHTML = "<table border='0' width='335px'><tr><td><strong>Start time choice</strong></td><td align='right'><input type='text' name='tourTime'></td></tr></table>";
			}
		    } else {
			//
			//  no time choice available
			//
              		newHTML = "<input type='hidden' name='tourTime'>";
			x.style.visibility = "hidden";
			x.style.display = "none";
		    }
		}
	    }
	    x.innerHTML = newHTML;


	    // Tour grade options - build grade selections
	    gradeLength = tourData[tourIndex][progGRADES].length;
	    x = document.getElementById( 'classDiv' );
	    if( x ){
		x.style.visibility = "visible";
		x.style.display = "block";
	    }
	    if( isARTREACH ){
		// build grade selections, class one
		newHTML = "";
		for( i=0; i<gradeLength; i++ ){
		    newHTML += tourData[tourIndex][progGRADES][i] + ' <input size="5" type="text" style="text-align:right" name="tourGradeLevels_' + tourData[tourIndex][progGRADES][i] + '" value="0" onchange="javascript:calcTotalStudents( this, 1 )" ><br/>';
		}
		x = document.getElementById( 'tourGradeLevels' );
		if( x ) x.innerHTML = newHTML;

		// build grade selections, class two
		newHTML = "";
		for( i=0; i<gradeLength; i++ ){
		    newHTML += tourData[tourIndex][progGRADES][i] + ' <input size="5" type="text" style="text-align:right" name="tourGradeLevels2_' + tourData[tourIndex][progGRADES][i] + '" value="0" onchange="javascript:calcTotalStudents( this, 2 )" ><br/>';
		}
		x = document.getElementById( 'tourGradeLevels2' );
		if( x ) x.innerHTML = newHTML;
	    } else {
		// Hide class2Div
	        x = document.getElementById( 'class2Div' );
		if( x ){
		    x.style.visibility = "hidden";
		    x.style.display = "none";
		}

		// build grade selections
	        newHTML = "";
		for( i=0; i<gradeLength; i++ ){
		    newHTML += tourData[tourIndex][progGRADES][i] + ' <input size="5" type="text" style="text-align:right" name="tourGradeLevels_' + tourData[tourIndex][progGRADES][i] + '" value="0" onchange="javascript:calcTotalStudents( this, 1 )" ><br/>';
		}
		x = document.getElementById( 'tourGradeLevels' );
		if( x ) x.innerHTML = newHTML;
	    }

	    // Show tour info box, now that we've populated it
	    nDiv = document.getElementById( 'tourBox' );
	    if( nDiv ){
		nDiv.style.visibility = "visible";
		nDiv.style.display = "block";
	    }

	    // Tour pricing
	    x = document.getElementById( 'tourPrice' );
	    if( x ) x.innerHTML = tourData[tourIndex][progPRICE];

	    // Show appropriate subsidy information
	    if( tourData[tourIndex][progTYPE] == 3 ){
		isARTREACH = 1;
	    	// show subsidy information for Art Reach Workshops
		nDiv = document.getElementById( 'artSubsidy' );
		if( nDiv ){
			nDiv.style.visibility = "visible";
			nDiv.style.display = "block";
		}
	    } else {
		isARTREACH = 0;
	    	// show bus subsidy information
		nDiv = document.getElementById( 'busSubsidy' );
		if( nDiv ){
			nDiv.style.visibility = "visible";
			nDiv.style.display = "block";
		}
		nDiv = document.getElementById( 'tourGuidelines' );
		if( nDiv ){
			nDiv.style.visibility = "visible";
			nDiv.style.display = "block";
		}
	    }

	    // Open contact information
	    nDiv = document.getElementById( "contactInfo" );
	    if( nDiv ){
		nDiv.style.visibility = "visible";
		nDiv.style.display = "block";
	    }

	    // Hide initial options	
	    nDiv = document.getElementById( "tourListing" );
	    if( nDiv ){
		nDiv.style.visibility = "hidden";
		nDiv.style.display = "none";
	    }
	}
      }
      scroll(0,0);					// make sure we are at the top of the page!
    }


    //
    //  For artReach, we want to capture grade levels for both classes independent of each other
    //  If there is only one class selected, hide the second class grade level boxes; otherwise show them.
    //
    //  For all tours, if the current total number of students is greater than the newly selected class size
    //  will allow, put up an error message.
    //
    function showClassCounts(){
	var theForm = document.tourForm;

	// check how many classes selected (1 or 2)
	var numClasses = 1;
	for( i=0; i<theForm.tourNumberOfClasses.length; i++ ){
	    if( theForm.tourNumberOfClasses[i].checked ){
		numClasses = theForm.tourNumberOfClasses[i].value;
		break;
	    }
	}

	if( isARTREACH ){
	    x = document.getElementById( 'class2Div' );
	    if( x ){
		if( numClasses == 1 ){
		    x.style.visibility = "hidden";
		    x.style.display = "none";
		    // debug - clear counts for class 2?
		} else {
		    x.style.visibility = "visible";
		    x.style.display = "block";
		}
	    }
	}
	else {
	    // check that the current total will allow the change in class size.
	    // reset number of classes if necessary.
	    totalStudents = theForm.tourNumberOfStudents.value;
	    if( (totalStudents / numClasses) > MAXCLASS ){
		alert("You have more students than your selected number of classes.");
		var realClassCount = parseInt( (totalStudents / MAXCLASS) );
		if( totalStudents % MAXCLASS ) realClassCount++;
		theForm.tourNumberOfClasses[realClassCount-1].checked = 1;
	    }
	}
    }


    function showTimeOptions( index, count ){
	// first hide all time options
	for( i=0; i<count; i++ ){
	    divName = "timeOptions" + i;
	    nDiv = document.getElementById( divName );
	    if( nDiv ){
		nDiv.style.visibility = "hidden";
		nDiv.style.display = "none";
	    }
	}

	// now show selected
	divName = "timeOptions" + index;
	nDiv = document.getElementById( divName );
	if( nDiv ){
		nDiv.style.visibility = "visible";
		nDiv.style.display = "block";
	}
    }

    //
    //  If time selected is "other", prompt user to enter value in comment box.
    //
    function checkTime( value ){
	if( value.toLowerCase() == "other" ){
	    alert("Please enter your time choices in the COMMENTS box below.");
	}
    }

    //
    // calc current total of students (no error checking, just get number; checking takes plae in calcTotalStudents()
    // whichClass = 1 or 2
    //
    function calcCurrentTotal( whichClass ){
	var theForm = document.tourForm;
	var currentTotal = 0;

	if( whichClass == 1 ){
		for( i=0; i<tourData[currentTour][progGRADES].length; i++ ){
		    currentTotal += parseInt(eval("theForm.tourGradeLevels_" + tourData[currentTour][progGRADES][i] + ".value"));
		}
	} else {
		for( i=0; i<tourData[currentTour][progGRADES].length; i++ ){
		    currentTotal += parseInt(eval("theForm.tourGradeLevels2_" + tourData[currentTour][progGRADES][i] + ".value"));
		}
	}
	return currentTotal;
    }

    //
    //  We are now having the user enter number of students by grade level;
    //  sum the values for total number of students, as well as checking for valid data entry.
    //
    //  classNum is for ArtReach - class1 or class2.
    //
    function calcTotalStudents( gradeNum, classNum ){
	var theForm = document.tourForm;
	var currentTotal = calcCurrentTotal( 1 );			// current sum of students 

	// check how many classes selected
	var classCount = 1;
	for( i=0; i<theForm.tourNumberOfClasses.length; i++ ){
	    if( theForm.tourNumberOfClasses[i].checked ){
		classCount = theForm.tourNumberOfClasses[i].value;
		break;
	    }
	}

	gradeNum.value = parseInt( gradeNum.value );		// enforce numeric
	if( isNaN( gradeNum.value )){
		gradeNum.value = 0;				// sorry, invalid number
		alert("please enter a number");
		gradeNum.focus();
	} else {
	    //
	    //  Check that we can handle the number of students indicated;
	    //  max students variable based on program type.
	    //  Add to total if ok, otherwise put up a message.
	    //

	    var numClasses  = tourData[currentTour][progCLASSES];		// number of classes per timeslot
	    var numTimeslot = tourData[currentTour][progMAXTIMES];		// maximum number of timeslots per day

	    switch( tourData[currentTour][progTYPE] ){
		case 1:				// TOUR + WORKSHOP
						// maximum number of students is MAXCLASS * classCount
			if( currentTotal > (MAXCLASS * classCount) ){
			    if( classCount < numClasses ){
				alert("You have more students than the number of classes you have indicated can accomodate.  Please add a class or reduce the number of students.");
			    } else {
			        alert("You have indicated more students than we can accomodate.  Please reduce your numbers.");
			    }
			    gradeNum.value = 0;
			    gradeNum.focus();
			} else {
			    theForm.tourNumberOfStudents.value = calcCurrentTotal( 1 );
			}
			break;
		case 2:				// TOUR ONLY
		case 4:				// DIY
						// maximum number of students is MAXCLASS * classCount
			if( currentTotal > (MAXCLASS * classCount) ){

			    // Too many students.  However, if there are multiple time slots available, they can sign up
			    // for additional tours.
			    var maxStudents = (numClasses * MAXCLASS) * numTimeslot;			// maximum number of students per day
//alert("maxClasses per time=" + numClasses + "; maxTimes=" + numTimeslot + "; maxStudents=" + maxStudents);		// debug

			    if( classCount < numClasses ){
				alert("You have more students than the number of classes you have indicated can accomodate.  Please add a class or reduce the number of students.");
			        gradeNum.value = 0;
			        gradeNum.focus();
			    } else if( currentTotal <= maxStudents ){
				alert("You have too many students for one tour.  However, you can be scheduled for multiple tours.  We will contact you to arrange the details.");
			        theForm.tourNumberOfStudents.value = calcCurrentTotal( 1 );
			    } else {
			        alert("You have indicated more students than we can accomodate.  Please reduce your numbers.");
			        gradeNum.value = 0;
			        gradeNum.focus();
			    }
			
			} else {
			    theForm.tourNumberOfStudents.value = calcCurrentTotal( 1 );
			}
			break;
		case 3:				// ARTREACH - MAXCLASS per class only.
		    switch( classNum ){
			case 1:
			    if( currentTotal > MAXCLASS ){
				gradeNum.value = 0;
				alert("max of " + MAXCLASS + " students per class");
				gradeNum.focus();
				
			    } else {
				theForm.tourNumberOfStudents.value = calcCurrentTotal( 1 );
			    }
			    break;
			case 2:
			default:
			    currentTotal = calcCurrentTotal( 2 );
			    if( currentTotal > MAXCLASS ){
				gradeNum.value = 0;
				alert("max of " + MAXCLASS + " students per class");
				gradeNum.focus();
				
			    } else {
				theForm.tourNumberOfStudents2.value = calcCurrentTotal( 2 );
			    }
			    break;

		    }
		    break;
		default:
alert("unrecognized type(" + tourData[currentTour][progTYPE] + ")!  Tour:" + tourData[currentTour][progTITLE]);
		    break;
	    }
	    theForm.tourNumberOfStudents.value = calcCurrentTotal( 1 );		// debug - we are doing this a few too many times...
	    if( tourData[currentTour][progTYPE] == 3  && classNum == 2 ){
	        theForm.tourNumberOfStudents2.value = calcCurrentTotal( 2 );
	    }
	}
    }

    function formValidator(){
	var theForm = document.tourForm;

	// check for miminal tour request information

	// if there are time options, make sure at least one is selected
	if( tourData[currentTour][progTIMES].length > 1 ){
	    if( theForm.tourTime[0].selectedIndex < 1 ){
	        alert("Please enter your first time choice");
	        theForm.tourTime[0].focus();
	        return( false );
	    }
	}

	// make sure first date choice is made
	if( theForm.tourDate1.value == "" ){
	    alert("Please enter your first date choice");
	    theForm.tourDate1.focus();
	    return( false );
	}

	// check all given dates for valid format
	for( i=0; i<6; i++ ){
	    dateVal = eval("theForm.tourDate" + (i+1) + ".value");
	    if( dateVal != "" ){
		    tmpDate = new Date( dateVal );
		    if( isNaN( tmpDate ) ){
			alert("Please enter a valid date");
			eval("theForm.tourDate" + (i+1)).focus();
			return( false );
		    } else {
			if( tmpDate < today ){
			    alert("Your selected date is past; please enter a future date");
			    eval("theForm.tourDate" + (i+1)).focus();
			    return( false );
			} else {
			    // Erica wants the day of week
			    eval("theForm.tourDayOfWeek" + (i+1) ).value = DAY_NAMES[ tmpDate.getDay() ];
			}
		    }
	    }
	}

	// require a start time and a value for number of students
	if( isARTREACH ){
	    if( theForm.tourTime.value == "" ) {
	        alert("Please enter a start time");
	        theForm.tourTime.focus();
	        return( false );
	    }
	    // different variable for artreach students - 2 possible fields
	    if( theForm.tourNumberOfStudents.value == "" || isNaN( theForm.tourNumberOfStudents.value ) ){
	        alert("Please enter the total number of students");
	        theForm.tourNumberOfStudents.focus();
	        return( false );
	    }
	    if( theForm.tourNumberOfStudents.value > MAXCLASS ){
	        alert("There is a maximum of " + MAXCLASS + " students per class!");
	        theForm.tourNumberOfStudents.focus();
	        return( false );
	    }
	    if( theForm.tourNumberOfStudents2.value != "" && isNaN( theForm.tourNumberOfStudents2.value ) ){
	        alert("Please enter the total number of students");
	        theForm.tourNumberOfStudents2.focus();
	        return( false );
	    }
	    if( theForm.tourNumberOfStudents2.value > MAXCLASS ){
	        alert("There is a maximum of " + MAXCLASS + " students per class!");
	        theForm.tourNumberOfStudents2.focus();
	        return( false );
	    }
	} else {
	    if( theForm.tourNumberOfStudents.value == "" || isNaN( theForm.tourNumberOfStudents.value ) ) {
		// not ARTREACH; just check that a value entered for number of students
		alert("Please enter the total number of students");
		theForm.tourNumberOfStudents.focus();
		return( false );
	    }

	    // get number of classes, then multiply by max students per class for a max value
	    for( i=0, count=1; i<theForm.tourNumberOfClasses.length; i++ ){
		if( theForm.tourNumberOfClasses[i].checked ){
		    count = theForm.tourNumberOfClasses[i].value;
		    break;
		}
	    }
	    if( theForm.tourNumberOfStudents.value > (count * MAXCLASS) ){
	        alert("There is a maximum of " + MAXCLASS + " students per class!");
	        theForm.tourNumberOfStudents.focus();
	        return( false );
	    }
	}

	// check for total count of students > 0
	if( theForm.tourNumberOfStudents.value == 0 ){
	    alert("please enter the number of students at each grade level");
	    theForm.tourNumberOfStudents.focus();
	    return( false );
	}

	// check for minimal contact information
	if( theForm.userName.value == "" )
	{
	    alert("Please enter your name");
	    theForm.userName.focus();
	    return( false );
	}
	if( theForm.userLastName.value == "" )
	{
	    alert("Please enter your last name");
	    theForm.userLastName.focus();
	    return( false );
	}
	if( theForm.PhoneDay.value == "" )
	{
	    alert("Please enter a phone number");
	    theForm.PhoneDay.focus();
	    return( false );
	} else {
	    var stripped = theForm.PhoneDay.value.replace(/[\(\)\.\-\ ]/g, '');

	    //strip out acceptable non-numeric characters
	    if (isNaN(parseInt(stripped))) {
		alert("Please enter a valid phone number");
	        theForm.PhoneDay.focus();
		return( false );
	    }
	    // Count the length of the number - should be 10 digits
	    if (!(stripped.length == 10)) {
		alert("Please make sure you include the area code");
	        theForm.PhoneDay.focus();
		return( false );
	    }
	}
	if( theForm.userEmail.value == "" )
	{
	    alert("Please enter your email address");
	    theForm.userEmail.focus();
	    return( false );
	} else {
	    //check for valid email syntax
	    val = theForm.userEmail.value;
	    apos = val.indexOf("@");
	    dpos = val.lastIndexOf(".");
	    if( apos < 1 || dpos-apos < 2 ){
		alert("Not a valid email address!");
		theForm.userEmail.focus();
		return( false );
	    }
	}
	if( theForm.userEmail2.value != "" )
	{
	    //check for valid email syntax
	    val = theForm.userEmail2.value;
	    apos = val.indexOf("@");
	    dpos = val.lastIndexOf(".");
	    if( apos < 1 || dpos-apos < 2 ){
		alert("Not a valid email address!");
		theForm.userEmail2.focus();
		return( false );
	    }
	    //theForm.userEmail.value += "," + theForm.userEmail2.value;		// want to send confirmation email to both accounts
	}

	if( !theForm.readProgramGuidelines.checked ){
	    alert("Please read the How to Schedule a Tour or Visit Guidelines and check the box");	
	    theForm.readProgramGuidelines.focus();
	    return( false );
	}

	// update confirmation text
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value  = alertText;
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "Thank you for submitting a request for a Seattle Art Museum Tour. ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "Here is the information you submitted: ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>Contact Name: " + theForm.userName.value + " " + theForm.userLastName.value;
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>School/Organization Name: " + theForm.orgName.value;
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Tour Name: " + theForm.tourName.value;

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Requested Dates: ";
	for( i=0; i<6; i++ ){
	    dateVal = eval("theForm.tourDate" + (i+1) + ".value");
	    if( dateVal != "" ){
		if( i )
		    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += ", " + dateVal;
		else
		    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += dateVal;
	    }
	}

	if( isARTREACH ){
	    // present ARTREACH class count info
	    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Time: " + theForm.tourTime.value;
	    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Students (class 1): " + theForm.tourNumberOfStudents.value;
	    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Students (class 2): " + theForm.tourNumberOfStudents2.value;
	} else {	
	    // present standard class/grade info
	    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Number of Classes: ";
	    var numClasses = 1;
	    for( i=0; i<theForm.tourNumberOfClasses.length; i++ ){
		if( theForm.tourNumberOfClasses[i].checked ){
		    numClasses = theForm.tourNumberOfClasses[i].value;
		    break;
		}
	    }
	    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += numClasses;			// number of classes

	    theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Number of Students: " + theForm.tourNumberOfStudents.value;
	}

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>This email/letter does not constitute a confirmed booking ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "for a school tour at the Seattle Art Museum. ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "Your request will be reviewed and may take up to two ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "weeks to process and book. <strong>A confirmation ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "letter indicating the booked title, date, time, ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "cost, payment instructions and location of your ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "tour will be mailed or emailed to you within ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "two weeks of this request. </strong> ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "Your confirmation letter will also include gallery ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "or park guidelines and any relevant pre-visit materials. ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "A tour is not considered booked until you receive the ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "confirmation letter. ";

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>If all the dates and/or times you requested ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "above have been booked by other schools, the Tour ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "Coordinator will contact you with alternative dates and/or times. ";

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>If you have requested a reduced tour fee or ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "are interested in bus reimbursement, please send a letter ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "or document proving that 40 percent or more of the students ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "at your school are on a subsidized lunch program. Please also ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "complete the ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<a href='http://www.seattleartmuseum.org/learn/schoolTeacher/pdf/busReimbursementForm.pdf'>bus expense reimbursement form</a>. ";

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>Before your school tour, please make sure to review the ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<a href='http://www.seattleartmuseum.org/learn/schoolTeacher/howTo.asp#4'>plan your visit</a> ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "section of SAM’s website. Here you can find information ranging ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "from where school buses should park to where you can eat sack ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "lunches at any of SAM’s three locations. If you have any ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "questions after reading over this information, contact the ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "Tour Coordinator at 206.654.3123 or ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<a href='mailto:schooltours@seattleartmuseum.org'>schooltours@seattleartmuseum.org</a>.";

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>Thank you for requesting a school tour ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "at the Seattle Art Museum. We look forward to seeing you soon, ";

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>SAM School + Educator Programs Team ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>Seattle Art Museum";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>1300 First Avenue";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>Seattle WA, 98101";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br>206.654.3123";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><a href='mailto:schooltours@seattleartmuseum.org'>schooltours@seattleartmuseum.org</a>";

	theForm.SAM_FormCheck.value = samx;
	theForm.submit();
    }

    function resetForm(){
	window.location.reload();
    }


