function getFlashMovieObject(movieName,pageURL)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  else if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
		return document.embeds[movieName];
  }
  else if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
  	return document.getElementById(movieName);
  }
  else
  {
  	location.href = pageURL;
	return null;
  }
}

//

function playMovie(pageURL,pageName)
{
	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 (browser == "Netscape Navigator")
	{
		location.href=pageURL;
		return null;
	}
	
	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";
	}
	
	if (OS == "Mac")
	{
		foundMac();
		return;
	}
	
	//
	
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
	
	//
	
	function foundMac()
	{
		location.href=pageURL;
	}
	
	//
	
	if(navigator.appName.indexOf("Netscape")==-1)
	{
		var flashObj;
		try
		{
			/* attempt to create an instance of the flash object, 
			if it is capable of being created, it can be treated 
			as a boolean TRUE */
			flashObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			//in other words TRUE
		}
		catch(error)
		{
			flashObj = false;
		}
		if(flashObj){
			var flashMovie=getFlashMovieObject("walkingMC",pageURL,pageName);
			if (!flashMovie){
				return;
			}
			flashMovie.SetVariable("_root.pageNameVar", pageName);
			flashMovie.SetVariable("pageURLVar", pageURL);
			flashMovie.Play();
			//embed.nativeProperty.anotherNativeMethod();
		}
		else
		{
			foundMac();
			return;
		}
	}
}

