// JavaScript Document

/*window.addEvent('domready', function(){
		var slideshows=$$('div.featureditems_slideshow');
		slideshows.each(function(el){
								 
           var loader = new SlideShowLoader(el,{showCaptions: true, scrollerType: 'click', orientation: 'vertical'});								 

	    });

});*/

var SlideShowLoader = new Class({
							      
    getOptions: function(){
        return { 
		showCaptions:false,
		milliseconds: 10000,
		transition: true,
		autoStart:true, 
		thumbnails:true, 
		scrollerType:'click',
		orientation: 'horizontal'};
    },	
    initialize: function(el,options){
        this.setOptions(this.getOptions(), options);
		el = $(el);
		
		var slidePanes = el.getChildren();
		var loader = new Array();
		slidePanes.each(function(el){
		   var slideElements = el.getChildren();
		   var caption = '';
		   var src = '';
		   var url = '';
		   var linkText = '';
		   var heading = '';
		   
		   slideElements.each(function(sl){
				if(sl.hasClass('slideshow_heading')){
				  heading = sl.innerHTML;
				}
				else if(sl.hasClass('slideshow_caption')){
				  caption = sl.innerHTML;
				}				
				else if(sl.hasClass('slideshow_image')){
				  src = sl.href;
				}
				else if(sl.hasClass('slideshow_link')){
				  url = sl.href;
				  linkText = sl.innerHTML;
				}
				//sl.remove();
				sl.parentNode.removeChild(sl)
				//sl.setStyle('display','none');
									   
		   });
		   
		   loader.push({'heading':heading, 'caption':caption, 'src':src, 'url':url, 'linkText':linkText});

		});
		//send to slideshow script
		this.options.loader = loader;
		var imageSlides = new ImageSlideShow(el,this.options);
		
	}
	

							   
});
							   
SlideShowLoader.implement(new Events);
SlideShowLoader.implement(new Options);
	
