var g_searent_ApplicationId 	= 2;
var g_strBaseQueryWebServiceUrl = "http://api.seattlerentals.com/searentAPI-1.4/webservice_getSearchCriteriaHtml.json.php";
var g_currentElmntSel 		= '';

function initNeighborhoodsLive(elmntSel,sel)
{
	_callService(elmntSel,'neighborhoods_live',sel);
}

function initNeighborhoods(elmntSel,sel)
{
	_callService(elmntSel,'neighborhoods',sel);
}

function _callService(elmntSel, strAction, strSel)
{
    var strQS 	= "";
    var strUrl 	= "";

    //setting the element that will contain the responsed html
    g_currentElmntSel = elmntSel;

    strQS += "?aid=" + g_searent_ApplicationId;
    strQS += "&sel=" + strSel;
    strQS += "&" + strAction;
    strQS += "&callback=?";

    _contShowLoadingMsg();

    strUrl = g_strBaseQueryWebServiceUrl + strQS;

    jQuery.getJSON(strUrl, function(data) { _contOnLoadedCallback(data); });
}

function _contOnLoadedCallback(data)
{
    jQuery(g_currentElmntSel).html(data.htmlPage);
}

function _contShowLoadingMsg()
{
    jQuery(g_currentElmntSel).html('Loading...');
}
