$(function(){//字体大中小



//打印
	var printAreaCount = 0;
		$.fn.printArea = function () {
			var ele = $(this);
			
			var idPrefix = "printArea_";
			removePrintArea(idPrefix + printAreaCount);
			printAreaCount++;
			var iframeId = idPrefix + printAreaCount;
			
			var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
			iframe = document.createElement('IFRAME');
			$(iframe).attr({
				style: iframeStyle,
				id: iframeId
			});

			document.body.appendChild(iframe);
			var doc = iframe.contentWindow.document;
			
			$(document).find("link").filter(function (index, item) {
				var path = $(item).attr("href"),
						reg = /(master)/g;
				return reg.test(path);
			}).each(
					function () {
						doc.write('<link type="text/css" rel="stylesheet" href="'
								+ $(this).attr("href") + '" >');
					});
			doc.write('<div class="' + $(ele).attr("class") + '">' + $(ele).html()
					+ '</div>');
			//console.log(doc);
			doc.close();
			var frameWindow = iframe.contentWindow;
			frameWindow.close();
			frameWindow.focus();
			var timer = setTimeout(function(){frameWindow.print();}, 1)
		}
		var removePrintArea = function (id) {
			$("iframe#" + id).remove();
		};
//打印调用
$("#btnPrint").on('click', function(event) {
	event.preventDefault();
	$("#UCAP-CONTENT").printArea();
});


})