
(function($){$.fn.extend({simpleSlider:function(options){var defTitleStyle={color:'#fff',fontSize:'14px',fontFamily:'Arial',margin:'0 10px 0 10px',textAlign:'left'};var defSubtitleStyle={color:'#fff',fontSize:'10px',fontFamily:'Verdana',margin:'0 10px 0 10px',textAlign:'left'};var defaults={alpha:'0.7',bgColor:'#000',bgSpeed:'slow',captionSpeed:'slow',height:'50px',timeOut:4000,titleStyle:defTitleStyle,subtitleStyle:defSubtitleStyle};var options=$.extend(defaults,options);return this.each(function(){var element=$(this);var w=element.find('img').eq(0).width();var h=element.find('img').eq(0).height();var ms='-'+options.height;var hsc=String(parseInt(options.height)/2)+'px';var items=[];var index=0;var bgSpeed=isNaN(parseInt(options.bgSpeed))?options.bgSpeed:parseInt(options.bgSpeed);var captionSpeed=isNaN(parseInt(options.captionSpeed))?options.captionSpeed:parseInt(options.captionSpeed);var start=function(){$(items[index]).fadeIn(bgSpeed,function(){var timeOut=($(items[index]).data('timeOut')==undefined)?parseInt(options.timeOut):$(items[index]).data('timeOut');$(items[index]).children('div').animate({marginTop:ms},captionSpeed,function(){setTimeout(nextItem,timeOut);});});}
var nextItem=function(){$(items[index]).children('div').animate({marginTop:'0'},captionSpeed,function(){$(this).parent().fadeOut(bgSpeed,start);});index++;if(index>(items.length-1))index=0;}
element.css({listStyle:'none',padding:'0px',width:w,height:h,overflow:'hidden'}).children('li').css({margin:'0',display:'block',width:w+'px',height:h+'px',overflow:'hidden'}).append('<div><h1 style="padding-top:7px;"></h1><p><p></div>').children('div').css({position:'relative',backgroundColor:options.bgColor,opacity:options.alpha,width:w+'px',height:options.height,overflow:'hidden'});element.find('li').each(function(i,e){var r=$(this).attr('rel');if(r!=undefined){if(r.indexOf('simpleSlider')!=-1){eval('var o = '+(r.substr(r.indexOf('{'),(r.length-1))));$(e).data('timeOut',o.timeOut);}}
var t=$(this).attr('title');var s=$(this).find('img').eq(0).attr('title');items[i]=e;$(e).hide();$(this).find('h1').css(defTitleStyle).css(options.titleStyle).html(t).next('p').css(defSubtitleStyle).css(options.subtitleStyle).html(s);});start();});}});})(jQuery);
