// Easy Events client side AJAX
// I know this could be reduced a lot...

var VenueEvents = {
    listDivId: '',
    calDivId: '',
    xhr0: window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0"),
    updateList:function(n,y,m,d,lp,gtdp){
        var xhro = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0");
        xhro.open('post',this.ajaxPageUrl,true);
        xhro.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        xhro.onreadystatechange = function()
        {
            if (xhro.readyState == 4 && xhro.status == 200)
            {
                document.getElementById(VenueEvents.listDivId).innerHTML = xhro.responseText;
            }
        }
        if ( xhro )
        {
            xhro.send('a=ul&y='+y+'&m='+m+'&d='+d+'&lp='+lp+'&gtdp='+gtdp+'&n='+n);

        }
        return false;
    },
    updateCalendar:function(n,y,m,d,pid,gtdp){
        var xhro = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0");
        xhro.open('post',this.ajaxPageUrl,true);
        xhro.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        xhro.onreadystatechange = function()
        {
            if (xhro.readyState == 4 && xhro.status == 200)
            {
                document.getElementById(VenueEvents.calDivId).innerHTML = xhro.responseText;
            }
        }
        if ( xhro )
        {
            xhro.send('a=uc&y='+y+'&m='+m+'&d=0&pid='+pid+'&n='+n+'&gtdp='+gtdp);

        }
        return false;
    },
    getDetails:function(n,eeid){
        var xhro = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0");
        xhro.open('post',this.ajaxPageUrl,true);
        xhro.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        xhro.onreadystatechange = function()
        {
            if (xhro.readyState == 4 && xhro.status == 200)
            {
                document.getElementById(VenueEvents.listDivId).innerHTML = xhro.responseText;
            }
        }
        if ( xhro )
        {
            xhro.send('n='+n+'&a=gd&i='+eeid);

        }
        return false;
    }
}