function fnFormSubmit(strSubActionId,strFormName){
    var varUrl = document.forms[strFormName].hdnUrl.value;
    var tmp = varUrl.split("|");
    var varServerName = tmp[0];
    var varHttpPort = tmp[1];
    var varHttpsPort = tmp[2];	
    var varAction = document.forms[strFormName].action;    
    var varNewAction = "";   
    varAction = varAction.substring(varAction.lastIndexOf('/'),varAction.length);
    document.forms[strFormName].hdnSubActionId.value = strSubActionId;   

    if (strSubActionId.indexOf("77") == 0) {
        varNewAction = "https://"+varServerName+":"+varHttpsPort+"/lsp"+varAction;
    }else if (strSubActionId == "5007" || strSubActionId == "1234" || strSubActionId == "38683" 
        || strSubActionId == "4321" || strSubActionId == "4111" || strSubActionId == "3006"
        || strSubActionId == "1401" || strSubActionId == "1402" || strSubActionId == "3003"
        || strSubActionId == "3004") {
           varNewAction = "https://"+varServerName+":"+varHttpsPort+"/lsp"+varAction;
    }else if (strSubActionId == "901" ||
                strSubActionId == "902" ||
                strSubActionId == "903" ||
                strSubActionId == "904") {
        varNewAction = "http://"+varServerName+":"+varHttpPort+"/lsp"+varAction;
    } else if (strSubActionId == "14009"
                || strSubActionId == "1008") {
           varNewAction = "http://"+varServerName+":"+varHttpPort+"/lsp/Enroll.do";;
    } else {
        varNewAction = "http://"+varServerName+":"+varHttpPort+"/lsp"+varAction;		
    }

    if (varNewAction.indexOf("http") == varNewAction.lastIndexOf("http")) {
        document.forms[strFormName].action = varNewAction;
    } else {
        varNewAction = varNewAction.substring(varNewAction.lastIndexOf("http"),varNewAction.length);
        document.forms[strFormName].action = varNewAction;
    }	
    document.forms[strFormName].submit();
}
function fnValidate(formName,strXml,errorCode)
{
	var objXMLDoc = new ActiveXObject("Microsoft.XMLDOM");
	objXMLDoc.async = false;
	var strXml	=	strXml;
	objXMLDoc.loadXML(strXml);
	var objXMLDocElement	=	objXMLDoc.documentElement;
	var strRootNode	=	objXMLDoc.documentElement.nodeName;
	var strFrstChild	=	objXMLDocElement.childNodes;
	var iFrstCount	=	0;
	for(iFrstCount=0;iFrstCount<strFrstChild.length;iFrstCount++)
	{
		var strScndChild	=	strFrstChild[iFrstCount].childNodes;
		if(strScndChild[0].text	== formName)
		{
		for(var iScndCount=1;iScndCount<strScndChild.length;iScndCount++)
		{
			var strThirdChild	=	strScndChild[iScndCount].childNodes;
			for(iThrdCount=0;iThrdCount<strThirdChild.length;iThrdCount++)
			{
			if(strThirdChild[iThrdCount].text==errorCode)
			{
				alert("Correct error MSG  :"+strThirdChild[iThrdCount+1].text);
			}
			iThrdCount++;
			}
		}
		}
	}
}

//Added this function to change the focus the next field in
//the attorney change email/password page
function changeFocus(field,frmName){
    var fname = field.name;                
    var n = document.forms[frmName].elements.length;
    for(i=0; i<n; i++){
        if(document.forms[frmName].elements[i].name==fname){
                document.forms[frmName].elements[i+1].focus();
                break;
        }
    }
}
