<!-- 
/*
------------------------------------------------------------------------------
File Name: flash_lib.js
Company: pH2 Enterprises
Author: Phillip J. Henslee II <ph2@ph2enterprises.com> ©2002
Purpose: Flash detection and Flash object insertion
Functions: 2
Date Created: January 15, 2002
Last Modified: February 6, 2002
Dependent Files: config.js
File Status: Optional
------------------------------------------------------------------------------
*/

// Set max version and other variables
var maxFlashVersion = 6;
var detectedVersion = 0; 
var isFlash3detected = false;    
var isFlash4detected = false;    
var isFlash5detected = false;    
var isFlash6detected = false;            

/* 
------------------------------------------------------------------------
Function detectFlashPlugin()
Purpose: detect presence of Flash plug-in
Arguments: None
------------------------------------------------------------------------
*/ 

function detectFlashPlugin(){

	if(isIe && isWindows){
		
		// create flash objects in vbscript
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('isFlash3detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('isFlash4detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('isFlash5detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
		document.write('isFlash6detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
		document.write('</SCR' + 'IPT\> \n');
	        
	}   
	
	if (navigator.plugins){
		if (navigator.plugins["Shockwave Flash"]) {
			var flashDesc = navigator.plugins["Shockwave Flash"].description;
			detectedVersion = parseInt(flashDesc.charAt(flashDesc.indexOf(".") - 1));
		}
	
	}
	
	for (var i = 3; i <= maxFlashVersion; i++) {  
		if (eval("isFlash" + i + "detected") == true){detectedVersion = i};			
	 }	
	 
	if(debugState){
		if (detectedVersion > 0){
		alert("Flash plug-in detected! \n \n Version: " + detectedVersion);
		}
	}
	
}

/* 
--------------------------------------------------------------------------
Function insertFlashContent
Purpose: Dyamically inserts flash content or alternate content
Arguments: 8
Arg 0: flashMovie - Name of the swf file
Arg 1: altImage - Name of alternate image if flash is not present
Arg 2: iwidth - Width of the Flash movie
Arg 3: iheight - height of the Flash movie
Arg 4: isLoop - boolean flag movie loops or plays once and stops
Arg 5: altPage - name of the alternat non flash page to use
Arg 6: upgradePage - sends user to update page if plugin is outdated.
Arg 7: targetFlashVersion - the version of the flash movie being inserted
--------------------------------------------------------------------------
*/   

function insertFlashContent(flashMovie,altImage,iwidth,iheight,isLoop,altPage,upgradePage,targetFlashVersion){
		
		// Handle Redirection to alternate non flash page
		if(altPage != 'NO'){
			if(!isOtherBrw){
				window.location.replace(altPage);  
			}else{
				window.location = altPage;
			}
		}	  
        
        // Handle Upgrade page option
        if (detectedVersion < targetFlashVersion && upgradePage != 'NO'){
			if(!isOtherBrw){
				window.location.replace(upgradePage);  
			} else {
				window.location = upgradePage;
			}
		}	  
		
		// insert flash content if flash is detected or is ie
		if (detectedVersion > 0 | isIe ){
		
			// build html output string
			var strHTML = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ ' WIDTH="' + iwidth + '" HEIGHT="' + iheight +'" '
			+ 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
			+ '<PARAM NAME="MOVIE" VALUE="' + flashMovie + '">'
			+ '<PARAM NAME="PLAY" VALUE="true">'
			+ '<PARAM NAME="LOOP"'
			if (isLoop == true){
				strHTML += ' VALUE="true"'
			}else{
				strHTML += ' VALUE="false"'
			}
			strHTML += '">'
			+ '<PARAM NAME="QUALITY" VALUE="high">'
			+ '<PARAM NAME="MENU" VALUE="false">'
			+ '<EMBED SRC="'  + flashMovie + '"'
			+ ' WIDTH="'+ iwidth + '" HEIGHT="' + iheight +'" '
			+ ' PLAY="true"'
			if (isLoop == true){
			strHTML += ' LOOP="true"'
			}else{
			strHTML += ' LOOP="false"'
			}
			strHTML += 'QUALITY="high"'
			+ 'MENU="false"'
			+ 'TYPE="application/x-shockwave-flash"'
			+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
			+ '</EMBED>'
			+ '</OBJECT>';
		
		} else {
			
			// Insert alternate image
			var strHTML = '<IMG SRC="' + altImage + '" HEIGHT="' + iheight + '" WIDTH="' + iwidth +'">'	+ '<BR>';
		}
		
		
if(debugState == true){
	alert(strHTML);
}
	
return strHTML;

}

// ** Call Flash Detection
detectFlashPlugin();


// -->








