var ym_annotate = {
    jq_min: [1,3,2],
    ready: false,
    cjq:function(){
        if (!jQuery) {
            return false;
        } else {
            var t = jQuery.fn.jquery.split(".");
            if (parseInt(t[0]) < ym_annotate.jq_min[0]) {
                return false;
            } else if (parseInt(t[1]) < ym_annotate.jq_min[1]) {
                return false;
            } else if (parseInt(t[2]) < ym_annotate.jq_min[2]) {
                return false;
            }
        }
        return true;
    },
    site: "http://www.meisakulive.com/",
    sjq: function(){jQuery.noConflict();ym_annotate.ready=true;},
    toolbar: {
        id: "ym_toolbar",
        create: function() {
            if (ym_annotate.ready == false) {
                return false;
            }
            jQuery("body").append('<div id="'+ym_annotate.toolbar.id+'" class="sui_moveable" style="display:block;position:fixed;left:800px;top:300px;width:370px;height:110px;background-image:url('+ym_annotate.site+'img/common/my_learning_tools.gif);z-index:50;"></div>');
            var t = jQuery("#toggleToolbar");
            var tt = jQuery("#"+ym_annotate.toolbar.id);
            if (t.length > 0) {
                tt.css({top:t.offset().top+'px'});
            }
            t = jQuery("#bookreader_main");
            if (t.length > 0) {
                tt.css({left:(t.offset().left+t.width()-(tt.width() / 2))+'px'});
            }
            tt.append('<div style="position:absolute;right:15px;top:0;"><a href="#" onclick="jQuery(\'#toggleToolbar\').click();return false;">&nbsp;&nbsp;</a></div>');
            tt.sui_moveable();
            return true;
        },
        destroy: function() {
            if (ym_annotate.ready == false) {
                return false;
            }
            jQuery("#"+ym_annotate.toolbar.id).remove();
            return true;
        },
        show: function() {
            if (ym_annotate.ready == false) {
                return false;
            }
            var t = jQuery("#"+ym_annotate.toolbar.id);
            if (t.length == 0) {
                ym_annotate.toolbar.create();
            } else {
                t.show();
            }
            return true;
        },
        hide: function() {
            if (ym_annotate.ready == false) {
                return false;
            }
            jQuery("#"+ym_annotate.toolbar.id).hide();
            return true;
        },
        toggle: function() {
            if (ym_annotate.ready == false) {
                return false;
            }
            var t = jQuery("#"+ym_annotate.toolbar.id);
            if (t.length == 0) {
                ym_annotate.toolbar.create();
            } else {
                if (t.is(":hidden")) {
                    t.show();
                } else {
                    t.hide();
                }
            }
            return true;
        }
    }
};

if (!ym_annotate.cjq()) {
    var h = document.getElementsByTagName('head')[0];
    var s = document.createElement('script');
    s.type='text/javascript';
    s.onreadystatechange=function(){if(this.readyState=='complete'){ym_annotate.sjq()}};
    s.onload=ym_annotate.sjq;
    s.src=ym_annotate.site+'js/jquery-1.3.2.min.js';
    h.appendChild(s);
} else {
    ym_annotate.ready = true;
}

