function handleClientError()
{
    var errMsg = "The E-Lock instaSign Web Client component is not present / corrupted / disabled.\n";
    errMsg+="You need to have the client component to perform the selected operation.\n";
    errMsg+="E-Lock instaSign Web Client component supports the following platforms and browsers - \n\n";
    errMsg+="       -   Operating System : Windows 2000 or higher\n";
    errMsg+="       -   Browser(s) :\n";
    errMsg+="       -             1. Microsoft Internet Explorer 6.0 or higher\n";
    errMsg+="       -             2. Mozilla Firefox 2.0 or higher\n";
    errMsg+="       -             3. Flock 2.0 or higher\n";
    errMsg+="If you have installed this browser after installing the component, then you need to re-install it.- \n\n";
    errMsg+="Do you want to download the client component now ?\n";
    if(confirm(errMsg))
    {
        var winId = window.open(clientEXEURL,"clientwindow","width=650,height=350,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0");
        if(winId==null)
        {
            alert("The window has been blocked. Please enable pop up for this site");
        }
    }
}

function InstantiateIEClient()
{
   	try
	{
		var DeskLicObjtemp = new ActiveXObject("DeskLicense.CDeskLicense.1");
		var SignLiteObjtemp = new ActiveXObject("SignLite.Sign.1");
		DeskLicObjtemp.GetVersion("DeskLicense.dll");
		SignLiteObjtemp.GetOperationStatusCode();
		var tagCode ="<object classid=\"CLSID:B0554373-9B22-4F4C-964C-448631802EBE\" id=\"objSign\" width=\"0\" height=\"0\"></object>";
        document.getElementById("client_container").innerHTML = tagCode;
        return document.getElementById("objSign");
	}
	catch(err)
	{		
		handleClientError();
		return null;
	}
}

function InstantiateNSClient()
{
   	try
	{
	    var	myMimetypeSign = navigator.mimeTypes["application/x-ELOCK-Plugin-For-SignLite"];
	    var	myMimetypeLic = navigator.mimeTypes["application/x-ELOCK-Plugin-For-Desk-License"];
	    if(myMimetypeLic && myMimetypeSign)
	    {
	        myMimetypeSign = null;
	        myMimetypeLic = null;
   		    var tagCode ="<embed id=\"objSign\" type=\"application/x-ELOCK-Plugin-For-SignLite\" width=\"0\" height=\"0\"></embed>";
            document.getElementById("client_container").innerHTML = tagCode;
            return document.getElementById("objSign");
	    }
	    else
	    {
            handleClientError();
            return null;
	    }
	}
	catch(err)
	{		
		handleClientError();
		return null;
	}
}

function InitClient()
{
	if(strOS=="win")
	{
		// Check For IE Browser
		if(navigator.appName.toLowerCase().indexOf("internet explorer") != -1 )
		{
			
			if((parseInt(navigator.appVersion, 10) < 4))
			{
				alert("This page requires Internet Explorer v6.0 or above. ");
				return null;
			}
			else
			{
			    return InstantiateIEClient();
			}
		}

        if( navigator.appName.toLowerCase().indexOf("netscape") != -1)
		{
			if( parseInt(navigator.appVersion, 10) < 4 )
			{
				alert("You need to Netscape 6 or above or a compatible browser to run this application");
				return null;
			}
			else
			{
                return InstantiateNSClient();
			}
		}
	}
	else
	{
		handleClientError();
		return null;
	}
} 

//Check the Operating System
var strOS = navigator.platform;
if (strOS.toLowerCase().indexOf("win") == -1)
{
    strOS = "Unix";
}
else
{
    strOS = "win";
}
document.write("<div id=\"client_container\" style=\"display:inline;height:0px;width:0px;\"></div>");

