// JavaScript Document
function urlencode (str) {
    
    str = (str+'').toString();
    
    // Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current
    // PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following.
    return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
                                                                    replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}
function ajaxrequest()
{
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broken!");
				return false;
			}
		}
	}
	return ajaxRequest;
}

function stateChanged(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("popup_event_container").innerHTML=xmlHttp.responseText ;
	 }
	else{
		document.getElementById("popup_event_container").innerHTML="<img src='loading.gif' />";
		}
	}
///////////////////////////////////////////	
/*8888888888888888888881234567876543218888888888888888888888888888888888*/
function ajax_show_event(year,month,day){
queryString = "&year="+year+"&month="+month+"&day="+day;
url="./includes/popup_event.php";
	xmlHttp=ajaxrequest();
	if (xmlHttp==null)
		{
		alert ("Browser does not support HTTP Request")
		return
		}
	
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("POST",url,true);
	
	//alert(encodeURIComponent(queryString));
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	xmlHttp.setRequestHeader("Content-Length",queryString.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(queryString);
}
