/*
 *
 * ShowDate Class
 *
 * ShowDate(sT, sS, sE) - constructor, must use the 3 args.
 * ShowDate.showCatagory - property, uses a choice of 4 class variables.
 *
 *
 */
function ShowDate(sTitle, sStart, sEnd)
{
	this.showTitle = sTitle;
	this.showStart = new Date(sStart);
	this.showEnd = new Date(sEnd);
	this.showExpires = new Date(sEnd);
	this.showExpires.setFullYear(this.showExpires.getFullYear() + 10);
	this.showDate = "";
	this.showHours = "";
	this.showAddress = "";
	this.showNotes = "";
	this.showCatagory = 0;
	this.thumb = "";
}
ShowDate.SHOW = 0;
ShowDate.DEMO = 1;
ShowDate.LECTURE = 2;
ShowDate.WORKSHOP = 3;





/*
 *
 * ShowManager Class
 *
 * ShowManager() - constructor, no args
 * ShowManager.addShow(ShowDate)
 * ShowManager.printArtShows() - includes document.write(), returns true
 * ShowManager.printArtDemos() - includes document.write(), returns true
 *
 *
 */
function ShowManager()
{
	this.shows = null;
}
function ShowManager_addShow(showToAdd)
{
	if(this.shows == null)
	{
		this.shows = new Array(1);
		this.shows[0] = showToAdd;
		return;
	}
	else
	{
		this.shows[this.shows.length] = showToAdd;
	}
}
function ShowManager_printArtShows()
{
	document.write("<div style='font: bold 30pt serif; text-align: center; height: 100px;'>");
	document.write("Art Exhibitions</div>");

	var validShows = false;
	if(this.shows != null)
	{
		for(var i = 0; i < this.shows.length; i++)
		{
			if(this.shows[i].showCatagory == ShowDate.SHOW)
			{
				validShows = true;
				break;
			}
		}
	}

	if(this.shows == null || !validShows)
	{
		return true;
	}

	var todaysDate = new Date();
	var indexes = this.getSortedIndexes();
	var sdHtml = "<table align='center'>";

	for(var i = 0; i < this.shows.length; i++)
	{
		if(this.shows[indexes[i]].showCatagory != ShowDate.SHOW |
			todaysDate > this.shows[indexes[i]].showExpires)
		{
			continue;
		}

		sdHtml += "<tr>";
		sdHtml += "<td valign='top'";

		if(todaysDate < this.shows[indexes[i]].showStart)
		{
			sdHtml += "><b>Coming...</b>";
		}
		else if(todaysDate > this.shows[indexes[i]].showStart && todaysDate < this.shows[indexes[i]].showEnd)
		{
			sdHtml += " style='color: #090;'>";
		}
		else if(todaysDate > this.shows[indexes[i]].showEnd)
		{
			sdHtml += " style='color: #a0a0a0;'><b>OVER</b>";
		}

		if(this.shows[indexes[i]].thumb != "")
		{
			sdHtml += "<br><br><img src='http://www.koala-pierrot.com/images/";
			sdHtml += this.shows[indexes[i]].thumb;
			sdHtml += ".jpg' width='200' align='left' border='1' style='margin-right: 10px;'>";
		}

		sdHtml += "<h1 align='center' style='color:#c00000;'>";

		sdHtml += this.shows[indexes[i]].showTitle + "</h1>";

		sdHtml += "<h2 align='center'>" + this.shows[indexes[i]].showDate + "</h2>";
		sdHtml += "<h2 align=center>" + this.shows[indexes[i]].showHours + "</h2><br clear='all'>";
		sdHtml += "<p><b>" + this.shows[indexes[i]].showAddress + "</b></p>";

		if(this.shows[i].showNotes != undefined)
		{
			sdHtml += "<p align='center'><i>" + this.shows[indexes[i]].showNotes + "</i></p>";
		}

		sdHtml += "<br/><hr/><br/><br/>";
		sdHtml += "</td>";
		sdHtml += "</tr>";
	}
	sdHtml += "</table>";
	document.write(sdHtml);
	document.write("<br/><br/>");
	return true;
}
function ShowManager_printArtDemos()
{
	document.write("<div style='font: bold 30pt serif; text-align: center; height: 100px;'>");
	document.write("Art Demos/Lectures etc...</div>");

	var validDemos = false;
	if(this.shows != null)
	{
		for(var i = 0; i < this.shows.length; i++)
		{
			if(this.shows[i].showCatagory != ShowDate.SHOW)
			{
				validDemos = true;
				break;
			}
		}
	}

	if(this.shows == null || !validDemos)
	{
		document.write("Contact Me to schedule a Workshop, Demo, or Lecture!</i></p>");
		document.write("<br/><br/><br/><br/>");
		return true;
	}

	var todaysDate = new Date();
	var indexes = this.getSortedIndexes();
	var sdHtml = "<table align='center'>";

	for(var i = 0; i < this.shows.length; i++)
	{
		if(this.shows[indexes[i]].showCatagory == ShowDate.SHOW |
			todaysDate > this.shows[indexes[i]].showExpires)
		{
			continue;
		}

		sdHtml += "<tr>";
		sdHtml += "<td";

		if(todaysDate < this.shows[indexes[i]].showStart)
		{
			sdHtml += "><b>Coming</b>";
		}
		else if(todaysDate > this.shows[indexes[i]].showStart & 
			todaysDate < this.shows[indexes[i]].showEnd)
		{
			sdHtml += " style='color: #090;'>";
		}
		else if(todaysDate > this.shows[indexes[i]].showEnd)
		{
			sdHtml += " style='color: #a0a0a0;'><b>OVER</b>";
		}

		sdHtml += "<h1 align='center' style='color:#C00000;'>" + this.shows[indexes[i]].showTitle + "</h1>";
		sdHtml += "<h2 align='center'>" + this.shows[indexes[i]].showDate + "<br/>";
		sdHtml += this.shows[indexes[i]].showHours + "</h2>";
		sdHtml += "<p><b>" + this.shows[indexes[i]].showAddress + "</b></p>";

		if(this.shows[indexes[i]].showNotes != undefined)
		{
			sdHtml += "<p align='center'><i>" + this.shows[indexes[i]].showNotes + "</i></p>";
		}

		sdHtml += "<br/><hr/><br/><br/>";
		sdHtml += "</td>";
		sdHtml += "</tr>";
	}
	sdHtml += "</table>";
	document.write(sdHtml);
	document.write("<br/><br/>");
	return true;
}
function ShowManager_getSortedIndexes()
{
	if(this.shows == null) return true;

	var todaysDate = new Date();
	var sArr = new Array(0);
	var eArr = new Array(0);
	var sInt = 0;
	var eInt = 0;

	for(var i = 0; i < this.shows.length; i++)
	{
		if(todaysDate < this.shows[i].showEnd)
		{
			sInt++;
		}
		else
		{
			eInt++;
		}
	}

	for(var i = 0; i < this.shows.length; i++)
	{
		if(todaysDate < this.shows[i].showEnd)
		{
			sArr[sArr.length] = i;
		}
		else
		{
			eArr[eArr.length] = i;
		}
	}

	var sDates = new Array(sInt);
	for(var i = 0; i < sInt; i++)
	{
		sDates[i] = this.shows[sArr[i]].showEnd.getTime();
	}
	sDates = sDates.sort();

	var eDates = new Array(eInt);
	for(var i = 0; i < eInt; i++)
	{
		eDates[i] = this.shows[eArr[i]].showEnd.getTime();
	}
	eDates.sort();
        eDates.reverse();

	var showIndexes = new Array(sInt);
	for(var i = 0; i < sInt; i++)
	{
		for(var j = 0; j < this.shows.length; j++)
		{
			if(this.shows[j].showEnd.getTime() == sDates[i])
			{
				showIndexes[i] = j;
				break;
			}
		}
	}

	var endIndexes = new Array(eInt);
	for(var i = 0; i < eInt; i++)
	{
		for(var j = 0; j < this.shows.length; j++)
		{
			if(this.shows[j].showEnd.getTime() == eDates[i])
			{
				endIndexes[i] = j;
				break;
			}
		}
	}

	var results = showIndexes.concat(endIndexes);
	return results;
}

