var img;
var videoSource;

//SERIES DESCRIPTION
var series1_desc = "Budget 09";

//DEFAULT IMAGES FOR EACH SERIES
var still_image1 = "/vgnmedia/images/Business_Solutions/confidence_movie1.gif";

// Images for Selection 1(on status)
var series1_thumb1_on = "http://oms.nab.com.au/media/09/budget09/overview_on.jpg";
var series1_thumb2_on = "http://oms.nab.com.au/media/09/budget09/business_on.jpg";
var series1_thumb3_on = "http://oms.nab.com.au/media/09/budget09/individuals_on.jpg";
var series1_thumb4_on = "http://oms.nab.com.au/media/09/budget09/agribusiness_on.jpg";

// Images for Selection 1(off status)
var series1_thumb1 = "http://oms.nab.com.au/media/09/budget09/overview.jpg";
var series1_thumb2 = "http://oms.nab.com.au/media/09/budget09/business.jpg";
var series1_thumb3 = "http://oms.nab.com.au/media/09/budget09/individuals.jpg";
var series1_thumb4 = "http://oms.nab.com.au/media/09/budget09/agribusiness.jpg";

function getCamp() {
	var mvID="";
	var strURL = document.URL;
	var urlPARAM = strURL.split("campaignID=");
	if (urlPARAM[1]) {
		var mvID = urlPARAM[1].split("&");
	} 

	seriesTitle(series1_desc);			// displays the title description eg: Series: Plan to become

	switch (mvID[0]) {
	case "WCM": 		
			nowPlaying(1);						// displays the html in the now playing area (the text is cma controlled)
			playVideo(1);
		break;
	case "WCO": 
			nowPlaying(2);						// displays the html in the now playing area (the text is cma controlled)
			playVideo(2);
		break;
	case "WCP": 
			nowPlaying(3);						// displays the html in the now playing area (the text is cma controlled)
			playVideo(3);
		break;
	case "WCQ": 
			nowPlaying(4);						// displays the html in the now playing area (the text is cma controlled)
			playVideo(4);
		break;
	}
}

// Displays the title of the series
function seriesTitle(seriesDesc) {
	$("#seriesTitle").show();
	var seriesHTML = '<span class="seriesText"> </span>' + 
					 '<span class="seriesTextRed">' + seriesDesc + '</span>';
	$("#seriesTitle").empty().append(seriesHTML);
}

// Resets all the nowPlaying divs and displays the "selected" now Playing text.
function nowPlaying(nowPlayingText) {
	resetNowPlaying();
	$("#nowPlaying" + nowPlayingText).show();
}

// Resets all the nowPlaying divs
function resetNowPlaying() {
	$("#nowPlaying1").hide();
	$("#nowPlaying2").hide();
	$("#nowPlaying3").hide();
	$("#nowPlaying4").hide();
}

// PLAYS THE NOMINATED VIDEO
function playVideo(videoSource) {
	selectedThumbnail(videoSource);
	
	switch(videoSource) {
	case 1:
		$("#videoScreen").empty().append().flash({src: "http://oms.nab.com.au/media/09/budget09/overview/player.swf"});
		break;
	case 2:
		$("#videoScreen").empty().append().flash({src: "http://oms.nab.com.au/media/09/budget09/business/player.swf"});
		break;
	case 3:
		$("#videoScreen").empty().append().flash({src: "http://oms.nab.com.au/media/09/budget09/individuals/player.swf"});
		break;
	}
}

// DISPLAYS A BORDER AROUND THE SELECTED IMAGE THUMBNAIL.
function selectedThumbnail(videoSource) { 
	reInitSeries1();
	switch(videoSource){
	case 1:	
		$("#thumb1").empty().append("<a href='javascript:playVideo(1)'><img src=" + series1_thumb1_on + "></a>");
		break;
	case 2:
		$("#thumb2").empty().append("<a href='javascript:playVideo(2)'><img src=" + series1_thumb2_on + "></a>");
		break;
	case 3:
		$("#thumb3").empty().append("<a href='javascript:playVideo(3)'><img src=" + series1_thumb3_on + "></a>");
		break;
	}
}

// RESETS SERIES 1 IMAGES TO THE OFF STATE.
function reInitSeries1() {
	var htmlSnippet = '<span id="thumb1"><a href="javascript:playVideo(1)"><img src="' + series1_thumb1 + '"></a></span>' +
					  '<span id="thumb2"><a href="javascript:playVideo(2)"><img src="' + series1_thumb2 + '"></a></span>' +
					  '<span id="thumb3"><a href="javascript:playVideo(3)"><img src="' + series1_thumb3 + '"></a></span>';
	$("#series1").empty().append(htmlSnippet);
}

