function loadBanner(xml)
{
    var contentID = xml.getElementsByTagName('cID').item(0).firstChild.nodeValue;
	var html_content = xml.getElementsByTagName('content').item(0).firstChild.nodeValue;
    var reload_after = xml.getElementsByTagName('reload').item(0).firstChild.nodeValue;
	var content_total = xml.getElementsByTagName('total').item(0).firstChild.nodeValue;
		
	//document.getElementById('contentRotate').innerHTML = html_content;
	
	$('#contentRotate img').fadeTo(2000, 0.0, function() {
                $(this).attr("src",html_content).fadeTo(2000, 1.0);
            });
	
	/*$("#contentRotate img").ready(function () {
          $("#contentRotate img").fadeIn(1000);
        });*/
	

	
	//$("#contentRotate").html(html_content);
	//$("#contentRotate").wrapInner() = html_content;
	
	//$("#BannerDiv").children().showdelay();
	
	/*$("#contentRotate").blur(function () {
          $("img").fadeIn(1000);
        });
	
	$("#contentRotate").ready(function () {
          $("img").fadeIn(1000);
        });*/
		
	/*$(document).ready(function () {
          $("#contentRotate img").fadeIn(1000);
        });*/
	
	contenTotal = (content_total - 1);
	
	if(document.RotateIndex == contenTotal)
	{
		document.RotateIndex = 0;
	}
	else if(document.RotateIndex == null)
	{
		document.RotateIndex = 1;
	}
	else
	{
		document.RotateIndex = parseInt(contentID) + 1;
	}
	
	
	
	//document.RotateIndex++;
	//alert(document.RotateIndex);
	
    try {
        clearTimeout(to);
    } catch (e) {}

    to = setTimeout("nextAd()", parseInt(reload_after));
}

function nextAd(displayid, page)
{	
    var now = new Date();
	if(displayid > -1)
	{
		//alert(displayid);
    	var url = 'contentRotate.php?cid=' + displayid + '&page='+ document.PageIndex + '&ts=' + now.getTime();
	}
	else if(document.RotateIndex == null)
	{
		document.RotateIndex = 0;
		var url = 'contentRotate.php?cid=0&page='+ document.PageIndex +'&ts=' + now.getTime();
	}
	else
	{	
		if(document.RotateIndex == 7)
		{
			document.RotateIndex = 0;
		}
		var url = 'contentRotate.php?cid=' + document.RotateIndex + '&page='+ document.PageIndex + '&ts=' + now.getTime();
	}
	//alert(url);
	if(displayid > (document.RotateIndex+1))
	{
		var featureID = "feature"+(displayid+1);
		//alert(featureID);
	}
	else if(displayid == null)
	{
		var featureID = "feature"+(document.RotateIndex+1);;
		//alert(featureID);
	}
	else
	{
		var featureID = "feature"+(displayid+1);
		//alert(featureID);
	}
	
	//menuReset();
	//if(featureID)
	//MM_swapImage(featureID,'','http://www.torontocondos.com/_images/images_n/button_on.gif',1);
	
    makeHttpRequest(url, 'loadBanner', true); 

}

