var xmlHttp

function displayRow(user_id, pg, username, password)
{ 
	var username = document.getElementById(username).value;
	if(password) var password = document.getElementById(password).value;

	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			}
			
if(password) var url="update_pg.php?user_id="+user_id+"&pg="+pg+"&username="+username+"&password="+password;
else  var url="update_pg.php?user_id="+user_id+"&pg="+pg+"&username="+username;

	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				var update = new Array();
				if(xmlHttp.responseText.indexOf('||' != -1)) 
					{
    					update = xmlHttp.responseText.split('||');
	  
						var half= update.length /2;
		
						for (i=0;i<=update.length-1 ;i++)
							{
								if(i<half){
									//document.getElementById(xmlHttp.responseText).disabled = true;
									if (update[half+i]=='false'){
										document.getElementById(update[i]).disabled = false;
									} else {
										document.getElementById(update[i]).disabled = true;
									}
									
								}
					 
							}
					}
			} 
	}

function GetXmlHttpObject()
	{
		var xmlHttp=null;
		try
			{
				// Firefox, Opera 8.0+, Safari
				xmlHttp=new XMLHttpRequest();
			}
	catch (e)
		{
 		//Internet Explorer
 		try
  			{
  				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  			}
	catch (e)
		{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
	}
return xmlHttp;
}