function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET",dname,false);
xhttp.send();
return xhttp.responseXML;
}

function getCommentCount(url)
{
        //Strip http, if any
        if (url.indexOf("https://") == 0)
               url = url.substring(8);
        if (url.indexOf("http://") == 0)
               url = url.substring(7);
    
        url = "https://api.facebook.com/method/fql.query?query=SELECT+url%2C+normalized_url%2C+share_count%2C+like_count%2C+comment_count%2C+total_count%2C+commentsbox_count%2C+comments_fbid%2C+click_count+FROM+link_stat+WHERE+url%3D%22" + url + "%22";
	var xmlDoc=loadXMLDoc(url);
	x = xmlDoc.getElementsByTagName("commentsbox_count")[0];
	y = x.childNodes[0];
        txt = y.nodeValue;
        
        return txt;
}

//ur = "ffxvhome.com/2011/11/15/kitase-thinks-final-fantasy-xv-should-be-an-action-rpg";
//alert(getCommentCount(ur));
