// Hi there.

var fname = Array(), floc = Array(), fyear = Array(), fsdate = Array(), fedate = Array(), fsite = Array(), fattend = Array(), fnotes = Array();

function add_festival(name,loc,year,startdate,enddate,site,attend) {
    var i = fname.length;
    
    fname[i] = name;
    floc[i] = loc;
    fyear[i] = year;
    fsdate[i] = startdate;
    fedate[i] = enddate;
    fsite[i] = site;
    fattend[i] = attend;
    fnotes[i] = '';
    
    return true;
}


add_festival('Midwest Ukefest','Indianapolis, Indiana',2003,new Date('2007/10/18'),new Date('2007/10/21'),'http://www.keystrummers.org/','2004');
fnotes[fnotes.length - 1] = "The Midwest Ukefest is a two-day festival that features daytime performances and workshops in the spacious <a href=\"http://www.in.gov/ism/\">Indiana State Museum</a> in downtown Indianapolis. The music styles in the 2004 festival tended towards Tin Pan Alley and early 20th century novelty tunes; not much authentic Hawaiian content was on display. Still, the crowd at the festival was very friendly, and the musicians were excellent. It appears that the 2005 festival will feature more Hawaiian performers, so it looks like things are improving there. <br /> <br /> In addition to the daytime festival and evening concerts, there are <i>kani ka pila</i> style get-togethers immediately following the concerts (known as WADSYs, or 'We Ain't Done Strumming Yet'). These are excellent chances to hang out with the performers and attendees and pick up a couple new songs.";

add_festival('Southern California Ukulele Festival','Cerritos, California',2002,new Date('2008/10/03'),new Date('2008/10/04'),'http://www.ukulelefestival.org/','2005');
fnotes[fnotes.length - 1] = "The Southern California Ukulele Festival is a one-day festival at the Cerritos Community Center in southern California. The evening concerts were quite good, although it was a bit difficult to see the stage from the back rows of the audience. The evening before the festival featured an evening of performances by local music clubs, who were all excellent. ";

add_festival('Ukulele Festival of Northern California','Hayard, California',1994,new Date('2007/04/29'),new Date('2007/04/29'),'http://www.pica-org.org/ukulele/index.htm','');
add_festival('Ukulele Festival, San Antonio','San Antonio, Texas',2002,new Date('2008/04/18'),new Date('2008/04/20'),'http://www.alohayall.net/','');
add_festival('Great Canadian Ukulele Expo','Winnipeg, Manitoba, Canada',2004,new Date('2005/05/07'),new Date('2005/05/07'),'http://www.manitobahal.com/ukulele/','');
add_festival('Mid-Atlantic Ukulele Invitational (MAUI)','Annapolis, Maryland',2002,new Date('2007/06/09'),new Date('2007/06/09'),'http://www.metroukeassoc.org/','');
add_festival('San Diego Ukulele Festival','San Diego, California',2004,new Date('2007/09/08'),new Date('2007/09/08'),'http://www.sandiegoukulelefestival.com/','');
add_festival("Ukulele Guild of Hawai'i Conference and Exhibition","Waikiki, Honolulu, Hawai'i",2002,new Date('2007/11/16'),new Date('2007/11/18'),'http://www.ukuleleguild.org/','');
add_festival("'Ukulele and Slack Key Institute","Kamuela, Hawai'i",2002,new Date('2006/11/08'),new Date('2006/11/11'),'http://www.kahilutheatre.org/ukulele.htm','');
add_festival('New York Uke Fest','NYC',2006,new Date('2007/04/26'),new Date('2007/04/29'),'http://www.nyukefest.com/','');
add_festival('International Ukulele Ceilidh in Nova Scotia','Liverpool, Nova Scotia, Canada',2005,new Date('2007/10/25'),new Date('2007/10/28'),'http://www.ukulele.ca','');
add_festival("Roy Sakuma Ukulele Festival","Waikiki, Honolulu, Hawai'i",1971,new Date('2007/07/22'),new Date('2007/07/22'),'http://www.roysakuma.net/ukulelefestival/index.htm','');
add_festival('Burning Uke','Big Sur, California',2003,new Date('2005/10/28'),new Date('2005/10/30'),'http://ukuleleclub.com/','');
add_festival('Annual Central Park Picnic','Central Park, NYC',1986,new Date('2007/06/03'),new Date('2007/06/03'),'http://www.hawaiiculturalfoundation.org/programs/ohana.html','');
fnotes[fnotes.length - 1] = "This picnic is an annual event in Central Park, and always falls on the first Sunday in June. This isn't actually an ukulele festival, but I think at some point we're going to try to attend, to do some networking with the East Coast people. ";