ShowManager.prototype.addShow = ShowManager_addShow;
ShowManager.prototype.printArtShows = ShowManager_printArtShows;
ShowManager.prototype.printArtDemos = ShowManager_printArtDemos;
ShowManager.prototype.getSortedIndexes = ShowManager_getSortedIndexes;




/*
 *
 * Use the space below to define ShowDates
 *
 *
 *
 */
var yaae = new ShowDate("Yumi's Annual Art Exhibition<br/><br/>\"Music & Culinary Arts\"", "Jun 1 2006", "Jun 15 2006");
yaae.showDate = "June 1 - 14, 2006";
yaae.showHours = "10:30 am - 5:00 pm daily";
yaae.showAddress = "Gallery 21<br/>Spanish Village Art Center, Balboa Park<br/>1770 Village Pl.<br/>San Diego, Ca";
yaae.showCatagory = ShowDate.SHOW;

var ljfa06 = new ShowDate("La Jolla Fine Arts<br/><br/>Annual Summer Lawn Show '06",
	"June 24 2006", "Aug 27 2006");
ljfa06.showDate = "June 24, 26<br/>July 15, 16<br/>July 29, 30<br/>Aug 12, 13<br/>Aug 26, 27<br/>";
ljfa06.showHours = "9:00am - 4:00pm";
ljfa06.showAddress = "La Jolla Recreation Center";
ljfa06.showNotes = "Located at the corner of Prospect St. and Draper Ave. Saturday and Sundays only! <nobr><a href='http://www.koala-pierrot.com/ljfa/web/map.jpg'>Show Map</a></nobr>";
ljfa06.showCatagory = ShowDate.SHOW;


