﻿var xmlHttp;
var stpuid = 0;
var pingInterval = 10000;

var communityListUrl = "/ajax/CommunityList.aspx";
function GetCommunity(filter) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        return false;
    }

    xmlHttp.open("POST", communityListUrl);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.onreadystatechange = communityHandleHttpResponse;
    xmlHttp.send("bookmark=" + filter);
    return false;
}

function GetXmlHttpObject()
{
	var objXMLHttp;
	if (window.XMLHttpRequest) 
	{
	    // Non IE browser
        objXMLHttp = new XMLHttpRequest();
    }
    else if(window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); }	
	return objXMLHttp;
}

function communityHandleHttpResponse() {
    if (xmlHttp.readyState == 4) {
        if (xmlHttp.status == 200) {
            var response = xmlHttp.responseText.toString();
            if (response.length > 5) {
                document.getElementById("quick_communities_list").style.display = "block";
                document.getElementById("quick_communities_list").innerHTML = response;
            }
        }
    }
    return;
}
