/*
# This file is part of OpenHatch.
# Copyright (C) 2009 OpenHatch, Inc.
# Copyright (C) 2010 John Stumpo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

var in_string = "\n\n\n<style type='text/css'>\n\n    #openhatch-widget {\n        color: #222;\n        font: 9pt Verdana, Bitstream Vera Sans, Arial, sans-serif;\n        width: 260px ! important;\n        height: 280px ! important;\n        background: #fff url('http://openhatch.org/static/images/motif-eee.png') repeat scroll 0 0;\n        float: left;\n        border: inherit;\n    }\n    #openhatch-widget h3 {\n        font-size: 9pt;\n        font-weight: normal;\n        margin: 0;\n    }\n    #openhatch-widget .module {\n        background: transparent url('http://openhatch.org/static/images/gray-60.png') repeat scroll 0 0;\n        float: left;\n        width: 252px;\n        height: 272px ! important;\n        border-radius: 0;\n        -moz-border-radius: 0;\n        padding: 4px;\n        margin: 0;\n    }\n    \n    #openhatch-widget .module > .head {\n        width: 240px ! important;\n    }\n\n    #openhatch-widget .module > .head h3,\n    #openhatch-widget .module > .body,\n    #openhatch-widget .module > .foot {\n        width: 242px ! important;\n        border-radius: 0;\n        -moz-border-radius: 0;\n    }\n    #openhatch-widget .module > .foot {\n        background: #fff url('http://openhatch.org/static/images/motif.png') repeat scroll 0 0;\n    }\n    #openhatch-widget .module > .body {\n        background: none;\n        border: none;\n    }\n    #openhatch-widget .foot img {\n        vertical-align: middle;\n    }\n    #openhatch-widget a {\n        color: darkorange ! important; \n        text-decoration: none ! important;\n    }\n\n    #openhatch-widget a:hover {\n        background-color: #ffffff ! important;\n        color: orange ! important; \n    }\n\n    #openhatch-widget a img {\n        border-style: none;\n    }\n\n    #openhatch-widget .project-escutcheon img {\n        text-align: center;\n    }\n    #openhatch-widget .project-escutcheon a {\n        width: 100%;\n    }\n\n    #openhatch-widget h1 a {\n        color: #2288BB;\n        text-decoration: none;\n    }\n\n    #openhatch-widget h1 a:hover {\n        color: #223366;\n        background-color #ffffff ! important;\n        text-decoration: none;\n    }\n\n    #openhatch-widget .module > .head h3 {\n        text-align: center;\n        margin: 10px auto;\n        padding: 0;\n        font-weight: bold;\n    }\n\n    #openhatch-widget .module > .body {\n        float: left;\n        padding: 10px 5px ! important;\n        height: 145px ! important;\n    }\n\n    #openhatch-widget .module > .foot {\n        float: left;\n        padding: 5px;\n        font-size: 8pt;\n        text-align: right;\n        border: 0;\n    }\n    \n    #openhatch-widget .module > .foot a {\n        color: #555;\n    }\n    \n    #openhatch-widget .module > .foot a:hover {\n        color: black;\n        background-color: #ffffff ! important;\n    }\n\n    #openhatch-widget .module > .body.contains-submodules {\n        background: #fff url('http://openhatch.org/static/images/motif.png');\n    }\n\n    #openhatch-widget .submodule {\n        margin-bottom: 20px;\n        float: left;\n    }\n\n    #openhatch-widget .submodule > .head {\n        float: left;\n        background: #fdfdfe url('http://openhatch.org/static/images/module-head-bg.png?1249849406.0') bottom repeat-x;\n        float: left;\n        padding: 10px 20px;\n    }\n\n    #openhatch-widget .submodule > .body {\n        background-color: #fff;\n    }\n\n    #openhatch-widget ul {\n        padding: 0;\n        margin: 0;\n        list-style: none;\n    }\n    #openhatch-widget .module > .head ul {\n        float: right;\n        padding: 0;\n        margin: 0;\n    }\n    #openhatch-widget .module > .head ul li {\n        float: left;\n        margin: 0;\n    }\n    #openhatch-widget .module > .head ul li a {\n        float: right;\n        padding: 17px 20px;\n        line-height: 13pt;\n        font-weight: bold;\n        margin-right: 3px;\n    }\n    #openhatch-widget .module > .head ul li a:hover {\n        background-color: #ffffff ! important;\n        color: orange;\n        text-decoration: underline;\n        \n    }\n    #openhatch-widget img {\n        border: 0;\n    }\n    #openhatch-widget .usernames {\n        font-size: 10pt;\n    }\n    #openhatch-widget #info .tag-type {\n        font-weight: normal;\n        display: block;\n        font-size: 8pt;\n    }\n    #openhatch-widget .aka {\n    }\n    #openhatch-widget .column {\n        float: left;\n        margin-right: 10px;\n    }\n    #openhatch-widget .project-display h3 {\n        float: left;\n    }\n    #openhatch-widget .project-display p {\n        margin: 0;\n        margin-bottom: 10px;\n        float: left;\n    }\n    #openhatch-widget .project-display h2 {\n        font-size: 9pt;\n        margin: 0;\n        margin-bottom: 3px;\n    }\n    #openhatch-widget .project-display h5 {\n        font-size: 12pt;\n        margin: 0;\n        margin-bottom: 10px;\n        font-weight: normal;\n    }\n    #openhatch-widget .project-display a {\n        text-decoration: none;\n    }\n\n    #openhatch-widget .module > .body .project-display ul {\n        float: left;\n    }\n    #openhatch-widget #portfolio .module > .body {\n        padding: 0;\n    }\n    #openhatch-widget #portfolio .module > .body ul li {\n        float: left;\n        padding: 10px;\n        width: 100px;\n    }\n    #openhatch-widget .project-escutcheon {\n        float: left;\n        margin-right: 5px;\n        width: 100px;\n        margin-bottom: 20px;\n    }\n\n    #openhatch-widget #portfolio {\n        width: 200px;\n        padding: 0 5px 3px 5px;\n        margin: 0;\n    }\n\n    #openhatch-widget .project-display {\n        width: 200px;\n        margin: 0 auto 2px auto;\n    }\n\n    #openhatch-widget .project-display h3 {\n        font-size: 11pt;\n        text-align: center;\n        width: 100%;\n    }\n\n    #openhatch-widget .project-display li {\n        float: left;\n        display: inline;\n        background-color: white;\n        margin: 0;\n        padding: 0;\n    }\n\n    #openhatch-widget .project-escutcheon {\n        width: 70px;\n        margin: 4px 3px 3px 3px;\n    }\n\n    #openhatch-widget .project-escutcheon .name {\n        font-size: 8pt;\n        padding: 4px;\n        width: 72px;\n        clear: left;\n        text-align: center;\n    }\n\n    #openhatch-widget #credit {\n        float: right;\n    }\n\n    #openhatch-widget h3 {\n        text-shadow: none;\n    }\n    \n    #openhatch-widget #credit h3 {\n        font-size: 10pt;\n        padding: 23px 0 0 0;\n        margin-right: 10px;\n        float: left;\n    }\n\n    #openhatch-widget #credit-logo {\n        float: right;\n        padding: 5px 0 0 0;\n    }\n\n    #openhatch-widget #widget .head h3 {\n        width: 240px ! important;\n    }\n\n    #openhatch-widget .module > .body { width: 280px; background-color: #fff; } \n\n    #openhatch-widget .project-name{ font-size: 8pt; } \n\n</style>\n<div id='openhatch-widget'>\n    <div class='module'>\n        <div class='head'>\n            <h3>My <abbr title='Free, Libre Open Source Software'>FLOSS</abbr> contributions</h3>\n        </div>\n        <div class='body'>\n            <ul>\n            \n            \n            \n                <div class=\"row\" style=\"float: left; width: 100%\">\n            \n            \n                <li>\n                <div class='project-escutcheon'>\n                    <div class='logo'>\n                        <a href='http://openhatch.org/+projects/Miro'>\n                            <img alt='logo' title='Miro'\n                            src='http://openhatch.org/static/images/icons/projects/3c18441b02364aa2afc267be060c16de.png?1269496652.0' width='40'/>\n                            <div class='project-name'>Miro</div>\n                        </a>\n                    </div>\n                </div>\n                </li>\n            \n            \n            \n            \n            \n            \n                <li>\n                <div class='project-escutcheon'>\n                    <div class='logo'>\n                        <a href='http://openhatch.org/+projects/PyBlosxom'>\n                            <img alt='logo' title='PyBlosxom'\n                            src='http://openhatch.org/static/no-project-icon-w=40.png?1257463126.0' width='40'/>\n                            <div class='project-name'>Py<wbr />Blosxom</div>\n                        </a>\n                    </div>\n                </div>\n                </li>\n            \n            \n            \n            \n            \n            \n                <li>\n                <div class='project-escutcheon'>\n                    <div class='logo'>\n                        <a href='http://openhatch.org/+projects/Miro%20Community'>\n                            <img alt='logo' title='Miro Community'\n                            src='http://openhatch.org/static/no-project-icon-w=40.png' width='40'/>\n                            <div class='project-name'>Miro<wbr /> <wbr />Communit<wbr />y</div>\n                        </a>\n                    </div>\n                </div>\n                </li>\n            \n            \n            \n            \n                </div>\n            \n            \n                <div class=\"row\" style=\"float: left; width: 100%\">\n            \n            \n                <li>\n                <div class='project-escutcheon'>\n                    <div class='logo'>\n                        <a href='http://openhatch.org/+projects/OpenHatch'>\n                            <img alt='logo' title='OpenHatch'\n                            src='http://openhatch.org/static/images/icons/projects/8c125056faac44768f7aaf7ced749bdc.png?1296232732.0' width='40'/>\n                            <div class='project-name'>Open<wbr />Hatch</div>\n                        </a>\n                    </div>\n                </div>\n                </li>\n            \n            \n            \n            \n            \n            \n                <li>\n                <div class='project-escutcheon'>\n                    <div class='logo'>\n                        <a href='http://openhatch.org/+projects/libtorrent-rasterbar'>\n                            <img alt='logo' title='libtorrent-rasterbar'\n                            src='http://openhatch.org/static/no-project-icon-w=40.png' width='40'/>\n                            <div class='project-name'>libtorre<wbr />nt-<wbr />rasterba<wbr />r</div>\n                        </a>\n                    </div>\n                </div>\n                </li>\n            \n            \n                </div>\n            \n            \n            </ul>\n        </div>\n        <div class='foot'>\n            <a href='http://openhatch.org/people/willkahngreene/'>See my full profile at\n                <img src='http://openhatch.org/static/images/logo-for-widget.png?1249849406.0' height='55' width='80'/></a>\n        </div>\n    </div>\n</div>\n\n\n";

var thisScript = /openhatch-widget.js/;
var theScripts = document.getElementsByTagName('script');
for (var i = 0 ; i < theScripts.length; i++) {
    if(theScripts[i].src.match(thisScript)) {
        var inForm = false;
        var currentNode = theScripts[i].parentNode;
        while (currentNode != null) {
            if (currentNode.nodeType == 1) {
                if (currentNode.tagName.toLowerCase() == 'form') {
                    inForm = true;
                    break;
                }
            }
            /* always */
            currentNode = currentNode.parentNode;
        }
        
        if (inForm) {
            /* if we are inside a form, we do not want to create
               another form tag. So replace our FORM tag with
               a DIV.
            */
            in_string = in_string.replace('<form ', '<div ');
            in_string = in_string.replace('</form>', '</div>');
        }
        var my_div = document.createElement('div');
        my_div.innerHTML = in_string;

        /* Hack alert: If we're in an XHTML document being served as
           application/xhtml+xml, we need to transplant the CSS into
           the page header for things to work correctly... */
        var my_style = my_div.getElementsByTagName('style')[0];
        var css_code = my_style.textContent;
        my_div.removeChild(my_style);

        var new_style = document.createElement('style');
        new_style.setAttribute('type', 'text/css');
        new_style.appendChild(document.createTextNode(css_code));
        var page_head = document.getElementsByTagName('head')[0];
        page_head.appendChild(new_style);

        theScripts[i].parentNode.insertBefore(my_div, theScripts[i]);
        theScripts[i].parentNode.removeChild(theScripts[i]);
        break;
    }
}

