function my_xmlHttpObject () {
          var xml_http_object;
          try {
	         xml_http_object = new XMLHttpRequest();
          } catch(e) {
              try {
                  xml_http_object = new ActiveXObject("Msxml2.XMLHTTP");
              } catch(e) {
                  try {
                      xml_http_object = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch(e) {
                      alert("ERROR: Your browser does not support AJAX.");
                      return false;
                  }
              }
          }
	     return xml_http_object;
      }          
      function my_login() { 
          var ajax = new my_xmlHttpObject(); 
         	if (ajax) {    
              var username = document.getElementById("username").value;   
              var password = document.getElementById("password").value;   
              if(username == "")
			  { 
				  alert("Please enter username");       				
                  
		  	  }   
		  	 if(password == "")
		     { 
				  alert("Please enter password"); 		
                  
			 }   
              
              var params = "loginid=" + username + "&passwd=" + password + "&";     
              ajax.onreadystatechange = function () {
                  var loginDiv = document.getElementById("loginMess");      
				  //var loginFields  = document.getElementById("loginDiv");  
				  var login = document.getElementById("username");      
   				  var pass = document.getElementById("password");      

                    if (ajax.readyState <4) {  
                      loginDiv.innerHTML = "Logging in as " + username + "...";
                    } else if (ajax.readyState == 4) {  
                    //alert(ajax.responseText );				
                      if (ajax.responseText.indexOf("OK")!= -1) {
                            loginDiv.innerHTML = "Login successful.Redirecting to Homepage";
                            loginDiv.innerHTML = "Logged in as " + username;
							login.disabled=true;
							pass.disabled=true;
	                        //	loginM.innerHTML = "</form><tr><td width='30%' height='26' align='right' valign='middle' class='arial12regular'><a href= class='style1' ><marquee>Welcome</marquee></a></td>";                  
                          	//alert(window.location.href);
                            //window.location.href="index.php?page=aboutus";	                            
                            location.replace("index.php?page=myhome");						
                        } else {
                            loginDiv.innerHTML = "Invalid Username/Password";  
                      }
                    }  
              }
              ajax.open("POST", "login.php", true);
              ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
              ajax.setRequestHeader("Content-length", params.length);
              ajax.setRequestHeader("Connection", "close");          
              ajax.send(params);             
          } else {
              alert('Your browser does not support AJAX. Please turn on Javascript in your browser options/preferences and try again.');
          }     
      }

      