
//7-Cedars Casino
var cedars = new Object;
cedars.icon = "<a href=\"http:\/\/www.7cedarscasino.com\/home.html\" target=\"_blank\"><img src=\"images\/cedars.gif\" alt=\"7-Cedars Casino\" style=\"border:none;\" /></a>";
cedars.info = "<a href=\"http:\/\/www.7cedarscasino.com\/home.html\" class=\"branding_textListLink\" target=\"_blank\">7-Cedars Casino</a><br />" +
			  "270756 Hwy 101<br />" +
			  "Sequim, WA 98382<br />" +
              "(360) 683-7777";
cedars.directions = "<a href=\"http:\/\/www.7cedarsresort.com\/directions.html\" class=\"branding_textListLink\" target=\"_blank\">Directions to 7-Cedars Casino</a>";
cedars.time = "9:00pm 'til 1:00am";
cedars.title = "7-Cedars Casino Sequim, 9pm";
cedars.header = "Performance venue information for Rock Candy!";
cedars.subheader = "Spend an evening with Seattle's sweetest party band!";

//Big Daddy's Place
var daddys = new Object;
daddys.icon = "<a href=\"http:\/\/www.bigdaddysplace.com\/index.htm\" target=\"_blank\"><img src=\"images\/daddys.gif\" alt=\"Big Daddy's Place\" style=\"border:none;\" /></a>";
daddys.info = "<a href=\"http:\/\/www.bigdaddysplace.com\/index.htm\" class=\"branding_textListLink\" target=\"_blank\">Big Daddy's Place</a><br />" +
			  "13420 NE 177th Place<br />" +
			  "(Little Bear Creek Parkway)<br />" +
			  "Woodinville, WA 98072<br />" +
              "(425) 402-9887";
daddys.directions = "<a href=\"http:\/\/www.bigdaddysplace.com\/directions.htm\" class=\"branding_textListLink\" target=\"_blank\">Directions to Big Daddy's Place</a>";
daddys.time = "9:00pm 'til 1:00am";
daddys.title = "Big Daddy's Place Woodinville, 9pm";
daddys.header = "Performance venue information for Rock Candy!";
daddys.subheader = "Spend an evening with Seattle's sweetest party band!";

//Clearwater Casino
var clearwater = new Object;
clearwater.icon = "<a href=\"http:\/\/www.clearwatercasino.com\" target=\"_blank\"><img src=\"images\/clearwater.gif\" alt=\"Clearwater Casino\" style=\"border:none;\" /></a>";
clearwater.info = "<a href=\"http:\/\/www.clearwatercasino.com\" class=\"branding_textListLink\" target=\"_blank\">Clearwater Casino</a><br />" +
			  "15347 Suquamish Way NE<br />" +
			  "Suquamish, WA 98392<br />" +
              "1 (800) 375-6073";
clearwater.directions = "<a href=\"http:\/\/www.clearwatercasino.com\/about\/location\/maps.html\" class=\"branding_textListLink\" target=\"_blank\">Directions to Clearwater Casino</a>";
clearwater.time = "9:00pm 'til 1:00am";
clearwater.title = "Clearwater Casino - Resort Suquamish, 9pm";
clearwater.header = "Performance venue information for Rock Candy!";
clearwater.subheader = "Spend an evening with Seattle's sweetest party band!";

//Club Hollywood
var hollywood = new Object;
hollywood.icon = "<a href=\"http:\/\/www.silverdollarcasinos.com\/main.html\" target=\"_blank\"><img src=\"images\/hollywood.gif\" alt=\"Club Hollywood Casino\" style=\"border:none;\" /></a>";
hollywood.info = "<a href=\"http:\/\/www.silverdollarcasinos.com\/main.html\" class=\"branding_textListLink\" target=\"_blank\">Club Hollywood Casino</a><br />" +
			  "16716 Aurora Avenue North<br />" +
			  "Shoreline, WA 98133<br />" +
              "(206) 546-4444";
hollywood.directions = "<a href=\"http:\/\/maps.google.com\/maps?hl=en&um=1&ie=UTF-8&q=club+hollywood+casino+shoreline&fb=1&gl=us&hq=club+hollywood+casino+shoreline&hnear=Kirkland,+WA&cid=0,0,8449205552062618986&ei=ZZO3S5L4MIbWtgOOjrnpDA&sa=X&oi=local_result&ct=image&resnum=4&ved=0CBUQnwIwAw\" class=\"branding_textListLink\" target=\"_blank\">Directions to Club Hollywood</a>";
hollywood.time = "9:00pm 'til 1:00am";
hollywood.title = "Club Hollywood Shoreline, 9pm";
hollywood.header = "Performance venue information for Rock Candy!";
hollywood.subheader = "Spend an evening with Seattle's sweetest party band!";

