function is_ios() {
	if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
		return true
	} else {
		return false;
	}
}


$(function(){
	
	// Fix shitty YouTube RSS feed data *sigh*
	$(".youtubeVideo").each(function(){
	
		var elem = $(this),
			image = elem.find("table td:first img").attr("src");
			
		//elem.find("table").before('<p>' + text + '</p>');
		elem.find("table").before('<img src="' + image + '" />');
		elem.find("table").remove();
		elem.show();
	
	});
	
	// Fix shitty YouTube RSS feed data *sigh*
	$(".vimeoVideo").each(function(){
	
		var elem = $(this),
			image = elem.find("img:first").attr("src");
			
		//elem.find("table").before('<p>' + text + '</p>');
		elem.find("p:first").before('<img src="' + image + '" />');
		elem.find("p").remove();
		elem.show();
	
	});
	
	$('.flexslider').flexslider({
		animation: "slide",
		controlsContainer: ".flexslider-container",
		slideshow: true,
		controlNav: false ,
		controlsContainer: ".flex-controls"
	});
	
	$(".flex-direction-nav, .flex-control-nav").css({
		"display" : "block",
		opacity : 0
	});
	
	if (!is_ios()) {
		$("#slides").hover(function(){
			$(".flex-direction-nav").animate({opacity: 0.5}, 200);
		}, function(){
			$(".flex-direction-nav").animate({opacity: 0}, 200);
		});
	}
	
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
});
