var xmlHttp;

function GetXmlHttpObject() {
	try	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch(e) {
		// Internet Explorer
		try	{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
}

function checkDateInEvents(date,tickId,quantity) {
	GetXmlHttpObject();
	url = "eventajax.php";
	url = url + "?doAction=checkdate&datex=" + date + "&tickId=" + tickId + "&quantity=" + quantity;//alert(url);
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() {
	if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {

		strResponseText = xmlHttp.responseText;

		arrResponse = strResponseText.split("#@#");

		if(arrResponse[0] == 'N') {
			var url = 'ticketregistration.php?tickId=' + arrResponse[1] + "&quantity=" + arrResponse[2] + "&datex=" + arrResponse[3];
			location.href=url;
		}
		else {
			if(confirm("On " + arrResponse[1] + ", we have a special event, so ticket fares would be different for this day. Shall we continue?")) {
				var url = "eventsdetails.php?evtId=" + arrResponse[0];
				location.href=url;
			}
		}
	}
}