//Mill Bay
var millbay = new Object;
millbay.icon = "<a href=\"http:\/\/www.colvillecasinos.com\/mbc-main.html\" target=\"_blank\"><img src=\"images\/millbay.gif\" alt=\"Mill Bay Casino\" style=\"border:none;\" /></a>";
millbay.info = "<a href=\"http:\/\/www.colvillecasinos.com\/mbc-main.html\" class=\"branding_textListLink\" target=\"_blank\">Mill Bay Casino</a><br />" +
			  "455 Wapato Lake Road<br />" +
			  "Manson, WA 98831<br />" +
              "(509) 687-2102";
millbay.directions = "<a href=\"http:\/\/www.google.com\/maps?f=q&hl=en&q=455 Wapato Lake Road, Manson, WA 98831&om=1\" class=\"branding_textListLink\" target=\"_blank\">Directions to Mill Bay Casino</a>";
millbay.time = "9:00pm 'til 1:00am";
millbay.title = "Mill Bay Casino, Lake Chelan 9pm";
millbay.header = "Performance venue information for Rock Candy!";
millbay.subheader = "Spend an evening with Seattle's sweetest party band!";

//Bite of Seattle
var bite = new Object;
bite.icon = "<a href=\"http:\/\/www.comcastbiteofseattle.com\" target=\"_blank\"><img src=\"images\/bite.gif\" alt=\"Bite of Seattle\" style=\"border:none;\" /></a>";
bite.info = "<a href=\"http:\/\/www.comcastbiteofseattle.com\" class=\"branding_textListLink\" target=\"_blank\">Bite of Seattle - 2010</a><br />" +
			  "Seattle Center - KZOK Stage<br />" +
			  "Rock Candy plays @3:00 pm<br />" +
			  "Seattle, WA 98109<br />" +
              "(425) 283-5050";
bite.directions = "<a href=\"http:\/\/www.seattlecenter.com\/transportation\/directions.asp\" class=\"branding_textListLink\" target=\"_blank\">Directions to Bite of Seattle</a>";
bite.time = "3:00pm 'til 3:40pm";
bite.title = "Bite of Seattle Seattle Center, KZOK Stage 3pm";
bite.header = "Performance venue information for Rock Candy!";
bite.subheader = "Spend an afternoon with Seattle's sweetest party band!";

//Private Event
var party = new Object;
party.icon = "<a href=\"contact.htm\"><img src=\"images\/party.gif\" alt=\"Rock Candy\" style=\"border:none;\" /></a>";
party.info = "<a href=\"contact.htm\" class=\"branding_textListLink\">Private Party</a><br />" +
			  "Book Rock Candy<br/>For Your Event!<br />";
party.time = "";
party.title = "Private Event - with Rock Candy";
party.header = "Private Event featuring Rock Candy";
party.subheader = "Make your next party or private event your best!";


//create gig calendar array
var gigCalendar = new Array();

//create gig(event) object property values with listGig() parameters:
//date (single gig days)
//title (description on calendar)
//venue (detail object from preset list)
//nights (optional - number of consecutive nights)
function runSchedule()
{
	listGig("07/31/2010", party.title, party);
	listGig("08/14/2010", party.title, party);
	listGig("08/20/2010", clearwater.title, clearwater, 2);
	listGig("08/21/2010", clearwater.title, clearwater);
	listGig("08/28/2010", party.title, party);
	listGig("09/03/2010", millbay.title, millbay, 2);
	listGig("09/04/2010", millbay.title, millbay);
	listGig("09/24/2010", daddys.title, daddys);
	listGig("10/30/2010", party.title, party);
	listGig("11/13/2010", party.title, party);
	listGig("12/10/2010", daddys.title, daddys);
}


//populate properties for each gig object, add to gig calendar array
function listGig(gigDate, gigTitle, gigVenue, gigNights)
{
	var currentDate = new Date();
	var compareDate = new Date(gigDate);
	var dateDay = Date.WeekdayNames[compareDate.getDay() + 1];
	
	currentDate = FormatDateTime(currentDate, 2);
	compareDate = FormatDateTime(compareDate, 2);
	
	currentDate = new Date(currentDate);
	compareDate = new Date(compareDate);
	
	//filter out past dates for calendar, include special condition for multiple nights
	if(compareDate >= currentDate)
	{
		var gig = new Object;

		gig.start = gigDate;
		gig.title = gigTitle;
		gig.detail = gigVenue;
		gig.nights = (gigNights) ? gigNights : 1;
		gigCalendar.push(gig);
	}
}


