var places = new Object();
var shows = new Array();
var pastShows = new Array();

addPlace(new Place(
		"summerfest",
		"Summerfest!",
		"http://www.summerfest.com",
		"img/sf.jpg",
		"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=summerfest+milwaukee&sll=33.258525,-111.849448&sspn=0.214454,0.528717&ie=UTF8&ll=43.034768,-87.89953&spn=0.011716,0.033045&z=16&iwloc=A",
		"http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=summerfest+milwaukee&amp;sll=33.258525,-111.849448&amp;sspn=0.214454,0.528717&amp;ie=UTF8&amp;ll=43.042735,-87.895689&amp;spn=0.011716,0.033045&amp;z=14&amp;iwloc=A&amp;cid=18338711752857626230&amp;output=embed",
		"200 N Harbor Dr<br/>Milwaukee, WI 53202"));

    addPlace(new Place(
		"bubs",
		"Bub's Irish Pub",
		"http://www.bubsirishpub.com/",
		"img/bubs.jpg",
		"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=bubs&aq=&sll=43.178897,-88.117313&sspn=0.179006,0.528374&ie=UTF8&hq=bubs&hnear=&ll=43.213934,-88.117218&spn=0.172648,0.528374&z=12&iwloc=A",
		"http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=bubs&amp;aq=&amp;sll=43.178897,-88.117313&amp;sspn=0.179006,0.528374&amp;ie=UTF8&amp;hq=bubs&amp;hnear=&amp;ll=43.228492,-88.110897&amp;spn=0.172648,0.528374&amp;z=12&amp;iwloc=A&amp;cid=6082030588290249898&amp;output=embed",
		"N116W16218 Main St<br/>Germantown, WI 53022"));

addPlace(new Place(
		"paulies",
		"Paulie's Pub",
		"http://www.pauliespubandeatery.com/",
		"img/paulies.jpg",
		"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=paulies+pub&aq=&sll=43.178897,-88.117313&sspn=0.179006,0.528374&ie=UTF8&hq=paulies+pub&hnear=&ll=43.103991,-88.065033&spn=0.345918,1.056747&z=11&iwloc=A",
		"http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=paulies+pub&amp;aq=&amp;sll=43.178897,-88.117313&amp;sspn=0.179006,0.528374&amp;ie=UTF8&amp;hq=paulies+pub&amp;hnear=&amp;ll=43.016596,-88.01216&amp;spn=0.345918,1.056747&amp;z=11&amp;iwloc=A&amp;cid=132242467633744604&amp;output=embed",
		"8031 W Greenfield Ave.<br/>Milwaukee, WI 53214"));

addPlace(new Place(
		"yesteryears",
		"Yester Years Pub & Grill",
		"http://yesteryearspubandgrill.com",
		null,
		"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=yester+years+pub&sll=43.022094,-88.028469&sspn=0.082077,0.154495&ie=UTF8&s=AARTsJql5OMIk7ACCIykPkv2nesT602m7A&ei=aFsASufrGYj8NeC9kZcE&cd=1&cid=43016417,-88030431,10868581635561791447&li=lmd&ll=43.032322,-88.030443&spn=0.01054,0.035105&z=14&iwloc=A",
		"http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=yester+years+pub&amp;sll=43.022094,-88.028469&amp;sspn=0.082077,0.154495&amp;ie=UTF8&amp;ll=43.036274,-88.021946&amp;spn=0.085091,0.154495&amp;z=13&amp;iwloc=A&amp;cid=10868581635561791447&amp;output=embed&amp;s=AARTsJql5OMIk7ACCIykPkv2nesT602m7A",
		"9427 W Greenfield Ave<br/>Milwaukee, WI 53214"));

addPlace(new Place(
		"ho_chunk_madison",
		"Ho Chunk Casino Madison (Dejope)",
		"http://www.ho-chunkgaming.com/madison",
		"img/hochunk.jpg",
		"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Dejope+Bingo+And+Entertainment,+4002+Evan+Acres+Rd+,+Madison,+WI+53718&sll=37.0625,-95.677068&sspn=41.767874,64.160156&ie=UTF8&hq=Dejope+Bingo+And+Entertainment,&hnear=4002+Evan+Acres+Rd,+Madison,+Dane,+Wisconsin+53718&z=16",
		"http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Dejope+Bingo+And+Entertainment,+4002+Evan+Acres+Rd+,+Madison,+WI+53718&amp;sll=37.0625,-95.677068&amp;sspn=41.767874,64.160156&amp;ie=UTF8&amp;hq=Dejope+Bingo+And+Entertainment,&amp;hnear=4002+Evan+Acres+Rd,+Madison,+Dane,+Wisconsin+53718&amp;ll=43.040288,-89.272386&amp;spn=0.006295,0.006295&amp;output=embed",
		"4002 Evan Acres Rd<br/>Madison, WI 53718"));

