/* All intellectual property rights relating to this code are owned by EURO RSCG 4D Digital. */
// Detects browser, and displays specified flash movie.
// Version 2.0

function get_safari_version() {
  var sf_version = '';

  if (sf) {
    var user_agent = navigator.appVersion;
    var sf_placement = user_agent.indexOf("Safari/");
    var version_placement = sf_placement + 7;
    sf_version = parseFloat(user_agent.substring(version_placement, user_agent.length));
  }
  else {
    sf_version = 0;
  }

  return sf_version;
}

/* REQUIRED MINIMUM FLASH VERSION */
var flash_version=9;

var dom = (document.getElementById)?1:0;
var mac = (navigator.userAgent.indexOf('Mac') != -1)?1:0;

var ie45mac = ((navigator.appVersion.toString().indexOf('MSIE 4.5') != -1) && mac)?1:0;
var ie5mac = ((navigator.appVersion.toString().indexOf('MSIE 5.') != -1) && mac)?1:0;
var ie4pc = (!document.getElementById && document.all)?1:0;
var ie50 = (navigator.userAgent.toString().indexOf('MSIE 5.') != -1)?1:0;
var op6 = (navigator.userAgent.toString().indexOf('Opera 6') != -1)?1:0;
var op7 = (navigator.userAgent.toString().indexOf('Opera 7') != -1)?1:0;
var sf = (navigator.appVersion.toString().indexOf('Safari') != -1)?1:0;
var sv = get_safari_version();
var nosf12 = (sf && (sv < 120))?1:0;

//alert("nosf12: " + nosf12)

var MAC=(navigator.userAgent.indexOf('Mac')!=-1)?1:0;

var IE45MAC=((navigator.appVersion.toString().indexOf('MSIE 4.5')!=-1)&&MAC)?1:0;
var IE50WIN=((navigator.appVersion.toString().indexOf('MSIE 5')!=-1)&&!MAC)?1:0;
var IE52MAC=(navigator.userAgent.toString().indexOf('MSIE 5.2')!=-1&&MAC)?1:0;
var IE55WIN=(document.getElementById&&document.all&&!MAC)?1:0;

var NS6=(document.getElementById&&!document.all)?1:0;
var NS7=(NS6&&navigator.userAgent.indexOf('Netscape/7')!=-1)?1:0;

//var sf = (navigator.appVersion.toString().indexOf('Safari') != -1)?1:0;

var FF = (navigator.userAgent.toString().indexOf('Firefox')!=-1)?1:0;

var SFOK = (sf && !nosf12)




//var DHTMLFLASH=(IE50WIN||IE52MAC||IE55WIN||NS7)?1:0;
var DHTMLFLASH=(IE50WIN||IE52MAC||IE55WIN||NS7||FF||SFOK||nv > 7)?1:0;
//alert(navigator.userAgent)


var SWF=0;
var sfobj='ShockwaveFlash.ShockwaveFlash.'+eval(flash_version);
var VBS='<SCRIP';
VBS+='T LANGUAGE=VBScript\> \n';
VBS+='on error resume next \n';
VBS+='SWF=IsObject(CreateObject(sfobj)) \n';
VBS+='</S'; VBS+='CRIPT\> \n';

if (!MAC) document.write(VBS);

var plugin=(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]?navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin:0);
if (plugin&&parseInt(plugin.description.substring(plugin.description.indexOf(".")-2))>=flash_version) { SWF=1; }

// Places flash movie in website.  Called from within <script> tags located in body of webpage.
// src = Location of flash file.
// color = Color of background for flash space.
// width = Width of flash movie.
// height = Height of flash movie.
// noflash = Insert this HTML code if no flash is available.
// underdhtml = Should usually be set to 0. If set to 1, allows DHTML content to layer on top of flash. Use with
//    extreme caution!  Only works on IE5+ in Windows, and then only with tiny flash movies.
// forceie45mac = Display flash in IE4.5 for Mac.
// overwrite = Either 1 (replace whatever already exists in flash space with this flash) or 0 (display noflash).
// rtn = Either 1 (Return HTML flash code to wherever this function was called) or 0 (Write HTML flash code directly to browser).
function flash(src,color,width,height,noflash,underdhtml,forceie45mac,overwrite,rtn) {
 // noflash = "<img src=\"" + noflash + "\" width=\"" + width + "\" height=\"" + height + "\" />";

// alert("Brower Version: " + parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) + "   Required Version: " + flash_version);

  var EC;
  if (forceie45mac&&IE45MAC&&!underdhtml) SWF=1;
  if (underdhtml&&!DHTMLFLASH) SWF=0;
  if (SWF||overwrite) {
    EC='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ ((overwrite)?overwrite:flash_version) +',0,0,0" ID=themovie WIDTH='+width+' HEIGHT='+height+'>'+ ((underdhtml)?'<param name="wmode" value="transparent" />':'') + '<PARAM NAME=movie VALUE="'+src+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=menu VALUE=false> <PARAM NAME=bgcolor VALUE='+color+'> <EMBED NAME="themovie" SRC="'+src+'" menu=false quality=high bgcolor='+color+'  WIDTH='+width+' HEIGHT='+height+' TYPE="application/x-shockwave-flash" swLiveConnect="true" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"'+ ((underdhtml)?' WMODE="transparent"':'') + '></EMBED></OBJECT>';
  }
  else {
    EC=noflash;
  }
  if (rtn) {
    return EC;
  }
  else {
    document.write(EC);
  }
}
// Function usually triggerd by onload() inside an invisible image.  Places flash movie inside specified DIV (this
//     function was originally intended to allow flash to display inside ajax content).
// div = Location where Flash is to be displayed.
// all other parameters: see flash(), above (note: this function expects "noflash" parameter to be an image path).
//    To specify something other than an image for "noflash", comment out the "noflash" line in this function.
// rtn value hard-coded as '1'.
function flashHere(div,src,color,width,height,noflash,underdhtml,forceie45mac,overwrite,rtn) {
  var obj = eval((ie45mac || ie4pc || ie50)?'document.all[\'' + div + '\']':'document.getElementById(\'' + div + '\')');
  noflash = "<img src=\"" + noflash + "\" width=\"" + width + "\" height=\"" + height + "\" />";
  if(obj) {
    obj.innerHTML = flash(src,color,width,height,noflash,underdhtml,forceie45mac,overwrite,1);
  }
}

function getFlashMovieObject(movieName){
  if(window.document[movieName]){
    return window.document[movieName];
  }
  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);
    }
  }
}
