// JavaScript Document

// configure variables for video player
var autoPlay = true;
var configXMLPath = '../webtv/xml/config.xml';
var theChannel = gup('pChan');
var theEpisode = gup('pEpi');
// make sure that the variable formats are empty strings when there is no parameter
if (theChannel ==  null || theChannel == "") {
	theChannel = "";
}
if (theEpisode ==  null || theEpisode == "") {
	theEpisode = "";
}

// parse parameters off of the url
function gup(name) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null ) {
		return "";
	} else {
		return results[1];
	}
}

/* functions for Flash to call with ExternalInterface */
function getConfigPath() {
	return configXMLPath;
}

function getStartingChannel() {
	return theChannel;
}

function getStartingEpisode() {
	return theEpisode;
}

