// On Ducument Ready short hand

var $j = jQuery.noConflict();

$j(function(){
	
	// Ajax funcion that get my XML files called pictures
	// the first argument is the path of the file.
	// The second is the callback function 
	// $j.get('http://localhost:8888/nl/pictures.xml', function(pix) {
	// 	
	// 		//This is a loop to find elements within the pictures node in the XML
	// 		$j(pix).find('picture').each(function(index) {
	// 					var picture = $j(this);
	// 					var desc = $j(this).find('desc').text();
	// 					var path = $j(this).find('path').text();
	// 					var link = $j(this).find('link').text();
	// 					
	// 					if (!desc == '') {
	// 						var desc = "<h2><span>"+desc+ "</span></h2>"
	// 					}else{ var desc = ''};
	// 					
	// 					if (!link == '') {
	// 						var link = "<a href=\""+link+ "\">"
	// 						var close = "</a>"
	// 					}else{var link = ''; var close = ''};
	// 				
	// 					$j('#rotator').append(
	// 					"<li>"+ link +"<img class=\"slide\" alt=\"\" src=\"" + path + "\"/>"+close+ desc +"</li>"
	// 					);
	// 				});
	// 		// End of loop
	// 		
	// 
	// 		// This function runs in the callback after the DOM elements have been loaded
	// 		// cycle plugin starts
	// 
	// 		// cycle plugin ends
	// });
	// The Ajax load(via .get()) function ends	
	
	roll = $j('#rotator li h2').hide();
	$j('#rotator').cycle(
		   {fx:     'scrollDown', 
		    speed: 1000,
			timeout: 5000}
		).hover(function(){
			if ($j(roll).queue("fx").length>1){return};
			//do animations
			$j(roll).show(1000);
			}, function(){
					if ($j(roll).queue("fx").length>1){return};
					//do animations
					$j(roll).hide(500);
			}
		);
});
// End of OnDocumentReady