function login_ajax(tbool){
			if(tbool){
				pusr=trimAll(document.getElementById("usrname").value);
				pwd=trimAll(document.getElementById("password").value);
			
				/*if(pusr=="username" || pwd=="password"){
					alert("Invalid username or password");
					return false;
				}*/
				if(!validateEmail(pusr) || pwd.length<6){
					alert("Invalid Email. or \nPassword should have atleast 6 characters");
					return false;
				}
			}
			
                var loginajax;
                try
                {
                    // Firefox, Opera, and the like
                    loginajax = new XMLHttpRequest();
                }
                catch (e)
                {
                    //Internet Exploder?
                    try
                    {
                        loginajax= new ActiveXObject("Msxm12.XMLHTTP");
                    }
                    catch (e)
                    {
                        //...
                        try
                        {
                            loginajax = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch (e)
                        {
                            alert("Your browser does not support Ajax, because of this you would not be able to login.");
							tobj=document.getElementById("pforward");
							tobj.style.display="none";
                        }
                    }
                }
				
				var d = new Date();
				timestamp=d.toUTCString();
                loginajax.open('POST', 'getlogin_result.php', 'true');
                loginajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded;text/html;charset=utf-8");
				loginajax.setRequestHeader('If-Modified-Since', 'Wed, 15 Feb 2008 00:00:00 GMT');
                //loginajax.setRequestHeader("Content-length", myname.length);
                //loginajax.setRequestHeader("Connection", "close");
				if(tbool){
					poststr="pusr=" + escape(pusr) + "&pwd=" + escape(pwd);
				}else{
					poststr="pcmd=logout"
				}
				loginajax.send(poststr);
				
                loginajax.onreadystatechange=function()
                {
                    if(loginajax.readyState == 4)
                    {
						
						if(loginajax.responseText=="0"){
							login_obj=document.getElementById('login_err');
							login_obj.innerHTML="Invalid email and/or password";
						}else{						    
							login_obj=document.getElementById('login_div');
	                        login_obj.innerHTML=loginajax.responseText;
							closePopUp('plogin');
						}
                    }
                }
}
