

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

function requestObject(){
	if(window.XMLHttpRequest){ return new XMLHttpRequest(); } 
	else if(window.ActiveXObject){ return new ActiveXObject("Microsoft.XMLHTTP"); } 
	else{}
}

function retrieveContent(){
	
	if (request.readyState == 4){
		
		var xml = request.responseXML;
		var items = xml.getElementsByTagName("item");
		
		var content = "";
		
		//index through category blocks
		for ( i=0; i<items.length; i++ ){
		

			if( items[i].childNodes[0].childNodes[0] != undefined && items[i].childNodes[1].childNodes[0] != undefined ){
			
				var title = items[i].childNodes[0].childNodes[0].nodeValue;
				content += '<p class="specialTitle">'+title+'</p>';
			
				var text = items[i].childNodes[1].childNodes[0].nodeValue;
				content += '<p class="specialDescription">'+text+'</p>';
			}
			
			//alert( items.length );
		}
		
		
		var div = document.getElementById("dynamicMenu");
		div.innerHTML = content;
	}		
}

function getForm(){

	if (request.readyState == 4 || request.readyState == 0){
		
		request.open("GET", 'specialsAndEvents.xml', true);
		request.setRequestHeader('Content-Type','text/plain;charset=UTF-8');
		//request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		request.onreadystatechange = retrieveContent; 
		request.send(null);
	}
}

