var adjustsize = function(){
    var getElement = function(aID)
    {
        return (document.getElementById) ?  document.getElementById(aID) :  document.all[aID];
    }
    var getIFrameDocument = function(aID){
        var rv = null;
        var frame=getElement(aID);
        if (frame.contentDocument)
            rv = frame.contentDocument;
        else // bad Internet Explorer  ;)
            rv = document.frames[aID].document;
        return rv;
    }
    var frame = getElement("chklist_frame");
    var frameDoc = getIFrameDocument("chklist_frame");
    frame.height = frameDoc.body.offsetHeight;
};
(function() {

    var getParamClean = function(key, value){
        if(key && value)
        {
            return "&" + key + "=" + encodeURIComponent(value)
        } else {
            return "";
        }
    }
    var getParams = function(){
        var src = '';
        for(var name in checklist_widget){
            src += getParamClean(name,checklist_widget[name]);
        }
        return src;
    }
    var getFormSource = function(){
        checklist_widget['location'] = location.href;
        var src = 'http://en.checklist.com/template_widget.jsp?' + getParams();
        src = src.substring(0,2000);
        src = src.replace(/%\w?$/, "");
        return src;
    }
    var a = document;
    var src = getFormSource();
    a.write('<iframe id="chklist_frame" src="' + src + '" width="' + checklist_widget.width + '" height="' + checklist_widget.height + '"' + 
        ' frameborder=' + 0 + ' marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="yes">');
    a.write("</iframe>");
})();


