//<![CDATA[

window.onload=function(){
	disqus_comment_counts();
	//disqus_latest_comments();
}

function disqus_comment_counts() {
	
	var links = document.getElementsByTagName('a');
	for(var i = 0; i < links.length; i++) {
		if(links[i].href.indexOf('#disqus_thread') >= 0) {
			load_comment(links[i].id, 'disqus_link_' +i, links[i].title);
		}
	}
	
}

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

	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			if (xmlHttp.responseText.length > 0) {
				document.getElementById(new_id).innerHTML = xmlHttp.responseText;
			}
			document.getElementById(new_id).title = null;
		}
	}
	document.getElementById(id).id = new_id;
	xmlHttp.open("GET","/disqus/get_count.php?id=" + id + "&title=" + title, true);
	xmlHttp.send(null);
}
//]]>