//Device detection and Touchwipe integration
//Copyright 2010 Frontend Design

$(function() {

var uagent = navigator.platform.toLowerCase();

//More devices can be added below by entering their platform name (e.g: 
	function detectDevices() {	
		if (uagent === "iphone")
			return true;
		else if (uagent === "ipad")
			return true;
		else if (uagent === "ipod")
			return true;
		/*else if (uagent === "macintel") //For testing
			return true;*/
		else 
			return false;
	}
	
	var mobileDetected = detectDevices();
	
	if (mobileDetected === true)
	{
		
		$.getScript("/js/jquery.touchwipe.min.js", function(){
			
			$(".carouselItem .swipeArea").touchwipe({
			  wipeRight: function() { 
				carouselFunctions.startCarousel();
			  },
			  wipeLeft: function() { 
				$variables.nextSlide = $variables.currentSlide - 1;
				if ($variables.nextSlide == 0)
				{
					$variables.nextSlide = 4;
					carouselFunctions.startCarousel();
				}
				else {carouselFunctions.startCarousel();}
				//alert('rightSwipe');
				},
			  min_move_x: 20,
			  preventDefaultEvents: true
			});
			
		});
		
		//alert('You are on a mobile device, it is a: ' + uagent);
	}
	else {
		//alert('NOT on an iphone/ipad/ipod')
		return false;
	}
});


