(function(a){var d=0,c={iframe:"iframe",popup:"popup"},f={mode:c.iframe,popHt:500,popWd:400,popX:200,popY:200,popTitle:"",popClose:false},b={};a.fn.printArea=function(p){a.extend(b,f,p);d++;var o="printArea_";a("[id^="+o+"]").remove();var q=e(a(this));b.id=o+d;var m,l;switch(b.mode){case c.iframe:var n=new j;m=n.doc;l=n.contentWindow||n;break;case c.popup:l=new k;m=l.doc}m.open();m.write(g()+"<html>"+i()+h(q)+"</html>");m.close();l.focus();l.print();b.mode==c.popup&&b.popClose&&l.close()};function g(){if(b.mode==c.iframe||!b.strict)return"";var a=b.strict==false?" Trasitional":"",d=b.strict==false?"loose":"strict";return'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01'+a+'//EN" "http://www.w3.org/TR/html4/'+d+'.dtd">'}function i(){var c="<head><title>"+b.popTitle+"</title>";a(document).find("link").filter(function(){return a(this).attr("rel").toLowerCase()=="stylesheet"}).filter(function(){var b=a(this).attr("media");return b.toLowerCase()==""||b.toLowerCase()=="print"}).each(function(){c+='<link type="text/css" rel="stylesheet" href="'+a(this).attr("href")+'" >'});c+="</head>";return c}function h(b){return'<body><div class="'+a(b).attr("class")+'">'+a(b).html()+"</div></body>"}function e(b){a("input,select,textarea",b).each(function(){var b=a(this).attr("type");if(b=="radio"||b=="checkbox")if(a(this).is(":not(:checked)"))this.removeAttribute("checked");else this.setAttribute("checked",true);else if(b=="text")this.setAttribute("value",a(this).val());else if(b=="select-multiple"||b=="select-one")a(this).find("option").each(function(){if(a(this).is(":not(:selected)"))this.removeAttribute("selected");else this.setAttribute("selected",true)});else if(b=="textarea"){var c=a(this).attr("value");if(a.browser.mozilla)if(this.firstChild)this.firstChild.textContent=c;else this.textContent=c;else this.innerHTML=c}});return b}function j(){var e=b.id,d="border:0;position:absolute;width:0px;height:0px;left:0px;top:0px;",c;try{c=document.createElement("iframe");document.body.appendChild(c);a(c).attr({style:d,id:e,src:""});c.doc=null;c.doc=c.contentDocument?c.contentDocument:c.contentWindow?c.contentWindow.document:c.document}catch(f){throw f+". iframes may not be supported in this browser.";}if(c.doc==null)throw"Cannot find document.";return c}function k(){var a="location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";a+=",width="+b.popWd+",height="+b.popHt;a+=",resizable=yes,screenX="+b.popX+",screenY="+b.popY+",personalbar=no,scrollbars=no";var c=window.open("","_blank",a);c.doc=c.document;return c}})(jQuery);