//partial calendar listing for Upcoming Show display on homepage
function listCalendar()
{
	var dateGig;
	var dateCurrent = new Date();
	
	var dateDiff;
	var rows = "";
	var gigs = 0;
	var gigVenue;
	
	//add initial spacer after header text
	rows += "<tr><td style=\"height:7px; valign:top;\"></td></tr>";

	for (var i = 0; i < gigCalendar.length; i++)
	{
		//only display next three gigs for Upcoming Shows
		if(gigs == 3)
			break;
			
		//check if next gig in line is the same venue (for multiple nights - exclude private events)
		if(gigVenue == gigCalendar[i].detail && gigVenue != party)
			continue;		
	
		//add date checking to display current and future gigs
		dateGig = new Date(gigCalendar[i].start);
		dateDiff = DateDiff("d", dateCurrent, dateGig);
		
		if(dateDiff < 0)
			continue;
		
		//add spacer row between listings
		if(gigs != 0)
		{	
			rows += "<tr><td style=\"height:7px; valign:top;\"></td></tr>";
		}
		
		//add date display (may be full day displays for main calendar page)
		rows += "<tr><td class=\"branding_textList_1\" style=\"text-align:center; valign:top;\"><u>" + dateDisplay(dateGig, gigCalendar[i].nights) + ":</u></td></tr>";	
		rows += "<tr><td class=\"branding_textList_2\" style=\"text-align:center; valign:top;\">" + gigCalendar[i].detail.info + "</td></tr>";
		
		//increment gig total
		gigs += 1;
		
		//assign gigVenue to track multiple nights
		gigVenue = gigCalendar[i].detail;
	}
	
	document.write("<table cellpadding=\"0\" cellspacing=\"0\">" + rows + "</table>");
}


function dateDisplay(gigDate, nights)
{
	var dateAfterAdd;
	var displayDate;
	
	displayDate = Date.MonthName(gigDate.getMonth()+1) + " " + dayDisplay(gigDate.getDate());
	
	if(nights > 1)
	{
		dateAfterAdd = DateAdd("d", 1, gigDate);
		
		displayDate += " & " + dayDisplay(dateAfterAdd.getDate());;
	}
	
	return displayDate;
}


function dayDisplay(gigDay)
{
	var suffix;
	
	//convert day integer to string
	gigDay += '';
	
	//determine suffix based on day
	switch(gigDay)
	{
		case "1":
		case "21":
		case "31":
			suffix = "st";
			break;
		case "2":
		case "22":
			suffix = "nd";
			break;
		case "3":
		case "23":
			suffix = "rd";
			break;
		default:
			suffix = "th";
			break;
	}
	
	return gigDay + suffix;	
}


//Calendar page venue information display
function showGigDetails(date, venue)
{
    var divDetails = $('#divDetails');

    if(divDetails.css('display') == 'none')
    {
		var html;
		var venueInfo;
		
		if(venue.time != "")
		{
			venueInfo =					
				"<td class=\"layout_venueInfo branding_calendarHeader\"><b>" + FormatDateTime(date, 1) + "</b><br/>" +
				"<img src=\"images/spacer.gif\" width=\"25\" height=\"1\"><b><i> - " + venue.time + "</i></b>" +
				"<div class=\"top_padding_10 branding_textList_2\">" + venue.info + "</div>" +
				"<div class=\"top_padding_10\">" + venue.directions + "</div></td>";
		}
		else
		{
			venueInfo =					
				"<td class=\"layout_venueInfo branding_calendarHeader\" style=\"text-align:center;\">" +
				"<a href=\"contact.htm\" class=\"branding_textListLink\">Book Rock Candy for your next Private Party or Corporate Event!</a><br/><br/>" +
				"<span class=\"branding_textList_2\">See more details for booking the <br/>band on our contact page...</span></td>";
		}
		
		html =
			"<table cellpadding=\"0\" cellspacing=\"0\" style=\"width:444px; background-color:#877d70;\" align=\"center\">" +
			"<tr>" +
			"<td style=\"width:2px; height:270px;\"><img src=\"images/schedule_border_270.gif\"></td>" +
			"<td style=\"width:440px; height:270px;\">" +
				"<table cellpadding=\"0\" cellspacing=\"0\" style=\"width:420px; background-color:#877d70;\" align=\"center\">" +
				"<tr><td class=\"branding_calendarHeader\" style=\"text-align:center;\">" + venue.header + 
				"<a href=\"Javascript:showGigDetails();\"><img src=\"images\/close.gif\" style=\"position:absolute; left:412px; top:8px;\" border=\"0\" title=\"Close Window\"></td></tr>" +
				"<tr><td class=\"branding_calendarSubheader\" style=\"text-align:center;\"><i>" + venue.subheader + "</i></td></tr>" +
				"<tr><td class=\"top_padding_15\">" +  
					"<table cellpadding=\"0\" cellspacing=\"0\">" +
					"<tr><td class=\"layout_venueIcon\">" + venue.icon + "</td>" + venueInfo +				
					"</tr></table>" +
				"</td></tr>" +
				"<tr><td class=\"top_padding_5\">&nbsp;</td></tr>" +
				"<tr><td align=\"center\"><a href=\"Javascript:showGigDetails();\" class=\"branding_textListLink\">Close Window</a></td></tr>" +
				"</table>" +
			"</td>" +
			"<td style=\"width:2px; height:270px;\"><img src=\"images/schedule_border_270.gif\"></td>" +
			"</tr>" +
			"</table>";
    
		divDetails.html(html);
		divDetails.modal();
		
    }    
    else
    {
        $.modal.close();
    }
}