﻿//navigation
var slider=function(){var array=[];var speed=5;var timer=10;return{init:function(t,c){var s,ds,l,i,y;s=document.getElementById(t);ds=s.getElementsByTagName('div');l=ds.length;i=y=0;for(i=0;i<l;i++){var d,did;d=ds[i];did=d.id;if(did.indexOf("section")!=-1){y++;d.onclick=new Function("slider.process(this)");}else if(did.indexOf("content")!=-1){array.push(did.replace('-content',''));d.maxh=d.offsetHeight;if(c!=y){d.style.height='0px';d.style.display='none'}
else{d.style.display='block';}}}},process:function(d){var cl,i;cl=array.length;i=0;for(i;i<cl;i++){var s,h,c,cd;s=array[i];h=document.getElementById(s+'-section');c=s+'-content';cd=document.getElementById(c);clearInterval(cd.timer);if(h==d&&cd.style.display=='none'){cd.style.display='block';this.islide(c,1);}else if(cd.style.display=='block'){this.islide(c,-1);}}},islide:function(i,d){var c,m;c=document.getElementById(i);m=c.maxh;c.direction=d;c.timer=setInterval("slider.slide('"+i+"')",timer)},slide:function(i){var c,m,h,dist;c=document.getElementById(i);m=c.maxh;h=c.offsetHeight;dist=(c.direction==1)?Math.round((m-h)/speed):Math.round(h/speed);if(dist<=1){dist=1}
c.style.height=h+(dist*c.direction)+'px';c.style.opacity=h/c.maxh;c.style.filter='alpha(opacity='+(h*100/c.maxh)+')';if(h<2&&c.direction!=1){c.style.display='none';clearInterval(c.timer);}else if(h>(m-2)&&c.direction==1){clearInterval(c.timer)}}};}();
//newSlider
jQuery.fn.accessNews=function(settings){settings=jQuery.extend({headline:"Top Stories",speed:"normal",slideBy:2},settings);return this.each(function(){jQuery.fn.accessNews.run(jQuery(this),settings);});};jQuery.fn.accessNews.run=function($this,settings){jQuery(".javascript_css",$this).css("display","none");var ul=jQuery("ul:eq(0)",$this);var li=ul.children();if(li.length>settings.slideBy){var $next=jQuery(".next > a",$this);var $back=jQuery(".back > a",$this);var liWidth=jQuery(li[0]).width();var animating=false;ul.css("width",(li.length*liWidth));$next.click(function(){if(!animating){animating=true;offsetLeft=parseInt(ul.css("left"))-(liWidth*settings.slideBy);if(offsetLeft+ul.width()>0){$back.css("display","block");ul.animate({left:offsetLeft},settings.speed,function(){if(parseInt(ul.css("left"))+ul.width()<=liWidth*settings.slideBy){$next.css("display","none");}
animating=false;});}else{animating=false;}}
return false;});$back.click(function(){if(!animating){animating=true;offsetRight=parseInt(ul.css("left"))+(liWidth*settings.slideBy);if(offsetRight+ul.width()<=ul.width()){$next.css("display","block");ul.animate({left:offsetRight},settings.speed,function(){if(parseInt(ul.css("left"))==0){$back.css("display","none");}
animating=false;});}else{animating=false;}}
return false;});$next.css("display","block").parent().after(["<p class=\"view_all\">","<a href=\"#\" class=\"browseLinks\">Click the arrow to browse links</a></p>"].join(""));jQuery(".view_all > a, .skip_to_news > a",$this).click(function(){var skip_to_news=(jQuery(this).html()=="Skip to News");if(jQuery(this).html()=="view all"||skip_to_news){ul.css("width","auto").css("left","0");$next.css("display","none");$back.css("display","none");if(!skip_to_news){jQuery(this).html("view less");}}else{if(!skip_to_news){jQuery(this).html("view all");}
ul.css("width",(li.length*liWidth));$next.css("display","block");}
return false;});}};
$(document).ready(function(){$("#example_2").accessNews({headline:"",speed:"slow",slideBy:3});});
//slideshows
;(function($){var settings={};$.fn.Slides=function(options){var that=this;var id=$(this).attr('id');settings[id]=$.extend({},$.fn.Slides.defaults,options||{});$.fn.Slides.init(that,settings[id],function(){return that.each(function(){$.fn.Slides.start(id);});});};$.fn.Slides.defaults={wait:0,pause:6000,fade:1000};$.fn.Slides.init=function(target,settings,callback){if(typeof settings.images==='undefined')
throw Error('Image array is not optional must be passed in the call $("#id").Slides({images : ["img1.jpg", "img2.jpg"]})');if(typeof settings.urls!='undefined'&&(settings.urls.length!=settings.images.length))
throw Error('Urls length must match images length');if(typeof settings.functions!='undefined'&&(settings.functions.length!=settings.images.length))
throw Error('Functions length must match images length');settings=$.extend(settings,{main:$(target),pipes:{urls:[],functions:[]},initialized:false});var initWrapper=function(){settings.toggle=settings.main.wrap('<span></span>').parent().css({display:'block',overflow:'hidden',height:settings.main.height()+'px',width:settings.main.width()+'px'});$.fn.Slides.preloadNextImage(settings);settings.initialized=true;};settings.main.load(function(){if(settings.initialized)
return;initWrapper();callback();});if(settings.main[0].complete&&!settings.initialized){initWrapper();callback();}};$.fn.Slides.preloadNextImage=function(settings){var nextImage=$.fn.Slides.getNextImage(settings);var image=new Image();image.src=nextImage;settings.nextImage=image;};$.fn.Slides.getNextImage=function(settings){var nextImage=settings.images.shift();settings.images.push(nextImage);if(settings.urls){var url=settings.urls.shift();settings.urls.push(url);settings.pipes.urls.push(url);}
if(settings.functions){var func=settings.functions.shift();settings.functions.push(func);settings.pipes.functions.push(func);}
return nextImage;};$.fn.Slides.start=function(id){setTimeout(function(){$.fn.Slides.execute(id);},settings[id].wait);};$.fn.Slides.execute=function(id){var _settings=settings[id];_settings.isToggle=false;setInterval(function(){if(_settings.isToggle){_settings.main.attr('src',_settings.nextImage.src).animate({opacity:1},_settings.fade);_settings.isToggle=false;}else{_settings.toggle.css({background:'transparent url('+_settings.nextImage.src+') left top no-repeat'});_settings.main.animate({opacity:0},_settings.fade);_settings.isToggle=true;}
if(_settings.pipes.urls.length>0){_settings.main.click(function(){window.location.href=_settings.pipes.urls.shift();});}
if(_settings.pipes.functions.length>0)
_settings.pipes.functions.shift()();$.fn.Slides.preloadNextImage(_settings);},_settings.pause);};})(jQuery);
$(document).ready(function(){$('#slide1image').Slides({images:['http://www.smokerisebaptist.org/images/homepage/slideshow/pic15.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic14.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic01.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic02.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic03.jpg'],wait:2000,pause:5000,fade:3000});$('#slide2image').Slides({images:['http://www.smokerisebaptist.org/images/homepage/slideshow/pic18.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic17.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic04.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic05.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic06.jpg'],wait:5000,pause:5000,fade:3000});$('#slide3image').Slides({images:['http://www.smokerisebaptist.org/images/homepage/slideshow/pic08.jpg','http://www.smokerisebaptist.org/images/homepage/slideshow/pic09.jpg'],wait:3500,pause:5000,fade:3000});});

