//This Javascript has code that checks the browser and java versions 
//installed on a clients machine.
//
//
//
//*************************************************************
//
//Date         Version          Author          Description
//??????????   1.00             KAZ             Original
//24/04/2004   1.01             KAZ             Changed the way that it checks for the minimuim verion
//												of java in _csi_isJavaInstalledForNetscape.
//26/05/2004   1.02				KAZ				Changed _csi_isJavaInstalledForNetscape to only call compareVersion
//												only if a jre is installed to prevent runtime error if no jre exists.
//
//19/07/2005   1.03				NV				Due to the way that the applet now works, the displayInstallationPage()
//												function has been modified.											
//												Altered the size of the applet when it appears in the browser, as all
//												that will be loaded is a button and so the size does not need
//												to be extraordinarily large.
//												Value of _csiCIA_End changed to 01. This value is used to toggle on a new set of 
//												messages that CDIA will display once Digital Certificate Installation has finished.
//
//09/08/2004   1.03             KAZ             Do not display redirect message if we redirect to RedirectOriginal
//
//28/09/2004   1.04				NV				Altered the method _csi_isNetscape7(), to allow the <APPLET> tag to 
//						 						be rendered for all versions of Netscape, not just 7.1
//
//22/10/2004   1.05				NV				Changed the IE Java check.
//
//26/10/2004   1.06				NV				Changed the Netscape Java Check and the way the applet is rendered under Netscape
//
//08/02/2005   1.07             KAZ             Applet tag for other browsers whichwill include FireFox Browser
//
//23/03/2005	1.08			KAZ				Added Code and Parameters for Feedbackform
//												Added correct Feedback form URL
//
//12/12/2005	1.09			KAZ				Added Vunerability Parameter
//
//14/08/2007	1.10			NV				Added checks for the CSI plugin and altered applet rendering so it uses the plugin
//

//12/06/2008 1.11 PL Added Skip's mod for _csi_isJavaInstalledForNetscape. OS compatibility.												

// Client Javascript functions to support BAF CSI.

// This version uses an indirect method of calling an applet that 
// is supported by both Microsoft and Netscape.

// The indirect method works by having javascript modify certain
// variables that are monitored by the the applet. Once the last
// key variable is set, the applet processes these variables and
// then runs a javascript call back function.


//======================================================================
// Constants for integrating with the CSI Applet.
// THESE VALUES MUST NOT BE CHANGED.


// The following constants are used by scripts that cannot do javascript to java communication.
var _csi_codeBase;


// Constants used for CSI installation.
// Note: The ^ character is replaced by new line characters in the javascript and java message boxes
var _csi_INSTALL_REDIRECTION_MESSAGE = "The CSI is not installed on this computer or is out of date.^";
	_csi_INSTALL_REDIRECTION_MESSAGE += "You will now be re-directed to install the latest version of this software.^";
	_csi_INSTALL_REDIRECTION_MESSAGE += "You can use our program when you have this installed.";

var _csi_CSIHTTP_INSTALL_PAGE = "./CDInstallJavaCSI.htm";
var _csi_CSICD_INSTALL_PAGE = "./CDInstallJavaCSI.htm";

var _csi_CSI_INSTALL_PAGE = "./CDInstallJavaCSI.htm"
var _csiCIA_NetscapeJavaVersion = "";
var _minJavaPluginVersion = "1.4.1_02";

//Valid values are DEV TEST PROD
var _csiCIA_Env = "PROD:01"; // Orig val 02

var _isJavaProblem = false; // True = Incorrect Java version etc, false otherwise

var _FEEDBACK_SITE = "https://pki.ato.gov.au/atoFeedbackForm/Feedback_Form.html"; //// Site Address which will be used for feedback form

var _feedbackToggle = false; ////Toggles feedback form on and off

