/* ----------------------------------------------------------
	title		  : CCK Framework
	created		  : 10/21/08
	last updated  : 10/21/08
	history		  :
---------------------------------------------------------- */
jQuery.noConflict();     
jQuery(document).ready(function($){


//remove default placeholder
$('#feature-content').empty();


//create controls
$('#feature').prepend('<div id="feature-controls"></div>');


	//get images
	$.ajax({
		type: "GET",
		url: "/Websites/cck/templates/cckTheme/feature.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('album').each(function(){
				var dirPath = $(this).attr('lgPath');
					
					$(this).find('img').each(function(){
						var imgPath = $(this).attr('src');			
						var linkPath = $(this).attr('link');
						
						
						var newImg = '<img src="' + dirPath + imgPath + '" alt="" />';
						
						if (linkPath == '#' || linkPath == '' || linkPath == null) {
							//do nothing						
							} else {
							var newImg = '<a href="' + linkPath + '">'+ newImg + '</a>';
							}
						
						
						$(newImg).appendTo('#feature-content');
					
					});
			}); 
		
		//rotate
		$('#feature-content').cycle({
			fx:     'scrollLeft', 
			speed:  'normal', 
			timeout: 5000,
			pager:  '#feature-controls',
			pause:   1
		});
		
		}
	}); 

});//end doc ready