
/************** Flash Electro-Filter Version 1.2
 Copyright:  RazorX.com (c) 2003, 2004.
 **User Rights: Permission is granted for anyone to use this code as long as this entire notice
   area is kept intact. Keeping this notice intact, also provides important info for other web
   developers who grab this script from their cache. In order to maintain a fast loading script,
   please read all rights, legal agreements, disclaimers, and setup files located at: RazorX.com.  
 **Code function: Detect for Flash player, then redirect only if lower or no version is detected.
 **Browser Design: Use for any browser version 4 or better. I have found that it is no longer
   worth the trouble to develop for browser versions of 3 or less, and it is more logical, based
   on current times, to force users to upgrade old browsers; for this, use the force old browsers
   script from RazorX.com.  
 **Code use: Copy the line below, also called  "sourcing in", to each page you need detection on
   or just your main or home page if everyone is entering in from that direction.
   <script type="text/javascript" language="javascript" src="/full_flash_ef.js"></script>  Then copy
   the .js file into your main or root directory. It's usually easier to use a /root-relative address.   
**************/

/// Start of set-up area...
/// Personalize the notice pages with your web address. Do not include the http:// protocol.
var web_SITE = ""; /// Don't add www. unless your site doesn't work without it.

/// Important note: if the min. version is met there will be no redirect; the visitor will stay on the page.
/// Any Flash player in an operating system beyond Macintosh or Linux, will be defaulted to the Windows ver. needed.
/// Here we are implementing out-of-sync. ability, because not all Flash players for each operating system get released at
/// the same time. Check for various Flash versions here: http://www.macromedia.com/shockwave/download/alternates/
var min_major_win_FLASH = 6; /// Minimum major Windows based Flash player ver. needed for your Flash site: 4, 5, 6, 7, etc.
var min_major_mac_FLASH = 6; /// Minimum major Macintosh based Flash player ver. needed for your Flash site: 4, 5, 6, 7, etc.
var min_major_linux_FLASH = 6; /// Minimum major Linux based Flash player ver. needed for your Flash site: 4, 5, 6, 7, etc.

/// Note: This area is for advanced Flashers who need to verify minor versions for ActionScript compatibility.
/// Macromedia also calls the minor version a release version. Either usage is correct and we use minor here.
/// Also, checking for minor versions ONLY works for Netscape based browswers and will not work in I.E.
var check_minor_FLASH = "off"; /// Leave "off" for default or "on" to check for minor Flash versions.
/// Note: If check_minor_FLASH is set to "on", it will still be ignored when I.E. browsers are detected.

/// Any Flash player in an operating system beyond Macintosh or Linux, will be defaulted to the Windows ver. needed.
var min_minor_win_FLASH = 0; /// Leave as "0" for default. Minimum minor Windows based Flash player version required.   
var min_minor_mac_FLASH = 0; /// Leave as "0" for default. Minimum minor Macintosh based Flash player version required.
var min_minor_linux_FLASH = 0; /// Leave as "0" for default. Minimum minor Linux based Flash player version required.
/// Minor ver. examples: Flash player 5: 30,41,42. Flash player 6: 21,23,29,47,65,79,81. Flash player 7: 2,14,19. 

/// If the mandatory_FLASH flag is set to "off" then the visitor will only be sent to the location in
/// redirect_nonflash_HTML if a Flash player is NOT found or if the Flash player is less than the
/// min_major_FLASH. Essentially the redirect_nonflash_HTML page can be a close copy of your Flash site. 
var mandatory_FLASH = "off"; /// Leave "on" for default or "off" for an HTML page if no or lesser Flash detected.
var redirect_nonflash_HTML = "index.asp?noflash=1"; /// This redirect only works if mandatory_FLASH is "off".

/// For the redirect locations use root-relative addressing and is much easier to work
/// with than having to put copies in each directory. You could also use absolute URLs.
var redirect_upgrade_FLASH = "upgrade_flash_en.htm"; /// Location to upgrade Flash player notice page.
var redirect_no_FLASH = "no_flash_en.htm"; /// Location of your no Flash found notice page.

/// Detect for WebTV because they have Flash players in them, but are usually older versions.
/// For example: Currently an MSN-WebTV version of 2.8 for Windows only supports a Flash 4 player.
/// AOLTV used to support Flash player 3, while MSN-WebTV versions 2.2 or less had no Flash player support.
var redirect_any_WEBTV = "webtv_en.htm"; /// Location of your WEBTV page.

