

navHover = function() {
	var lis = document.getElementById("navmenu").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", navHover);



        var url = 'classes/captcha/captcheck.php?code=';
        var captchaOK = 2;  // 2 - not yet checked, 1 - correct, 0 - failed
        
        function getHTTPObject()
        {
        try {
        req = new XMLHttpRequest();
          } catch (err1)
          {
          try {
          req = new ActiveXObject("Msxml12.XMLHTTP");
          } catch (err2)
          {
          try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (err3)
            {
	req = false;
            }
          }
	}
        return req;
	}
        
        var http = getHTTPObject(); // We create the HTTP Object        
        
        function handleHttpResponse() {
        	code	 = document.getElementById("code").value;
        if (http.readyState == 4) {
            captchaOK = http.responseText;
            if(captchaOK != 1) {
              document.getElementById("codeError").style.display = "inline";
							document.getElementById("code").select();
							document.getElementById("code").focus();
							 return false;
              return false;
              }
              document.myform.submit();
           }
        }

        function checkcode(thecode) {
        http.open("GET", url + escape(thecode), true);
        http.onreadystatechange = handleHttpResponse;
        http.send(null);
        }
        
         
       
         
         function hideAllErrors() 
				{
					document.getElementById("usernameError").style.display = "none"
					document.getElementById("entryError").style.display = "none"
					document.getElementById("codeError").style.display = "none"
				}
        
        function checkform() {
       
       username 	   = document.getElementById("username").value;
       entry	 = document.getElementById("entry").value;
       code	 = document.getElementById("code").value;
       
        // First the normal form validation
        if (username == "") 
							{
        			hideAllErrors();
							document.getElementById("usernameError").style.display = "inline";
							document.getElementById("username").select();
							document.getElementById("username").focus();
    					return false;
    					}
    		else if (entry == "") 
							{
							hideAllErrors();
							document.getElementById("entryError").style.display = "inline";
							document.getElementById("entry").select();
							document.getElementById("entry").focus();
							 return false;
							}     			
    					
    		else if (code == "") 
							{
							hideAllErrors();
							document.getElementById("codeError").style.display = "inline";
							document.getElementById("code").select();
							document.getElementById("code").focus();
							 return false;
							}     			
   					
        
          // Now the Ajax CAPTCHA validation
          checkcode(document.myform.code.value);
          return false;
        }     		