var p08 = new ShowDate("Pieces of Eight", "Oct 31 2005", "Nov 13 2005");
p08.showDate = "Oct 31 - Nov 13, 2005";
p08.showHours = "11:00 am - 5:30 pm daily";
p08.showAddress = "Thie Village Gallery<br/>7932 Ivanhoe Ave<br/>La Jolla, Ca";
p08.showCatagory = ShowDate.SHOW;

var fhaa = new ShowDate("Foothills Art Association Demo", "Oct 6 2005", "Oct 7 2005");
fhaa.showDate = "October 6, 2005";
fhaa.showHours = "7:30 pm";
fhaa.showAddress = "Lamplighter Theatre<br/>8053 University Ave.<br/>La Mesa, Ca";
fhaa.showCatagory = ShowDate.DEMO;

var cvag = new ShowDate("Chula Vista Art Guild Demo", "Oct 5 2005", "Oct 6 2005");
cvag.showDate = "October 5, 2005";
cvag.showHours = "12:30 pm";
cvag.showAddress = "St. Lutherans Church, Fellowship Hall<br/>580 Hilltop Dr.<br/>Chula Vista, Ca";
cvag.showCatagory = ShowDate.DEMO;

var ljfa07 = new ShowDate("La Jolla Fine Arts<br /><br />Annual Summer Lawn Show 2007", "June 30 2007", "Aug 19 2007");
ljfa07.showDate = "June/July 30, 1<br />July 14, 15<br />July 28, 29<br />August 11, 12<br />August 18, 19";
ljfa07.showHours = "9:00am - 4:00pm";
ljfa07.showAddress = "La Jolla Recreation Center";
ljfa07.showNotes = "Located at the corner of Prospect St. and Draper Ave. Saturday and Sundays only! <nobr><a href='http://www.koala-pierrot.com/ljfa/web/map.jpg'>Show Map</a></nobr>";
ljfa07.showCatagory = ShowDate.SHOW;

var yEx = new ShowDate("La Mesa Community \"Art Event\"", "Oct 20 2007", "Oct 22 2007");
yEx.showDate = "October 20, 2007";
yEx.showHours = "10:00 am to 2:00 pm";
yEx.showAddress = "La Mesa Blvd.,<br>La Mesa, CA, 91942";
yEx.showNotes = "YUMI's 8 oil paintings are exhibited";

var ecpac = new ShowDate("8 Artists Exhibition", "Nov 12 2007", "Dec 31 2007");
ecpac.showDate = "November 12 thru December 31, 2007";
ecpac.showAddress = "SD East County Performing Arts Center<br>210 E Main St.<br>El Cajon, CA 92020<br>(619) 440-2277";
ecpac.showNotes = "<a href='http://www.ecpaclive.com'>Vist Website for Hours</a>";
ecpac.showCatagory = ShowDate.SHOW;

