var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}



function getFlashMovieObject( moviePlayer ) {
	
	if( window.document[moviePlayer] ) {
		return window.document[moviePlayer];
	}
	if( browser == "Internet Explorer" ) {
		if( document.embeds && document.embeds[moviePlayer] )
			return document.embeds[moviePlayer];
	}
	else {
		//return document.getElementById(moviePlayer);
		return document.moviePlayer;
	}
}

function playMovie( movieUrlStr, startStopBool ) {
	
	var moviePlayer = getFlashMovieObject("moviePlayer");
	
	if( ( browser == "Safari" && version < 4 ) || moviePlayer == null ){
	
		if( startStopBool ) {
			window.location = document.location.pathname + "?url=" + movieUrlStr;
		}
		else {
			window.location = document.location.pathname;
		}
		
	}
	else {
		
		if( moviePlayer != null) {
			
			if( startStopBool ) {
				//if(! moviePlayer.IsPlaying() ) {
					moviePlayer.SetVariable("url", movieUrlStr);
					moviePlayer.GotoFrame(45);
					moviePlayer.Play();
				//}
				toggle_navigation_container(false);
			}
			else {
				moviePlayer.GotoFrame(1);
				toggle_navigation_container(true);
			}
			document.body.scrollTop = 0;
		}
	}

}
