function loadBanner(xml)
{
	(function($) {
		$(document).ready(function() {
			var effect=xml.getElementsByTagName('effect').item(0).firstChild.nodeValue;
			var in_duration=xml.getElementsByTagName('effect_in_duration').item(0).firstChild.nodeValue;
			var out_duration=xml.getElementsByTagName('effect_out_duration').item(0).firstChild.nodeValue;
			switch (effect) {
				case "slide": 
					$("#rnd_img").slideUp(in_duration, function(){
							document.getElementById('rnd_img').innerHTML = xml.getElementsByTagName('content').item(0).firstChild.nodeValue;
					  	$("#rnd_img").slideDown(out_duration);
					});
					break;
				case "fade":
					$("#rnd_img").fadeOut(in_duration, function(){
							document.getElementById('rnd_img').innerHTML = xml.getElementsByTagName('content').item(0).firstChild.nodeValue;
					  	$("#rnd_img").fadeIn(out_duration);
					});
					break;
				default :
					$("#rnd_img").fadeOut(in_duration, function(){
							document.getElementById('rnd_img').innerHTML = xml.getElementsByTagName('content').item(0).firstChild.nodeValue;
					  	$("#rnd_img").fadeIn(out_duration);
					});
					break;
			}					
				
			var reload_after = xml.getElementsByTagName('reload').item(0).firstChild.nodeValue;
	 		try {
				clearTimeout(reload_after);
	  	} catch (e) {}
			to = setTimeout("nextRndImg(null)", parseInt(reload_after));
		});
	})(jQuery);
}

function nextRndImg(url)
{
	if (url!=null) {
		nextRndImg.url=url;
	}
	 	
	(function($) {
		$(document).ready(function() {
			$.ajax ({ 
				url:  nextRndImg.url,
    		cache: false,
				dataType: "xml", 
				success: loadBanner
			}); 
		});
	})(jQuery);
}
//window.onload = nextRndImg;
function addLoadEvent_ajax_head(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } 
	else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
addLoadEvent_ajax_head(nextRndImg);
