if (self.location != top.location) {
    top.location = self.location;
}
if (xInclude('js/x_core.js', 'js/x_event.js', 'js/x_slide.js')) {
    window.onload = winOnLoad;
}
function winOnLoad()
{
    xSlideTo('floatingMenu', xScrollLeft(), xScrollTop(), 1500);
    xShow('floatingMenu');
    xZIndex('floatingMenu',1000);
    xAddEventListener(window, 'scroll', scrolllistener, false);
    xAddEventListener(document, 'mousemove', movelistener, false);
    var divs = document.getElementsByTagName('div');
    var heights = '';
    for(i=0;i<divs.length;i++) {
        if (divs[i].className == "article") {
            heights += divs[i].id + ': ' + xHeight(divs[i].id) + '\n';
        }
    }
    //alert(heights);
};
//var isScrolling = false;
function scrolllistener()
{
//    if (!isScrolling) {
        xSlideTo('floatingMenu', xScrollLeft(), xScrollTop(), 1500);
//    }
}
function movelistener(e)
{
/*    var evt = new xEvent(e);
    if (evt.pageX - xScrollLeft() > (xClientWidth() - 100)) {
        if (!isScrolling) {
            startScrolling();
        }
    } else {
        if (isScrolling) {
            stopScrolling();
        }
    }*/
}
var scrollID;
function startScrolling()
{
    scrollID = setInterval("scroll()", 1);
    isScrolling = true;
}
function stopScrolling()
{
    clearInterval(scrollID);
    isScrolling = false;
    scrollListener();
}
function scroll()
{
    window.scrollBy(2, 0);
}
function openLyrics()
{
    var type = (arguments.length == 1)? 'song': 'book';
    var songname = arguments[0];
    var win = window.open('lyrics/'+type+'_'+songname+'.html', 'lyrics','left=0,top=0,width=500,height=500,scrollbars');
    if (win.focus) {
        win.focus();
    }
}
