var current_banner_id = null;

function ShowBImg(_ele_id, _location_name, _count, _uri) {
	var div_id = document.getElementById(_ele_id);

	/*new Ajax.Request('/show_banner.php', {
		asynchronous: true,
		method: 'post',
		postBody: 'id=' + _id,
		onSuccess: function (r) {
			div_id.innerHTML = r.responseXML.getElementsByTagName('content')[0].firstChild.nodeValue;


			//current_banner[_id] = _id;
		}
	});*/

	$.ajax({
	   type: "POST",
	   url: '/ajax/banner/',     // this is the path from above
	   data: 'location_name=' + _location_name + '&count=' + _count + '&uri=' + encodeURIComponent(_uri),
	   success: function(s) {
			div_id.innerHTML = s.getElementsByTagName('content')[0].firstChild.nodeValue;
			current_banner_id = $('#' + _ele_id + ' div').attr('id');
	   }
	});
}

function SwitchBanner(_ele_id, _location_name, _count, _uri) {
	var div_id = document.getElementById(_ele_id);
	/*new Ajax.Request('/show_banner.php', {
		asynchronous: true,
		method: 'post',
		postBody: 'without=' + _without_id + '&location=' + _location,
		onSuccess: function (r) {
			div_id.innerHTML = r.responseXML.getElementsByTagName('content')[0].firstChild.nodeValue;

			setTimeout("SwitchBanner('" + _ele_id + "', '" + r.responseXML.getElementsByTagName('id')[0].firstChild.nodeValue + "', '" + _location + "')", delay);
		}
	});*/

	$.ajax({
	   type: "POST",
	   url: '/ajax/banner/',     // this is the path from above
	   data: 'location_name=' + _location_name + '&count=' + _count + '&uri=' + encodeURIComponent(_uri) + '&exclude=' + current_banner_id,
	   success: function(s) {
			div_id.innerHTML = s.getElementsByTagName('content')[0].firstChild.nodeValue;
			current_banner_id = $('#' + _ele_id + ' div').attr('id');
			setTimeout("SwitchBanner('" + _ele_id + "', '" + _location_name + "', '" + _count + "', '" + _uri + "')", delay);
	   }
	});
}