<!--
	//
	// v1.0.34.0    
	// Copyright (c) ArtistScope 1998-2004
	//
	// Checks to see if the plugin is installed and the latest version
	//
	// Supports 
	//	IE4+ 
	//	NS4+, NS6+
	//
	
	// Where to go if we do not support their browser/operating system
	var urlDownloadNo = "http://download.copysafe.net/Plugin/download-no.html";
	
	// Where to go to download the plugin
	var urlDownload =   "http://download.copysafe.net/Plugin/download.html";
	
	// OCX name
	var strOCXName = "COPYSAFE3.CopySafe3Ctrl.34";
	
	// Version Info - Edit these line to change the version
	
	// Netscape Plugin
	var verFull = "1.0.34.0";
	var ver1 = 1;
	var ver2 = 0;
	var ver3 = 34;
	var ver4 = 0;
	
	
	// Do NOT change any thing below
	var downloadURL=''
	var bolDebug = false;
	var lngOCXInstalled = 0;
	var agt=navigator.userAgent;
	var app=navigator.appName;
	  	
	// Write the code to call too check for the plugin 
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('\n');
	document.write('Dim objPlugin\n');
	document.write('lngOCXInstalled = false\n');   	
	document.write('Set objPlugin = CreateObject("COPYSAFE3.CopySafe3Ctrl.34")\n');
	document.write('If IsNull(objPlugin) or err <> 0 Then\n');
	document.write('	lngOCXInstalled = false\n');   	
	document.write('Else\n');
	document.write('	lngOCXInstalled = true\n');   	
	document.write('End if\n');
	document.write('Set objPlugin = Nothing\n');
	document.write('</SCRIPT\> \n');

  	checkIfPlugInIsInstalled();
  
//
// Check what operating systems and browser is used
//
function checkIfPlugInIsInstalled()
{

	
	if (bolDebug)
	{
		document.writeln("Start Check" + "<BR>"); 
		document.writeln("agt = " + agt + "<BR>"); 
		document.writeln("app = " + app + "<BR>"); 
	}
		
	// Check if running Windows
  if ((agt.indexOf("Win")!=-1)||(agt.indexOf("Windows")!=-1))
  {
		// Check if Netscape Browser
  	if (app.indexOf('Netscape') != -1)
	  {
		if (bolDebug) document.writeln("Netscape<BR>"); 
	  	checkNetscape();
	  }
		// Check if Microsoft Browser
	  else if (app.indexOf('Microsoft') != -1)
	  {
		if (bolDebug) document.writeln("Microsoft<BR>"); 
	  	checkMicrosoft();
	  }
		// Unknown browser
	  else
	  {				
		if (bolDebug) document.writeln("Unknown browser<BR>"); 
	  	downloadURL=urlDownloadNo;
	  }
  }
  // Not running Windows
  else
  {	
  	downloadURL=urlDownloadNo;
  }

  // If there is a value the display that page
  if (downloadURL)
  {	
		window.location=unescape(downloadURL);
		document.MM_returnValue=false;
  }
}

