<script type="text/javascript">
  

function LogIn_LogOut(action)
{
var xmlHttp;
  try
    {    // Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest(); 
	}
	catch (e)
		{    // Internet Explorer    
			try
			{      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
				 catch (e)
						{      
						  try
							{        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
								catch (e)
								{        document.userForm.submit();        return false;        } 
							
						}    
		
		}
if (action == 'LogIN')
{
var style='hide';
var obj=document.getElementById('smallwindow');
obj=obj.style;
obj.visibility='hidden';
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
		var str=xmlHttp.responseText;
		if (str.match("Please specify User Name and Password") || str.match("Invalid User Name or Password")){ 
		obj.visibility='visible';
		document.getElementById("ERROR").innerHTML=xmlHttp.responseText;
		}
		else if(str.match("activate your account"))
		{ 
		obj.visibility='visible';
		document.getElementById("ACTIVATE").innerHTML=xmlHttp.responseText;
		}
		else{ document.getElementById("user").innerHTML=xmlHttp.responseText; }
		
        }
      }
    xmlHttp.open("POST","/cgi-bin/AddBook/quickloginlogout1.pl",true);
    xmlHttp.send("user=" + document.userForm.user.value + "&password=" + document.userForm.password.value); 
	}

if (action == 'LogOut')
		{
		xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
		document.getElementById("user").innerHTML=xmlHttp.responseText;
		}
      }
	xmlHttp.open("POST","/cgi-bin/AddBook/quickloginlogout1.pl",true);
    xmlHttp.send("action=logout"); 
		}
}

</script>