var flVol = 0.5;
var newUrlName = 'short';

function onLoadWindow(newUrl, newPlayVolume) {

	if (newUrl == 'index') {

		newUrlName = 'short';

	} else {

		newUrlName = newUrl;

	}

	flVol = newPlayVolume;

	callChangeMovie();

}

function thisMovie(playerName) {

	var isIE = navigator.appName.indexOf("Microsoft") != -1;

	return (isIE) ? window[playerName] : document[playerName];

}

function changeMovie(newUrl) {

	newUrlName = newUrl;

	changeVolume();

}

function changeVolume() {

	flVol = thisMovie("player").changeVolume();

	var ajaxRequest = new Ajax.Request(
		'./lib/setVolumeSession.php',
		{
			'method': 'post',
			'parameters': 'vol=' + flVol,
			onComplete: function(request) {

				location.href = newUrlName + '.html';

			}

		}
	);

}

function callChangeMovie(){

	setTimeout("asCallChangeMovie()", 100);

}

function asCallChangeMovie() {

	thisMovie("player").changeMovie(newUrlName, true, flVol);

}

