<!--

//'***** VERSION CONTROL DATA *************************************************
//'**
//'** $Workfile: SecurityInfo.js $
//'** $Revision: 53 $
//'** $Modtime: 12/01/06 3:43p $
//'** $Author: Hy200007 $
//'** $Date: 12/01/06 3:43p $
//'**
//'****************************************************************************

function  SetJavaVariables(){

     document.SecufityInfo.UserJavaPlatForm.value = navigator.platform;
     document.SecufityInfo.UserJavaBrowser.value = navigator.appName;
     document.SecufityInfo.UserJavaVersion.value = navigator.appVersion;
     document.SecufityInfo.UserJavaCodeName.value = navigator.appCodeName;
     document.SecufityInfo.UserJavaColorDepth.value = window.screen.colorDepth;
     document.SecufityInfo.UserJavaColors.value = Math.pow (2, window.screen.colorDepth);;
     document.SecufityInfo.UserJavaCurrentResolution.value = window.screen.width + "x" + window.screen.height;
     document.SecufityInfo.UserJavaMaxResolution.value = window.screen.availWidth + "x" + window.screen.availHeight;
     
     if (navigator.javaEnabled() < 1)
          document.SecufityInfo.UserJavaEnabled.value = "No";
          
     if (navigator.javaEnabled() == 1)
          document.SecufityInfo.UserJavaEnabled.value = "Yes";
          
	if (window.screen.fontSmoothingEnabled == true)
		document.SecufityInfo.UserJavaAAFonts.value = "Yes";
	else 
	     document.SecufityInfo.UserJavaAAFonts.value = "No";

	var now = new Date();
	document.SecufityInfo.UserJavaUTCOffset.value = now.getTimezoneOffset() / 60;
	
	for (var i = 0; i < navigator.plugins.length; i++) {	
		document.SecufityInfo.UserJavaPlugins.value = document.SecufityInfo.UserJavaPlugins.value + " " + navigator.plugins[i].name;
	}	
     
     return;     
}

