﻿	$.jPrintArea=function(el){
	    var iframe=$("#printIframe")[0];
        if (!iframe){
          iframe=document.createElement('IFRAME');
          $(iframe).attr('style','position:absolute;width:0px;height:0px;left:-500px;top:-500px;').attr("id","printIframe");  
          document.body.appendChild(iframe);  
        }
        var doc=null;
        doc=iframe.contentWindow.document;
        doc.write("<ht"+"ml><he"+"ad><tit"+"le>"+document.title+"</tit"+"le>");
        var links=window.document.getElementsByTagName('link');
        for(var i=0;i<links.length;i++)
            if(links[i].rel.toLowerCase()=='stylesheet')
                doc.write('<link type="text/css" rel="stylesheet" href="'+links[i].href+'"></link>');
        doc.write("</he"+"ad><bo"+"dy onload='this.focus(); this.print();'>");
        doc.write('<div class="'+$(el).attr("class")+'">'+$(el).html()+'</div>');
        doc.write("</bo"+"dy></ht"+"ml>");
        doc.close();
    }

	
	
	$(function(){
	    $("#printThisPage").click(function(){
	        $.jPrintArea("#content");
	    });
	});

	function printframe(el) {
	    var iframe = $("#printIframe")[0];
	    if (!iframe) {
	        iframe = document.createElement('IFRAME');
	        $(iframe).attr('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;').attr("id", "printIframe");
	        document.body.appendChild(iframe);
	    }
	    var doc = null;
	    doc = iframe.contentWindow.document;
	    doc.write("<ht" + "ml><he" + "ad><tit" + "le>" + document.title + "</tit" + "le>");
	    var links = window.document.getElementsByTagName('link');
	    for (var i = 0; i < links.length; i++)
	        if (links[i].rel.toLowerCase() == 'stylesheet')
	        doc.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
	    doc.write("</he" + "ad><bo" + "dy onload='this.focus(); this.print();'>");
	    doc.write('<div class="' + $(el).attr("class") + '">' + $(el).html() + '</div>');
	    doc.write("</bo" + "dy></ht" + "ml>");
	    doc.close();
	}
