// This function is used to pull parameters from the URL string
function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

// This function is necessary for some date work being done 
Date.prototype.setISO8601 = function (string) {
    var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" +
        "(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?" +
        "(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";
    var d = string.match(new RegExp(regexp));

    var offset = 0;
    var date = new Date(d[1], 0, 1);

    if (d[3]) { date.setMonth(d[3] - 1); }
    if (d[5]) { date.setDate(d[5]); }
    if (d[7]) { date.setHours(d[7]); }
    if (d[8]) { date.setMinutes(d[8]); }
    if (d[10]) { date.setSeconds(d[10]); }
    if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
    if (d[14]) {
        offset = (Number(d[16]) * 60) + Number(d[17]);
        offset *= ((d[15] == '-') ? 1 : -1);
    }

    offset -= date.getTimezoneOffset();
    time = (Number(date) + (offset * 60 * 1000));
    this.setTime(Number(time));
}

var Months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

function header()
{
	document.write('<div id="background_header">');
	document.write('<div id="container">');
	document.write('  <div id="masthead">');
	document.write('    <div id="logo"><a href="/index.htm"><img src="/images/header_space.gif" alt="Shepherd University Friends of Music"/></a></div>');
	document.write('  </div>');
	document.write('  <div id="navigation">');
	document.write('    <ul id="main_navigation">');
	document.write('	  <li><a href="/about.html">about us</a></li>');
	document.write('	  <li><a href="/concerts.html">concerts</a></li>');
	document.write('	  <li><a href="/sponsors.html">sponsors</a></li>');
	document.write('	  <li><a href="/tworivers.html">2rco</a></li>');
	document.write('	  <li><a href="/projects.html">projects</a></li>');
	document.write('	  <li><a href="http://www.shepherd.edu/musicweb">su music</a></li>');
	document.write('	  <li><a href="/membership.html">join or donate</a></li>');
	document.write('	  <li><a href="/contact.html">contact/directions</a></li>');
	document.write('	  <li><a href="/news.html">news</a></li>');
	document.write('    </ul>');
	document.write('  </div>');
	document.write('</div>');
}

function footer()
{
	document.write('<div id="content_spacer"></div>');
	document.write('<div id="container_info">');
	document.write('  <div id="footer">');
	document.write('	<div id="footer_right">Shepherd University Friends of Music | <A HREF="mailto:friends@sufom.org">friends@sufom.org</A><BR>(304) 876-5765 | P.O. Box 220 | Shepherdstown, WV 25443</div>');
	document.write('    <br class="clear" />');
	document.write('  </div>');
	document.write('</div>');
	document.write('</div>');
	document.write('</body>');
	document.write('</html>');
}

