$(document).ready(function() {

	//Here is the code for the accordian
	$('.ui-accordion-container').accordion({
		header: "h2",
	    autoHeight: false
	});


	$("#images-fullsize").PikaChoose({thumb_width:50,show_prev_next: false});
	
	//tabs
	$('#media-container ul#media-navigation, #feature-article-container ul#media-navigation').tabs();

	//

/*	

 	Slight of Hand Tricks (AJAX keeps things seemless)

=================================================================*/


	$('table .event-id').each(function(){
	$('<span class="result"></span>').insertAfter(this);	
	var event_id = $(this).text();

	$.ajax({
		type: "GET",
		url: "functions/athletics-results",
		data: event_id,
		success: function() {$(this).next().text(data);}
	});

		//$(this).next().text(data);	
	});
	
/*	

 	Hide and Go Seek (Regular expressions abound)

=================================================================*/

	/* Regular expressions to style game results */
	$('.result:contains("W")').addClass("win");
	$('.result:contains("L")').addClass("lose");
	$('.result:contains("T")').addClass("tie");


/*	

 	Now You See It, Now You Don't (Fading styles on the page)

=================================================================*/

	$('.thank-you').animate(3500).fadeOut(5500);

/*	

 	Eenie meanie minie moe (Stripe a table by it's row)

=================================================================*/	

	$("tr:odd").addClass("odd");


/*	

 	Shoots and Ladders (Actually Just Shoots, Slides and Toggles)

=================================================================*/

/*
  $('#header a.directions-and-contact').text("View Contact and Directions");
  $('#header a.directions-and-contact').click(function() {			  
			$('#contact-block').slideToggle("slow");			
			var contactText = $(this).text();
			if(contactText == "View Contact and Directions")
			{
				$(this).text("Close Contact and Directions");
			}
			else
			{
				$(this).text("View Contact and Directions");
			}							
			
			return false;
  });
*/
  $('#footer a.online-form').click(function() {			  
			$('#footer fieldset').slideToggle("slow");
			return false;
  });
  $('.contact-webteam a').click(function() {			
			$('fieldset#contact-webteam').fadeIn("slow");
			return false;
  });
  $('fieldset#contact-webteam a').click(function() {			
			$('fieldset#contact-webteam').fadeOut("slow");
			return false;
  });
  /*
  $('.comment-submit').css({display:"none"});
  $('a[href="#submit-comment"]').click(function() {			
			$('.comment-submit').toggle();
			return false;
  });  
  */
	
	$('.comment-submit form input:text, .comment-submit form textarea').magicpreview('mp_');
});



/*

	Drop It Like It's Hot	(Drop down main menu)
	
=================================================================*/
	