var yaae08 = new ShowDate("YUMI's Annual Art Exhibition<br><br>\"Hikari - Night & Day\"", "Jun 11 2008", "Jun 23 2008");
yaae08.showDate = "June 11, thru June 23, 2008";
yaae08.showHours = "10:30am to 5:00pm";
yaae08.showAddress = "Gallery 21<br/>Spanish Village Art Center, Balboa Park<br/>1770 Village Pl.<br/>San Diego, Ca";
yaae08.showNotes = "Yumi will be in the Gallery daily.";
yaae08.thumb = "coolJazz";
yaae08.showCatagory = ShowDate.SHOW;

var mma08 = new ShowDate("Mainly Mozart Amedeus 2008","Jan 19 2008","Jan 20 2008");
mma08.showDate = "January 19, 2008 only";
mma08.showNotes = "Yumi's paintings will be auctioned for this <b>Gala Blacktie Event</b>";
mma08.showCatagory = ShowDate.SHOW;

var bmja = new ShowDate("BONITA MUSEUM JURIED EXHIBITION", "March 8 2008", "April 19 2008");
bmja.showDate = "MARCH 8 ~ APRIL 19 2008";
bmja.showHours = "10am ~ 3pm";
bmja.showNotes = "Reception: March 8, 6:00 - 7:30pm<br /><br />Yumi's 2 oil paintings are exhibited.";
bmja.showAddress = "Bonita Museum<br />4355 Bonita Road.<br />Bonita, CA 91902<br />(619) 267-5141";
bmja.showCatagory = ShowDate.SHOW;

var aaasd08 = new ShowDate("AAASD 2008 ALL MEMBERS EXHIBITION", "May 1 2008", "May 31 2008");
aaasd08.showDate = "May 1 through May 31, 2008";
aaasd08.showAddress = "La Jolla Library<br />7555 Draper Ave.<br />La Jolla, CA";
aaasd08.showNotes = "Reception and Awards Ceremonies: Saturday, May 10, 2 to 4 pm";
aaasd08.showCatagory = ShowDate.SHOW;

var ljfa08 = new ShowDate("La Jolla Fine Arts<br /><br />Annual Summer Lawn Show 2008", "June 28 2008", "Aug 24 2008");
ljfa08.showDate = "June 28, 29<br />July 12, 13<br />July 26, 27<br />August 9, 10<br />August 23, 24";
ljfa08.showHours = "9:00am - 4:00pm";
ljfa08.showAddress = "La Jolla Recreation Center";
ljfa08.showNotes = "Located at the corner of Prospect St. and Draper Ave. Saturday and Sundays only! <nobr><a href='http://www.koala-pierrot.com/ljfa/web/map.jpg'>Show Map</a></nobr>";
ljfa08.showCatagory = ShowDate.SHOW;

var aaasdJFAE = new ShowDate("Allied Artists Association of San Diego<br /><br />JURIED FINE ART EXHIBITION", "Aug 8 2008", "September 20 2008");
aaasdJFAE.showDate = "August 8 through September 20, 2008";
aaasdJFAE.showHours = "10:00am - 3:00pm<p style='color:black;'><small>RECEPTION FOR THE ARTISTS<br />Saturday, "+
"August 16, 2008 6:00 - 7:30 pm<br />Awards presentation at 6:30 pm</small></p>";
aaasdJFAE.showAddress = "Bonita Museum & Cultural Center<br />4355 Bonita Road,<br />Bonita, CA 91902";
aaasdJFAE.showNotes = "<b>Directions:</b> Travel South on 805, use the <b>Bonita Road/E Street</b> exit and "+
"turn left (east) on Bonita Road. The museum is at the intersection of Billy Casper Way & Bonita Road, "+
"next to the Library.";

var faa = new ShowDate("Foothills Art Association<br /><br /><small>presents</small><br /><br />"+
"YUMI - Art Lecture & Painting Demo", "Oct 2 2008", "Oct 2 2008");
faa.showDate = "Oct 2, 2008";
faa.showHours = "7:30 pm";
faa.showAddress = "Foothills Art Association Gallery<br />4910 Memorial Dr.<br />"+
"La Mesa, CA<br />Information: (619) 646-7167";
faa.showNotes = "Located at the corner of La Mesa Blvd.";
faa.showCatagory = ShowDate.DEMO;

