function AjaxQuery(method, url, data, use_resp_text)
{
	var xmlthhp = null;

	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp = null;
	}

	if (xmlhttp == null)
	{
		try {
		 	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlhttp = null;
		}
	}

	if (xmlhttp == null)
	{
		try {
	 		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			xmlhttp = null;
		}
	}

	if (xmlhttp == null) {
		alert('Your browser not support AJAX');
		return '';
	}

	if (method.toLowerCase() == 'get')
	{
		if (url.indexOf('?') > 0)
		{
			url += '&rand=' + (new Date()).valueOf();
		}
		else
		{
			url += '?rand=' + (new Date()).valueOf();
		}
	}

	xmlhttp.open(method, url, false);

	if (method.toLowerCase() == 'post') {
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
	}

	xmlhttp.send(data);

	if (typeof(use_resp_text)!='undefined' && use_resp_text) return xmlhttp.responseText;
	else return xmlhttp.responseXML;
}

function RetreiveAdsForDate(element, date)
{
	var res = element;

	if (document.all) {
		res = element.parentNode.parentNode.parentNode;
	}

	res.innerHTML = AjaxQuery('get', '../ads/nlarchives_marketplace_dailyads.php?date=' + date, '', true);
}