addPlace(new Place(
		"ho_chunk",
		"Ho Chunk Casino",
		"http://www.ho-chunkgaming.com/wisconsindells",
		"img/hochunk.jpg",
		"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Casino&aq=&sll=43.531127,-89.77684&sspn=0.171747,0.528374&ie=UTF8&hq=Casino&hnear=&ll=43.527891,-89.77684&spn=0.177979,0.528374&z=12&iwloc=A",
		"http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Casino&amp;aq=&amp;sll=43.531127,-89.77684&amp;sspn=0.171747,0.528374&amp;ie=UTF8&amp;hq=Casino&amp;hnear=&amp;ll=43.528015,-89.776811&amp;spn=0.177979,0.528374&amp;z=12&amp;iwloc=A&amp;cid=17156068781647175063&amp;output=embed",
		"S3214 Highway 12<br/>Baraboo, WI 53913"));

addPlace(new Place(
		"brewskis",
		"Brewski's Sports Club",
		"http://www.brewskissc.com/",
		"img/brewskis.jpg",
		"http://maps.google.com/maps?hl=en&ie=UTF8&q=brewski%27s+milwaukee&fb=1&gl=us&hq=brewski%27s&hnear=Milwaukee,+WI&cid=0,0,11317228835418199221&sqi=2&z=16&iwloc=A",
		"http://maps.google.com/maps?hl=en&amp;ie=UTF8&amp;q=brewskis+milwaukee&amp;fb=1&amp;gl=us&amp;hq=brewskis&amp;hnear=Milwaukee,+WI&amp;cid=0,0,11317228835418199221&amp;sqi=2&amp;iwloc=A&amp;ll=43.034104,-88.007177&amp;spn=0.006295,0.006295&amp;output=embed",
		"304 North 76th Street<br/>Milwaukee, WI 53213"));

addPlace(new Place(
		"oregon",
		"Oregon Summer Fest",
		"http://www.oregonwi.com/sysfiles/site_uploads/custom2/custom135_files/live_music_entertain.html",
		"img/oregon.jpg",
		"http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=216252488105146918619.000487575fcd7c996665c&f=d&daddr=Music+Entertainment+Tent+%4042.927049,-89.381375&ll=42.928148,-89.380474&spn=0.011234,0.033023&z=16&iwloc=000487577c712f0d56908",
		"http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=216252488105146918619.000487575fcd7c996665c&amp;f=d&amp;daddr=Music+Entertainment+Tent+%4042.927049,-89.381375&amp;ll=42.928148,-89.380474&amp;spn=0.005499,0.00912&amp;iwloc=000487577c712f0d56908&amp;output=embed",
		"249 Brook St.<br/>Oregon, WI 53575"));
    
addPlace(new Place(
		"st_ritas",
		"St. Rita's Parish Festival",
		"http://www.lpiwebsuccess.com/websuccess/ViewFreeformPage.do?freeformPageId=1130&subdomain=stritaparish-westallis",
		null,
		"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=st+ritas&aq=&sll=43.002902,-87.987454&sspn=0.01122,0.033023&ie=UTF8&hq=st+ritas&hnear=&ll=43.002482,-87.987442&spn=0.02244,0.066047&z=15&iwloc=A",
		"http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=st+ritas&amp;aq=&amp;sll=43.002902,-87.987454&amp;sspn=0.01122,0.033023&amp;ie=UTF8&amp;hq=st+ritas&amp;hnear=&amp;ll=43.002565,-87.98879&amp;spn=0.02244,0.066047&amp;z=14&amp;iwloc=A&amp;cid=15090113312216889463&amp;output=embed",
		"2318 S 61st St.<br/>West Allis, WI 53219 "));