/// Browser language detection. Use this area ONLY if your site supports multiple languages.
/// Turning "on" any lang_detect_XX will add the lanaguage code to the end of the redirect file.
/// Example: upgrade_flash_en.htm would be changed to upgrade_flash_de.htm if German detect was "on".
var lang_default = "en"; /// Default language is "en" for English. You do not have to have lang_detect_EN
///  turned "on". This option would be for other countries who want to serve the English page version.
var lang_detect_CS = "off"; /// Leave as "off" for default or "on" to detect for Czech language.
var lang_detect_DE = "off"; /// Leave as "off" for default or "on" to detect for German language.
var lang_detect_EN = "off"; /// Leave as "off" for default or "on" to detect for English language.
var lang_detect_ES = "off"; /// Leave as "off" for default or "on" to detect for Spanish language. 
var lang_detect_FR = "off"; /// Leave as "off" for default or "on" to detect for French language.
var lang_detect_JA = "off"; /// Leave as "off" for default or "on" to detect for Japanese language.
var lang_detect_RO = "off"; /// Leave as "off" for default or "on" to detect for Romanian language.  
var lang_detect_RU = "off"; /// Leave as "off" for default or "on" to detect for Russian language. 
var lang_detect_SV = "off"; /// Leave as "off" for default or "on" to detect for Swedish language.
var lang_detect_ZH = "off"; /// Leave as "off" for default or "on" to detect for Chinese language.

/// End of set-up area...
/// WARNING - No need to configure or change anything below this line. You shouldn't have to update
/// any of the JavaScript below. The global variables from the set-up area above are used below.
////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////// Begin detection ///////////////////////////////////////////////////////////
var min_major_FLASH = 0; /// Set initial variable values to zero.
var min_minor_FLASH = 0; 
var flash_major_VER = 0; 
var flash_minor_VER = false; /// Set initial variable value to false.
var final_IE = 0; /// Set initial variable value to zero.

var user_AGENT = navigator.userAgent.toLowerCase(); /// Browser ver. type and op sys.
/// Note: Support for AOLTV is no longer - AOL shut down it's AOLTV service on November 30, 2003.
//JH added 3/20/07
//alert(user_AGENT);
//document.cookie = 'accbrowser'=escape(user_AGENT);
//Set_Cookie('accbrowser',user_AGENT);

/// Note: MSNTV was formally called WebTV renamed in July 2001 to MSNTV. This service is still active.					
var detect_MSNTV = ((user_AGENT.indexOf("webtv") != -1) || (user_AGENT.indexOf("msntv") != -1));


var detect_IE = ((user_AGENT.indexOf("msie") != -1) && (user_AGENT.indexOf("opera") == -1)
                && (user_AGENT.indexOf("netscape") == -1) && (detect_MSNTV == false));
				  
if(detect_IE) { final_IE = parseFloat(user_AGENT.substring(4+user_AGENT.indexOf("msie"))) }

var detect_LINUX = (user_AGENT.indexOf("linux") != -1);
				  
/// Version of I.E. of 4.5 or less on Macintosh cannot handle VBscript, and therefore no client-side
/// detection will work according to Macromedia. We also do not want to write the VBscript to them as
/// it will produce an error message pop-up. So we let them pass through hoping that they have a
/// Flash Player installed. 
var MAC_IE_4pt5 = false; /// Set to false. Variable changes to true if MAC and I.E. 4.5 or less is detected.				  
var detect_MAC = ((user_AGENT.indexOf("mac") != -1) || (user_AGENT.indexOf("macintosh") != -1)
                  || (user_AGENT.indexOf("68k") != -1) || (user_AGENT.indexOf("68000") != -1) 
				  || (user_AGENT.indexOf("ppc") != -1) || (user_AGENT.indexOf("powerpc") != -1));				  

 if (detect_MAC && final_IE <= 4.5) { MAC_IE_4pt5 = true; }

