function pageWidth(){return window.innerWidth!=null?window.innerWidth:document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body!=null?document.body.clientWidth:null}function pageHeight(){return window.innerHeight!=null?window.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body!=null?document.body.clientHeight:null}function posLeft(){return typeof window.pageXOffset!="undefined"?window.pageXOffset:document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft?document.body.scrollLeft:0}function posTop(){return typeof window.pageYOffset!="undefined"?window.pageYOffset:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop?document.body.scrollTop:0}function posRight(){return posLeft()+pageWidth()}function posBottom(){return posTop()+pageHeight()}(function(a){a.fn.agile_carousel=function(b){agile_validated="fail";validate_carousel=function(){var f;for(f in b){checkme=b[f];checkme=checkme.toString();checkme=checkme.replace(/<\S+>/g,"")}agile_validated="pass"};validate_carousel();if(agile_validated=="pass"){slide_containter_elem=a(this);var e={disable_on_first_last:"no",first_last_buttons:"no",first_slide_is_intro:"no",hover_next_prev_buttons:"no",intro_timer_length:"3000",intro_transtion:"no",next_prev_buttons:"yes",number_slides_visible:"1",pause_button:"no",slide_buttons:"no",slide_captions:"no",slide_directory:"slides",doctype:"html",slide_links:"no",slide_number_display:"no",timer_length:"7000",timer_on:"yes",transition_duration:1000,transition_easing:"swing",transition_type:"carousel",water_mark:"no"};var c=a.extend(e,b);a.ajax({type:"POST",url:"/make_slides.php",cache:false,data:{screen_width:pageWidth(),window_width:window.innerWidth,first_last_buttons:e.first_last_buttons,first_slide_is_intro:e.first_slide_is_intro,hover_next_prev_buttons:e.hover_next_prev_buttons,next_prev_buttons:e.next_prev_buttons,pause_button:e.pause_button,slide_buttons:e.slide_buttons,slide_captions:e.slide_captions,slide_directory:e.slide_directory,doctype:e.doctype,slide_links:e.slide_links,slide_alt:e.slide_alt,slide_number_display:e.slide_number_display,water_mark:e.water_mark},success:function(f){slide_containter_elem.html(f);if(e.first_slide_is_intro=="yes"){d()}else{carousel()}}});function d(){a("#intro").appendTo("#slide_holder_inner");a("#slide_1").css("z-index","1000");do_show_1=function(){a("#slide_1").show()};show_1=setTimeout(do_show_1,300);intro_transition=function(){if(e.intro_transtion=="fade"){a("#intro").fadeOut("slow");intro_timer=setTimeout(carousel,300)}else{a("#intro").hide()}};intro_timer=setTimeout("intro_transition()",e.intro_timer_length)}carousel=function(){button_class="slide_1";curr_slide_id="slide_1";curr_slide_id_number=1;next_slide_id_number=1;slideshow_paused="not_paused";transition_type=e.transition_type;slide_finder=a("#slide_holder_inner div.slide");slide_id_array=[];slides_index_counter=0;slide_finder.each(function(){slide_id_array[slides_index_counter]=a(this).attr("id");slides_index_counter++});slide_captions_array=e.slide_captions.split("|");slide_height=a("#slide_holder_inner").height();half_slide_height_raw=slide_height/2;half_slide_height=parseFloat(half_slide_height_raw);slide_holder_width=a(slide_containter_elem).width();slide_holder_height=a(slide_containter_elem).height();slide_holder_inner_width=a("#slide_holder_inner").width();slide_holder_inner_height=a("#slide_holder_inner").height();slide_holder_inner_width_px=slide_holder_inner_width+"px";slide_holder_inner_height_px=slide_holder_inner_height+"px";width_per_slide=slide_holder_inner_width/e.number_slides_visible;width_per_slide=Math.floor(width_per_slide);all_slides_width_raw=slide_id_array.length*width_per_slide;all_slides_width_raw=Math.floor(all_slides_width_raw);all_slides_width=all_slides_width_raw+"px";slide_finder_array_length=slide_finder.length;carousel_tranition_number_slides_visible=e.carousel_tranition_number_slides_visible;num_slides_vis=parseFloat(e.number_slides_visible);a("#intro").remove();a("#slide_buttons").show();a("#slide_holder_inner div.slide:not(#slide_1)").hide();a("#slide_1").css("z-index","0");a("#slide_holder_inner .pause_button").show();a("#slide_buttons li").removeAttr("id");a("#slide_buttons .slide_1").attr("id","button_selected");if(e.disable_on_first_last=="yes"){a(".prev_button").attr("class","prev_button_disabled")}Array.prototype.inArray=function(r){var q;for(q=0;q<this.length;q++){if(this[q]===r){return true}}return false};slide_finder.each(function(){update_slide_number_display=function(){if(e.slide_number_display=="yes"){var s=curr_slide_id;var q=s.split("_");var r=q.pop();a("#slide_number_display span").html(r+" of <span>"+slide_id_array.length+"</span>")}};if(e.slide_number_display=="yes"){update_slide_number_display()}});pause=function(){if(e.timer_on=="yes"){clearInterval(slideshow_timer)}a("#pause_button span").html("play");slideshow_paused="paused";a("#pause_button").attr("class","paused_button")};change_slide_caption=function(){if(e.slide_captions!="no"){curr_caption=slide_captions_array[curr_slide_id_number-1];if(curr_caption==null){curr_caption=""}a("#slide_captions span").html(curr_caption)}};change_slide_caption();if(e.transition_type=="fold"){options_object={size:half_slide_height,easing:e.transition_easing}}else{options_object={easing:e.transition_easing}}if((e.jquery_ui_effect_param!=null)&&(e.jquery_ui_effect_value!=null)){jquery_ui_effect_param=e.jquery_ui_effect_param;if((e.jquery_ui_effect_param=="distance")||(e.jquery_ui_effect_param=="number")||(e.jquery_ui_effect_param=="percent")||(e.jquery_ui_effect_param=="size")||(e.jquery_ui_effect_param=="times")||(e.jquery_ui_effect_param=="direction")){jquery_ui_effect_value=e.jquery_ui_effect_value}else{jquery_ui_effect_value="'"+e.jquery_ui_effect_value+"'"}options_object[jquery_ui_effect_param]=jquery_ui_effect_value}if(e.transition_type=="carousel"){a(".slide").show();for(i=0;i<slide_finder_array_length;i++){var n=slide_finder[i];if(pageWidth()>=1200){var h=((width_per_slide)*i)+((slide_holder_width-390)/2)}else{var h=((width_per_slide)*i)+((slide_holder_width-270)/2)}a(n).css("left",h)}a("#row_of_slides").css("width",all_slides_width)}x_position_array=[];slidestop_array=[];sliced_slidestop_array=[];next_slidestop_array=[];prev_slidestop_array=[];for(i=0;i<slide_id_array.length;i++){test_me_for_float=(i)/e.number_slides_visible;if(i==0||(test_me_for_float==parseInt(test_me_for_float)&&test_me_for_float==parseFloat(test_me_for_float))){var o="yes";the_x_pos=width_per_slide*(i)*-1;the_next_slidestop=(1+i+num_slides_vis);if(the_next_slidestop>slide_id_array.length){the_next_slidestop=1}next_slidestop_array[i]=the_next_slidestop;the_prev_slidestop=(1+i-num_slides_vis);if(the_prev_slidestop<1){the_prev_slidestop=slide_id_array.length-num_slides_vis+1}prev_slidestop_array[i]=the_prev_slidestop;next_counter=num_slides_vis-1;prev_counter=1}else{o="no";the_next_slidestop=i+1+next_counter;if(the_next_slidestop>slide_id_array.length){the_next_slidestop=1}next_slidestop_array[i]=the_next_slidestop;next_counter=next_counter+1;the_prev_slidestop=i+1-prev_counter;if(the_prev_slidestop<1){the_prev_slidestop==slide_id_array.length}if(the_prev_slidestop>slide_id_array.length){the_prev_slidestop=1}prev_slidestop_array[i]=the_prev_slidestop;prev_counter=prev_counter+1}x_position_array[i]=the_x_pos;slidestop_array[i]=o}function j(){a("#row_of_slides").stop().animate({left:x_position_array[next_slide_id_number-1]},{duration:e.transition_duration,easing:e.transition_easing})}function k(){a("#slide_holder_inner div.slide").each(function(){if(a(this).attr("id")!=curr_slide_id){a(this).hide()}});a('#slide_holder_inner div[@id$="'+curr_slide_id+'"]').css("z-index","50");a('#slide_holder_inner div[@id$="'+button_class+'"]').css("z-index","100");a('#slide_holder_inner div[@id$="'+button_class+'"]').animate({opacity:"show"},{duration:e.transition_duration,easing:e.transition_easing})}function m(){next_top_show_next=function(){a("#slide_holder_inner div.slide").show().css("z-index","20");a('#slide_holder_inner div[@id$="'+next_slide_id+'"]').css("z-index","60");a('#slide_holder_inner div[@id$="'+curr_slide_id+'"]').css("z-index","50");a('#slide_holder_inner div[@id$="'+next_slide_id+'"]').stop().show(e.transition_type,options_object,e.transition_duration)};next_bottom_hide_curr=function(){a("#slide_holder_inner div.slide").show().css("z-index","20");var q=a('#slide_holder_inner div[@id$="'+next_slide_id+'"]').css("z-index","50");a(q).css("z-index","1000");a('#slide_holder_inner div[@id$="'+curr_slide_id+'"]').css("z-index","60");a('#slide_holder_inner div[@id$="'+curr_slide_id+'"]').effect(e.transition_type,options_object,e.transition_duration)};if(e.transition_type=="blind"||e.transition_type=="bounce"||e.transition_type=="clip"||e.transition_type=="drop"||e.transition_type=="fold"||e.transition_type=="shake"||e.transition_type=="slide"||e.transition_type=="scale"||e.transition_type=="pulsate"){next_top_show_next()}else{if(e.transition_type=="explode"||e.transition_type=="puff"){next_bottom_hide_curr()}else{next_top_show_next()}}}function g(){var r=a("#slide_holder_inner").width();var q=-1*r+"px";a('#slide_holder_inner div[@id$="'+button_class+'"]').stop().show().css("left",q);a('#slide_holder_inner div[@id$="'+button_class+'"]').stop().show().animate({left:0},{easing:e.transition_easing},e.transition_duration);a('#slide_holder_inner div[@id$="'+curr_slide_id+'"]').stop().animate({left:r},{easing:e.transition_easing},e.transition_duration)}function f(){a('#slide_holder_inner div[@id$="'+button_class+'"]').show();a('#slide_holder_inner div[@id$="'+curr_slide_id+'"]').hide()}function p(){function q(){if(curr_slide_id!=button_class){if(transition_type=="fade"){k()}else{if(transition_type=="no_transition_effect"){f()}else{if(transition_type=="scroll_right"){g()}else{if(transition_type=="carousel"){j()}else{if(transition_type=="blind"||transition_type=="clip"||transition_type=="drop"||transition_type=="explode"||transition_type=="fold"||transition_type=="puff"||transition_type=="slide"||transition_type=="scale"||transition_type=="pulsate"){m()}else{f()}}}}}}curr_slide_id_number=next_slide_id_number;function s(){curr_slide_id=button_class}s()}q();function r(){}}function l(q){a("#slide_buttons li").removeAttr("id");a("#slide_buttons li").each(function(){if(a(this).attr("class")==q){a(this).attr("id","button_selected")}})}a(".pause_button").click(function(){if(slideshow_paused=="paused"){skip("next");if(e.timer_on=="yes"){slideshow_timer=setInterval("skip('next')",e.timer_length)}slideshow_paused="not_paused";a("#pause_button span").html("pause");a(this).attr("class","pause_button")}else{if(slideshow_paused=="not_paused"){clearInterval(slideshow_timer);slideshow_paused="paused";a(this).attr("class","paused_button");pause()}}});skip=function(q){curr_slide_id_string=curr_slide_id.toString();split_curr_slide_id_string=curr_slide_id.split("_");curr_slide_id_string=split_curr_slide_id_string.pop();curr_slide_id_number=parseFloat(curr_slide_id_string);if(q=="next"){next_slide_id_number=curr_slide_id_number+1;if(e.transition_type=="carousel"){the_index_to_use=curr_slide_id_number-1;next_slide_id_number=next_slidestop_array[the_index_to_use]}}else{if(q=="prev"){next_slide_id_number=curr_slide_id_number-1;if(e.transition_type=="carousel"){the_index_to_use=curr_slide_id_number-1;next_slide_id_number=prev_slidestop_array[the_index_to_use]}}else{if(q=="first"){next_slide_id_number=slide_id_array.length;curr_slide_id_number=1}else{if(q=="last"){next_slide_id_number=1;curr_slide_id_number=slide_id_array.length}else{next_slide_id_number=q}}}}next_slide_id="slide_"+next_slide_id_number;if(next_slide_id_number>slide_id_array.length){next_slide_id="slide_1";curr_slide_id_number=slide_id_array.length;next_slide_id_number=1}else{if(next_slide_id_number<1){next_slide_id="slide_"+slide_id_array.length;next_slide_id_number=slide_id_array.length}}button_class=next_slide_id;p();l(button_class);if(e.slide_number_display=="yes"){update_slide_number_display()}change_slide_caption();if((e.disable_on_first_last=="yes"&&((next_slide_id_number==slide_id_array.length)||(next_slide_id_number==slide_id_array.length-num_slides_vis+1)))){a("#next_button").attr("class","next_button_disabled");a("#hover_next_button").attr("class","hover_next_buttondisabled");a("#last_button").attr("class","last_buttondisabled")}else{a("#next_button").attr("class","next_button");a("#hover_next_button").attr("class","hover_next_button");a("#last_button").attr("class","last_buton")}if((e.disable_on_first_last=="yes"&&((next_slide_id_number==1)||(next_slide_id_number==num_slides_vis)))){a("#prev_button").attr("class","prev_button_disabled");a("#hover_prev_button").attr("class","hover_prev_button_disabled");a("#first_button").attr("class","first_button_disabled")}else{a("#prev_button").attr("class","prev_button");a("#hover_prev_button").attr("class","hover_prev_button");a("#first_button").attr("class","first_button")}};if(e.timer_on=="yes"){slideshow_timer=setInterval("skip('next')",e.timer_length)}a("#slide_buttons li").each(function(){a(this).click(function(){button_class=a(this).attr("class");l(button_class);split_button_class_string=button_class.split("_");button_class_string=split_button_class_string.pop();next_slide_id_number=parseFloat(button_class_string);pause();skip(next_slide_id_number);return(false)})});if(e.transition_type=="carousel"){a("#slide_buttons li").each(function(){test_the_button_number=a(this).text()-1;if(slidestop_array[test_the_button_number]=="no"){a(this).remove()}})}a(".next_button").click(function(){if(e.disable_on_first_last!="yes"){skip("next");pause()}else{if((e.disable_on_first_last=="yes"&&next_slide_id_number==slide_id_array.length)||(next_slide_id_number==(slide_id_array.length-num_slides_vis+1))){pause()}else{skip("next");pause()}}});a(".prev_button, .prev_button_disabled").click(function(){if(e.disable_on_first_last!="yes"){skip("prev");pause()}else{if((e.disable_on_first_last=="yes"&&curr_slide_id_number==1)||(e.disable_on_first_last=="yes"&&next_slide_id_number==num_slides_vis)){pause()}else{skip("prev");pause()}}});if(e.hover_next_prev_buttons=="yes"){a(".hover_button").fadeTo(1,0,function(){a(this).css("display","block")});a("#hover_prev_button").hover(function(){a("#hover_prev_button").stop().fadeTo("slow",0.95)},function(){a("#hover_prev_button").stop().fadeTo("slow",0)});a("#hover_next_button").hover(function(){a("#hover_next_button").stop().fadeTo("slow",0.95)},function(){a("#hover_next_button").stop().fadeTo("slow",0)})}a("#first_button").click(function(){skip("last");pause()});a("#last_button").click(function(){pause();skip("first")})}}}})(jQuery);