addPlace(new Place(
		"sandees",
		"Sandee's",
		"http://www.sandeescoolrunnings.com/",
		"img/sandees.jpg", 
    null, null,
		"1202 Michigan Avenue<br/>Sheboygan, WI 53083"));

    addPlace(new Place(
    "sandbar",
    "SandBar Sports Pub",
    "http://sandbarsportspub.com/sandbar.html",
    "img/sandbar2.jpg",
    "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=sandbar&aq=&sll=43.061389,-88.249444&sspn=0.09419,0.264187&g=Pewaukee,+WI&ie=UTF8&z=13&iwloc=A",
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=sandbar&amp;aq=&amp;sll=43.061389,-88.249444&amp;sspn=0.09419,0.264187&amp;g=Pewaukee,+WI&amp;ie=UTF8&amp;z=13&amp;iwloc=A&amp;cid=5379702776931476640&amp;ll=43.060986,-88.303384&amp;output=embed",
    "W278 N2315 Prospect Ave. Hwy SS<br/>Pewaukee, WI 53072"));

addPlace(new Place(
		"jdrf",
		"JDRF Walk, Milwaukee Zoo",
		null,
		"img/jdrf.jpg", 
    "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=milwaukee+zoo&aq=&sll=43.527891,-89.77684&sspn=0.177979,0.528374&ie=UTF8&hq=milwaukee+zoo&hnear=Milwaukee+County+Zoo,+10001+W+Bluemound+Rd,+Milwaukee,+Wisconsin+53226&z=15&iwloc=A", 
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=milwaukee+zoo&amp;aq=&amp;sll=43.527891,-89.77684&amp;sspn=0.177979,0.528374&amp;ie=UTF8&amp;hq=milwaukee+zoo&amp;hnear=Milwaukee+County+Zoo,+10001+W+Bluemound+Rd,+Milwaukee,+Wisconsin+53226&amp;z=14&amp;iwloc=A&amp;cid=17460359808419706410&amp;ll=43.03069,-88.039977&amp;output=embed",
		"10001 West Bluemound Road<br/>Milwaukee, WI 53226"));
    
addPlace(new Place(
		"pp",
		"Pistol Pete&apos;s",
		null,
		null, 
    "http://maps.google.com/maps?q=pistol+pete&hl=en&sll=43.104187,-88.120104&sspn=0.006776,0.016512&vpsrc=0&hq=pistol+pete&t=m&z=16&iwloc=A", 
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=pistol+pete&amp;aq=&amp;sll=43.104187,-88.120104&amp;sspn=0.006776,0.016512&amp;vpsrc=0&amp;ie=UTF8&amp;hq=pistol+pete&amp;hnear=&amp;t=m&amp;z=14&amp;iwloc=A&amp;cid=17959029006919429868&amp;ll=43.10419,-88.119223&amp;output=embed",
		"16755 West Lisbon Road<br/>Brookfield, WI 53005"));

    addPlace(new Place(
    "mos_tosa",
    "Mo&#39;s Irish Pub (Tosa)",
    "http://www.mosirishpub.com/wauwatosa/",
    "img/mos.jpg",
    "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Mos+Irish+Pub,+West+Bluemound+Road,+Wauwatosa,+WI&aq=&sll=43.035521,-88.047824&sspn=0.023338,0.066047&ie=UTF8&hq=Mos+Irish+Pub,&hnear=W+Bluemound+Rd,+Wauwatosa,+Wisconsin&z=15&iwloc=A",
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Mos+Irish+Pub,+West+Bluemound+Road,+Wauwatosa,+WI&amp;aq=&amp;sll=43.035521,-88.047824&amp;sspn=0.023338,0.066047&amp;ie=UTF8&amp;hq=Mos+Irish+Pub,&amp;hnear=W+Bluemound+Rd,+Wauwatosa,+Wisconsin&amp;z=14&amp;iwloc=A&amp;cid=8868087176994842018&amp;ll=43.035521,-88.047824&amp;output=embed",
    "10842 W Bluemound Rd<br/>Milwaukee, WI 53203"));

addPlace(new Place(
    "alehouse",
    "The Milwaukee Ale House (Downtown)",
    "http://ale-house.com/",
    "img/alehouse.jpg",
    "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=milwaukee+ale+house&aq=&sll=43.038902,-87.906474&sspn=0.373386,1.056747&g=milwaukee,+wi&ie=UTF8&hq=ale+house&hnear=Milwaukee,+Wisconsin&ll=43.033796,-87.90925&spn=0.022554,0.066047&z=15&iwloc=A",
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=milwaukee+ale+house&amp;aq=&amp;sll=43.038902,-87.906474&amp;sspn=0.373386,1.056747&amp;g=milwaukee,+wi&amp;ie=UTF8&amp;hq=ale+house&amp;hnear=Milwaukee,+Wisconsin&amp;ll=43.033424,-87.909244&amp;spn=0.022554,0.066047&amp;z=14&amp;iwloc=A&amp;cid=6089653355245614284&amp;output=embed",
    "233 North Water Street<br/>Milwaukee, WI 53203"));

