function getXMLHttp(divclass)
{
  var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }

function MakeTweet(divclass,tweet,url)
{
	document.getElementById(divclass).innerHTML = "Working...";
	
  var xmlHttp = getXMLHttp(divclass);
  
  if(xmlHttp) {
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleTweet(xmlHttp.responseText, divclass);
    }
  }

	var script = 'bb-tweet.php?message='+tweet+'&link='+url;

  xmlHttp.open("GET", script, true); 
  xmlHttp.send(null);

  } else { document.getElementById(divclass).innerHTML = "Currently Unavailable"; };
}

function HandleTweet(response, divclass)
{
  document.getElementById(divclass).innerHTML = response;
}