//
// Check what version of browser
//
function checkNetscape()
{
	var verStr=navigator.appVersion;
	var version = parseFloat(verStr);
	var verMinorStr=navigator.appMinorVersion;
	var pluginversion = 0;
	
	if (bolDebug)
	{
		document.writeln("verStr = " + verStr + "<BR>"); 
		document.writeln("version = " + version + "<BR>");
		document.writeln("verMinorStr = " + verMinorStr + "<BR>");
	}
	
	// Netscape 6+
	if (version >= 5.0)
	{
		if (bolDebug) document.writeln("Version 6+<BR>");
		if (bolDebug) document.writeln("agt = " + agt + "<BR>"); 
		
//		if (agt.indexOf('Netscape/7') != -1)
//		{
//				if (bolDebug) document.writeln("Netscape/7<BR>");

				// Plugin not supported in this version of browser
//		 		downloadURL=urlDownloadNo;		
//		}
//		else 
if (agt.indexOf('Netscape6/6.01') != -1)
		{
				if (bolDebug) document.writeln("Netscape6/6.01<BR>");

				// Plugin not supported in this version of browser
		 		downloadURL=urlDownloadNo;			
		}
		else
		{
			if (bolDebug) document.writeln("NOT Netscape6/6.01<BR>");

			 if (InstallTrigger.enabled() )
			 {
			 	if (bolDebug) document.writeln("InstallTrigger.enabled<BR>");

			 	intVer = InstallTrigger.compareVersion('copysafe',verFull);
				if (bolDebug) document.writeln("intVer = " + intVer + "<BR>");
							
				// Older file installed
			 	if ( intVer < 0 )
			 	{				
			 		downloadURL=urlDownload;
			 	}
			 }
			// Display download page
			 else
			 {			
			 	if (bolDebug) document.writeln("InstallTrigger.NOT enabled<BR>");
			 	downloadURL=urlDownload;
			 }		
		 }
	}
	// Netscape 4+
	else if (version >= 4.0)
	{
		// Update the Plugin list
		navigator.plugins.refresh(true);

		// Check if smartupdate is installed
		trigger = netscape.softupdate.Trigger;
		if (bolDebug) document.writeln("trigger.UpdateEnabled = " + trigger.UpdateEnabled() + "<BR>");

		// Get the SmartUpdate version information
		myMimetype = navigator.mimeTypes["application/x-Artistscope-Plugin"];
		if (bolDebug) document.writeln("myMimetype = " + myMimetype + "<BR>"); 
		
		if ( trigger.UpdateEnabled() )
		{
			if ( myMimetype )
			{
				pluginversion = trigger.GetVersionInfo("plugins/copysafe/copysafe");
				if (bolDebug) document.writeln("pluginversion = " + pluginversion + "<BR>"); 
				
				if (pluginversion != null)
				{
					// There is an older version
					if (pluginversion > verFull)
					{						
						downloadURL=urlDownload;	
					}				
				}
				// Installed by SmartUpdate, but is missing info
				else
				{					
					downloadURL=urlDownload;					
				}
			}
			// Install the Plug-In using SmartUpdate
			else
			{				
				downloadURL=urlDownload;
			}
		}
		else
		{   
			alert('Please enable smartupdate to install the copysafe plugin.');
			downloadURL=urlDownloadNo;
		}
	}
	// Old browser
	else
	{	
		downloadURL=urlDownloadNo;
	}
}

//
// Check what version of browser
//
function checkMicrosoft()
{
	var verStr=navigator.appVersion;
	var verMinorStr=navigator.appMinorVersion;


  	  	
	if (bolDebug)
	{
		document.writeln("verStr = " + verStr + "<BR>"); 
		document.writeln("verMinorStr = " + verMinorStr + "<BR>"); 
		document.writeln("lngOCXInstalled = " + lngOCXInstalled + "<BR>"); 
	}
	
	if (verStr.indexOf("MSIE") != -1)
	{ 
		// Install OCX and check if there is an update

		if (bolDebug) document.writeln("IE v4+ <BR>"); 
   		if (bolDebug) document.writeln("lngOCXInstalled = " + lngOCXInstalled + "<BR>");
   		
		if (lngOCXInstalled)
		{
			if (bolDebug) document.writeln("Copysafe Internet Explorer plug-in is installed. ");
			//downloadURL=urlDownload;
			document.writeln("<object ID='CopysafeCtl' classid='CLSID:BE1BDC4F-2AAC-494E-88B1-86B2EE4F2D6D' height='0' width='0'><param name='KeySafe' value='1'><param name='MenuSafe' value='1'><param name='CaptureSafe' value='1'></object>");
		}
		else
		{
			if (bolDebug) document.writeln("Copysafe Internet Explorer plug-in is NOT installed. ");
			downloadURL=urlDownload;
		}
	}
	else
	{	
		// Invalid browser
		downloadURL=urlDownloadNo;
	}
}
//-->