jQuery(document).ready(function(){
	jQuery('.coupon_cont').click(function(){
		//set the html in the print coupon div
		jQuery("#print_coupon").html('<div class="print"><div class="coupon_cont">'+jQuery(this).html()+'</div></div>');
		
		//setup html
		var html = '<html><head><title>Print Coupon</title><link rel="stylesheet" type="text/css" href="/app/modules/coupons/css/default/coupons.css" /></head><body>';
		html += jQuery("#print_coupon").html();
		html += '</body></html>';
		
		//get the window width and height
		var winWidth = jQuery('#print_coupon').outerWidth(true)+15;
		var winHeight = jQuery('#print_coupon').outerHeight(true)+25;
		
		//create the window
		var printWin = window.open("","Coupon","location=1,status=1,width="+winWidth+",height="+winHeight+",menubar=0,resizable=0,scrollbars=0,toolbar=0");
		
		//open the document and write the html
		printWin.document.open();
		printWin.document.write(html);
		
		//close the document
		printWin.document.close();
		
		//show print dialog
		printWin.print();
	});
});