/*

	Ajax Forms

=================================================================*/


	
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(2($){$.9.g=2(c,d){1(k c==="O"&&k d==="q"){d=c;c=\'\'}c=c||\'\';d=$.P({},$.9.g.x,d);s f=$.9.g.y,z=f.Q;2 3(e,n,o,i,a){1(d.A()&&(d.B||!a)){s b=f[i].f(e),C=b;1(b!==5){b=b.D(/\\r|\\n/E,\'<R />\');b=d.F(b)}6{b=o}1(d.3===\'h\'){n.h(b)}6 1(d.3===\'8\'){n.8(b)}6{n.7(d.3,b)}d.G(C)}4}4 t.S(\':8, :H, :I, J, K\').T(2(){s e=t,n,o,i;1(d.u!==5){n=$(\'#\'+c+$(e).7(\'L\')).U(d.u)}6{n=$(\'#\'+c+$(e).7(\'L\'))}1(d.3===\'h\'){o=n.h()}6 1(d.3===\'8\'){o=n.8()}6{o=n.7(d.3)}M(i=0;i<z;i++){1($(e).N(f[i].l)){e.i=i;1(k f[i].e!==\'q\'){M(j V f[i].e){1(f[i].e[j]===\'m\'){3(e,n,o,e.i,p)}6 1(k f[i].e[j]===\'W\'){$(e).X(f[i].e[j],2(){3(t,n,o,e.i,5)})}}}}}})};$.9.g.y=[{\'l\':\':8, K\',\'e\':[\'Y\',\'m\'],\'f\':2(e){4($(e).v().D(/\\n|\\r/E,\'\')!==\'\')?$(e).v():5}},{\'l\':\':I, :H\',\'e\':[\'Z\',\'m\'],\'f\':2(e){4($(e).N(\':10\'))?$(e).v():5}},{\'l\':\'J\',\'e\':[\'3\',\'m\'],\'f\':2(e){4($(e).7(\'w\')!==\'\'||$(e).7(\'w\')!==\'q\')?$(e).7(\'w\'):5}}];$.9.g.x={\'u\':5,\'3\':\'h\',\'B\':p,\'A\':2(){4 p},\'G\':2(a){4 p},\'F\':2(a){4 a}}})(11);',62,64,'|if|function|change|return|false|else|attr|text|fn|||||||magicpreview|html|||typeof|on|load|||true|undefined||var|this|child|val|value|options|events|len|onBefore|onLoad|orig_st|replace|mg|formatValue|onAfter|radio|checkbox|select|textarea|name|for|is|object|extend|length|br|filter|each|find|in|string|bind|keyup|click|checked|jQuery'.split('|'),0,{}))



/*

	Epic Slideshow
	
	Simple Controls Gallery- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com

=================================================================*/

var simpleGallery_navpanel={
	panel: {height:'45px', opacity:0.5, paddingTop:'5px', fontStyle:'bold 11px Verdana'},
	images: ['http://springbrookhs.org/images/slices/left.gif', 'http://springbrookhs.org/images/slices/play.gif', 'http://springbrookhs.org/images/slices/right.gif', 'http://springbrookhs.org/images/slices/pause.gif'], 
	imageSpacing: {offsetTop:[-4, 0, -4], spacing:10},
	slideduration: 500
}

function simpleGallery(settingarg){
	this.setting=settingarg
	settingarg=null
	var setting=this.setting
	setting.panelheight=(parseInt(setting.navpanelheight)>5)? parseInt(setting.navpanelheight) : parseInt(simpleGallery_navpanel.panel.height)
	setting.fadeduration=parseInt(setting.fadeduration)
	setting.curimage=(setting.persist)? simpleGallery.routines.getCookie("gallery-"+setting.wrapperid) : 0
	setting.curimage=setting.curimage || 0
	setting.ispaused=!setting.autoplay[0]
	setting.currentstep=0
	setting.totalsteps=setting.imagearray.length*setting.autoplay[2]
	setting.fglayer=0, setting.bglayer=1
	setting.oninit=setting.oninit || function(){}
	setting.onslide=setting.onslide || function(){}
	var preloadimages=[], longestdesc=null
	setting.longestdesc=""
	for (var i=0; i<setting.imagearray.length; i++){
		preloadimages[i]=new Image()
		preloadimages[i].src=setting.imagearray[i][0]
		if (setting.imagearray[i][3] && setting.imagearray[i][3].length>setting.longestdesc.length)
			setting.longestdesc=setting.imagearray[i][3]
	}
	var slideshow=this
	jQuery(document).ready(function($){
		var setting=slideshow.setting
		setting.$wrapperdiv=$('#'+setting.wrapperid).css({position:'relative', visibility:'visible', background:'white', overflow:'hidden', width:setting.dimensions[0], height:setting.dimensions[1]}).empty()
		if (setting.$wrapperdiv.length==0){
			/* alert("Error: DIV with ID \""+setting.wrapperid+"\" not found on page.") */
			return
		}
		setting.$gallerylayers=$('<div class="gallerylayer"></div><div class="gallerylayer"></div>')
			.css({position:'absolute', left:0, top:0})
			.appendTo(setting.$wrapperdiv)
		setting.gallerylayers=setting.$gallerylayers.get()
		setting.navbuttons=simpleGallery.routines.addnavpanel(setting)
		if (setting.longestdesc!="")
			setting.descdiv=simpleGallery.routines.adddescpanel(setting)
		$(setting.navbuttons).filter('img.navimages').css({opacity:0.8})
			.bind('mouseover mouseout', function(e){
				$(this).css({opacity:(e.type=="mouseover")? 1 : 0.8})
			})
			.bind('click', function(e){
				var keyword=e.target.title.toLowerCase()
				slideshow.navigate(keyword)
			})
		setting.$wrapperdiv.bind('mouseenter', function(){slideshow.showhidenavpanel('show')})
		setting.$wrapperdiv.bind('mouseleave', function(){slideshow.showhidenavpanel('hide')})
		slideshow.showslide(setting.curimage)
		setting.oninit.call(slideshow) 
		$(window).bind('unload', function(){ 
			$(slideshow.setting.navbuttons).unbind()
			if (slideshow.setting.persist) 
				simpleGallery.routines.setCookie("gallery-"+setting.wrapperid, setting.curimage)
			jQuery.each(slideshow.setting, function(k){
				if (slideshow.setting[k] instanceof Array){
					for (var i=0; i<slideshow.setting[k].length; i++){
						if (slideshow.setting[k][i].tagName=="DIV") 
							slideshow.setting[k][i].innerHTML=null
						slideshow.setting[k][i]=null
					}
				}
				if (slideshow.setting[k].innerHTML) 
					slideshow.setting[k].innerHTML=null
				slideshow.setting[k]=null
			})
			slideshow=slideshow.setting=null
		})
	})
}

simpleGallery.prototype={

	navigate:function(keyword){
		clearTimeout(this.setting.playtimer)
		this.setting.totalsteps=100000 
		if (!isNaN(parseInt(keyword))){this.showslide(parseInt(keyword))}
		else if (/(prev)|(next)/i.test(keyword)){this.showslide(keyword.toLowerCase())}
		else{ 
			var slideshow=this
			var $playbutton=$(this.setting.navbuttons).eq(1)
			if (!this.setting.ispaused){ 
				this.setting.autoplay[0]=false
				$playbutton.attr({title:'Play', src:simpleGallery_navpanel.images[1]})
			}
			else if (this.setting.ispaused){ 
				this.setting.autoplay[0]=true
				this.setting.playtimer=setTimeout(function(){slideshow.showslide('next')}, this.setting.autoplay[1])
				$playbutton.attr({title:'Pause', src:simpleGallery_navpanel.images[3]})
			}
			slideshow.setting.ispaused=!slideshow.setting.ispaused
		}
	},

	showslide:function(keyword){
		var slideshow=this
		var setting=slideshow.setting
		var totalimages=setting.imagearray.length
		var imgindex=(keyword=="next")? (setting.curimage<totalimages-1? setting.curimage+1 : 0)
			: (keyword=="prev")? (setting.curimage>0? setting.curimage-1 : totalimages-1)
			: Math.min(keyword, totalimages-1)
		setting.gallerylayers[setting.bglayer].innerHTML=simpleGallery.routines.getSlideHTML(setting.imagearray[imgindex])
		setting.$gallerylayers.eq(setting.bglayer).css({zIndex:0, opacity:0}) 
			.stop().css({opacity:0}).animate({opacity:1}, setting.fadeduration, function(){ 
				clearTimeout(setting.playtimer)
				setting.gallerylayers[setting.bglayer].innerHTML=null  
				try{
					setting.onslide.call(slideshow, setting.gallerylayers[setting.fglayer], setting.curimage)
				}catch(e){
					alert("Simple Controls Gallery: An error has occured somwhere in your code attached to the \"onslide\" event: "+e)
				}
				setting.currentstep+=1
				if (setting.autoplay[0]){
					if (setting.currentstep<=setting.totalsteps)
						setting.playtimer=setTimeout(function(){slideshow.showslide('next')}, setting.autoplay[1])
					else
						slideshow.navigate("play/pause")
				}
			}) 
		setting.gallerylayers[setting.fglayer].style.zIndex=-100
		setting.fglayer=setting.bglayer
		setting.bglayer=(setting.bglayer==0)? 1 : 0
		setting.curimage=imgindex
		setting.navbuttons[3].innerHTML=(setting.curimage+1) + '/' + setting.imagearray.length
		if (setting.imagearray[imgindex][3]){setting.$descpanel.css({visibility:'visible'})
			setting.descdiv.innerHTML=setting.imagearray[imgindex][3]
		}
		else if (setting.longestdesc!=""){ 
			setting.descdiv.innerHTML=null
			setting.$descpanel.css({visibility:'hidden'})

		}
	},

	showhidenavpanel:function(state){
		var setting=this.setting
		var endpoint=(state=="show")? setting.dimensions[1]-setting.panelheight : this.setting.dimensions[1]
		setting.$navpanel.stop().animate({top:endpoint}, simpleGallery_navpanel.slideduration)
		if (setting.longestdesc!="")
			this.showhidedescpanel(state)
	},

	showhidedescpanel:function(state){
		var setting=this.setting
		var endpoint=(state=="show")? 0 : -setting.descpanelheight
		setting.$descpanel.stop().animate({top:endpoint}, simpleGallery_navpanel.slideduration)
	}
}

simpleGallery.routines={

	getSlideHTML:function(imgelement){
		var layerHTML=(imgelement[1])? '<a href="'+imgelement[1]+'" target="'+imgelement[2]+'">\n' : '' 
		layerHTML+='<img src="'+imgelement[0]+'" style="border-width:0" />'
		layerHTML+=(imgelement[1])? '</a>' : ''
		return layerHTML
	},

	addnavpanel:function(setting){
		var interfaceHTML=''
		for (var i=0; i<3; i++){
			var imgstyle='position:relative; border:0; cursor:hand; cursor:pointer; top:'+simpleGallery_navpanel.imageSpacing.offsetTop[i]+'px; margin-right:'+(i!=2? simpleGallery_navpanel.imageSpacing.spacing+'px' : 0)
			var title=(i==0? 'Prev' : (i==1)? (setting.ispaused? 'Play' : 'Pause') : 'Next')
			var imagesrc=(i==1)? simpleGallery_navpanel.images[(setting.ispaused)? 1 : 3] : simpleGallery_navpanel.images[i]
			interfaceHTML+='<img class="navimages" title="' + title + '" src="'+ imagesrc +'" style="'+imgstyle+'" /> '
		}
		interfaceHTML+='<div class="gallerystatus" style="margin-top:1px">' + (setting.curimage+1) + '/' + setting.imagearray.length + '</div>'
		setting.$navpanel=$('<div class="navpanellayer"></div>')
			.css({position:'absolute', width:'100%', height:setting.panelheight, left:0, top:setting.dimensions[1], font:simpleGallery_navpanel.panel.fontStyle, zIndex:'0'})
			.appendTo(setting.$wrapperdiv)
		$('<div class="navpanelbg"></div><div class="navpanelfg"></div>') 
			.css({position:'absolute', left:0, top:0, width:'100%', height:'100%'})
			.eq(0).css({background:'black', opacity:simpleGallery_navpanel.panel.opacity}).end()
			.eq(1).css({paddingTop:simpleGallery_navpanel.panel.paddingTop, textAlign:'center', color:'white'}).html(interfaceHTML).end() 
			.appendTo(setting.$navpanel)
		return setting.$navpanel.find('img.navimages, div.gallerystatus').get() 
	},

	adddescpanel:function(setting){
		setting.$descpanel=$('<div class="gallerydesc"><div class="gallerydescbg"></div><div class="gallerydescfg"><div class="gallerydesctext"></div></div></div>')
			.css({position:'absolute', width:'100%', left:0, top:-1000, zIndex:'1001'})
			.find('div').css({position:'absolute', left:0, top:0, width:'100%'})
			.eq(0).css({background:'black', opacity:simpleGallery_navpanel.panel.opacity}).end()
			.eq(1).css({color:'white'}).end() 
			.eq(2).html(setting.longestdesc).end().end()
			.appendTo(setting.$wrapperdiv)
		var $gallerydesctext=setting.$descpanel.find('div.gallerydesctext')
		setting.descpanelheight=$gallerydesctext.outerHeight()
		setting.$descpanel.css({top:-setting.descpanelheight, height:setting.descpanelheight}).find('div').css({height:'100%'})
		return setting.$descpanel.find('div.gallerydesctext').get(0) 
	},

	getCookie:function(Name){ 
		var re=new RegExp(Name+"=[^;]+", "i"); 
		if (document.cookie.match(re)) 
			return document.cookie.match(re)[0].split("=")[1] 
		return null
	},

	setCookie:function(name, value){
		document.cookie = name+"=" + value + ";path=/"
	}
}


/*

	Slip and Slide (Slideshow for homepage)

=================================================================*/

	var mygallery=new simpleGallery({
		wrapperid: "mssHolder", //ID of main gallery container
		dimensions: [580, 345], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
		imagearray: [ //"path to image", "optional link", "optional link target", "optional text description"
		 
			["http://springbrookhs.org/media/banners/school-starts.png", "", "", ""], 
		 
			["http://springbrookhs.org/media/banners/community-forums.jpg", "http://springbrookhs.org/images/uploads/community_forms.pdf", "", ""], 
		 
			["http://springbrookhs.org/media/banners/summer-reading.png", "http://edubookclub.com/", "", ""], 
		 
		],
		autoplay: [true, 3500, 2], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
		persist: true, //remember last viewed slide and recall within same session?
		fadeduration: 0, //transition duration (milliseconds)
		oninit:function(){ //event that fires when gallery has initialized/ ready to run
			//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
		},
		onslide:function(curslide, i){ //event that fires after each slide is shown
			//Keyword "this": references current gallery instance
			//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
			//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
		}
	})
jQuery.iPikaChoose={build:function(user_options){var defaults={show_captions:true,slide_enabled:true,auto_play:false,show_prev_next:true,slide_speed:5000,thumb_width:90,thumb_height:60,buttons_text:{play:"",stop:"",previous:"Previous",next:"Next"},delay_caption:true,user_thumbs:false};return jQuery(this).each(function(){function LoadImages(){jQuery(this).bind("load",function(){jQuery(this).parent('div').prev().remove();images=jQuery(this).parents('ul').find('img');var w=jQuery(this).width();var h=jQuery(this).height();if(w===0){w=jQuery(this).attr("width")}if(h===0){h=jQuery(this).attr("height")}var rw=options.thumb_width/w;var rh=options.thumb_height/h;var ratio;if(rw<rh){ratio=rh;var left=((w*ratio-options.thumb_width)/2)*-1;left=Math.round(left);jQuery(this).css({left:left})}else{ratio=rw;var top=0;jQuery(this).css({top:top})}var width=Math.round(w*ratio);var height=Math.round(h*ratio);jQuery(this).css("position","relative");jQuery(this).width(width).height(height);var imgcss={width:width,height:height};jQuery(this).css(imgcss);jQuery(this).hover(function(){jQuery(this).fadeTo(250,1)},function(){if(!jQuery(this).hasClass("pika_selected")){jQuery(this).fadeTo(250,0.4)}});jQuery(this).fadeTo(250,0.4);if(jQuery(this).hasClass('pika_first')){jQuery(this).trigger("click",["auto"])}});var newImage=jQuery(this).clone(true).insertAfter(this);jQuery(this).hide();images=ulist.children('li').children('img')}var options=jQuery.extend(defaults,user_options);var images=jQuery(this).children('li').children('img');images.fadeOut(1);var ulist=jQuery(this);images.each(LoadImages);jQuery(this).before("<div class='pika_main'></div>");var main_div=jQuery(this).prev(".pika_main");if(options.slide_enabled){main_div.append("<div class='pika_play'></div>");var play_div=jQuery(this).prev(".pika_main").children(".pika_play");play_div.html("<a class='pika_play_button'>"+options.buttons_text.play+"</a><a class='pika_stop_button'>"+options.buttons_text.stop+"</a>");play_div.fadeOut(1);var play_anchor=play_div.children('a:first');var stop_anchor=play_div.children('a:last')}main_div.append("<div class='pika_subdiv'></div>");var sub_div=main_div.children(".pika_subdiv");sub_div.append("<img class='pika_back_img'/><img class='pika_main_img' />");var main_img=sub_div.children("img:last");var back_img=sub_div.children("img:first");sub_div.append("<div class='pika_prev_hover'></div><div class='pika_next_hover'></div>");var prevHover=sub_div.find('.pika_prev_hover');var nextHover=sub_div.find('.pika_next_hover');prevHover.hide();nextHover.hide();if(options.show_captions){main_div.append("<div class='pika_caption'></div>");var caption_div=main_div.children(".pika_caption")}jQuery(this).after("<div class='pika_navigation'></div>");var navigation_div=jQuery(this).next(".pika_navigation");navigation_div.prepend("<a>"+options.buttons_text.previous+"</a> :: <a>"+options.buttons_text.next+"</a>");var previous_image_anchor=navigation_div.children('a:first');var next_image_anchor=navigation_div.children('a:last');if(!options.show_prev_next){navigation_div.css("display","none")}var playing=options.auto_play;main_img.wrap("<a></a>");var main_link=main_img.parent("a");function activate(){images.bind("click",image_click);if(options.slide_enabled){if(options.auto_play){playing=true;play_anchor.hide();stop_anchor.show()}else{play_anchor.show();stop_anchor.hide()}}ulist.children("li:last").children("img").addClass("pika_last");ulist.children("li:first").children("img").addClass("pika_first");ulist.children("li").each(function(){jQuery(this).children("span").hide()});var divcss={width:options.thumb_width+"px",height:options.thumb_height+"px","list-style":"none",overflow:"hidden"};var licss={"list-style":"none",overflow:"hidden"};images.each(function(){jQuery(this).parent('li').css(licss);jQuery(this).wrap(document.createElement("div"));jQuery(this).parent('div').css(divcss);if(jQuery(this).attr('complete')===true&&jQuery(this).css('display')=="none"){jQuery(this).css({display:'inline'})}});previous_image_anchor.bind("click",previous_image);prevHover.bind("click",previous_image);next_image_anchor.bind("click",next_image);nextHover.bind("click",next_image);sub_div.mousemove(function(e){var w=sub_div.width();var x=e.pageX-sub_div.offset().left;if(x<w*0.3){prevHover.fadeIn('fast')}else{prevHover.fadeOut('fast')}if(x>w*0.7){nextHover.fadeIn('fast')}else{nextHover.fadeOut('fast')}});sub_div.mouseleave(function(){prevHover.fadeOut('fast');nextHover.fadeOut('fast')})}function image_click(event,how){if(how!="auto"){if(options.slide_enabled){stop_anchor.hide();play_anchor.show();playing=false}main_img.stop();main_img.dequeue();if(options.show_captions){caption_div.stop();caption_div.dequeue()}}if(options.user_thumbs){var image_source=jQuery(this).attr("ref")}else{var image_source=this.src}var image_link=jQuery(this).attr("rel");var image_caption=jQuery(this).parent().next("span").html();images.filter(".pika_selected").fadeTo(250,0.4);images.filter(".pika_selected").removeClass("pika_selected");jQuery(this).fadeTo(250,1);jQuery(this).addClass("pika_selected");if(options.show_captions){if(options.delay_caption){caption_div.fadeTo(800,0)}caption_div.fadeTo(500,0,function(){caption_div.html(image_caption);caption_div.fadeTo(800,1)})}var delay=100;if(main_img.attr('opacity')<0.8){delay=500}back_img.attr("src",main_img.attr("src"));main_img.fadeTo(delay,0.00,function(){main_img.unbind('load');main_img.bind('load',function(){main_img.fadeTo(0,1,function(){if(playing){jQuery(this).animate({opactiy:1},options.slide_speed,function(){if(playing){next_image_anchor.trigger("click",["auto"])}})}back_img.attr("src",main_img.attr("src"))})});main_img.attr("src",image_source);main_link.attr("href",image_link)})}function next_image(event,how){if(images.filter(".pika_selected").hasClass("pika_last")){images.filter(":first").trigger("click",how)}else{images.filter(".pika_selected").parents('li').next('li').find('img').trigger("click",how)}}function previous_image(event,how){if(images.filter(".pika_selected").hasClass("pika_first")){images.filter(":last").trigger("click",how)}else{images.filter(".pika_selected").parents('li').prev('li').find('img').trigger("click",how)}}function play_button(){main_div.hover(function(){play_div.fadeIn(400)},function(){play_div.fadeOut(400)});play_anchor.bind("click",function(){main_img.stop();main_img.dequeue();if(options.show_captions){caption_div.stop();caption_div.dequeue()}playing=true;next_image_anchor.trigger("click",["auto"]);jQuery(this).hide();stop_anchor.show()});stop_anchor.bind("click",function(){playing=false;jQuery(this).hide();play_anchor.show()})}if(options.slide_enabled){play_button()}activate()})}};jQuery.fn.PikaChoose=jQuery.iPikaChoose.build;