var current_banner_id = null;

function ShowBImgUsingGet(_ele_id, _location_name, _count, _uri) {
	var div_id = document.getElementById(_ele_id);

	$.ajax({
	   type: "GET",
	   url: '/ajax/b/',     // this is the path from above
	   data: 'location_name=' + _location_name + '&count=' + _count + '&uri=' + encodeURIComponent(_uri),
	   success: function(s) {
	        if(s) {
			    div_id.innerHTML = s.getElementsByTagName('content')[0].firstChild.nodeValue;
			}
			current_banner_id = $('#' + _ele_id + ' div').attr('id');
	   }
	});
}

function ShowBImg(_ele_id, _location_name, _count, _uri) {
	var div_id = document.getElementById(_ele_id);

	$.ajax({
	   type: "POST",
	   url: '/ajax/b/',     // this is the path from above
	   data: 'location_name=' + _location_name + '&count=' + _count + '&uri=' + encodeURIComponent(_uri),
	   success: function(s) {
	        if(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);

	$.ajax({
	   type: "POST",
	   url: '/ajax/b/',     // this is the path from above
	   data: 'location_name=' + _location_name + '&count=' + _count + '&uri=' + encodeURIComponent(_uri) + '&exclude=' + current_banner_id,
	   success: function(s) {
	        if(s.getElementsByTagName('content').length) {
			    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);
	   }
	});
}

