/**********
* GLOBALS *
**********/

// Blocks
var g_project;
var g_blocks;
var g_current = 6;
var g_currently = 6;

/************
* FUNCTIONS *
************/

// Preloaded settings
function f_preLoad(a_project, a_sections)
{
	// Set global variables from PHP
	g_project = a_project;
	g_blocks = a_sections;
	
	// Set default content
	f_switchInfo(g_current);
	f_switchGame(g_currently);
	f_switchCatcher("videos");
}

// Switching eyecatcher content
function f_switchCatcher(a_section)
{
	// Hide all content
	document.getElementById("videos").style.display = "none";
	document.getElementById("screens").style.display = "none";
	document.getElementById("game").style.display = "none";
	document.getElementById("press").style.display = "none";
	document.getElementById("faq").style.display = "none";
	
	// Show correct content
	document.getElementById(a_section).style.display = "block";
}

// Switching information content
function f_switchInfo(a_section)
{
	/*// Hide all content
	for (var l_blocks = 1; l_blocks <= g_blocks; l_blocks++) {
		document.getElementById("page" + l_blocks).style.display = "none";
		document.getElementById("img" + l_blocks).src = "Images/wya_"+l_blocks+".gif";
	}
	
	// Determine content
	switch (a_section) {
		case "next":
			g_current = (g_current + 1 > g_blocks) ? 1 : g_current + 1;
			break;
		case "prev":
			g_current = (g_current - 1 < 1) ? g_blocks : g_current - 1;
			break;
		default:
			g_current = a_section;
			break;
	}
	
	// Show correct content	
	document.getElementById("page" + g_current).style.display = "block";
	document.getElementById("img" + g_current).src = "Images/wya_"+g_current+"selected.gif";
	*/
}

// Switching game content
function f_switchGame(a_section)
{
	// Hide all content
	for (var l_blocks = 1; l_blocks <= g_blocks; l_blocks++) {
		document.getElementById("page0" + l_blocks).style.display = "none";
		document.getElementById("img0" + l_blocks).src = "Images/wya_"+l_blocks+".gif";
	}
	
	// Determine content
	switch (a_section) {
		case "next0":
			g_currently = (g_currently + 1 > g_blocks) ? 1 : g_currently + 1;
			break;
		case "prev0":
			g_currently = (g_currently - 1 < 1) ? g_blocks : g_currently - 1;
			break;
		default:
			g_currently = a_section;
			break;
	}
	
	// Show correct content	
	document.getElementById("page0" + g_currently).style.display = "block";
	document.getElementById("img0" + g_currently).src = "Images/wya_"+g_currently+"selected.gif";
	
		// Hide all content
	for (var l_blocks = 1; l_blocks <= g_blocks; l_blocks++) {
		document.getElementById("page" + l_blocks).style.display = "none";
		document.getElementById("img" + l_blocks).src = "Images/wya_"+l_blocks+".gif";
	}
	
	// Show correct content	
	document.getElementById("page" + g_currently).style.display = "block";
	document.getElementById("img" + g_currently).src = "Images/wya_"+g_currently+"selected.gif";
	
	// Hide all content
	for (var l_blocks = 1; l_blocks <= g_blocks; l_blocks++) {
		document.getElementById("page1" + l_blocks).style.display = "none";
	}
	
	// Show correct content	
	document.getElementById("page1" + g_currently).style.display = "block";
}

function f_switchPic(a_folder, a_screen)
{
	document.getElementById("big_" + a_folder).innerHTML = "<a href=\"Images/Screenshots/" + a_screen + "_t.jpg\" target=\"_blank\"><img alt=\"Click to enlarge\" title=\"Click to enlarge\" src=\"Images/Screenshots/" + a_screen + "m.jpg\" /></a>";
}

function f_switchVid(a_source)
{
	document.getElementById("ytm").innerHTML = "<object width=\"528\" height=\"297\"><param name=\"movie\" value=\"" + a_source + "\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"" + a_source + "\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"528\" height=\"297\"></embed></object>";
}
