
    // list of days to exclude from selection
    var SAMholidays = [ '09/03/2009', '10/01/2009', '10/12/2009', '11/05/2009', '11/26/2009', '12/03/2009', '12/24/2009', '12/25/2009', '12/31/2009', '01/01/2010', '01/07/2010', '02/04/2010', '03/04/2010', '04/04/2010', '05/06/2010', '06/03/2010', '07/03/2010', '07/04/2010' ];

    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 (optional)
    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 = [
      [
        'Artistic Elements',
        'Artistic Elements',
        '(tour + workshop)',
	'Learn about the elements of art &mdash; line, shape, color and texture while exploring art from around the world in SAM\'s permanent collection.  Students learn how artists use these elements to communicate with the viewer.',
	'DTtours/collection.asp#artistic',
	'SAM',
	'1',
	'<strong>Grades K&ndash;1</strong>: 10:15am&ndash;12pm. Tour and workshop are 45 min. each.<br/><strong>Grades 2&ndash;12</strong>: 10:15am&ndash;12:15pm. Tour and workshop are 60 min. each.',
	1,		
	[],
	2,
	'09/30/2009',
	'06/18/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 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 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;1</strong>: 10:15am&ndash;12pm. Tour and workshop are 45 min. each.<br/><strong>Grades 2&ndash;3</strong>: 10:15am&ndash;12:15pm. Tour and workshop are 60 min. each.',
	1,		
	[],
	2,
	'09/30/2009',
	'06/18/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['K', '1', '2', '3'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Living Histories: NW Native American Art',
        'Living Histories: Northwest Native American Art',
        '(tour + workshop)',
	'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;3</strong>: 10:15am&ndash;12:15pm. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'09/30/2009',
	'06/18/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['2', '3', '4', '5', '6', '7', '8'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'African Art in Motion',
        'African Art in Motion',
        '(tour + workshop)',
	'Experience the energy and beauty of SAM\’s African art collection, including figurative sculpture, masks and masquerades, and the art of everyday life.',
	'DTtours/collection.asp#african',
	'SAM',
	'1',
	'<strong>Grades 3&ndash;12</strong>: 10:15am&ndash;12:15pm. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'09/30/2009',
	'06/18/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Images and Words: Writing About Art',
        'Images and Words: Writing About Art',
        '(tour only)',
	'This tour is a literary exploration of SAM’s collection of art designed for high school students. Students interested in narrative, story, poetry, and text in art will participate in guided looking, with time to reflect in writing and sketching.',
	'DTtours/collection.asp#made',
	'SAM',
	'1',
	'<strong>Grades 9&ndash;12</strong>: Tour is 90 minutes, no art workshop.',
	2,
	[],
	1,
	'09/30/2009',
	'06/18/2010',
	'Thursday only',
	[0, 1, 2, 3, 5, 6],
	['9', '10', '11', '12'],
	['10am', '10:30am', '11am', '11:30am'],
	1,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 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. The Wyckoff Teacher Resource Center offers a wide variety of resource materials to help you create a tailored visit that supports your classroom curriculum. We also recommend exploring the museum’s online collection prior to visiting. ',
	'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,
	'Wednesday&ndash;Sunday',
	[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: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Alexander Calder: A Balancing Act',
        'Alexander Calder: A Balancing Act',
        '(tour + workshop)',
	'Alexander Calder\’s (1898-1976), illustrious career spanned much of the 20th century. One of the most acclaimed and influential sculptors of our time, Calder is famous for developing a new method of sculpting by bending and twisting wire and for inventing the mobile. Students trace the development of Alexander Calder\’s work, exploring its playful, delicate beauty, and inventiveness.',
	'DTtours/speExh.asp#calder',
	'SAM',
	'0',
	'<strong>Grades K&ndash;1</strong>: 9:30&ndash;11:15am. Tour and workshop are 45 min. each.<br/><strong>Grades 2&ndash;12</strong>: 9:30&ndash;11:30am. Tour and workshop are 60 min. each.',
	1,
	[],
	2,
	'10/21/2009',
	'04/09/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Alexander Calder: A Balancing Act',
        'Alexander Calder: A Balancing Act',
        '(tour only)',
	'Alexander Calder\’s (1898-1976), illustrious career spanned much of the 20th century. One of the most acclaimed and influential sculptors of our time, Calder is famous for developing a new method of sculpting by bending and twisting wire and for inventing the mobile. Students trace the development of Alexander Calder\’s work, exploring its playful, delicate beauty, and inventiveness.',
	'DTtours/speExh.asp#calder',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Tour is 60 minutes, no art workshop',
	2,		
	[],
	1,
	'10/21/2009',
	'04/09/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['9am', '10am', '11am (no Friday)', '12pm (no Friday)'],
	4,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Alexander Calder: A Balancing Act',
        'Alexander Calder: A Balancing Act',
	'(do-it-yourself)',
	'Alexander Calder\’s (1898-1976), illustrious career spanned much of the 20th century. One of the most acclaimed and influential sculptors of our time, Calder is famous for developing a new method of sculpting by bending and twisting wire and for inventing the mobile. Students trace the development of Alexander Calder\’s work, exploring its playful, delicate beauty, and inventiveness.',
	'DTtours/speExh.asp#calder',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.  No tours before 11:30am',
	4,		
	[],
	1,
	'10/15/2009',
	'04/11/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['11:30am', '12:30pm', 'other'],
	2,
	'Regular Price: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Michelangelo Public and Private',
        'Michelangelo Public and Private: Drawings for the Sistine Chapel and other Treasures from the Casa Buonarroti',
        '(tour only)',
	'Drawn exclusively from the private collection of the Casa Buonarroti, Florence, <em>Michelangelo Public and Private</em> features 12 original drawings by Michelangelo and is organized around two themes: "Michelangelo the Man" and "Michelangelo and the Sistine Chapel." Through portraits of the artist, documents, and decorative arts from the Casa Buonarroti, the exhibition addresses Michelangelo\’s complex personality and aspects of his career. Then, a selection of working drawings made by Michelangelo for the Sistine Chapel ceiling unveil the great artist\'s creative process. On this tour students will study select works of art closely through sketching and writing.',
	'DTtours/speExh.asp#michelangelo',
	'SAM',
	'0',
	'<strong>Grades 6&ndash;12</strong>: Tour is 60 minutes, no art workshop.',
	2,		
	[],
	1,
	'10/21/2009',
	'01/29/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['6', '7', '8', '9', '10', '11', '12'],
	['9:15am', '10:15am', '11:30am (Wed only)', '12:30pm (Wed only)'],
	2,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
        'Michelangelo Public and Private',
        'Michelangelo Public and Private: Drawings for the Sistine Chapel and other Treasures from the Casa Buonarroti',
	'(do-it-yourself)',
	'Drawn exclusively from the private collection of the Casa Buonarroti, Florence, <em>Michelangelo Public and Private</em> features 12 original drawings by Michelangelo and is organized around two themes: "Michelangelo the Man" and "Michelangelo and the Sistine Chapel." Through portraits of the artist, documents, and decorative arts from the Casa Buonarroti, the exhibition addresses Michelangelo\’s complex personality and aspects of his career. Then, a selection of working drawings made by Michelangelo for the Sistine Chapel ceiling unveil the great artist\'s creative process. On this tour students will study select works of art closely through sketching and writing.',
	'DTtours/collection.asp#buonarroti',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	1,
	'10/21/2009',
	'01/29/2010',
	'Wednesday&ndash;Sunday',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['11am', '12pm', '1pm', 'other'],
	1,
	'Regular Price: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Photographs by Imogen Cunningham',
	'Everything Under the Sun: Photographs by Imogen Cunningham',
	'(do-it-yourself)',
	'Imogen Cunningham (1883 – 1976) is one of the most well-known photographers from the Northwest. Working at a time when female photographers were few, Cunningham did not shy away from controversial subject matter. The world was always a feast for her eyes.',
	'DTtours/speExh.asp#imogen',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	1,
	'06/11/2009',
	'08/29/2010',
	'Wednesday&ndash;Sunday',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '10:30am', '11am', '12pm', '12:30pm', 'other'],
	4,
	'Regular Price: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Kurt',
	'Kurt',
	'(do-it-yourself)',
	'As a Seattle-based artist who died prematurely in 1994, Kurt Cobain\'s life and work has reverberated across the globe. Grunge music is arguably Seattle\’s greatest cultural export of the past 20 years. Kurt and his band Nirvana were central figures in that movement. This exhibition features objects ranging from straightforward portraits of Kurt to works that show a more subtle assimilation of his ethos and idealism. This exhibition is being developed in partnership with the Experience Music Project\'s exhibition on Kurt\'s band Nirvana.',
	'DTtours/speExh.asp#kurt',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	'05/13/2010',
	'09/12/2010',
	'Wednesday&ndash;Sunday',
	[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: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Andy Warhol Media Works',
	'love fear pleaure lust pain glamour death - Andy Warhol Media Works',
	'(do-it-yourself)',
	'This exhibition of Andy Warhol\’s photography and Screen Tests relates to themes of pop culture, celebrity, death, and the artist\’s image. Through a variety of formats, including photobooth strips, Polaroids, Screen Test films, and Stitched Photographs, the exhibition delves into the artist\’s deep engagement with all things ephemeral, from beauty and youth to fame and celebrity status. The exhibition is drawn primarily from the Andy Warhol Foundation and the Andy Warhol Museum.',
	'DTtours/speExh.asp#warhol',
	'SAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	'05/13/2010',
	'09/12/2010',
	'Wednesday&ndash;Sunday',
	[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: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 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/collection.asp#selfguided',
	'SAAM',
	'1',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	2,
	null,
	null,
	'Wednesday&ndash;Sunday',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '11am', '12pm', '1pm', 'other'],
	4,
	'Regular Price: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Arts of Asia: People, Animals and Nature',
	'Arts of Asia: People, Animals and Nature',
	'(tour + workshop)',
	'Examine the different images of people, animals and nature that abound in the visual art of China, Japan and Korea, and the stories that they tell.',
	'SAAMtours/specExh.asp#seattleperspective',
	'SAAM',
	'0',
	'<strong>Grades 2&ndash;12</strong>: 10:15am&ndash;12:15pm. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'12/02/2009',
	'06/17/2010',
	'Wednesday or Thursday',
	[0, 1, 2, 5, 6],
	['2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Fleeting Beauty',
	'Fleeting Beauty: Japanese Woodblock Prints',
	'(tour + workshop)',
	'Explore the play between delicate ink lines and rich blocks of color in this collection of Japanese woodblock prints from some of the most renowned Ukiyo-e artists of the eighteenth and nineteenth centuries.',
	'SAAMtours/specExh.asp#brocade',
	'SAAM',
	'0',
	'<strong>Grades 4&ndash;12</strong>: 10:15am&ndash;12:15pm. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'04/07/2010',
	'06/17/2010',
	'Wednesday or Thursday',
	[0, 1, 2, 5, 6],
	['4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Fleeting Beauty',
	'Fleeting Beauty: Japanese Woodblock Prints',
	'(do-it-yourself)',
	'Explore the play between delicate ink lines and rich blocks of color in this collection of Japanese woodblock prints from some of the most renowned Ukiyo-e artists of the eighteenth and nineteenth centuries.',
	'SAAMtours/specExh.asp#brocade',
	'SAAM',
	'0',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	1,
	'04/01/2010',
	'07/04/2010',
	'Wednesday&ndash;Sunday',
	[1, 2],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['10am', '11am', '12pm', '12:30pm', '1pm', 'other'],
	4,
	'Regular Price: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Where Earth Meets Art',
	'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.',
	'OSPtours.asp#where',
	'OSP',
	'1',
	'<strong>Grades K&ndash;1</strong>: 10&ndash;11:45am. Tour and workshop are 45 min. each.<br/><strong>Grades 2&ndash;8</strong>: 10am&ndash;12:15pm. Tour and workshop are 60 min. each.',
	1,		
	[],
	2,
	'03/10/2010',
	'06/18/2019',
	'Wednesday&ndash;Thursday',
	[0, 1, 2, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Where Earth Meets Art',
	'Where Earth Meets Art',
	'(tour only)',
	'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.',
	'OSPtours.asp#where',
	'OSP',
	'1',
	'<strong>Grades K-1</strong>: Tour is 45 minutes, no art workshop.<br/><strong>Grades 2-8</strong>: Tour is 60 minutes, no art workshop.',
	2,
	[],
	1,
	'03/10/2010',
	'06/18/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8'],
	['10am', '11:15am'],
	2,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Beauty and the Beach',
	'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.',
	'OSPtours.asp#beauty',
	'OSP',
	'1',
	'<strong>Grades 6&ndash;12</strong>: 10am&ndash;12:15pm. Tour and workshop are offered this time only and are 60 min. each.',
	1,		
	[],
	2,
	'03/10/2010',
	'06/18/2010',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['6', '7', '8', '9', '10', '11', '12'],
	[],
	1,
	'Regular Price: $150 per class (one class=1&ndash;35 students)<br/>Reduced Price: $75 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Beauty and the Beach',
	'Beauty and the Beach',
	'(tour only)',
	'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.',
	'OSPtours.asp#beauty',
	'OSP',
	'1',
	'<strong>Grades 6&ndash;12</strong>: Tour is 60 minutes, no art workshop.',
	2,
	[],
	1,
	'03/03/2009',
	'06/19/2009',
	'Wednesday&ndash;Friday',
	[0, 1, 2, 6],
	['6', '7', '8', '9', '10', '11', '12'],
	['10am', '11:15am'],
	2,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 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. The Wyckoff Teacher Resource Center offers a wide variety of resource materials to help you create a tailored visit that supports your classroom curriculum. A map and suggested on-site activities will be included with your tour confirmation letter.',
	'OSPtours.asp#selfguided',
	'OSP',
	'1',
	'<strong>Grades K&ndash;12</strong>: Visit only, no docent-led tour or art workshop.',
	4,		
	[],
	3,
	null,
	null,
	'Tuesday&ndash;Sunday',
	[1],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	['11am', '12pm', '1pm', 'other'],
	6,
	'Regular Price: $30 per class (one class=1&ndash;35 students)<br/>Reduced Price: $15 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Beauty and Bling: West African Textile Design',
	'Beauty and Bling: West African Textile Design',
	'',
	'Explore and model beautiful fabric treasures from Ghana and Nigeria. Discover hand carved Adinkra stamps, modern tennis shoes made from Kente cloth, dramatically patterned beads and traditional African music. Create a personal statement of self-adornment using the recycled materials and tiny Adinkra stamps.',
	'ARTreach.asp#stories',
	'ARTREACH',
	'0',
	'<strong>Grades K&ndash;12</strong>',
	3,		
	[],
	2,
	'09/28/2009',
	'06/15/2010',
	'Monday or Tuesday, between 10am&ndash;2pm',
	[0, 3, 4, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[0],
	1,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Gifts: Art of the Coast Salish',
	'Gifts: Art of the Coast Salish',
	'',
	'Coast Salish people from the Pacific Northwest Coast value the materials and resources of the earth. These gifts are offered and accepted with gratitude. Investigate natural materials like wool, cedar, and grass. Listen to the wisdom of the elders through oral teachings. Create gifts for each other using your own creativity and imagination, finding inspiration in those that have come before us. Give. Receive. Create. ',
	'ARTreach.asp#tales',
	'ARTREACH',
	'0',
	'<strong>Grades K&ndash;12</strong>',
	3,
	[],
	2,
	'09/28/2009',
	'06/15/2010',
	'Monday or Tuesday, between 10am&ndash;2pm',
	[0, 3, 4, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[0],
	1,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 per class (one class=1&ndash;35 students)',
	0,
	[],
      ],
      [
	'Stroke it Out! Chinese Calligraphy',
	'Stroke it Out! Chinese Calligraphy',
	'',
	'All of creation can be found within one single brushstroke – such is the belief behind the ancient art of Calligraphy. During this workshop students investigate the gesture, breath, and artistic integrity of the calligraphic stroke. Materials include brush, paper, ink and stone. The adventure has only just begun.',
	'ARTreach.asp#tools',
	'ARTREACH',
	'0',
	'<strong>Grades K&ndash;12</strong>',
	3,		
	[],
	2,
	'09/28/2009',
	'06/15/2010',
	'Monday or Tuesday, between 10am&ndash;2pm',
	[0, 3, 4, 5, 6],
	['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
	[0],
	1,
	'Regular Price: $75 per class (one class=1&ndash;35 students)<br/>Reduced Price: $38 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 = "<h3>SAM Downtown</h3>";	// 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][progPERMANENT] != permanentFlag ){
			newList += "<h4>Special Exhibitions</h4>";
			permanentFlag = 0;
		    }
		    newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'><img src='/images/arrow_right.gif' /><strong>" + tourData[i][progTITLE] + "</strong> " + tourData[i][progSUBTITLE] + "</p></a>";
		}
	    }

	    permanentFlag = 1;				// reset for SAAM location
	    newList += "<h3><br/>Seattle Asian Art Museum</h3>";
	    for(i=0; i<tourData.length; i++){
		if( tourData[i][progSITE] == "SAAM" ){
		    if( tourData[i][progPERMANENT] != permanentFlag ){
			newList += "<h4>Special Exhibitions</h4>";
			permanentFlag = 0;
		    }
		    newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'><img src='/images/arrow_right.gif' /><strong>" + tourData[i][progTITLE] + "</strong> " + tourData[i][progSUBTITLE] + "</p></a>";
		}
	    }

	    newList += "<h3><br/>Olympic Sculpture Park</h3>";
	    for(i=0; i<tourData.length; i++){
		if( tourData[i][progSITE] == "OSP" )
		newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'><img src='/images/arrow_right.gif' /><strong>" + tourData[i][progTITLE] + "</strong> " + tourData[i][progSUBTITLE] + "</p></a>";
	    }

	    newList += "<h3><br/>ARTreach</h3>";
	    for(i=0; i<tourData.length; i++){
		if( tourData[i][progSITE] == "ARTREACH" )
		newList += "<a href='javascript:openTour(" + i + ")'><p class='compact1'><img src='/images/arrow_right.gif' /><strong>" + tourData[i][progTITLE] + "</strong> " + 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( 'quickLinks' );
	    if( x ){
		x.style.visibility = "hidden";
		x.style.display = "none";
	    }

	    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'><strong>" + tourData[tourIndex][progFULLTITLE] + "</strong> " + tourData[tourIndex][progSUBTITLE] + "</p>";
		nDiv.innerHTML += "<h3><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, 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>10am</strong> and <strong>2pm</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.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  = "Thank you for submitting a request for a Seattle Art Museum Program. ";
	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>Program 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 program at the Seattle Art Museum. ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "Your request for a guided tour, a self-guided ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "visit, an ARTreach workshop or an Art in Action ";
	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "workshop 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 += "program 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 program 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 program, 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:tours@seattleartmuseum.org'>tours@seattleartmuseum.org</a>.";

	theForm.SAM_FORM_CONFIRM_EMAIL_TEXT.value += "<br><br>Thank you for requesting a school program ";
	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:tours@seattleartmuseum.org'>tours@seattleartmuseum.org</a>";

	theForm.submit();
    }

    function resetForm(){
	window.location.reload();
    }

