//Audubon Flash Contruction System
//Written: 7/13/05
//Michael Callari - Web Developer
//www.audubon.org

var MM_contentVersion = 6;
var flashPlugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( flashPlugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i]))) //Checks if there is a number
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function flashMovie() {
	this.state = "none";
	this.version = "live";
	this.flashFile = "filename.swf";
	this.height = "500";
	this.width = "300";
	this.align = "left";
	this.quality = "high";
	this.bgcolor = "#FFFFFF";
	this.redirect = "http://www.macromedia.com/go/getflashplayer/";
	// alternate code to display if pluc-in is not installed
    this.altCode = '<table align="center" width="100%" cellpadding="0" cellspacing="0" border="0">';
	this.altCode += ' <tr>';
	this.altCode += ' <td class="normalText">';
	this.altCode += ' <br><br>';
    this.altCode += '<table align="right" width="240" cellpadding="0" cellspacing="0" border="0">';
	this.altCode += ' <tr>';
	this.altCode += ' <td class="photocaption">';
	this.altCode += ' <img src="'+this.domain+'images/screenshot.gif"><br><br>Screenshot of interactive map';
	this.altCode += ' <td>';
	this.altCode += ' </td>';
	this.altCode += ' </tr>';
	this.altCode += '</table>';
	this.altCode += '<b>FLASH IS NOT INSTALLED</b><p>';
	this.altCode += 'We have detected that you do not have the <a href="'+this.redirect+'" target="_blank" class="link">Flash Player plug-in</a>';
	this.altCode += ' installed on your computer.<p>';
	this.altCode += 'This interactive map requires that you have the plug-in installed.<p>';
	this.altCode += 'If you feel you have received this message in error plese contact us at ';
	this.altCode += '<a href="mailto:webmaster@audubon.org?subject=Interactive Flash Map Error" class="link">webmaster@audubon.org</a><p>';
	this.altCode += 'You may click the button below to download the plug-in for free at macromedia.com<p>';
	this.altCode += '<a href="'+this.redirect+'" target="_blank"><img src="'+this.domain+'images/noFlashBtn.gif" border="0"></a><p>';
	this.altCode += '<img src="images/clear.gif" width="1" height="250">';
	this.altCode += ' <td>';
	this.altCode += ' </td>';
	this.altCode += ' </tr>';
	this.altCode += '</table>';
	// alternate code to display if pluc-in is not installed
    this.wMode = "opaque";
	this.altFile = null;
	this.LiveConnect = "false";
	this.menu = "false"
	this.scale = "showall";
	this.ID = "National Audubon Society";
	this.quality = "high";
	this.deviceFont = "false";
	this.classID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
	this.downLoadLink = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
	this.create = writeFlashMovie;
	this.base = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0";
}


function writeFlashMovie(){
 if ( MM_FlashCanPlay ){
 
  // set version domain (live, proto, test)
 if(this.version == "test"){
  server = 'http://mis-t01.int.audubon.org/states/application';
 }else if (this.version == "proto"){
  server = 'http://proto.audubon.org/states/application';
 }else{
  server = 'http://www.audubon.org/states/application';
 }//end if	
 
 // set iframe url
 if(this.state != "none"){
  iframeFile = server+'/iframes/index_branded.php?STATE='+this.state;
 }else{
  iframeFile = server+'/iframes/index.php?state=';
 }//end if
	
    display='<table align="center" width="100%" cellpadding="0" cellspacing="0" border="0">';
	display+=' <tr>';
	display+='  <td>';
	display+='<OBJECT classid="' + this.classID+'" codebase="'+this.base+ '" ';
	display+='ID="'+this.ID+'" WIDTH="'+this.width+'" HEIGHT="'+this.height+'" ALIGN="'+this.align+'"\>';
	display+='<PARAM NAME="movie" VALUE="'+server+this.flashFile+"&state="+this.state+"&server="+server+'">';
	display+='<PARAM NAME="quality" VALUE="'+this.quality+'"\>';
    display+='<PARAM NAME="bgcolor" VALUE="'+this.bgcolor+'"\><PARAM NAME="menu" VALUE="'+this.menu+'"\>';
    display+='<PARAM NAME="wmode" VALUE="'+this.wMode+'">';
	display+='<EMBED src="'+server+this.flashFile+"&state="+this.state+"&server="+server+'"';
	display+=' quality="'+this.quality+'" bgcolor="'+this.bgcolor;
	display+='" swLiveConnect="'+this.LiveConnect+'" WIDTH="'+this.width+'" HEIGHT="'+this.height+'" ALIGN="'+this.align;
	display+='" TYPE="application/x-shockwave-flash" PLUGINSPAGE="'+this.downLoadLink+'"\>';
	display+='</EMBED>';
	display+='</OBJECT>';
	display+='  </td>';
	display+=' </tr>';
	display+=' <tr>';
	display+='  <td>';
	display+='<img src="'+server+'/images/clear.gif" width="577" height="9"><br>';
	display+='<iframe src="'+iframeFile+'"';
	display+=' width="100%" height="210" name="mainIframe" frameborder="0" scrolling="no"></iframe>';
	//display+='<br>'+ server + '<br>' + iframeFile;
	display+='  </td>';
	display+=' </tr>';
	display+='</table>';
 }else {
  if ( !this.altFile ){
   display=this.altCode;
  }else {
    display='<a href=' + this.downLoadLink + ' target="_blank"><img src=' + this.altFile + ' border="0"></a>';
   //display=location.href= this.redirect;
  }
 }
return display;
}

