jQuery(function ($) {
	$.fn.voucher = function (opt) {
		var options = $.extend({ 
			reveal: '.reveal'
		}, opt);
		
		$.fn.extend({
			reveal: function (e) {
				var link = $(this).attr('href');
				var mer_window = window.open(link, '_blank', 'toolbar=1,location=1,directories=1,scrollbars=1,resizable=1,status=1,menubar=1');
				if (typeof mer_window === "object")
				{
					mer_window.blur();
				}
				
				return false;
			}
		});
		
		return this.each(function () {
			var e = this;
			
			if ($(this).is('.voucher_code'))
			{
				$(this).find('a[class*="revealcodes"]').click(function () {					
          return $(this).reveal(e);
				});
			}
		});
	};
});
