//The following code, up to and including line 21, should not be edited.
function displaycalendar (display) {
	document.getElementById('calendar').innerHTML=display;

	//Stylistic Info
	var cells = document.getElementById('calendar').getElementsByTagName('td');
	var length = cells.length;
	for (i=0;i<length;i++) {
		var a = cells[i].getElementsByTagName('a');
		if ( a.length == 1 ) {
			cells[i].style.backgroundColor="orange";
		}
	}

	return false;
}

start = "<div class='cinfo'>";
back = "<p><a href='' onclick='return displaycalendar(ctable)'>Back to Calendar</a></p></div>";

c = new Array();


//Calendar dates. This code should be edited. Array is numeric and key should be the day of the month (for example, c[3] is the third of the month)

c[4] = start;
c[4] += "<p>Wed. January 4 at 12:00 PM<br />";
c[4] += "Christian the Magician at City Museum<br /><br />";
c[4] += back;

c[12] = start;
c[12] += "<p>Thurs. January 12 at 12:00 PM<br />";
c[12] += "Christian the Magician at City Museum<br /><br />";
c[12] += back;

c[19] = start;
c[19] += "<p>Thurs. January 19 at 12:00 PM<br />";
c[19] += "Christian the Magician at City Museum<br /><br />";
c[19] += back;

c[6] = start;
c[6] += "<p>Fri. January 6 at 12:00 &amp; 2:00 PM<br />";
c[6] += "The Good, The Bad, &amp; The Ugly at City Museum<br /><br />";
c[6] += "8:00 PM<br />";
c[6] += "Christian the Magician at City Museum<br /><br />";
c[6] += back;

c[13] = start;
c[13] += "<p>Fri. January 13 at 12:00 &amp; 2:00 PM<br />";
c[13] += "The Good, The Bad, &amp; The Ugly at City Museum<br /><br />";
c[13] += "8:00 PM<br />";
c[13] += "Christian the Magician at City Museum<br /><br />";
c[13] += back;

c[21] = start;
c[21] += "<p>Sat. January 21 at 7:00 &amp; 9:00 PM<br />";
c[21] += "Christian the Magician at City Museum<br /><br />";
c[21] += back;

c[28] = start;
c[28] += "<p>Sat. January 28 at 1:00 &amp; 3:00 PM<br />";
c[28] += "St. Louis Arches at City Museum<br /><br />";
c[28] += "7:00 &amp; 9:00 PM<br />";
c[28] += "Christian the Magician at City Museum<br /><br />";
c[28] += back;

c[16] = start;
c[16] += "<p>Mon. January 16 at 1:00 &amp; 3:00 PM<br />";
c[16] += "Christian the Magician at City Museum<br /><br />";
c[16] += back;

c[2] = start;
c[2] += "<p>Mon. January 2 at 12:00 PM<br />";
c[2] += "Magic with Steve Corbitt at City Museum<br /><br />";
c[2] += back;

c[5] = start;
c[5] += "<p>Thurs. January 5 at 12:00 PM<br />";
c[5] += "Magic with Steve Corbitt at City Museum<br /><br />";
c[5] += back;

c[11] = start;
c[11] += "<p>Wed. January 11 at 12:00 PM<br />";
c[11] += "Magic with Steve Corbitt at City Museum<br /><br />";
c[11] += back;

c[18] = start;
c[18] += "<p>Wed. January 18 at 12:00 PM<br />";
c[18] += "Magic with Steve Corbitt at City Museum<br /><br />";
c[18] += back;

c[25] = start;
c[25] += "<p>Wed. January 25 at 12:00 PM<br />";
c[25] += "Magic with Steve Corbitt at City Museum<br /><br />";
c[25] += back;

c[22] = start;
c[22] += "<p>Sun. January 22 at 1:00 &amp; 3:00 PM<br />";
c[22] += "Magic with Steve Corbitt at City Museum<br /><br />";
c[22] += back;

c[20] = start;
c[20] += "<p>Fri. January 20 at 12:00 &amp; 2:00 PM<br />";
c[20] += "The Good, The Bad, &amp; The Ugly at City Museum<br /><br />";
c[20] += "8:00 PM<br />";
c[20] += "Joe the Juggler at City Museum<br /><br />";
c[20] += back;

c[27] = start;
c[27] += "<p>Fri. January 27 at 12:00 &amp; 2:00 PM<br />";
c[27] += "The Good, The Bad, &amp; The Ugly at City Museum<br /><br />";
c[27] += "8:00 PM<br />";
c[27] += "Joe the Juggler at City Museum<br /><br />";
c[27] += back;

c[26] = start;
c[26] += "<p>Thurs. January 26 at 12:00 PM<br />";
c[26] += "Joe the Juggler at City Museum<br /><br />";
c[26] += back;

c[29] = start;
c[29] += "<p>Sun. January 29 at 1:00 &amp; 3:00 PM<br />";
c[29] += "Joe the Juggler at City Museum<br /><br />";
c[29] += back;

c[7] = start;
c[7] += "<p>Sat. January 7 at 2:00 &amp; 7:00 PM<br />";
c[7] += "Circus Harmony: Tessitura at City Museum (call for details re: tickets)<br /><br />";
c[7] += back;

c[14] = start;
c[14] += "<p>Sat. January 14 at 2:00 &amp; 7:00 PM<br />";
c[14] += "Circus Harmony: Tessitura at City Museum (call for details re: tickets)<br /><br />";
c[14] += back;

c[8] = start;
c[8] += "<p>Sun. January 8 at 2:00 PM<br />";
c[8] += "Circus Harmony: Tessitura at City Museum (call for details re: tickets)<br /><br />";
c[8] += back;

c[15] = start;
c[15] += "<p>Sun. January 15 at 2:00 PM<br />";
c[15] += "Circus Harmony: Tessitura at City Museum (call for details re: tickets)<br /><br />";
c[15] += back;


//Go to http://circusday.org/calendar.php and view source code. Copy and paste all code into the following block
ctable = "<table><tr><td colspan='7'>January, 2012</td></tr>";
ctable = ctable + "<tr><td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td></tr>";
ctable = ctable + "<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>"; 
ctable = ctable + "<tr><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr>"; 
ctable = ctable + "<tr><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td></tr>"; 
ctable = ctable + "<tr><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td></tr>"; 
ctable = ctable + "<tr><td>29</td><td>30</td><td>31</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
ctable = ctable + "</table>";
//The block ends here. The following code, up to the end of the document, should not be edited


		for(i=1;i<=31;i++) {
			if(c[i]) {
				var td = "<td>" + i + "</td>"
				var tda = "<td><a href='' onclick='return displaycalendar(c[" + i + "])'>" + i + "</a></td>";
				var ctable = ctable.replace(td, tda);
			}
		}

displaycalendar(ctable);
