function submitForm(theAction)
{
    if(validateLogin())
    {
        var oForm = eval(document.fe_login)

	oForm.action = theAction;


	// Set your defaults
	var sBrowserName = "ie";
	var iBrowserVersion = 5;

	// Detect the browser
	var browser = new BrowserDetector();

	if (browser.nav) {
		if (browser.nav4up) {
			sBrowserName	= 'navigator';
			iBrowserVersion	= browser.major;
			if(iBrowserVersion >= 5) {
				sBrowserName = "ie";
			}
		}
	}
	else if (browser.ie) {
		if (browser.ie4up) {
			sBrowserName	= 'ie';
			iBrowserVersion	= browser.major;
			// IE5 thinks it's major ver is 4
			if (browser.ie5)
				iBrowserVersion = 5;   
		}
	}

	oForm.browser_name.value 	= sBrowserName;
	oForm.browser_version.value = iBrowserVersion; 
	oForm.submit();
    } else {
	return false;
    }
}

function errormessage(mes1, mes2) {
        myWin=window.open("", "", "left=330, top=280, width=340, height=160,fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,directories=no, location=no");
        myWin.document.write("<html><head>");
	myWin.document.write("<style type=\"text/css\">");
	myWin.document.write("body { background-color: #2E2E2E; color: #c2c2c2; font:bold 13px tahoma; }\n");
	myWin.document.write("a.ok {background-image: url(/pro/images/btn_ok.gif); cursor:pointer; width:67px; height:22px; text-decoration:none; display:block; }\n");
	myWin.document.write("a.ok:hover {background-image: url(/pro/images/btn_ok2.gif); cursor:pointer; width:67px; height:22px; text-decoration:none; display:block; }\n")
	myWin.document.write("</style>");
	myWin.document.write("</head>");
	myWin.document.write("<body>");
        myWin.document.write("<table width='100%'><tr><td rowspan='2' width=5%><img src='../images/error.png'></td>");
	myWin.document.write ("<td align='center' style=\"font:bold 15px;\">");
        myWin.document.write(mes1);
        myWin.document.write("</td></tr><tr><td align='center' style=\"font:bold 14px tahoma;\"><strong>");
 	myWin.document.write(mes2); 
	myWin.document.write("</strong></td></tr></table>");
        myWin.document.write("<tr><td colspan='2' align='center' style=\"font:bold 13px tahoma;\">");
	myWin.document.write("<br><center><a href=\"#\" onclick=\"javascript:window.close();\" class=\"ok\">&nbsp;</a></center>");
        myWin.document.write("</td></tr></table></body></html>");
	myWin.document.close();
        myWin.focus();
} 

function validateLogin()
{
        if(
		document.forms[0].state.value == "TX" ||
		document.forms[0].state.value == "DC" ||
		document.forms[0].state.value == "OK" ||
		document.forms[0].state.value == "NV" ||
		document.forms[0].state.value == "NJ" ||
		document.forms[0].state.value == "HI" ||
		document.forms[0].state.value == "AK" ||
		document.forms[0].state.value == "UT" ||
		document.forms[0].state.value == "NC" ||
		document.forms[0].state.value == "SC" ||
		document.forms[0].state.value == "MS" ||
		document.forms[0].state.value == "GA" ||
		document.forms[0].state.value == "NM" ||
                document.forms[0].state.value == "NE" ||
                document.forms[0].state.value == "MO" ||
		document.forms[0].state.value == "AZ"
	) {
		errormessage(error1, error2);  
		return false;
       }

        if(document.forms[0].username.value == "" || document.forms[0].password.value == "") {
		errormessage(error1, error3);
                return false;
    	} else if(document.forms[0].state.value == "" || document.forms[0].state.selectedIndex==0) {
		errormessage(error1, error4);
            	return false;
    }

    return true;
}


function BrowserDetector () 

{ 

    var agt=navigator.userAgent.toLowerCase(); 



	// on IE5, following returns 4, so use is.ie5up to detect IE5

    this.major = parseInt(navigator.appVersion); 

    this.minor = parseFloat(navigator.appVersion); 



    this.nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 

                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 

                && (agt.indexOf('webtv')==-1)); 

    this.nav2 = (this.nav && (this.major == 2)); 

    this.nav3 = (this.nav && (this.major == 3)); 

    this.nav4 = (this.nav && (this.major == 4)); 

    this.nav4up = (this.nav && (this.major >= 4)); 

    this.navonly      = (this.nav && ((agt.indexOf(";nav") != -1) || 

                          (agt.indexOf("; nav") != -1)) ); 

    this.nav5 = (this.nav && (this.major == 5)); 

    this.nav5up = (this.nav && (this.major >= 5)); 



    this.ie   = (agt.indexOf("msie") != -1); 

    this.ie3  = (this.ie && (this.major < 4)); 

    this.ie4  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")==-1) ); 

    this.ie4up  = (this.ie  && (this.major >= 4)); 

    this.ie5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) ); 

    this.ie5up  = (this.ie  && !this.ie3 && !this.ie4); 



    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser 

    // or if this is the first browser window opened.  Thus the 

    // properties is.aol, is.aol3, and is.aol4 aren't 100% reliable. 

    this.aol   = (agt.indexOf("aol") != -1); 

    this.aol3  = (this.aol && this.ie3); 

    this.aol4  = (this.aol && this.ie4); 



    this.opera = (agt.indexOf("opera") != -1); 

    this.webtv = (agt.indexOf("webtv") != -1); 



    if (this.nav2 || this.ie3) this.js = 1.0 

    else if (this.nav3 || this.opera) this.js = 1.1 

    else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2 

    else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3 

    else if (this.nav5) this.js = 1.4 

    // NOTE: In the future, update this code when newer versions of JS 

    // are released. For now, we try to provide some upward compatibility 

    // so that future versions of Nav and IE will show they are at 

    // *least* JS 1.x capable. Always check for JS version compatibility 

    // with > or >=. 

    else if (this.nav && (this.major > 5)) this.js = 1.4 

    else if (this.ie && (this.major > 5)) this.js = 1.3 

    // HACK: no idea for other browsers; always check for JS version with > or >= 

    else this.js = 0.0; 



    this.win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); 

    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all 

    //        Win32, so you can't distinguish between Win95 and WinNT. 

    this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)); 



    // NOTE: Reliable detection of Win98 may not be possible. It appears that: 

    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent. 

    //       - On Mercury client, the 32-bit version will return "Win98", but 

    //         the 16-bit version running on Win98 will still return "Win95". 

    this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1)); 

    this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1)); 

    this.win32 = ( this.win95 || this.winnt || this.win98 || 

                   ((this.major >= 4) && (navigator.platform == "Win32")) || 

                   (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1) ); 



    this.mac    = (agt.indexOf("mac")!=-1); 

    this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) || 

                               (agt.indexOf("powerpc")!=-1))); 

}
