$().ready(function() {
	// pdf open in new window
	$('a.image-trigger[href$=pdf]')
		.removeClass('image-trigger')
		.attr('target','_blank');

	$('#jqm-image').jqm({
		trigger: 'a.image-trigger'
	});
	
	$('a.image-trigger').click(function(e){
	  var url = $(this).attr('href');
	  var img = new Image();
	  var loadImg = new Image();
	  $(loadImg).attr('src','img/ajax_load.gif');
	  $('#jqm-content')
	  		// clear content
	      	.html('')
	      	// put loading image	    
			.append(loadImg);
	  // wrap our new image in jQuery, then:
	  $(img)
	    // once the image has loaded, execute this code
	    .load(function () {
	      // set the image hidden by default    
	      $(this).hide();
	   
	      $('#jqm-content')
	      	// clear content
	      	.html('')
	        //  insert our image
	        .append(this);
	    
	      // fade our image in to create a nice effect
	      $(this).fadeIn();
	    })
	    
	    // if there was an error loading the image, react accordingly
	    .error(function () {
	      // notify the user that the image could not be loaded
	    })
	    
	    // *finally*, set the src attribute of the new image to our image
	    .attr('src', url);
	});
});
