function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

var _sport = "";
var _season = "";
var _itemtype = "";

// get
function getSport() {
	return _sport;
}

function getSeason() {
	return _season;
}

function getItemtype() {
	return _itemtype;
}

// following functions called from Flash when the selection item values change
function setSport(sport) {
	_sport = sport;
}

function setSeason(season) {
	_season = season;
	getFlashMovie("outfitbrowser").setSeason(_season); // update main movie
}

function setItemtype(itemtype) {
	_itemtype = itemtype;
	updateHash();
}

function submitSelection() {
	getFlashMovie("outfitbrowser").startVirtualSearch(_sport, _season, _itemtype);
}

function updateHash() {
	if (_sport != "" && _season != "" && _itemtype != "") {
		window.location.hash = _sport + "###" + _season + "###" + _itemtype;
	}
}

function getHash() {
	var hash = window.location.hash;
	hash = hash.replace(/#/, "");
	hash = hash.split("###");
	if (hash.length == 3) {
		_sport = hash[0];
		_season = hash[1];
		_itemtype = hash[2];
	}
}

function formReportLoaded() {
	getHash();
	if (_sport != "" && _season != "" && _itemtype != "") {
		getFlashMovie("virtualform").initSelection(_sport, _season, _itemtype);	
	}
}

function browserReportLoaded() {
	getHash();
	if (_sport != "" && _season != "" && _itemtype != "") {
		getFlashMovie("outfitbrowser").setSeason(_season);	
		submitSelection();
	}
}