//***CodePage***

//Internal javscript below

var requiredVersion = 5;   
var useRedirect = false; 

// System globals
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var maxVersion = 6;
var actualVersion = 0;
var hasRightVersion = false;

// Netscape Navigator Resize Fix
var oldHeight;
var oldWidth;
oldHeight = window.outerHeight;
oldWidth = window.outerWidth;

//detect os
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

//detect browser
var appVer = navigator.appVersion.toLowerCase();
var iePos  = appVer.indexOf('msie');
var isIE = (iePos !=-1) ? true : false
var isNS =  (navigator.appName == "Netscape") ? true : false

//if IE detect version
if (isIE) {
	is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
	is_major = parseInt(is_minor);	
}

var isDhtmlNav = (isIE && isWin && (iePos !=-1) && is_minor >= 5) ? true : false
var isDynamicTable = (isNS) ? true : false
var isReloadOnResize = (isNS) ? true : false

jsVersion = 1.1;

if(isIE && isWin){
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('</SCRIPT\> \n'); 
}

//func_flash
/*
Tridion

This function embeds an flash if the user has flash or else it shows a gif.
The function needs to be included on every page that uses flash

*/

function placeFlash(flashFile, alternateFile, fileWidth, fileHeight, alternateLink, altText){
	
	detectFlash(); //detect Flash version
	
	if(hasRightVersion) {  // if we've detected an acceptable version
	    var oeTags = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
		+ 'codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=3,0,0,0" '
		+ 'ID=three_tier '
		+ 'WIDTH="' + fileWidth + '" HEIGHT="' + fileHeight + '" >'
		+ '<PARAM NAME=MOVIE VALUE="' + flashFile + '">'
		+ '<PARAM NAME=quality VALUE=high>'
		+ '<PARAM NAME=bgcolor VALUE=white>'
		+ '<PARAM NAME=menu VALUE=>'
		+ '<PARAM NAME=wmode value=transparent>'
		+ '<EMBED SRC="' + flashFile + '" '
		+ 'swLiveConnect=FALSE '
		+ 'WIDTH="' + fileWidth + '" HEIGHT="' + fileHeight + '" '
		+ 'QUALITY=autohigh '
		+ 'BGCOLOR=white '
		+ 'TYPE="application/x-shockwave-flash" '
		+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
		+ '</EMBED>'
		+ '</OBJECT>';
		
	    document.write(oeTags); 
	  } else {
		if(alternateLink != ""){
			    var alternateContent = '<a href="' + alternateLink + '"><img src="' + alternateFile + '" width="' + fileWidth + '" height="' + fileHeight + '" alt="" border="0"></a>'
		}
		else{
			    var alternateContent = '<img src="' + alternateFile + '" width="' + fileWidth + '" height="' + fileHeight + '" alt="" border="0" usemap="#mapmap">'
		}
	    document.write(alternateContent); 
	}
}	


function detectFlash() {  
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      
      var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
     
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion >= 6;
    }
  }
  
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  
	
  if (actualVersion >= requiredVersion) {
    hasRightVersion = true;                
  }
}

// open pop-up windows function
function popup(url){
	if (navigator.appName == 'Netscape'){
		window.open(url,'windowName','width=544,height=380,toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes');
	}
	else{
		window.open(url,'Title', 'scrollbars, width=544, height=380, resizable, toolbar');
	}
}