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')
{
    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")){ 
		
		document.getElementById("ERROR").innerHTML=xmlHttp.responseText;
		}
		else if(str.match("activate your account"))
		{ 
		document.getElementById("ERROR").innerHTML='';
		document.getElementById("user").innerHTML='';
		document.getElementById("ACTIVATE").innerHTML=xmlHttp.responseText;
		}
		else{ 
		document.getElementById("ERROR").innerHTML='';
		document.getElementById("ACTIVATE").innerHTML='';
		document.getElementById("user").innerHTML=xmlHttp.responseText; 
		
		}
		
        }
      }
    xmlHttp.open("POST","/cgi-bin/members/qcinout-ajax.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/members/qcinout-ajax.pl",true);
    xmlHttp.send("action=logout"); 
		}
}