addPlace(new Place(
    "private",
    "Private Event",
    null,
    "img/private.jpg",
    "#",
    "#",
    ""));

addPlace(new Place(
    "hornygoat",
    "Horny Goat Hideaway",
    "http://www.hghideaway.com/",
    "http://www.caughtlookingband.com/images/hornygoat2.jpg",
    "http://maps.google.com/maps?q=The+Horny+Goat+Hideaway,+South+1st+Street,+Milwaukee,+WI&hl=en&ll=43.02542,-87.91307&spn=0.025726,0.066047&sll=37.0625,-95.677068&sspn=56.331468,135.263672&z=15&iwloc=A",
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=The+Horny+Goat+Hideaway,+South+1st+Street,+Milwaukee,+WI&amp;aq=0&amp;sll=37.0625,-95.677068&amp;sspn=56.331468,135.263672&amp;ie=UTF8&amp;hq=The+Horny+Goat+Hideaway,+South+1st+Street,&amp;hnear=Milwaukee,+Wisconsin&amp;ll=43.007804,-87.911629&amp;spn=0.025726,0.066047&amp;z=14&amp;iwloc=A&amp;cid=17423819862644009846&amp;output=embed",
    "2011 South First Street<br/>Milwaukee, WI 53207"));

addPlace(new Place(
    "bl",
    "Bar Louie Water St.",
    "http://www.barlouieamerica.com/",
    "img/bl.jpg",
    "",
    "",
    "1114 N. Water St.,<br/>Milwaukee, WI"));

addPlace(new Place(
    "rox",
    "The Rox Bar",
    "http://www.theroxbar.com",
    "img/rox2.jpg",
    "http://maps.google.com/maps?q=rox+bar+waukesha&hl=en&ll=43.046875,-88.265705&spn=0.024149,0.066047&sll=37.0625,-95.677068&sspn=53.035373,135.263672&hq=rox+bar&hnear=Waukesha,+Wisconsin&t=m&z=15&iwloc=A",
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=rox+bar+waukesha&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=53.035373,135.263672&amp;ie=UTF8&amp;hq=rox+bar&amp;hnear=Waukesha,+Wisconsin&amp;ll=43.043297,-88.256834&amp;spn=0.024149,0.066047&amp;t=m&amp;z=14&amp;iwloc=A&amp;cid=13862694952335155590&amp;output=embed",
    "2820 North Grandview Boulevard<br/>Pewaukee, WI"));
    
addPlace(new Place(
    "quaker",
    "Quaker Steak &amp; Lube",
    "http://quakersteakandlube.com/New_Berlin_WI/",
    "img/quaker2.jpg",
    "http://maps.google.com/maps?q=quaker+steak+and+lube&hl=en&ll=42.956611,-88.106961&spn=0.021892,0.027595&sll=43.178897,-88.117313&sspn=0.174499,0.220757&hq=quaker+steak+and+lube&t=m&z=15&iwloc=A",
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=quaker+steak+and+lube&amp;aq=&amp;sll=43.178897,-88.117313&amp;sspn=0.174499,0.220757&amp;ie=UTF8&amp;hq=quaker+steak+and+lube&amp;hnear=&amp;t=m&amp;ll=42.955276,-88.107989&amp;spn=0.021892,0.027595&amp;z=14&amp;iwloc=A&amp;cid=7987652351479432255&amp;output=embed",
    "4900 South Moorland Road<br/>New Berlin, WI"));

