﻿// JSON object to hold the content of the views.
var view = '';
//$Trumba.Spuds.controller.addEventListener("navigate", SwapViewText(qs));
$Trumba.Spuds.controller.addEventListener("navigate", function(qs){
	var newView = qs.getAt("template")[1];
	if (newView != view) {
		// The view is the key into our JSON object.
		var vt = FindViewText(newView);
		
		$(".view_text").fadeOut("fast", function(){
			$("#vh").text(vt.vh);
			$("#vt").text(vt.vt);
			$(".view_text").fadeIn("fast");
		});
		
		view = newView;
	}
});

var ViewText = [
	// Day
	{"vtID":"day","vh":"Day view","vt":"If you’re presenting a schedule of events that take place over a limited number of days, this view makes sense. Visitors can quickly page between days to see what’s happening when. All-day events are listed at the top above events that have specific start times. For busy calendars with many events on the same day, this view isn’t terribly useful."},
	// Week
	{"vtID":"week","vh":"Week view","vt":"Classic Week view presents a week's worth of events per page organized by day. You can control which event fields display. Week view works best when you have a relatively small number of events per week."},
	// Month
	{"vtID":"month","vh":"Classic Month view","vt":"The familiar month grid remains one of the most economical, intuitive ways to present and take in a schedule. It's most effective, however, with a small to moderate number of events."},
	// List
	{"vtID":"list","vh":"List view","vt":"This view is extremely easy for site visitors to navigate and gives you a lot of control. For example, you  decide how many events to display per page, how the events are grouped, and which fields to display. We chose to display 25 events per page grouped by week and then by day. We also chose to hide the notes to make the view more compact."},
	// Table
	{"vtID":"table","vh":"Table view","vt":"Economical. Easy to scan. Highly customizable. This compact view is one our most versatile. You control which event fields to display on the calendar and the order in which they appear. You also decide how many events to display per page and how they are grouped. Visitors click the event description to see more details and the location to see a map."},
	// Multi-Week
	{"vtID":"5week","vh":"Muti-Week view","vt":"Some event schedules don’t conform to the four-week chunks typical of month view. That’s why we provide a multi-week view. You can display from two to eight weeks per page. Given the number of events on our calendar, we chose to display just two weeks."},
	// Performance Schedule
	{"vtID":"performance","vh":"Performance Schedule view","vt":"If your calendar includes lots of repeating events, such as weekly or monthly workshops and classes, this is an excellent view to use. In this view, all instances of each repeating event are grouped together. Visitors can easily see and take actions with both individual events or the series as a whole. You control the number of events per page and which event fields display in the calendar."},
	// Conference Schedule
	{"vtID":"conference","vh":"Conference Schedule view","vt":"This view organizes events by day and then by location. That makes it the ideal view for conferences where meetings occur simultaneously in several venues. As you can see in our calendar, this view is not useful for presenting a variety of events that take place in a wide range of different locations."},
	// 3 Columns
	{"vtID":"3columns","vh":"3 Columns view","vt":"This highly compact and organized view lists events under three column headings, description, date, and location. You control whether notes display in the calendar, how many events to list per page, and how the events are grouped. We chose to hide notes, list about 25 events per page, and group events by day."},
	// Compact	
	{"vtID":"compact","vh":"Compact List view","vt":"Want to display a lot of events in a small space? This view is for you. You have control over how many events display per page, how the events are grouped, and which event fields to include. We chose to display 100 events per page, grouped them by week and then by day, and included the description, date and time, and location fields. Visitors click the event description to see more details and the location to see a map."},
	// Detail List - Description
	{"vtID":"detaillist","vh":"Detail List – Description","vt":"Use this informative view when you want to provide details about events right up front. Each event takes up quite a bit of space on the page but visitors don’t have to navigate anywhere else to read event notes. You control how many events display per page. Similar to Labeled List - Description view but fewer fields are labeled."},
	// Labeled List - Description
	{"vtID":"labeledlist","vh":"Labeled List – Description","vt":"Use this informative view when you want to provide details about events right up front. Each event takes up quite a bit of space on the page but visitors don’t have to navigate anywhere else to read event notes. You control how many events display per page. Similar to Detail List - Description view except that more fields are labeled."},	
	// Detail List - Date
	{"vtID":"detaillistdate","vh":"Detail List – Date","vt":"When date and details are what you want to emphasize, use this informative view. Each event takes up quite a bit of space on the page but visitors don’t have to navigate anywhere else to read event notes. You control how many events display per page. As you can see in our calendar, this view may not be the best choice when several events occur on the same date. Similar to Labeled List - Date view except that fewer fields are labeled."},
	// Labeled List - Date	
	{"vtID":"labeledlistdate","vh":"Labeled List – Date","vt":"When date and details are what you want to emphasize, use this informative view. Each event takes up quite a bit of space on the page but visitors don’t have to navigate anywhere else to read event notes. You control how many events display per page. As you can see in our calendar, this view may not be the best choice when several events occur on the same date. Similar to Detail List - Date view except that more fields are labeled."}
];

function FindViewText(viewTextID)
{
	for (var i = 0; i < ViewText.length; i++) {
		if (ViewText[i].vtID == viewTextID)
			return ViewText[i];
	}
}

function InitViewText(view)
{
	var vt = FindViewText(view);
	if (vt == null || vt == "undefined")
		vt = FindViewText("3columns");
	$(".view_text").fadeOut("fast", function(){
		$("#vh").text(vt.vh);
		$("#vt").text(vt.vt);
		$(".view_text").fadeIn("fast");
	});
}