$(document).ready(function () {
	
	
if (($(".vivoSlider ul").size()) > 1) {
	
	var maxCount = 0;

	$(".vivoSlider ul").addClass(function() {
		maxCount++
		return "item-" + $(this).index();
	});
	
	var count = 0;
	var possy = 0;
	maxCount = maxCount -1;
	
	if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/android/i)) {
		
		$(".vivoSliderContainer").bind('swiperight',function(event){
			$('.vivoSlider').stop(true, true).css('left', function(index) {
				count--;
				if (count < 0){
					count = 0;
				}
				possy = -count * 960
				return possy;
			});
		});
		
		$(".vivoSliderContainer").bind('swipeleft',function(event){
			$('.vivoSlider').stop(true, true).css('left', function(index) {
				count++;
				if (count > maxCount){
					count = 0;
				}
				return -count * 960;
			});
		});
	}	
	else {
	
		$('.vivoSliderContainer .leftControl').click(function(event){
			$('.vivoSlider').stop(true, true).css('left', function(index) {
				count--;
				if (count < 0){
					count = 0;
				}
				possy = -count * 960
				return possy;
			});
		});
		
		$('.vivoSliderContainer .rightControl').click(function(event){
			$('.vivoSlider').stop(true, true).css('left', function(index) {
				count++;
				if (count > maxCount){
					count = 0;
				}
				return -count * 960;
			});
		});
		
		// Fadin the slide controllers nicely
		$('.vivoSliderContainer').hover(
			function () {
				$('.vivoSliderContainer .controller').stop(true, true).fadeIn();
			}, 
			function () {
				$('.vivoSliderContainer .controller').stop(true, true).fadeOut();
			}
		);
		
	}//eo else	
	
}// eo if

	
//	Nice onmouse hover effect
$('.vivoSlider ul li').hover(
	function () {
		var h = $(this).height();
		var w = $(this).width();
		var newH = h-4;
		var newW = w-4;
		
		$("span",this).stop(true, true).slideDown(100);
		$(this).stop(true, true).css('border','2px solid red');
		$(this).stop(true, true).css('width',newW+'px');
		$(this).stop(true, true).css('height',newH+'px');
	}, 
	function () {
		var h = $(this).height();
		var w = $(this).width();
		var newH = h+4;
		var newW = w+4;
		
		$("span",this).stop(true, true).slideUp(100);
		$(this).stop(true, true).css('border','none');
		$(this).stop(true, true).css('width',newW+'px');
		$(this).stop(true, true).css('height',newH+'px');
	}
);
	
$("p iframe").parent().css({'margin':'0', 'padding':'10px 0 10px 0'});
	
});




