    //
    // STATUS
    //
    
 	var SWEKEY_STATUS_OK=0;
	var SWEKEY_STATUS_NOT_FOUND=1;  // The key does not exist in the db
	var SWEKEY_STATUS_INACTIVE=2;   // The key has never been activated
	var SWEKEY_STATUS_LOST=3;	    // The user has lost his key
	var SWEKEY_STATUS_STOLEN=4;		// The key was stolen
	var SWEKEY_STATUS_FEE_DUE=5;	// The annual fee was not paid
	var SWEKEY_STATUS_OBSOLETE=6;   // The hardware is no longer supported

	var SWEKEY_STATUS_REPLACED=100;	  // This key has been replaced by a backup key
	var SWEKEY_STATUS_BACKUP_KEY=101; // This key is a backup key
	
	var SWEKEY_STATUS_NOTPLUGGED=200; // This key is not plugged in the computer



	// -------------------------------------------------------------------
	//
	//	
	function Swekey_ListAllKeyIds()
	{
		try
		{
			return Swekey_Plugin().listall();
		}
		catch (e)
		{
//			alert("Swekey_ListAllKeyIds" + e);
		}
		return "";
	}
	

	// -------------------------------------------------------------------
	//
	//	
	function Swekey_GetStatus(id)
	{
		try
		{
			return Swekey_Plugin().getstatus(id);
		}
		catch (e)
		{
//			alert("Swekey_GetStatus" + e);
		}
		
		return SWEKEY_STATUS_NOTPLUGGED;
	}
	
	// -------------------------------------------------------------------
	//
	//	
	function Swekey_GetPrivKeyVers(id)
	{
		try
		{
			return Swekey_Plugin().getpkvers(id);
		}
		catch (e)
		{
//			alert("Swekey_GetPrivKeyVers" + e);
		}
		
		return -3;
	}
	
	// -------------------------------------------------------------------
	//
	//	
	function Swekey_Update()
	{
		try
		{
			return Swekey_Plugin().update();
		}
		catch (e)
		{
//			alert("Swekey_Update" + e);
		}
		return "";
	}

	// -------------------------------------------------------------------
	//
	//
	function Swekey_GetStatusStr(status)
	{
		switch(Number(status))
		{
           case SWEKEY_STATUS_OK			: return 'OK';
           case SWEKEY_STATUS_NOT_FOUND	    : return 'key does not exist in the db';
           case SWEKEY_STATUS_INACTIVE		: return 'key not activated';
           case SWEKEY_STATUS_LOST			: return 'key was lost';
           case SWEKEY_STATUS_STOLEN		: return 'key was stolen';
           case SWEKEY_STATUS_FEE_DUE		: return 'the annual fee was not paid';
           case SWEKEY_STATUS_OBSOLETE		: return 'key is no longer supported';
           case SWEKEY_STATUS_REPLACED	    : return 'This key has been replaced by a backup key';
           case SWEKEY_STATUS_BACKUP_KEY    : return 'This key is a backup key';
           case SWEKEY_STATUS_NOTPLUGGED    : return 'This key is not plugged in the computer';
		}
		return 'unknown status ' + status;
    } 
	
	// -------------------------------------------------------------------
	//
	//	
	function Swekey_Version()
	{
		try
		{
			if (window.ActiveXObject)
				return Swekey_Plugin().getVersion();

			return Swekey_Plugin().version;
		}
		catch (e)
		{
//			alert("Swekey_Version" + e);
		}
		return 0;
	}

	// -------------------------------------------------------------------
	//
	//	
	function Swekey_Revision()
	{
		try
		{
			if (window.ActiveXObject)
				return Swekey_Plugin().getRevision();

			return Swekey_Plugin().revision;
		}
		catch (e)
		{
//			alert("Swekey_Revision" + e);
		}
		return 0;
	}

	// -------------------------------------------------------------------
	//
	//	
	function Swekey_ServerRevision()
	{
		try
		{
			if (window.ActiveXObject)
				return Swekey_Plugin().getServer_Revision();

			return Swekey_Plugin().server_revision;
		}
		catch (e)
		{
//			alert("Swekey_ServerRevision" + e);
		}
		return 0;
	}

	// -------------------------------------------------------------------
	//
	//	
	function Swekey_ServerVersion()
	{
		try
		{
			if (window.ActiveXObject)
				return Swekey_Plugin().getServer_Version();

			return Swekey_Plugin().server_version;
		}
		catch (e)
		{
//			alert("Swekey_ServerRevision" + e);
		}
		return 0;
	}


