// START Initiating
jQuery("document").ready(function(){

	//Array for video locations
	testimonials = ['video_testimonials/testimonial_1.mov?width=720&height=480', 'video_testimonials/testimonial_2.mov?width=720&height=480', 'video_testimonials/testimonial_3.mov?width=720&height=480', 'video_testimonials/testimonial_4_rn.mov?width=720&height=480', 'video_testimonials/testimonial_5_airway.mov?width=720&height=480' ];
	
	//Array for video titles
	titles = ['Testimonial 1', 'Testimonial 2', 'Testimonial 3', 'Testimonial 4', 'Testimonial 5'];
	
	//Add click event for slideshow Call To Action
	jQuery("#slideshow-CTA").click(function() {
    	$.prettyPhoto.open(testimonials,titles);
    });
	

	/*** PrettyPhoto ***/
    jQuery("a[rel^='prettyPhoto'], a[rel^='lightbox']").prettyPhoto({
        overlay_gallery: false,
        "theme": 'light_rounded' /* light_square / dark_rounded / light_square / dark_square */
    });
    
    /*** SlideShow ***/
	 function cyclePause() {
		jQuery('#slideshow, .container').hover(
		function(){
			jQuery('.slides').cycle('pause')
		},
		function(){
			jQuery('.slides').cycle('resume')
		});
	 }

	 cyclePause();
	 var $sliderspeed = 3000;
	 if ($sliderspeed != ""){$duration = $sliderspeed}else{$duration = 5000;}
    $('.slides').cycle({
        fx: 'fade',
        speed: 700,
		timeout: $sliderspeed,
        pager: '.pagination',
		pauseOnPagerHover: true,
        pagerAnchorBuilder: function(idx, slide){
            // return selector string for existing anchor 
            return '.pagination li:eq(' + idx + ') a';
        }
    });
    
    //Inject <span> for Tool tip
	$(this).find(".slide a").append("<span></span>");
	$(this).find(".slide span").css({"opacity" : "0"});


	//Hover Effect for Tooltip
	$(".slide a").hover(function() {
		$(this).find("span").stop().animate({ opacity: 0.7}, 200 ).show();
	}, function() {
		$(this).find("span").stop().animate({ opacity: 0}, 200 );
	});
	
	

}); // End Initiating
