if (document.all)
{
	var docObj="document.all.";
	var styleObj=".style";
}
else
{
	var docObj="document.";
	var styleObj="";
}

function check()
{
	var retval=true;
	var errs="";	var nerrs=0;
	var warns="";	var nwarns=0;
	var biofilename="L:\\audio.log";
	var first=document.getElementById('first').value;
	var middle=document.getElementById('middle').value;
	var surname=document.getElementById('surname').value;
	var commonname=document.getElementById('common_name');
	var biofile=document.getElementById('biofile');
	var keysize=document.getElementById('keysize'); 
	var spkac=document.getElementById('keygen');
	var goodsize="1024 (Medium Grade)";
	var biggest="2048 (High Grade)";

	//alert ("We got to this function-6.");

	if (commonname.value.length == 0)
	{
		if ((first.length>0) && (surname.length > 0))
		{
			if(confirm("You left the common name blank.  Would you like it to be "+first+" "+surname+"?"))
			{
				commonname.value=first+" "+surname;
			}
		}
		else
		{
			warns=warns+"\nYou have not given a common name.";
			nwarns++;
		}
	}

	if (first.length == 0)
	{
		warns=warns+"\nYou did not enter a first name or initial.";
		nwarns++;
	}
	if (middle.length == 0)
	{
		warns=warns+"\nYou did not enter a middle name or initial.";
		nwarns++;
	}
	if (surname.length == 0)
	{
		warns=warns+"\nYou did not enter a surname.";
		nwarns++;
	}

	if (biofile.value.length == 0)
	{
		errs=errs+"\nYou did not choose the biometrics file, it should be "+biofilename+".";
		nerrs++;
	}
	else if (biofile.value != biofilename)
	{
		warns=warns+"\nYou chose a biometrics file of "+biofile.value+" instead of the standard "+biofilename+".";
		nwarns++;
	}
	if (spkac.value != goodsize)
	{
		if (confirm("You have chosen a key size of "+spkac.value+".  The smart card can only handle up to "+goodsize+".  Would you like to change it?"))
		{
			spkac.value=goodsize;
		}
		else
		{
			warns=warns+"\nYou did not choose the recommended keysize of "+goodsize+" for your private key.";
			nwarns++;
		}
	}
	else if (spkac.value != biggest)
	{
		warns=warns+"\nYou did not choose the largest key size available of "+biggest+".";
		nwarns++;
	}

/////////////////////////////////////////////////////////////////////////////////
	if (nerrs == 1)
	{
		alert("We cannot continue because of this problem:\n"+errs+"\nCould you please take care of it?");
		retval=false;
		if (nwarns == 1)
		{
			alert("You might also look at this thing which is acceptable but ungood:\n"+warns);
		}
		else if (nwarns > 1)
		{
			alert("You might also look at these "+nwarns+" things which are acceptable but ungood:\n"+warns);
		}
	}
	else if (nerrs > 1)
	{
		alert("We cannot continue because of these "+nerrs+" problems\n"+errs+"\nCould you please take care of them?");
		retval=false;
		if (nwarns == 1)
		{
			alert("You might also look at this things which is acceptable but ungood:\n"+warns);
		}
		else if (nwarns > 1)
		{
			alert("You might also look at these "+nwarns+" things which are acceptable but ungood:\n"+warns);
		}
	}
	else if (nwarns == 1)
	{
		retval=confirm("Did you truly mean to do this:\n"+warns+"?\nIt is acceptable but not good.");
	}
	else if (nwarns > 1)
	{
		retval=confirm("Did you truly mean to do these "+nwarns+" things?\n"+warns);
	}

	if (retval)
	{
		alert ("Remember to choose the correct token, probably the smart card reader.");
	}
	return retval;
}
function deprecate()
{

	if (keysize.value.length == 0)
	{
		errs=errs+"\nYou did not choose a key size.";
		nerrs++;
	}
	else if (keysize.value != 2048)
	{
		warns=warns+"\nYou chose the smaller key size of "+keysize.value+".";
		nwarns++;
	}
}