add_festival('Portland Uke Fest','Portland, Oregon',2004,new Date('2007/06/20'),new Date('2007/06/24'),'http://www.portlandukefest.org/','');
add_festival('Arizona Aloha Festival','Phoenix, Arizona',1995,new Date('2007/03/17'),new Date('2007/03/18'),'http://www.azalohafest.org/','');

add_festival('Chicagoland Ukulele Jam Festival','Maywood, Illinois',2007,new Date('2007/06/22'),new Date('2007/06/23'),'http://www.gotuke.com/','2007');
fnotes[fnotes.length - 1] = "Like the Indianapolis festival, this Midwest fest gathers together a mixture of Hawaiian and Tin Pan Alley players. The first festival contained more Pacific Island content than you would expect from a Midwest show, thanks mostly to the influence of our teacher. The festival took the usual practice of having a concert the evenin before the festival, where a roster of uke musicians were featured. ";

add_festival("Wine Country 'Ukulele Festival",'St. Helena, California',2008,new Date('2008/10/10'),new Date('2008/10/11'),'http://www.kani-ka-pila.com/index_files/UkuleleFestival.htm','');

// add_festival('name','location',year,new Date('date string'),new Date('date string'),'site','');


function fmt_date(d1,d2) {
    var monthnames = Array('January','February','March','April','May','June','July','August','September','October','November','December');

    if (d1.getDate() == d2.getDate() && d1.getMonth() == d2.getMonth()) {
        return monthnames[d1.getMonth()] + ' ' + d1.getDate() + ', ' + (1900 + d1.getYear());
    } else {
        if (d1.getMonth() == d2.getMonth()) {
            return monthnames[d1.getMonth()] + ' ' + d1.getDate() + '-' + d2.getDate() + ', ' + (1900 + d1.getYear());
        } else {
            return monthnames[d1.getMonth()] + ' ' + d1.getDate() + '-' + monthnames[d2.getMonth()] + ' ' + d2.getDate() + ', ' + (1900 + d1.getYear());
        }
    }
}

function init_festival() {
    var d = document.getElementById('festivaldiv');
    var txt = '';
    var today = new Date();

    d.innerHTML = '';
    
    txt = txt + '<ul> ';
    
    for (n = 0; n < fname.length; ++n) {
        txt = txt + '<li> <strong> ' + fname[n] + ' </strong> <br /> <strong> Location: </strong> ' + floc[n] + ' <br /> ' +
            '<strong> Starting year: </strong> ' + fyear[n] + ' <br /> ';
        if (fsdate[n] > today) {
            txt = txt + '<strong> Next festival date: </strong> ' + fmt_date(fsdate[n], fedate[n]) + ' <br /> ';
        } else {
            txt = txt + '<strong> Most recent festival date: </strong> ' + fmt_date(fsdate[n], fedate[n]) + ' <br /> ';
        }
        txt = txt + ' <strong> Website: </strong> ';
        if (fsite[n] != '') { txt = txt + '<a href="' + fsite[n] + '">' + fsite[n] + '</a>'; } else { txt = txt + 'None '; }
        txt = txt + ' <br /> ' +
            '<strong> Years attended: </strong> ';
        if (fattend[n] == '') { txt = txt + 'None yet'; } else { txt = txt + fattend[n]; }
        
        if (fnotes[n] != '') {
            txt = txt + ' <p> ' + fnotes[n] + '</p> ';
        }
        
        txt = txt + ' </li> ';
    }
    d.innerHTML = txt;

    return true;
}