//used on product group and find result pages
//uses div with id "jqm-loading" and an inner div in this
//changes url to the popup page with no menu etc
$(function(){
	var loadhref = function(jqmHash){
		jqmHash.w.show();
	
		// Determine href
		var urltoget = jqmHash.t.href.replace(/ProductClass/i,'ProductClassPopup');
       
       
		// Load href
		$('#jqm-loading div').load(urltoget ,function(){
			$(this).show();
			$("body").addClass("lightbox");
		});
	};
	var closemodal = function(jqmHash){
		jqmHash.w.hide();
		jqmHash.w.find('div').html('Loading...');
		jqmHash.o.remove(); 
		$("body").removeClass("lightbox");
	};
	
	
	// Assign modal popup behaviour to links
	$('#jqm-loading').jqm({zIndex: 10002, trigger: 'a.popup', onShow: loadhref, onHide: closemodal});
	
	// Prevent default action of clicking link
	$('a.popup').click(function(){
		return false;
	});
});

