$(function (){
	
	// check for iOS
	var isiOS = false;
	var agent = navigator.userAgent.toLowerCase();
	if(agent.indexOf('iphone') >= 0 || agent.indexOf('ipad') >= 0){
	       isiOS = true;
	}

	// Add Topup to all images
	if (screen.width > 480) {
		TopUp.images_path = "css/img/topup/";
		$('.work, .news').not('.grid').find('#main img').each(function() {
			$(this).wrap('<a href="' + $(this).attr("src") + '" toptions="shaded = 0, overlayClose = 1"></a>');
		});
	}
	
	// Add VideoJS to all video tags on the page when the DOM is ready
	if (!isiOS) {
		$('video')
			.each(function(index) {
				if ($(this).parent().is('figure')) {
					$(this).addClass('video-js').parent().addClass('video-js-box');
				} else {
					$(this).addClass('video-js').wrap("<div class='video-js-box'></div>");
				}
			})
			.addClass('video-js')
			.VideoJS();
	}
		
});