addPlace(new Place(
    "srf",
    "St. Robert Fair",
    "http://www.strobert.org/",
    "img/festival2.jpg",
    "http://maps.google.com/maps?q=st.+robert%27s+shorewood&hl=en&sll=43.089662,-87.8813&sspn=0.010468,0.013797&hq=st.+robert%27s&hnear=Shorewood,+Milwaukee,+Wisconsin&t=m&z=16&iwloc=A",
    "http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=st.+robert's+shorewood&amp;aq=&amp;sll=43.089662,-87.8813&amp;sspn=0.010468,0.013797&amp;g=4019+N.+Farwell,+shorewood,+wi&amp;ie=UTF8&amp;hq=st.+robert's&amp;hnear=Shorewood,+Milwaukee,+Wisconsin&amp;t=m&amp;z=14&amp;iwloc=A&amp;cid=4694209609380514380&amp;ll=43.090092,-87.882201&amp;output=embed",
    "4019 N. Farwell Ave.<br/>Shorewood, WI"));
    
addShow(new Show("jdrf", "Sep 18, 2010 8:30:00 AM", "Sep 18, 2010 11:00:00 AM", null));
addShow(new Show("bubs", "Sep 18, 2010 9:30:00 PM", "Sep 19, 2010 2:00:00 AM", null));
addShow(new Show("sandees", "Oct 2, 2010 10:00:00 PM", "Oct 3, 2010 2:00:00 AM", null));
addShow(new Show("ho_chunk", "Oct 15, 2010 8:00:00 PM", "Oct 16, 2010 12:00:00 AM", null));
addShow(new Show("ho_chunk", "Oct 16, 2010 8:00:00 PM", "Oct 17, 2010 12:00:00 AM", null));
addShow(new Show("sandees", "Nov 27, 2010 10:00:00 PM", "Nov 28, 2010 2:00:00 AM", null));
addShow(new Show("bubs", "Jan 14, 2011 9:30:00 PM", "Jan 15, 2011 2:00:00 AM", null));
addShow(new Show("paulies", "Jan 29, 2011 9:30:00 PM", "Jan 30, 2011 1:30:00 AM", null));
addShow(new Show("yesteryears", "Jan 22, 2011 10:00:00 PM", "Jan 23, 2011 2:00:00 AM", null));
addShow(new Show("yesteryears", "March 26, 2011 10:00:00 PM", "March 27, 2011 2:00:00 AM", null));
addShow(new Show("ho_chunk_madison", "April 8, 2011 8:00:00 PM", "April 9, 2011 12:00:00 AM", null));
addShow(new Show("ho_chunk_madison", "April 9, 2011 8:00:00 PM", "April 10, 2011 12:00:00 AM", null));
addShow(new Show("brewskis", "April 16, 2011 9:30:00 PM", "April 17, 2011 1:30:00 AM", null));
addShow(new Show("yesteryears", "May 14, 2011 10:00:00 PM", "May 15, 2011 2:00:00 AM", null));
addShow(new Show("oregon", "Jun 24, 2011 8:00:00 PM", "Jun 25, 2011 12:00:00 AM", null));
addShow(new Show("summerfest", "July 5, 2011 1:00:00 PM", "July 5, 2011 2:30:00 PM", "Summerfest Rock Stage"));
addShow(new Show("st_ritas", "Jul 15, 2011 7:00:00 PM", "Jul 15, 2011 11:00:00 PM", null));
addShow(new Show("alehouse", "September 17, 2011 9:30:00 PM", "September 18, 2011 1:00:00 AM", null));
addShow(new Show("mos_tosa", "September 23, 2011 10:00:00 PM", "September 24, 2011 1:30:00 AM", "Mo's Irish Pub (Tosa)"));
addShow(new Show("paulies", "October 1, 2011 9:30:00 PM", "October 2, 2011 1:30:00 AM", null));
addShow(new Show("private", "October 14, 2011 9:00:00 PM", "October 15, 2011 12:00:00 AM", "Jeans &amp; Jewels Benefit"));
addShow(new Show("hornygoat", "October 21, 2011 09:30:00 PM", "October 22, 2011 1:00:00 AM", null));
addShow(new Show("mos_tosa", "November 11, 2011 10:00:00 PM", "November 12, 2011 1:30:00 AM", "Mo's Irish Pub (Tosa)"));
addShow(new Show("sandbar", "November 19, 2011 9:00:00 PM", "November 20, 2011 1:00:00 AM", null));
addShow(new Show("pp", "November 26, 2011 9:30:00 PM", "November 27, 2011 1:30:00 AM", null));
addShow(new Show("paulies", "December 3, 2011 9:30:00 PM", "December 4, 2011 1:30:00 AM", null));
addShow(new Show("bl", "December 31, 2011 9:00:00 PM", "January 1, 2012 1:00:00 AM", null));
addShow(new Show("mos_tosa", "January 20, 2012 10:00:00 PM", "January 21, 2012 1:30:00 AM"));
addShow(new Show("private", "January 21, 2012 9:00:00 PM", "January 22, 2012 1:00:00 AM"));
addShow(new Show("rox", "February 25, 2012 9:00:00 PM", "February 26, 2012 1:00:00 AM", null));
addShow(new Show("paulies", "March 3, 2012 9:30:00 PM", "March 4, 2012 1:30:00 AM", null));
addShow(new Show("sandbar", "March 23, 2012 9:00:00 PM", "March 24, 2012 1:00:00 AM", null));
addShow(new Show("sandbar", "April 21, 2012 9:00:00 PM", "April 22, 2012, 1:00:00 AM", null));
addShow(new Show("paulies", "May 12, 2012 9:30:00 PM", "May 13, 2012 1:30:00 AM", null));
addShow(new Show("srf", "June 3, 2012 3:00:00 PM", "June 3, 2012 7:00:00 PM", null));
addShow(new Show("quaker", "July 11, 2012 6:00:00 PM", "July 11, 2012 9:30:00 PM", null));


