var xmlHttp

function twitThis(id,message){
	
	var username = document.getElementById("username_"+id).value;
	var password = document.getElementById("password_"+id).value;
	
	//alert(username);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="processtwit.php";
	url=url+"?username="+username;
	url=url+"&password="+password;
	url=url+"&message="+escape(message);
	
	xmlHttp.onreadystatechange=stateChanged;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}

function setFbStatus(message)
{
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="processfbstatus.php";
	url=url+"?message="+escape(message);
	xmlHttp.onreadystatechange=stateChangedFb;
	xmlHttp.open("GET",url,true);
	
	xmlHttp.send(null);
}

function stateChangedFb() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		if (xmlHttp.responseText == "success") {
			alert("Your Facebook Status has been updated Successfully. Thank You for Spreading the Word.")
			var test = YAHOO.util.Dom.getElementsByClassName('twit-box');
			for (var i in test) {
				test[i].style.display = "none";
			}
		}else{
			alert("Could not update your status. Try again later.")
		}
		//document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	}
}


function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		if(xmlHttp.responseText == "success"){
			alert("Your Twitter status has been updated Successfully. Thank You for Spreading the Word.");
			var test = YAHOO.util.Dom.getElementsByClassName('twit-box');
			 for(var i in test){
			 	test[i].style.display = "none"; 
			 }
			
		}else{
			
			alert("Could not update your status. Try again later.");
		}
		
	}
}


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;
}