function submitForm()
{
    if ( (document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E")){
          SetJavaVariables();
    }

     if(document.SecufityInfo.SecAnswer.value.length == 0) {
          alert("Please enter your security answer.");
          document.SecufityInfo.SecAnswer.focus();
          return false;
     }
     
    
     if(document.SecufityInfo.Email.value.length == 0){
          alert("Please enter your email address.");
          document.SecufityInfo.Email.focus();
          return false;
     }

     var  varEmailAddress = document.SecufityInfo.Email.value;
     
     if (validateEmail(varEmailAddress) == false){
          document.SecufityInfo.Email.focus();
          return false;
     }
     
     var	varAlphaNumerics;
     
     varAlphaNumerics = lowercaseLetters + uppercaseLetters + digits

     if ( (document.SecufityInfo.EnhancedAuthType.value == "Y") || (document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E") || (document.SecufityInfo.EnhancedAuthType.value == "H")){
          
          var  MinQuestionsForEA = document.SecufityInfo.TotalAnswersrow.value;
          
          var i=0;
          var j=0;
          for(i=0; i<MinQuestionsForEA; i++) {
               // make sure user has entered an answer
               if(document.SecufityInfo.SpecialSecAnswer[i].value.length ==0 ) {
                    alert("Please select answers for all the questions.");
                    document.SecufityInfo.SpecialSecAnswer[i].focus();
                    return false;
               } else {
                    if ( ((document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E") )){
                         if ((document.SecufityInfo.OldAnswerText[i].value != document.SecufityInfo.SpecialSecAnswer[i].value) || 
                              (document.SecufityInfo.EASecurityQuestion[i].options[document.SecufityInfo.EASecurityQuestion[i].selectedIndex].value != document.SecufityInfo.OldIAQuestionID[i].value)){
                              	
                              	document.SecufityInfo.SpecialSecAnswer[i].value = stripCharsNotInBag(document.SecufityInfo.SpecialSecAnswer[i].value, varAlphaNumerics);
                              	
                              	if ((document.SecufityInfo.SpecialSecAnswer[i].value.length < 3 )|| (document.SecufityInfo.SpecialSecAnswer[i].value.length > 32 )) {
	                                 alert("Your security question response must be at least 3 characters in length and it may contain only letters and numbers, all other characters will be ignored.");
	                                 document.SecufityInfo.SpecialSecAnswer[i].focus();
	                                 return false;
                              	}

                         }
                    } else {

						 document.SecufityInfo.SpecialSecAnswer[i].value = stripCharsNotInBag(document.SecufityInfo.SpecialSecAnswer[i].value, varAlphaNumerics);
						 
                      	 if ((document.SecufityInfo.SpecialSecAnswer[i].value.length < 3 )|| (document.SecufityInfo.SpecialSecAnswer[i].value.length > 32 )) {
                             alert("Your security question response must be at least 3 characters in length and it may contain only letters and numbers, all other characters will be ignored.");
                             document.SecufityInfo.SpecialSecAnswer[i].focus();
                             return false;
                      	 }
                    }
               }
               
               // make sure user has not selected duplicate questions.
               j=0;
               for(j=0; j<MinQuestionsForEA; j++) {
                    // make sure user has entered an answer
                    if (i != j){
                         if(document.SecufityInfo.EASecurityQuestion[i].selectedIndex == document.SecufityInfo.EASecurityQuestion[j].selectedIndex ) {
                              alert("Please select " + MinQuestionsForEA + " different security questions and responses.");
                              document.SecufityInfo.EASecurityQuestion[i].focus();
                              return false;                         
                         }
                    }
               }
          }
     }
	document.SecufityInfo.action = "SaveSecurityInfo.asp";
	//document.SecufityInfo.submit();
	 return true;  
}

function fusubmitForm()
{
	var	varCheckSecurityInfo;
	
     if ( (document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E")){
          SetJavaVariables();
     }
     
    varCheckSecurityInfo = "Y";
    
    if (document.SecufityInfo.DisplaySecurityInfoOnForceIASetup != undefined){
    	if (document.SecufityInfo.DisplaySecurityInfoOnForceIASetup.value == "N")
     		varCheckSecurityInfo = "N";
    }
     

	if (varCheckSecurityInfo == "Y") {		

	     if(document.SecufityInfo.SecAnswer.value.length == 0) {
	          alert("Please enter your security answer.");
	          document.SecufityInfo.SecAnswer.focus();
	          return false;
	     }
	     if(document.SecufityInfo.Email.value.length == 0){
	          alert("Please enter your email address.");
	          document.SecufityInfo.Email.focus();
	          return false;
	     }
	     
	     var  varEmailAddress = document.SecufityInfo.Email.value;
	     
	     if (validateEmail(varEmailAddress) == false){
	          document.SecufityInfo.Email.focus();
	          return false;
	     }
     }
     
     var	varAlphaNumerics;
     
     varAlphaNumerics = lowercaseLetters + uppercaseLetters + digits


     var  MinQuestionsForEA = document.SecufityInfo.TotalAnswersrow.value;
     
    if (document.SecufityInfo.SpecialSecAnswer == undefined){
		MinQuestionsForEA = 0;
    }     
     
     var i=0;
     var j=0;
     for(i=0; i<MinQuestionsForEA; i++) {
          // make sure user has entered an answer
          if(document.SecufityInfo.SpecialSecAnswer[i].value.length ==0 ) {
               alert("Please select answers for all the questions.");
               document.SecufityInfo.SpecialSecAnswer[i].focus();
               return false;
          } else {
               if ( ((document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E") )){
                    if ((document.SecufityInfo.OldAnswerText[i].value != document.SecufityInfo.SpecialSecAnswer[i].value) || 
                         (document.SecufityInfo.EASecurityQuestion[i].options[document.SecufityInfo.EASecurityQuestion[i].selectedIndex].value != document.SecufityInfo.OldIAQuestionID[i].value)){
                         	
                              	document.SecufityInfo.SpecialSecAnswer[i].value = stripCharsNotInBag(document.SecufityInfo.SpecialSecAnswer[i].value, varAlphaNumerics);
                              	
                              	if ((document.SecufityInfo.SpecialSecAnswer[i].value.length < 3 )|| (document.SecufityInfo.SpecialSecAnswer[i].value.length > 32 )) {
	                                 alert("Your security question response must be at least 3 characters in length and it may contain only letters and numbers, all other characters will be ignored.");
	                                 document.SecufityInfo.SpecialSecAnswer[i].focus();
	                                 return false;
                              	}

                    }
               } else {
                    
                  	document.SecufityInfo.SpecialSecAnswer[i].value = stripCharsNotInBag(document.SecufityInfo.SpecialSecAnswer[i].value, varAlphaNumerics);
                  	
                  	if ((document.SecufityInfo.SpecialSecAnswer[i].value.length < 3 )|| (document.SecufityInfo.SpecialSecAnswer[i].value.length > 32 )) {
                         alert("Your security question response must be at least 3 characters in length and it may contain only letters and numbers, all other characters will be ignored.");
                         document.SecufityInfo.SpecialSecAnswer[i].focus();
                         return false;
                  	}
               }
          }
          
          // make sure user has not selected duplicate questions.
          j=0;
          for(j=0; j<MinQuestionsForEA; j++) {
               // make sure user has entered an answer
               if (i != j){
                    if(document.SecufityInfo.EASecurityQuestion[i].selectedIndex == document.SecufityInfo.EASecurityQuestion[j].selectedIndex ) {
                         alert("Please select " + MinQuestionsForEA + " different security questions and responses.");
                         document.SecufityInfo.EASecurityQuestion[i].focus();
                         return false;                         
                    }
               }
          }
     }
     	if (document.SecufityInfo.FUserTandCYN.value == "Y")
	{
     		if (document.SecufityInfo.FUserConditions.checked == false)
		{
         	  alert("Please read and agree to the Terms and Conditions.");
          	  document.SecufityInfo.FUserConditions.focus();
          	  return false;
     		}
	}
	document.SecufityInfo.action = "SaveSecurityInfo.asp";
	document.SecufityInfo.submit();
}

function SkipSetup()
{
     if ( (document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E")){
          SetJavaVariables();
     }
     
     document.SecufityInfo.SkipEASetup.value = "Y";

	document.SecufityInfo.action = "SaveSecurityInfo.asp";
	document.SecufityInfo.submit();
}

function fUpdateEmail()
{
     if(document.frmEmailUpdate.Email.value.length == 0){
          alert("Please enter your email address.");
          document.frmEmailUpdate.Email.focus();
          return false;
     }

     var  varEmailAddress = document.frmEmailUpdate.Email.value;
     
     if (validateEmail(varEmailAddress) == false){
          document.frmEmailUpdate.Email.focus();
          return false;
     }
	document.frmEmailUpdate.action = "SaveEmailAddress.asp";
	document.frmEmailUpdate.submit();
}
function OBHSubmit()
{
	alert("You are not authorized to do this function.");
	return false;
}
function displayDemoMessage()
{
	alert("This function is not available for the Demo User.");
	return false;
}
function SpcialAuthsubmitForm()
{
     if ( (document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E")){
          SetJavaVariables();
     }

     if(document.SecufityInfo.Answer.value.length == 0) {
          alert("Please enter your security answer.");
          document.SecufityInfo.Answer.focus();
          return false;
     } else {
	     var	varAlphaNumerics;     
	     varAlphaNumerics = lowercaseLetters + uppercaseLetters + digits
     	 document.SecufityInfo.Answer.value = stripCharsNotInBag(document.SecufityInfo.Answer.value, varAlphaNumerics);
     	
     }
 
	document.SecufityInfo.action = "CheckSpecialSecurityAns.asp";
	document.SecufityInfo.submit();
}

function SetChkBoxValue(obj)
{     
     if(obj.checked)
     {
          obj.value="Y";
     }
     else
     {
          obj.value="N";
     }
    
}

function ActivatePSI() {
	document.SecufityInfo.action = "ActivatePSI.asp";
	document.SecufityInfo.submit();
}

function EnableToken() {
	document.SecufityInfo.action = "AddRemoveToken.asp";
	document.SecufityInfo.UserAction.value = "Add";
	document.SecufityInfo.submit();
}

function DisableToken() {
	document.SecufityInfo.action = "AddRemoveToken.asp";
	document.SecufityInfo.UserAction.value = "Remove";
	document.SecufityInfo.submit();
}

function SubmitActivatePSIForm() {

     var	varAlphaNumerics;
     
     varAlphaNumerics = lowercaseLetters + uppercaseLetters + digits
          
     var  MinQuestionsForEA = document.SecufityInfo.MinQuestionsForEA.value;
     
     if ( (document.SecufityInfo.EnhancedAuthType.value == "I") || (document.SecufityInfo.EnhancedAuthType.value == "E")){
          SetJavaVariables();
     }     
     
     var i=0;
     var j=0;
     for(i=0; i<MinQuestionsForEA; i++) {
          // make sure user has entered an answer
          if(document.SecufityInfo.SpecialSecAnswer[i].value.length ==0 ) {
               alert("Please select answers for all the questions.");
               document.SecufityInfo.SpecialSecAnswer[i].focus();
               return false;
          } else {
          	
	          	document.SecufityInfo.SpecialSecAnswer[i].value = stripCharsNotInBag(document.SecufityInfo.SpecialSecAnswer[i].value, varAlphaNumerics);
	          	
	          	if ((document.SecufityInfo.SpecialSecAnswer[i].value.length < 3 )|| (document.SecufityInfo.SpecialSecAnswer[i].value.length > 32 )) {
	                 alert("Your security question response must be at least 3 characters in length and it may contain only letters and numbers, all other characters will be ignored.");
	                 document.SecufityInfo.SpecialSecAnswer[i].focus();
	                 return false;
	          	}
                  	          	
          }
          
          
          // make sure user has not selected duplicate questions.
          j=0;
          for(j=0; j<MinQuestionsForEA; j++) {
               // make sure user has entered an answer
               if (i != j){
                    if(document.SecufityInfo.EASecurityQuestion[i].selectedIndex == document.SecufityInfo.EASecurityQuestion[j].selectedIndex ) {
                         alert("Please select " + MinQuestionsForEA + " different security questions and responses.");
                         document.SecufityInfo.EASecurityQuestion[i].focus();
                         return false;                         
                    }
               }
          }
     }
     document.SecufityInfo.action = "SavePSI.asp";
     document.SecufityInfo.submit();
}

function isAlphanumericOrSpace (s)

{   
    var i;
    var varTemp;
    
    if ( s.length == 0 )
          return false;

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number or letter.
        var c = s.charAt(i);

        if (! (isLetter(c) || isDigit(c) || ( c == " ") ) )
        return false;
    }
    
    // Make sure it is not all space
    varTemp = stripWhitespace(s);
    
    if ( varTemp.length == 0 )
          return false;

    return true;
}



//-->