/// Now we write VBScript to I.E. and loop through until we find the Flash major version. The Flash minor
/// version is not contained in the flash.ocx and therfore the minor version cannot be detected in I.E.				  
 if (detect_IE && MAC_IE_4pt5 == false)
    {
      document.write(
       '<scr' + 'ipt type=text\/vbscript language=vbscript>' + '\n' +
       'Dim have_PLAYER, flash_PLAYER' + '\n' +
       'have_PLAYER = false' + '\n' +
       'flash_PLAYER = 20' + '\n' +
       'Do While flash_PLAYER > 0' + '\n' +
            'On Error Resume Next' + '\n' +
            'have_PLAYER = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flash_PLAYER)))' + '\n' +
            'If have_PLAYER = true Then Exit Do' + '\n' +
            'flash_PLAYER = flash_PLAYER - 1' + '\n' +
       'Loop' + '\n' +
       'flash_major_VER = flash_PLAYER' + '\n' +
       '<\/sc' + 'ript>'
       );
    }

//////////////////// Begin Mozilla/Netscape type detection ////////////////////////////////
///Here we detect with mimeTypes property instead of the plugins property unlike most flash detection
///schemes on the Web. A little known bug in Netscape Navigator 4.x can cause the plugins property
///to fail to expand out or work as needed, the mimeTypes property doesn't have this problem.
var flash_MIME = (navigator.mimeTypes &&
                  navigator.mimeTypes["application/x-shockwave-flash"])
	              ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
    
 if (flash_MIME)
    {
    var flash_major_VER = parseInt(flash_MIME.description.substring(flash_MIME.description.indexOf(".")-1))
/// Note: The minor version check only works in Netscape based browsers. Minor checks are ignored for I.E.	 
	var flash_minor_VER = parseInt(flash_MIME.description.substring(2+flash_MIME.description.indexOf("r")-1))
	}
	
/// Flash player will still be zero for Mac I.E. 4.5 unless we change it here, and we need to let them pass
/// through, as if they had a Flash player, so they don't get redirected to the No Flash Found screen. 	
	if (MAC_IE_4pt5) { flash_major_VER = 100; flash_minor_VER = 100; }
	if (detect_IE && MAC_IE_4pt5 == false) { flash_minor_VER = 0; }
	if (flash_minor_VER == false) { flash_minor_VER = 0; }
	
/// Here we synthesize the final major and minor Flash player required based on the operating system detected.
	if (detect_MAC) { min_major_FLASH = min_major_mac_FLASH; min_minor_FLASH = min_minor_mac_FLASH }
	else if (detect_LINUX) { min_major_FLASH = min_major_linux_FLASH; min_minor_FLASH = min_minor_linux_FLASH }
	else { min_major_FLASH = min_major_win_FLASH; min_minor_FLASH = min_minor_win_FLASH }
	
	
/// Double check for any user set-up typos in our FLASH flags; check order is based on defaults.
 if ( mandatory_FLASH != "off" ) { mandatory_FLASH = "on" }
 if ( mandatory_FLASH != "on" ) { mandatory_FLASH = "off" }
 
 if ( check_minor_FLASH != "on" ) { check_minor_FLASH = "off" }
 if ( check_minor_FLASH != "off" ) { check_minor_FLASH = "on" }


/// Query string info tack. This part appends the user's flash info and required info to the redirect URL.
var final_req_major_VER = min_major_FLASH;  /// Need a seperate variable for next line if majors are equal but minor is different.
if (flash_major_VER == min_major_FLASH  &&  flash_minor_VER < min_minor_FLASH ) { final_req_major_VER = min_major_FLASH+"0"+min_minor_FLASH };

var value_string = new String ("?usrmjr="+flash_major_VER+"&usrmnr="+flash_minor_VER+"&reqmjr="+final_req_major_VER+"&reqmnr="+min_minor_FLASH+"&chkmnr="+check_minor_FLASH+"&ws="+web_SITE+" "); /// Keep two quotes on end.
var qry_str = value_string.replace(/ /g,""); /// Remove any spaces globally.

//// Browser language detection
var check_lang = false;
var brow_lang = new String(); /// Nothing as default.
if (navigator.language) { brow_lang = navigator.language; } /// For Netscape based.
if (navigator.systemLanguage) { brow_lang = navigator.systemLanguage; }  /// For Web TV.
if (navigator.browserLanguage) { brow_lang = navigator.browserLanguage; } /// For IE.
var brow_lang_final = brow_lang.substring(0,2);

  if (brow_lang_final != lang_default)
  {
   if (lang_detect_CS == "on") { check_lang = true; }
   if (lang_detect_DE == "on") { check_lang = true; }
   if (lang_detect_EN == "on") { check_lang = true; }
   if (lang_detect_ES == "on") { check_lang = true; }  
   if (lang_detect_FR == "on") { check_lang = true; }
   if (lang_detect_JA == "on") { check_lang = true; }
   if (lang_detect_RO == "on") { check_lang = true; }
   if (lang_detect_RU == "on") { check_lang = true; }
   if (lang_detect_SV == "on") { check_lang = true; }
   if (lang_detect_ZH == "on") { check_lang = true; }
  }


