var xmlHttp;
var off=false;

function toggleBubbles(){
    if (off==false){
      off=true;
      document.getElementById('bubble').style.display='none';
      document.getElementById("toggleBubbles").innerHTML="Bubbles: OFF";
    }else{
      off=false;
      document.getElementById("toggleBubbles").innerHTML="Bubbles: ON";
    }
}

function changeContent()
{
  if (off==true){
    return false;
  }
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Browser does not support HTTP Request");
    return;
    }
  var url="feed.php?r="+Math.random();
  xmlHttp.onreadystatechange=stateChanged;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

function stateChanged()
{
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  {
    document.getElementById("bubble").innerHTML=xmlHttp.responseText;
    Effect.Appear('bubble', { duration: 1.0});
    setTimeout("Effect.Fade('bubble', { duration: 1.0})",117500);//5000
  }
}

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;
}