function printFriendly(title){
    try{
        //Establish the document model for the iframe
        var ifrm = document.getElementById('printarea');

        //Set the content variable to the contents of the maincontent div
        var content;
        if(document.getElementById('maincontent')){
            //If this is a whitehouse theme
            content = document.getElementById('maincontent').innerHTML;
        } else {
            if(jQuery){
                content = jQuery('.entry').html();
            } else {
                throw "error";
            }
        }
        

        //Correct for IE
        var printDoc = (ifrm.contentWindow || ifrm.contentDocument);
        if(printDoc.document){printDoc = printDoc.document;}

        //Create the iframe content
        printDoc.write("<html><head><title>" + title + "</title>");
        printDoc.write("<style type='text/css'>body{font-family:Arial;} img{border:0px;}</style>");
        printDoc.write("</head><body onload='this.focus(); this.print();'>");
        printDoc.write(content);

        //Remove the sharing links and the comments section (if it exists) from the print content
        var shareLinks = printDoc.getElementById("csharinglinks");
        if(shareLinks){printDoc.getElementById("csharinglinks").innerHTML = '';}
        var respondDiv = printDoc.getElementById("respond");
        if(respondDiv){printDoc.getElementById("respond").innerHTML = '';}

        printDoc.write("</body></html>");

        printDoc.close();

        } catch(e) {
            //console.log(e);
            self.print();
        }
}