// Constants for checking/using the CSI Plugin
var _csi_CSI_PLUGIN_MIME_TYPE_MOZILLA 	= "application/x-AuGovCsiPlugin"; 		// Mozilla MIME type for the CSI Plugin
var _csi_CSI_PLUGIN_PLID_MOZILLA	= "@csi.business.gov.au/CsiPlugin";		// The PLID for Mozilla CSI Plugin
var _csi_CSI_PLUGIN_CLASSID 		= "clsid:FEAD952B-CEED-4b17-A8D2-2DCD0DF96271"; // Class ID for IE CSI Plugin
var _csi_CSI_PLUGIN_INSTALLED_IE 	= "CsiPlugin.isInstalled"; 			// Class ID name for checking if IE CSI Plugin installed


function _csi_isCsiPluginInstalledForIE()
{
    // Immediately return false if the Browser isn't IE.
    if (!_csi_isIe())
  	    return false;

	var csiInstalled = false;

	// try/catch is available in IE5+, Mozilla 1.0, and Netscape 6.
	try
	{
		var tempObject = new ActiveXObject(_csi_CSI_PLUGIN_INSTALLED_IE);
		delete (tempObject);
		tempObject = null;
		csiInstalled = true;
	}
	catch(err)
	{
		// No need to do anything
	}

	return csiInstalled;
}

/***************************************************************************
 *
 * Determines whether the CSI Plugin is installed on this machine. The plugin
 * is available in CSI v3.1 onwards and replaces the Java plugin. This
 * function is specific for Mozilla-based browsers.
 *
 * @return  true if CSI Plugin is installed and enabled for this Mozilla
 *          based browser, false otherwise.
***************************************************************************/
function _csi_isCsiPluginInstalledForMozilla()
{
    // Immediately return false if this is IE.
    // todo: Check what happens for IE on Mac.
    if (_csi_isIe())
  	    return false;

    // Refresh plugins state. 'false' is so we don't reload or activate them
  	navigator.plugins.refresh(false);

  	var installedMimeTypes = window.navigator.mimeTypes;
  	var csiInstalled = false;

	// sanity checks
	if (!installedMimeTypes || !installedMimeTypes.length || installedMimeTypes.length <= 0)
		return false;

    // See if the browser handles this MIME type
    var csiMimePlugin = installedMimeTypes[_csi_CSI_PLUGIN_MIME_TYPE_MOZILLA];

  	// See if there is a plugin associated for the MIME type
	if (csiMimePlugin && csiMimePlugin.enabledPlugin)
	{
		// todo: Additional checks can be performed in here by querying
		// the plugin object. For now we assume that the existance of a
		// plugin for our MIME type is enough.
		csiInstalled = true;
	}

	return csiInstalled;
}

/***************************************************************************
 *
 * Returns true if the browser is internet explorer, false otherwise.
 ***************************************************************************/
function _csi_isInternetExplorer()
{
	return (navigator.appName.toLowerCase().indexOf("internet explorer") != -1);
}


/***************************************************************************
 *
 * Returns true if the browser is netscape 4, false otherwise.
 ***************************************************************************/