function getShow(showIndex) {
	return shows[showIndex];
}

function getTodaysShow() {
	for (i = 0; i < shows.length; i++) {
		if (isShowToday(shows[i])) {
			return shows[i];
		}
	}
	return null;
}

function addPlace(place) {
	places[place.place] = place;
}

function addShow(show) {
	var now = new Date();
	// Only add show if not older than 4 hours after start time.
	if ((show.date.getTime() + 4 * 60 * 60 * 1000) >= now.getTime()) {
		shows[shows.length] = show;
	}
  else {
		pastShows[pastShows.length] = show;
  }
}

function getDay(show) {
	var days = new Array("Sunday", "Monday", "Tuesday", "Wednesday",
			"Thursday", "Friday", "Saturday");
	return days[show.date.getDay()];
}

function getTime(date) {
	var ap;
	var hour = date.getHours();
	if (date.getHours() < 12) {
		ap = "am";
	} else {
		ap = "pm";
	}
	if (hour == 0) {
		hour = 12;
	}
	if (hour > 12) {
		hour -= 12;
	}
	
	var minutes = "";
	if (date.getMinutes() != 0) {
		minutes = ":" + date.getMinutes();
	}
  return hour + minutes + ap;
}

function getDateTime(show) {
	var months = new Array("Jan.", "Feb.", "March", "April", "May",
			"June", "July", "Aug.", "Sept.", "Oct.", "Nov.",
			"Dec.");

	var suffix;

	if (show.date.getDate() == 1 || show.date.getDate() == 21
			|| show.date.getDate() == 31) {
		suffix = "st";
	} else if (show.date.getDate() == 2 || show.date.getDate() == 22) {
		suffix = "nd";
	} else if (show.date.getDate() == 3 || show.date.getDate() == 23) {
		suffix = "rd";
	} else {
		suffix = "th";
	}

	var date = null;
	if (isShowToday(show)) {
		date = "<span class='showAlert'>Today</span>, " + getDay(show) + " ";
	}
	else if (isShowTomorrow(show)) {
		date = "<span class='showAlert'>Tomorrow</span>, " + getDay(show) + " ";
	}
	else {
		var now = new Date();
    if (show.date.getYear() < now.getYear()) {
      date = getDay(show) + ", " + months[show.date.getMonth()]
        + " " + show.date.getDate() + "<SUP>" + suffix + "</SUP>, " 
        + (show.date.getYear() + 1900) + " ";
    }
    else {
      date = getDay(show) + ", " + months[show.date.getMonth()]
        + " " + show.date.getDate() + "<SUP>" + suffix + "</SUP> ";
    }
  }

	return date + getTime(show.date)+ " - " + getTime(show.endDate);
}

function isShowToday(show) {
	var now = new Date();
	if (show.date.getDate() == now.getDate() && show.date.getMonth() == now.getMonth() && show.date.getYear() == now.getYear()) {
		return true;
	}
	return false;
}

function isShowTomorrow(show) {
	var now = new Date();
	now.setTime(now.getTime() + (24 * 60 * 60 * 1000));
	if (show.date.getDate() == now.getDate() && show.date.getMonth() == now.getMonth() && show.date.getYear() == now.getYear()) {
		return true;
	}
	return false;
}

