
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 124;
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
									
function TVCWebPlayer(key) {

	if (hasRequestedVersion) {
		
		AC_FL_RunContent(
			"src", "TVCatchupWebPlayer",
			"width", "901",
			"height", "500",
			"align", "middle",
			"id", "TVCatchupWebPlayer",
			"quality", "high",
			"wmode", "transparent",
			"name", "TVCatchupWebPlayer",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"flashvars","frame=3&Key=TEST_KEY&Auth_Key=" + key + "&apiUrl=http://api.tvcatchup.com&channelsUrl=http://www.tvcatchup.com/?cache=1",
			"allowFullScreen", "true"
		);
		
	} else {
		
	    document.write('TVCatchup requires the Adobe Flash Player. <a href=http://www.adobe.com/go/getflash/>Install Flash Now (Free)</a>.');
	     
	}
}
					 
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}
		
function reset() {
	thisMovie("TVCatchupWebPlayer").resetPlayer();
}

function changeChannel(value) {
	var sto = setTimeout(function() {
		var val = value;
		thisMovie("TVCatchupWebPlayer").loadChannel(val);
	}, 1000);
}
					
function loadFirstChannel() {
	changeChannel(active_id);
}

/* ie disconnect */
window.onbeforeunload = ieDisconnect;
function ieDisconnect() {
	thisMovie("TVCatchupWebPlayer").resetPlayer();
}

var this_id;
/*var active_id = '';*/
var active_id = 1;

urlquery = location.href.split("?c=");
if(urlquery[1] > 0 && urlquery[1] != '') {
	active_id = urlquery[1];		
}

