
	$(function() {
		$('.nyroModal').nyroModal({
			callbacks: {
				afterShowCont: function(nm) {
					$('.resizeLink', nm.elts.cont).click(function(e) {
						e.preventDefault();
						nm.sizes.initW = Math.random()*1000+200;
						nm.sizes.initH = Math.random()*1000+200;
						nm.resize();
					});
				}
			}
		});
		$.extend({
		printData : function(el){
		
			if($("iframe").size())	{
				$("iframe").remove();
			}

			// create and set iframe
			var iframe = document.createElement('IFRAME');
			
			$(iframe).css({
				position : "absolute",
				width : 0,
				height : 0,
				left : "-500px",
				top : "-500px"			  
			})
			.appendTo("body");
			
			var doc = iframe.contentWindow.document;
			
			// set CSS
			$("link").each(function(){
				if($(this).attr("rel").toLowerCase() == 'stylesheet')	{
					doc.write('<link type="text/css" rel="stylesheet" href="'+ $(this).attr("href") + '"></link>');
				}					
			});			
			
			doc.write('<div id="data" class="show"><div id="dataInner">'+$(el).html()+'</div></div>');
			doc.close();
			
			setTimeout(function(){
				// focus and print
				iframe.contentWindow.focus();
				iframe.contentWindow.print();		
			},1000)
		}
	});
	});