function lang_insert(rdrct,lngcd)
{
var rdrct_string = new String(rdrct)
  if ( rdrct_string.indexOf("_"+lang_default) ) {var rdrct_clean = rdrct_string.replace("_"+lang_default,""); }
  else { var rdrct_clean = rdrct_string }
var rdrct_string2 = new String(rdrct_clean);
var rdrct_splice = rdrct_string2.replace(/\./,"_"+lngcd+".");
return( rdrct_splice )
}


function master_ef_redirect()
{

///////////////////////////// Filter the results and redirect accordingly ///////////////////////////  
/// Catch WebTV based browsers and redirect them first as they have lesser Flash player versions.
 if ( detect_MSNTV )
     if ( check_lang == true ) { window.location.replace( lang_insert( redirect_any_WEBTV, brow_lang_final ) ); }
     else { window.location.replace( redirect_any_WEBTV ); }
	 
/// Use the replace() method to prevent history trapping and use of the back button if needed.
/// Note: the replace() method only works for NS 3 or better and IE 4 or better, but you should
/// already be forcing major browsers of 3 or less to an upgrade link instead of accommodating them.
 if ( mandatory_FLASH == "off"  &&  flash_major_VER < min_major_FLASH  )
      { 
      if ( check_lang == true ) { window.location.replace( lang_insert( redirect_nonflash_HTML, brow_lang_final ) ); }
      else { window.location.replace( redirect_nonflash_HTML ); }
	  }
	 
 if ( mandatory_FLASH == "on"  &&  flash_major_VER == 0  )
      {
      if ( check_lang == true ) { window.location.replace( lang_insert( redirect_no_FLASH, brow_lang_final )+qry_str ); }
      else { window.location.replace( redirect_no_FLASH+qry_str ) ; }
	  }	 
 	 
 if ( mandatory_FLASH == "on"  &&  flash_major_VER != 0  &&  check_minor_FLASH == "on"  &&  flash_minor_VER != 0 )
    {	 
      if ( flash_major_VER < min_major_FLASH || ( flash_major_VER == min_major_FLASH  &&  flash_minor_VER < min_minor_FLASH ) )
	     {
	     if ( check_lang == true ) { window.location.replace( lang_insert( redirect_upgrade_FLASH, brow_lang_final )+qry_str ); }
         else { window.location.replace( redirect_upgrade_FLASH+qry_str ); }
		 } 	
     }
	 
 if ( mandatory_FLASH == "on"  &&  flash_major_VER != 0  &&  check_minor_FLASH == "on" &&  flash_minor_VER == 0 )
    {	 
      if ( flash_major_VER < min_major_FLASH )
	     {
	     if ( check_lang == true ) { window.location.replace( lang_insert( redirect_upgrade_FLASH, brow_lang_final )+qry_str ); }
         else { window.location.replace( redirect_upgrade_FLASH+qry_str ); }
		 } 	
     }
	 
 if ( mandatory_FLASH == "on"  &&  flash_major_VER != 0  &&  check_minor_FLASH == "off" )
    {	 
      if ( flash_major_VER < min_major_FLASH )
	     {
	     if ( check_lang == true ) { window.location.replace( lang_insert( redirect_upgrade_FLASH, brow_lang_final )+qry_str ); }
         else { window.location.replace( redirect_upgrade_FLASH+qry_str ); } 
		 }	
     }

 }
///Closing curly brace for master_ef_redirect function.
  	 	 
//////////////////////////////////////// BYPASS  Ability /////////////////////////////////////////////
///This ability allows a user to bypass or diregard any notice page and allows them to enter the site
///anyway. They may just want to see what the site is about before they upgrade their Flash player.
var firstfluri = String(window.location);
var fullflashuri = firstfluri.substring(7+firstfluri.indexOf("fullef="),13+firstfluri.indexOf("fullef="));

if (fullflashuri == "bypass") { firstfluri = ""; }
else { master_ef_redirect(); }
 	 	 
///End of script
