//function write_flash(flash, width, height) {
//	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'" style="z-index: 0;">');
//	document.write('<param name="movie" value="'+flash+'">');
//	document.write('<param name="quality" value="high">');
//	document.write('<param name="wmode" value="transparent">');
//	document.write('<embed src="'+flash+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent" style="z-index: 0;"></embed>');
//	document.write('</object>');
//} //end function write_flash()

function write_flash(flash, width, height, name, wmode) {

var flashhtml =  '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	flashhtml += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
	flashhtml += 'width="'+width+'" ';
	flashhtml += 'height="'+height+'" ';
	flashhtml += 'id="'+name+'" ';
	flashhtml += 'style="z-index: 0;">';
	flashhtml += '<param name="allowScriptAccess" value="sameDomain" />';
	flashhtml += '<param name="movie" value="'+flash+'">';
	flashhtml += '<param name="quality" value="high">';
	flashhtml += '<param name="wmode" value="transparent">';
	flashhtml += '<embed name="'+name+'" src="'+flash+'" quality="high" ';
	flashhtml += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	flashhtml += 'type="application/x-shockwave-flash" ';
	flashhtml += 'width="'+width+'" ';
	flashhtml += 'height="'+height+'" ';
	flashhtml += 'wmode="'+wmode+'"transparent" ';
	flashhtml += 'allowscriptaccess="sameDomain" ';
	flashhtml += 'style="z-index: 0;">';
	flashhtml += '</embed>';
	flashhtml += '</object>';
	
	return flashhtml
	
} //end function write_flash()

//function thisMovie(movieName) {
//  // IE and Netscape refer to the movie object differently.
//  // This function returns the appropriate syntax depending on the browser.
// if (navigator.appName.indexOf ("Microsoft") !=-1) {
//    return parent.window[movieName]
//  }	else {
//    return parent.document[movieName]
//  }
//}

function thisMovie(movieName)
{
  if (parent.window.document[movieName]) 
  {
      return parent.window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (parent.document.embeds && parent.document.embeds[movieName])
      return parent.document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return parent.document.getElementById(movieName);
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}


function setFrame(theFrame, movieName) {
  if (movieIsLoaded(thisMovie(movieName)) && !thisMovie(movieName).IsPlaying()) {
    thisMovie(movieName).GotoFrame(theFrame);
  }
}


function goLabelIfLoadedAndStopped(movieName,frameRoot,theFrame) {
	if (movieIsLoaded(thisMovie(movieName)) && !thisMovie(movieName).IsPlaying()) {
	thisMovie(movieName).TGotoLabel(frameRoot,theFrame);
  	}
}

function goLabelIfLoaded(movieName,frameRoot,theFrame) {
	if (movieIsLoaded(thisMovie(movieName))) {
	thisMovie(movieName).TGotoLabel(frameRoot,theFrame);
  	}
}