function _csi_isNetscape4()
{
	if (navigator.appName.toLowerCase().indexOf("netscape") != -1)
	{
		if (navigator.appVersion.charAt(0) == '4')
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}

/***************************************************************************
 *
 * Returns true if the browser is netscape 7, false otherwise.
 ***************************************************************************/
function _csi_isNetscape7()
{	
	if (navigator.userAgent.indexOf("Netscape") != -1)
	{
		return true;
	}
	else
	{
		return false;
	}
}
/***************************************************************************
 *
 * Checks if the minimuim java plugin is install on Netscape browser.
 *
 * @return	true if the plugin is installed, false otherwise.
 ***************************************************************************/

function _csi_isJavaInstalledForNetscape()
{
	var isJavaInstalled = false;

	for (var pluginIndex = 0; pluginIndex < navigator.plugins.length; pluginIndex++)
	{
		var thePlugin = navigator.plugins[pluginIndex];
		for (var mimeTypeIndex = 0; mimeTypeIndex < thePlugin.length; mimeTypeIndex++)
		{
			if (_csi_isCorrectPluginType(thePlugin[mimeTypeIndex].type))
			{
				isJavaInstalled = true;
				break;
			}

			if (isJavaInstalled)
			{
				break;
			}
		}
	}

	return isJavaInstalled;
}

/**************************************************************************
 *
 * Checks if the plugin mime type is the version of the java plugin that we are
 * after.
 *
 * @return true if the plugin is the correct type.
 **************************************************************************/
function _csi_isCorrectPluginType(pluginType)
{
	if ((pluginType.indexOf("application/x-java-applet") == 0)
			&& (pluginType.indexOf("1.3.1") > -1))
	{
		return true;
	}
	else
	{
		return false;
	}
}

/**
* Transforms a version number from a String to an string array.
* @param   versionString A string representation.
*
* @return  An string array containing the version.
*/
function parseVersion(versionString)
{
	var version = new Array( );
	var dotCount = 0;


   	// count number of dots
   	for (var i = 0; i < versionString.length; i++)
   	{	    
		if ( (versionString.charAt(i) == ".") || (versionString.charAt(i) == "_") )
		{
			dotCount++;  
		}
   	}
   
   	var startIndex = 0;
   	var endIndex;
   	var endIndex2;
   	var subVersion;
   	var subversionIndex = 0;

	do
	{
		   endIndex = versionString.indexOf('.', startIndex) 
		  	
		   if (endIndex == -1)
		   {
			   endIndex = versionString.indexOf('_', startIndex)
 			   if (endIndex == -1)
		   	   {		
			   	endIndex = versionString.length;
			   }
		   }
		   subVersion = versionString.substring(startIndex, endIndex);
		   
		   version[subversionIndex] = parseInt(subVersion);
		  
		   startIndex = endIndex + 1;
		   subversionIndex++;
	}
	while (endIndex < versionString.length);

return version;

}

/**
* Compares the first version to the second version.
* @param firstVersion 	The first version number to compare with the second
* 						version number.
* @param secondVersion The second version number to compare with the first
* 						version number.
*
* @return The following values can be returned:
*      0 if the first version is less than the second version or they are equal.
*      -1 if the first version is greater than the second version.
*/
function compareVersion(firstVersion, secondVersion)
{
   	
   var minSize;

   minSize = Math.min(firstVersion.length, secondVersion.length);

   // Check each corresponding value from left to right.
   for (var i = 0; i < minSize; i++)
   {	
	
	   if (firstVersion[i] > secondVersion[i])
	   {
		   return -1;
	   }
	   else if (firstVersion[i] < secondVersion[i])
	   {
		   return 0;
	   }
	   else
	   {
		   // do nothing they are the same
	   }
   }

   // if one array is larger than the other then assume the larger is the
   // higher value.
   if (firstVersion.length > secondVersion.length)
   {
	   return -1;
   }
   else if (firstVersion.length < secondVersion.length)
   {
	   return 0;
   }
   else
   {
	   // they are exactly the same.
	   return 0;
   }

}   



/***************************************************************************
 *
 * Checks if the java plugin is install on Internet Explorer browser.
 *
 * @return	true if the plugin is installed, false otherwise.
 ***************************************************************************/
var _csi_isIeJavaInstalled;
function _csi_isJavaInstalledForIE()
{	

	try{
		document.applets[0].isAppletRunning();
	}
	catch (Exception)
	{
		return false;
	}

	return true;
}


/***************************************************************************
 *
 * Checks if the current operating system is an Apple Mac
 ***************************************************************************/
function _csi_isMac()
{
	return (navigator.userAgent.indexOf("Mac") > -1);
}


/***************************************************************************
 *
 * Checks if the current browser is Internet Explorer
 ***************************************************************************/
function _csi_isIe()
{
	return (navigator.appName.indexOf("Microsoft") > -1);
}


/***************************************************************************
 *
 * Creates the string used by javascript to open a new window.
 * @param	windowHeight	The height of the new window.
 * @param	windowWidth		The width of the new window.
 *
 * @return	The string used by javascript to open a new window.
 ***************************************************************************/
function _csi_createWindowParams(windowHeight, windowWidth)
{
	var windowTop = _csi_getWindowCentreTop(windowHeight);
	var windowLeft = _csi_getWindowCentreLeft(windowWidth);
	var windowParams = "height=" + windowHeight + ",width=" + windowWidth 
			+ ",screenX=" + windowLeft + ",screenY=" + windowTop 
			+ ",left=" + windowLeft + ",top=" + windowTop 
			+ ",status=no,directories=no,toolbar=no,menubar=no,location=no";

	return windowParams;
}


/***************************************************************************
 *
 * Finds to position that the top of the window must be for the window to be 
 * in the middle of the screen.
 * @param	windowHeight	The height of the new window.
 *
 * @return	Top position of the new window.
 ***************************************************************************/
function _csi_getWindowCentreTop(windowHeight)
{
	return (screen.height / 2) - (windowHeight / 2);
}


/***************************************************************************
 *
 * Finds to position that the left of the window must be for the window to be 
 * in the middle of the screen.
 * @param	windowWidth		The width of the new window.
 *
 * @return	Left position of the new window.
 ***************************************************************************/
function _csi_getWindowCentreLeft(windowWidth)
{
	return (screen.width / 2) - (windowWidth / 2);
}


/***************************************************************************
 * if the url protocal is file then we are running the CD version
 ***************************************************************************/
function _csi_setupCSIInstallation()
{
	if (window.location.protocol == "file:")
	{
		_csi_CSI_INSTALL_PAGE = _csi_CSICD_INSTALL_PAGE;
	}
	else
	{
		_csi_CSI_INSTALL_PAGE = _csi_CSIHTTP_INSTALL_PAGE;
	}
	return true;
}


///////////////////////////////////////////////////////////////////////////////////
/////			The following functions are the only functions 			/////
/////			to be called by the application developer				/////
///////////////////////////////////////////////////////////////////////////////////


/***************************************************************************
 *
 * Checks if the java plugin is installed. If it is not then the user
 * will be redirected to the CSI install page.
 *
 * NB: Edited by James Newell 30/03/2007 v3.2.0
 * This function now checks if the CSI Plugin is installed and will 'pass'
 * if either the Java or CSI Plugin is installed.
 ***************************************************************************/
function checkForJavaPlugin()
{
	var isJavaInstalled = false;

	if (_csi_isMac())
	{
		// Do nothing java is always installed on Mac osX (which is the only version of Mac we support).
		// v3.2.0: Don't check for CSI Plugin either as no support for this on Mac.
		return;
	}

	if (_csi_isIe())
	{
		// N.B.: Check for the CSI Plugin before the Java Plugin because we prefer the CSI Plugin
		isJavaInstalled = _csi_isCsiPluginInstalledForIE() || _csi_isJavaInstalledForIE();
	}
	else
	{
		// N.B.: Check for the CSI Plugin before the Java Plugin because we prefer the CSI Plugin
		isJavaInstalled = _csi_isCsiPluginInstalledForMozilla() || _csi_isJavaInstalledForNetscape();
	}

	if (isJavaInstalled == false)
	{
		var message;

		// replace the ^ character with new line characters.
		message = _csi_INSTALL_REDIRECTION_MESSAGE.replace(/\^/g, '\n');
		alert(message);
		window.location.href = _csi_CSI_INSTALL_PAGE;
	}
}

function displayInstallationPage()
{
	var message;

	_isJavaProblem = true; // If we reach the call to this function then something is wrong with Java on the user's computer

	// replace the ^ character with new line characters.
	message = _csi_INSTALL_REDIRECTION_MESSAGE.replace(/\^/g, '\n');
	alert(message);
	window.open(_csi_CSI_INSTALL_PAGE, "CSI_INSTALL_WINDOW");
	//window.location.href = "./DummyPage.htm";			
	//window.close();
}

function getCDIAParameter()
{
	if (window.location.href.indexOf("Type=Download")>-1)
	{
		return "Download";
	}

	if (window.location.href.indexOf("Type=Import")>-1)
	{
		return "Import";
	}
	return "Type Error";

}

// Altered version of getCDIAParameter() that will be used because of the new way the applet is loaded
function altFuncGetCDIAParameter()
{
	var type = getType();
	
	if (type == "Download")
		return "Download";
	else if (type == "Import")
		return "Import";
	
	return "Type Error";
}

function jarFileName()
{

	if (window.location.href.indexOf("?SSL=true")>-1)
	{
		return "sslCDIAApplet.jar";
	}
	else
	{
		return "CDIAApplet.jar";
	}
	
}

// Altered version of jarFileName() that will be used because of the new way the applet is loaded
function altFuncJarFileName()
{
	return "sslCDIAApplet.jar";
}


function getCDIACertDir()
{
	return	'E579CBFBC8F8D6B0';
}

function getCDIACertFileName()
{
	return	'0000000835_20030908_B.p12';
}


function feedbackToggle()
{

	return _feedbackToggle;

}



/***************************************************************************
 *
 * Called by inline script in the form as it is rendered to dynamically
 * bound the applet. The only real reason for doing this is to keep this
 * code out of the framework and have it here in this central location.
 * @codeBase	The directory where the applet jar can be found.
 ***************************************************************************/
function renderCsiApplet(codeBase)
{
	_csi_setupCSIInstallation();

	_csi_codeBase = codeBase;

	var appletHtml = "";

	if (_csi_isMac())
	{
		appletHtml += '<APPLET 	width="0"																'; // Used to be 800
		appletHtml += '			height="0"																'; // Used to be 530
		appletHtml += '			align="baseline"															';
		appletHtml += '			codebase="' + codeBase + '"													';
 	      appletHtml += '			mayscript="true"																	';
		appletHtml += '			code="au.gov.ato.certificateimport.csi.main.ImportApplet"					';
		appletHtml += '			archive="sslCDIAApplet.jar">												';
		appletHtml += '	<PARAM NAME="archive"  VALUE="sslCDIAApplet.jar">									';
		appletHtml += '	<PARAM NAME="code"     VALUE="au.gov.ato.certificateimport.csi.main.ImportApplet">	';
		appletHtml += '	<PARAM NAME="type"     VALUE="application/x-java-applet;version="' + _minJavaPluginVersion +'">				';
		appletHtml += '	<PARAM NAME="install_redirection_message" VALUE="' + _csi_INSTALL_REDIRECTION_MESSAGE +'">';
		appletHtml += '	<PARAM NAME="csi_install_page" 		VALUE="' + _csi_CSI_INSTALL_PAGE + '">			';
		appletHtml += '	<PARAM NAME="PROCESSTYPE" 	VALUE="' + altFuncGetCDIAParameter() + '">			';
		appletHtml += '	<PARAM NAME="ENV" 		VALUE="' + _csiCIA_Env  + '">			';
		appletHtml += '	<PARAM NAME="BROWSER" 		VALUE="MAC">			';
		appletHtml += '	<PARAM NAME="VUNERABILITY" 	VALUE="TRUE">			';
		appletHtml += ' <PARAM NAME="FEEDBACK"		VALUE="' + feedbackToggle() + '">			';
		appletHtml += ' <PARAM NAME="FEEDBACKSITE"		VALUE="' + _FEEDBACK_SITE + '">			';
		appletHtml += '</APPLET>																			';

	}
	else if (_csi_isIe())
	{
		if (_csi_isCsiPluginInstalledForIE())
		    appletHtml += '<OBJECT	classid="' + _csi_CSI_PLUGIN_CLASSID + '"								';
		else
		    appletHtml += '<OBJECT	classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"';
		appletHtml += '			width="0"																'; // Used to be 100%
		appletHtml += '			height="0"																'; // Used to be 530
		appletHtml += '			align="top"																	';
		appletHtml += '			name="csi_applet"															';
		appletHtml += '			mayscript="true">															';
	 	appletHtml += '	<PARAM NAME="codebase" VALUE="' + codeBase + '">									';
		appletHtml += '	<PARAM NAME="archive"  VALUE="' + altFuncJarFileName()   + '">									';
		appletHtml += '	<PARAM NAME="code"     VALUE="au.gov.ato.certificateimport.csi.main.ImportApplet">	';
//		appletHtml += '	<PARAM NAME="type"     VALUE="application/x-java-applet;version="' + _minJavaPluginVersion +'">				';
		appletHtml += '	<PARAM NAME="type"     VALUE="application/x-java-applet;version=1.3">				';
		appletHtml += '	<PARAM NAME="install_redirection_message" VALUE="' + _csi_INSTALL_REDIRECTION_MESSAGE +'">';
		appletHtml += '	<PARAM NAME="csi_install_page" 		VALUE="' + _csi_CSI_INSTALL_PAGE + '">			';
		appletHtml += '	<PARAM NAME="PROCESSTYPE" 	VALUE="' + altFuncGetCDIAParameter() + '">			';
		appletHtml += '	<PARAM NAME="ENV" 		VALUE="' + _csiCIA_Env  + '">			';
		appletHtml += '	<PARAM NAME="BROWSER" 		VALUE="IE">			';
		appletHtml += '	<PARAM NAME="VUNERABILITY" 	VALUE="TRUE">			';
		appletHtml += ' <PARAM NAME="FEEDBACK"		VALUE="' + feedbackToggle() + '">			';
		appletHtml += ' <PARAM NAME="FEEDBACKSITE"		VALUE="' + _FEEDBACK_SITE + '">			';
		appletHtml += '</OBJECT>																					';
	}
	else if (_csi_isNetscape7())
	{
		//if (_csi_isJavaInstalledForNetscape()== true)
		//{
			appletHtml += '<APPLET	width="100"																'; // Used to be 100%
			appletHtml += '			height="70"																'; // Used to be 530
			appletHtml += '			align="baseline"															';
			appletHtml += '			name="csi_applet"															';
			appletHtml += '			mayscript="true"															';
			appletHtml += '			codebase="' + codeBase + '"													';
			appletHtml += '			archive=="' + altFuncJarFileName()   + '"												';
			appletHtml += '			code="au.gov.ato.certificateimport.csi.main.ImportApplet">					';
			appletHtml += '	<PARAM NAME="archive"  VALUE="' + altFuncJarFileName()   + '">									';
			appletHtml += '	<PARAM NAME="code"     VALUE="au.gov.ato.certificateimport.csi.main.ImportApplet">	';
			appletHtml += '	<PARAM NAME="type"     VALUE="application/x-java-applet;version="' + _minJavaPluginVersion +'">				';
			appletHtml += '	<PARAM NAME="install_redirection_message" VALUE="' + _csi_INSTALL_REDIRECTION_MESSAGE +'">';
			appletHtml += '	<PARAM NAME="csi_install_page" 		VALUE="' + _csi_CSI_INSTALL_PAGE + '">			';
			appletHtml += '	<PARAM NAME="PROCESSTYPE" 	VALUE="' + altFuncGetCDIAParameter() + '">			';
			appletHtml += '	<PARAM NAME="ENV" 		VALUE="' + _csiCIA_Env  + '">			';
			appletHtml += '	<PARAM NAME="BROWSER" 		VALUE="Netscape">			';
			appletHtml += '	<PARAM NAME="VUNERABILITY" 	VALUE="TRUE">			';
			appletHtml += ' <PARAM NAME="FEEDBACK"		VALUE="' + feedbackToggle() + '">			';
			appletHtml += ' <PARAM NAME="FEEDBACKSITE"		VALUE="' + _FEEDBACK_SITE + '">			';
			appletHtml += '</APPLET>																			';
		//}
	}
	else 
	{
			 if(_csi_isCsiPluginInstalledForMozilla())
    	    {
    	        appletHtml += '<embed   type="' 			+ _csi_CSI_PLUGIN_MIME_TYPE_MOZILLA + '"                                                     ';
    	        appletHtml += '		height=				"0"																			';
		        appletHtml += '		width=				"0"																			';
    	        appletHtml += '		align=				"baseline"																	';
    	        appletHtml += '		name=				"csi_applet"																	';
    	        appletHtml += '		mayscript=				"true"																	';
    	        appletHtml += '		codebase="' 			+ codeBase + '"													';
    	        
    	        appletHtml += '		archive=			"sslCDIAApplet.jar"																';
    	       // appletHtml += '		archive=			"../../eclipse-SDK-3.2-win32.zip"																';

    	        appletHtml += '		code=				"au.gov.ato.certificateimport.csi.main.ImportApplet"											';
    	        appletHtml += '	        install_redirection_message="'  + _csi_INSTALL_REDIRECTION_MESSAGE + '"           	';
    	        appletHtml += '	        csi_install_page="'             + _csi_CSI_INSTALL_PAGE + '"	    				';
    	        appletHtml += '	        PROCESSTYPE="'              + altFuncGetCDIAParameter() + '"	    	    			';
    	        appletHtml += '	        ENV="'            + _csiCIA_Env + '"				        	';
    	        appletHtml += '	        BROWSER="Other"				    	';
    	        appletHtml += '		VUNERABILITY="TRUE"				';
    	        appletHtml += '	        FEEDBACK="'            + feedbackToggle() + '"				        	';
    	        appletHtml += '	        FEEDBACKSITE="'            + _FEEDBACK_SITE + '"				        	';
    	        appletHtml += '>                                                                                            ';
    	        appletHtml += '</embed>                                                                                     ';
    	    }
    	    else // Mozilla but no CSI Plugin
    	    {
    	        appletHtml += '<APPLET 	width="0"																			';
    	        appletHtml += '			height="0"																			';
    	        appletHtml += '			align="baseline"																	';
    	        appletHtml += '			name="csi_applet"																	';
    	        appletHtml += '			mayscript="true"																	';
    	        appletHtml += '			codebase="' + codeBase + '"													';
    	        appletHtml += '			archive="sslCDIAApplet.jar"																';
    	        appletHtml += '			code="au.gov.ato.certificateimport.csi.main.ImportApplet">											';
    	        appletHtml += '	<PARAM NAME="install_redirection_message" VALUE="' + _csi_INSTALL_REDIRECTION_MESSAGE + '">	';
    	        appletHtml += '	<PARAM NAME="csi_install_page" 		VALUE="' + _csi_CSI_INSTALL_PAGE + '">					';
				appletHtml += '	<PARAM NAME="PROCESSTYPE" 	VALUE="' + altFuncGetCDIAParameter() + '">			';
				appletHtml += '	<PARAM NAME="ENV" 		VALUE="' + _csiCIA_Env  + '">			';
				appletHtml += '	<PARAM NAME="BROWSER" 		VALUE="Netscape">			';
				appletHtml += '	<PARAM NAME="VUNERABILITY" 	VALUE="TRUE">			';
				appletHtml += ' <PARAM NAME="FEEDBACK"		VALUE="' + feedbackToggle() + '">			';
				appletHtml += ' <PARAM NAME="FEEDBACKSITE"		VALUE="' + _FEEDBACK_SITE + '">			';
    	        appletHtml += '</APPLET>';
    	    }
	}


	document.writeln(appletHtml);
}