function nextFOMConcertWidget()
{
	document.write('<A HREF="concerts.html"><h2>Next FOM Concert</h2></A>');
	document.write('<div class="box_right">');
	document.write('<p style="font-size: 9pt;">');
	
	var today = new Date();
	var tworivers1 = new Date("September 18, 2011");
	var glennmiller = new Date("September 23, 2011");
	var masterworks1 = new Date("November 6, 2011");
	var piffaro = new Date("November 12, 2011");
	var gala = new Date("December 5, 2011");
	var eaken = new Date("January 13, 2012");
	var project = new Date("February 15, 2012");
	var jazz = new Date("March 4, 2012");
	var tworivers2 = new Date("March 11, 2012");
	var kingssingers = new Date("March 21, 2012");
	var masterworks2 = new Date("April 23, 2012");
	
 if (today <= tworivers1)
	{
		document.write('<img src="images/tworivers-mini.jpg" style="float: left; padding-right: 5px;"><b>Two Rivers Chamber Orchestra</b><br>(Sept. 17, 2011)<br>The region’s very own orchestra, now in its fifth season. Come and meet guest conductor Tara Simoncic and hear outstanding selections from Edvard Grieg, Kenneth Fuchs, and Beethoven. ');
		document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= glennmiller)
	{
		document.write('<img src="images/glenn_miller_mini.jpg" style="float: left; padding-right: 5px;"><b>Glenn Miller Orchestra</b><br>(Sept. 22, 2011)<br>The World Famous Glenn Miller Orchestra is the most popular and sought after big band in the world today for both concert and swing dance engagements. ');
	document.write(' (<!--<A HREF="/tickets.html">Buy Tickets</A>-->SOLD OUT!)');
	}
	else if (today <= masterworks1)
	{
		document.write('<img src="images/masterworks-mini.jpg" style="float: left; padding-right: 5px;"><b>Masterworks Chorale</b><br>(Nov. 5 or 6, 2011)<br>Beethoven, Mass in C Major &bull; Sibelius, Finlandia &bull; Brahms, Alto Rhapsody. ');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= piffaro)
	{
		document.write('<img src="images/piffaro-mini.jpg" style="float: left; padding-right: 5px;"><b>Piffaro</b><br>(Nov. 11, 2011)<br>The nation’s finest Renaissance wind band, is world-renowned for its highly polished performances as the pied pipers of Early Music. ');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= gala)
	{
		document.write('<img src="images/holiday-mini.jpg" style="float: left; padding-right: 5px;"><B>Holiday Gala Concert</b><br>(Dec. 3 or 4, 2011)<br>Enjoy classic sounds of the season featuring the Shepherd University Wind Symphony, Chamber Singers, Camerata Singers, Masterworks Chorale and others. Followed by a reception at the Cress Creek Country Club on Saturday. ');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= eaken)
	{
		document.write('<img src="images/eaken_mini.jpg" style="float: right; padding-left: 5px;"><B>Eaken Trio</b><br>(Jan. 12, 2012)<br>Now in their 25th season, this trio travels and performs extensively throughout America, Canada, Europe, and Asia.<br> ');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= project)
	{
		document.write('<img src="images/project_mini.jpg" style="float: left; padding-right: 5px;"><b>PROJECT Trio</b><br>(February 14, 2012)<br>A passionate, high energy chamber music ensemble comprised of three virtuosic composer/performers from Brooklyn, NY. Blending their classical training with an eclectic taste in musical styles, PROJECT Trio has made an impact on audiences of all ages.<br> ');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= jazz)
	{
		document.write('<img src="images/gary_hobbs_mini2.jpg" style="float: left; padding-right: 5px;"><B>Gary Hobbs</b><br>(March 3, 2012)<br>Gary Hobbs became a legend in his own time as the drummer who joined the Stan Kenton Orchestra right out of college, following such class acts as Gene Krupa and Shelley Manne. At 59, with 38 years of gigging behind him, he is still the guy who drives big bands, undaunted by tempo changes or polyrhythms.<br>');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= tworivers2)
	{
		document.write('<img src="images/tworivers-mini.jpg" style="float: left; padding-right: 5px;"><B>Two Rivers Chamber Orchestra</b><br>(March 10, 2012)<br>The region’s very own orchestra, now in its fifth season. Come and meet guest conductor Stephen Czarkowski and hear outstanding selections from John Adams, George Gershwin with Soloist Scott Beard, and Dvo&#345;&aacute;k.<br>');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= kingssingers)
	{
		document.write('<img src="images/kings_singers_mini.jpg" style="float: left; padding-right: 5px;"><b>The King\'s Singers</b><br>(March 20, 2012)<br>One of the world’s most celebrated ensembles, The King’s Singers have a packed schedule of concerts, recordings, media and education work that spans the globe. Championing the work of young and established composers, they remain consummate entertainers; a class-act with a delightfully British wit. ');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else if (today <= masterworks2)
	{
		document.write('<img src="images/masterworks-mini.jpg" style="float: left; padding-right: 5px;"><b>Masterworks Chorale</b><br>(Apr. 21 or 22, 2012)<br>The Masterworks Chorale, the Eastern Panhandle’s premiere vocal ensemble, under the direction of Dr. Erik Reid Jones, presents Rossini\'s Stabat Mater and Beethoven\'s Symphony No. 9 (Final Movement). ');
	document.write(' (<A HREF="/tickets.html">Buy Tickets</A>)');
	}
	else
	{
		document.write('Our season has come to a close! Check back in August for our 2011-12 concerts.');
	}

	document.write('</p></div>');
}

