<?php $uniq_id = uniqid(); ?>

<div class="widget testimonials">

    <?php if (!empty($instance['title'])): ?>
	
	<div class="title-caption">
		 <h3><?php echo $instance['title'] ?></h3>
	</div>
       
    <?php endif; ?>
	
	<div class="entry-holder">
		
		<ul class="testimonials_<?php echo $uniq_id ?>">

			<?php
			$query = new WP_Query(array(
						'post_type' => 'testimonials',
						'orderby' => 'rand',
							)
			);

			if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();

					?>

					<li>
						<div class="quote-text">

							<span class="quote"></span><?php the_content_feed(); ?>

						</div>
						<b class="quote-author">-<?php the_title(); ?>-</b>			
					</li>

					<?php

				endwhile;

			endif;
			?>
		</ul>		
		
	</div>

	<script type="text/javascript">

		jQuery(document).ready(function() {

			var $testimonials = jQuery('.testimonials_<?php echo $uniq_id ?>');

			if($testimonials.length) {

				$testimonials.cycle({

					fx: 'fade',
					timeout: <?php echo $instance['pause']; ?>,
					height: 'auto',
					pause: 1,
					pager: '.testimonial-pager',
					before: function(curr, next, opts) {
						var $this = $(this);
						$this.parent().stop().animate({height: $this.height()}, opts.speed);
					},
					cleartypeNoBg: true
				});

			}

		});

	</script>
		
</div><!--/ .testimonials-->