function getEmailShowsView() {
	var html = "";
	
	for (i = 1; i < shows.length; i++) {
		html += getViewForEmailShow(shows[i]);
	}
	return html;
}

function getViewForEmailShow(show) {
	return "<tr><td>" + getDateTime(show) + "</td><td width='20px'></td><td>" +
		show.description + "</td></tr>";
}

function getHomeViews(mobile, count) {
	var html = "";
	if (count == null) {
		count = 4;
	}
	for (i = 0; i < count && i < shows.length; i++) {
		html += getViewForHome(shows[i], mobile);
	}
	return html;
}

function getViewForHome(show, mobile) {

	var html;
	var description;
	if (show.place.logoImage != null) {
		description = "<img src='" + show.place.logoImage + "' alt='" + show.place.description + "'/>";
    if (show.description != null) {
       description = description + "<br/>" + show.description;
    }
	} 
  else {
		if (show.description != null) {
      description = show.description;
    }
    else {
      description = show.place.description;
    }
	}

	if (mobile) {
		html = "<div class='homeshow'><span class='tourinfo'>"
				+ "<a href='/tour'>"
				+ description + "<br/>"
				+ "</a><br/><a href='/tour'>"
				+ getDateTime(show)
				+ "<a/></span></div><br/><br/>";
	}
	else {
		html = "<div class='homeshow'><a href='schedule.html'><center>"
				+ description + "<br/>"
				+ getDateTime(show)
				+ "</center></div></a><br/>";
	}
	return html;
}

function getTourViews(mobile) {
	var html = "";
	for (i = 0; i < shows.length; i++) {
		html += getViewForTour(shows[i], mobile);
	}
	return html;
}

function getPastTourViews(mobile) {
	var html = "";
	for (i = pastShows.length - 1; i >= 0 ; i--) {
		html += getViewForTour(pastShows[i], mobile);
	}
	return html;
}


function getViewForTour(show, mobile, alert) {
  var html;
	var description;
	var description2 = "";
	if (show.place.logoImage != null) {
		description = "<img src='" + show.place.logoImage + "' alt='" + show.place.description + "'/>";
    if (show.description != null) {
       description2 = show.description;
    }
    else {
      description2 = show.place.description;
    }
	}
  else {
    if (show.description != null) {
       description = show.description;
    }
    else {
      description = show.place.description;
    }
  }
	if (show.place.website != null) {
		description = "<a href='" + show.place.website + "'>" + description
				+ "</a>";
	}

	if (mobile) {
		html = "<span class='tourinfo'>" + description + "<br/>"
				+ description2 + getDateTime(show)
				+ "<br/>" + show.place.address
				+ "<br/><a href='" + show.place.mapUrl + "'>Map</a></span><br/><br/>"; 
	}
	else {
				html = "<div class='subcontent'><table class='tourtable' width='510px'><tr>"
				+ "<td width='200' class='tourinfo' style='vertical-align:middle'><span class='tourinfo'>" + description + "</span></td>"
				+ "<td width='5px'></td><td>";
        if (description2 != "") {
          html += "<span class='tourinfo'>" + description2 + "</span><br/>";
        }
        html += getDateTime(show)
				+ "<br/><table width='100%'><tr><td>" + show.place.address + "</td>";
				
        var now = new Date();
        if ((show.date.getTime() + 4 * 60 * 60 * 1000) >= now.getTime() && alert == null) {
					html += "<td align='right'><a href='#' onClick=\"showMap('" + show.place.place + "')\">&nbsp;Map</a></td>";
				}
				
				html += "</tr></table>" + "</td></tr></table></div>";
	}
	return html;
}

function getPlaceImage(placeName) {
	var place = places[placeName];
	if (place != null) {
		if (place.logoImage != null) {
			return "<img src='" + place.logoImage + "' alt='"
				+ place.description + "'/>";
		}
		return place.description;
	}
	return "";
}

function Place(place, description, website, logoImage, mapUrl, embedMapUrl, address) {
	this.place = place;
	this.description = description;
	this.website = website;
	this.logoImage = logoImage;
	this.mapUrl = mapUrl;
	this.embedMapUrl = embedMapUrl;
	this.address = address;
}

function Show(place, date, endDate, description, pics) {

	this.place = places[place];
	this.date = new Date(date);
	this.endDate = new Date(endDate);
  this.description = description;
  this.pics = pics;
}