var yap09 = new ShowDate("Art Performance at Ciao Bella", "May 8 2009", "May 9 2009");
yap09.showDate = "May 8 2009";
yap09.showHours = "6pm to 9pm";
yap09.showAddress = "";
yap09.showCatagory = ShowDate.SHOW;

var rbaa09 = new ShowDate("Demo at Rancho Bernardo Art Assoc.", "May 28 2009", "May 29 2009");
rbaa09.showDate = "May 28 2009";
rbaa09.showHours = "";
rbaa09.showAddress = "";
rbaa09.showCatagory = ShowDate.DEMO;

var ljfa09 = new ShowDate("La Jolla Fine Arts Annual Lawn Show '09", "June 13 2009", "October 31 2009");
ljfa09.showDate = "June 13, 14<br />June 27, 28<br />July 11, 12<br />July 25, 26<br />August 8, 9<br />August 22, 23<br />October 31";
ljfa09.showHours = ljfa09.showHours;
ljfa09.showAddress = ljfa08.showAddress;
ljfa09.showNotes = ljfa08.showNotes;
ljfa09.showCatagory = ShowDate.SHOW; 

var yaae09 = new ShowDate("YUMI's Annual Art Exhibition<br><br>\"Toward the Light\"", "September 16 2009", "September 28 2009");
yaae09.showDate = "Sep 16 - 28, 2009";
yaae09.showHours = "10:30am to 5:30pm";
yaae09.showAddress = yaae.showAddress;
yaae09.thumb = "peace2";
yaae09.Catagory = ShowDate.SHOW;

var yaae10 = new ShowDate("YUMI's Annual Art Exhibition<br><br>\"Symphony of Light\"", "August 18 2010", "August 30 2010");
yaae10.showDate = "Aug 18 - 30, 2010";
yaae10.showHours = "10:30am to 5:00pm";
yaae10.showAddress = yaae.showAddress;
yaae10.showNotes = "Yumi will be in the Gallery daily.";
yaae10.thumb = "symphonyOfLight";
yaae10.Catagory = ShowDate.SHOW;

var afa10 = new ShowDate("Demo at A.F.A.", "February 10 2010", "February 11 2010");
afa10.showDate = "Wed, Feb 10, 2010";
afa10.showHours = "1:30 to 3:00pm";
afa10.showAddress = "Allied Gardens Recreation Center<br>5155 Greenbrier Ave,<br>San Diego, CA 92120";
afa10.showNotes = "Open to the public";
afa10.showCatagory = ShowDate.DEMO;

var rsdl_10 = new ShowDate("Rancho San Diego Library Show","September 1 2010","September 30 2010");
rsdl_10.showDate = "September 1 thru 30, 2010";
rsdl_10.showHours = "Sunday 1:00 to 5:00<br>Monday and Wednesday 9:30 to 6:00<br>Tuesday and Thursday 9:30 to 8:00<br>Friday and Saturday 9:30 to 5:00";
rsdl_10.showAddress = "11555 Via Rancho San Diego<br>El Cajon, CA, 92019";
rsdl_10.thumb = "aduAndHello"
rsdl_10.showCatagory = ShowDate.SHOW;


/*
 *
 * Use the space below to define ShowManager
 *
 *
 */


var showManager = new ShowManager();


showManager.addShow(yaae);
showManager.addShow(ljfa06);
showManager.addShow(p08);
showManager.addShow(fhaa);
showManager.addShow(cvag);
showManager.addShow(ljfa07);
showManager.addShow(yEx);
showManager.addShow(ecpac);
showManager.addShow(yaae08);
showManager.addShow(mma08);
showManager.addShow(bmja);
showManager.addShow(aaasd08);
showManager.addShow(ljfa08);
showManager.addShow(aaasdJFAE);
showManager.addShow(faa);
showManager.addShow(yap09);
showManager.addShow(rbaa09);
showManager.addShow(yaae09);
showManager.addShow(ljfa09);
showManager.addShow(yaae10);
showManager.addShow(afa10);
showManager.addShow(rsdl_10);

