/*

Copyright (C) 2007 by Marian Meravy

*/

/* ========= section #1: Browse by: COVER */

/* table row #0 */
var g_zebra1_tr0_col_1_bg_color='#c7b792'; // bg color for year (first and 3rt column)
var g_zebra1_tr0_col_1_fg_color='#000'; // fg color (font color) for year (first nad 3rd column)

var g_zebra1_tr0_col_1_bg_color_hover='#2a2d2e'; // hover bg color for year (first and 3rt column)
var g_zebra1_tr0_col_1_fg_color_hover='#f0e4cd'; // hover fg color (font color) for year (first nad 3rd column)

var g_zebra1_tr0_col_2_bg_color='#c0ae86'; // bg color for year (second column)
var g_zebra1_tr0_col_2_fg_color='#000'; // fg color (font color) for year (second column)

var g_zebra1_tr0_col_2_bg_color_hover='#2a2d2e'; // hover bg color for year (second column)
var g_zebra1_tr0_col_2_fg_color_hover='#f0e4cd'; // hover fg color (font color) for year (second column)

/* table row #1 */
var g_zebra1_tr1_col_1_bg_color='#f00'; // bg color for year (first and 3rt column)
var g_zebra1_tr1_col_1_fg_color='#0ff'; // fg color (font color) for year (first nad 3rd column)

var g_zebra1_tr1_col_1_bg_color_hover='#00f'; // hover bg color for year (first and 3rt column)
var g_zebra1_tr1_col_1_fg_color_hover='#ff0'; // hover fg color (font color) for year (first nad 3rd column)

var g_zebra1_tr1_col_2_bg_color='#0f0'; // bg color for year (second column)
var g_zebra1_tr1_col_2_fg_color='#f0f'; // fg color (font color) for year (second column)

var g_zebra1_tr1_col_2_bg_color_hover='#0ff'; // hover bg color for year (second column)
var g_zebra1_tr1_col_2_fg_color_hover='#f00'; // hover fg color (font color) for year (second column)

/* ========= section #2: Browse by: AUTHOR */

/* table row #0 */
var g_zebra2_tr0_bg_color='#ecd7a2'; // bg color
var g_zebra2_tr0_fg_color='#000'; // fg color

var g_zebra2_tr0_bg_color_hover='#782a19'; // hover bg color
var g_zebra2_tr0_fg_color_hover='#f0e4cd'; // hover fg color

/* table row #1 */
var g_zebra2_tr1_bg_color='#e8d4a0'; // bg color
var g_zebra2_tr1_fg_color='#000'; // fg color

var g_zebra2_tr1_bg_color_hover='#782a19'; // hover bg color
var g_zebra2_tr1_fg_color_hover='#f0e4cd'; // hover fg color

/* ========= section #3: Browse by: YEAR */

var g_zebra3_tr0_bg_color='#ecd7a2'; // bg color for half of <tr> (first/odd) RIADKY
var g_zebra3_tr1_bg_color='#e8d4a0'; // bg color for half of <tr> (second/even) RIADKY

var g_zebra3_tr0_fg_color='#000'; // fg color (font color) for half of <tr> (first/odd) PISMO
var g_zebra3_tr1_fg_color='#000'; // fg color (font color) for half of <tr> (second/even) PISMO

var g_zebra3_tr0_bg_color_hover='#e8d4a0'; // hover bg color for half of <tr> (first/odd) RIADKOVE HOVER
var g_zebra3_tr1_bg_color_hover='#deca99'; // hover bg color for half of <tr> (second/even) RIADKOVE HOVER

var g_zebra3_tr0_fg_color_hover='#000'; // hover fg color (font color) for half of <tr> (first/odd) PISMO
var g_zebra3_tr1_fg_color_hover='#000'; // hover fg color (font color) for half of <tr> (second/even) PISMO

var g_zebra3_tr0_td_bg_color_hover='#802713'; // hover bg color of <td> in first/odd <tr> TUKATKO
var g_zebra3_tr1_td_bg_color_hover='#802713'; // hover bg color of <td> in second/even <tr> TUKATKO

var g_zebra3_tr0_td_fg_color_hover='#f0e4cd'; // hover fg color (font color) of <td> in first/odd <tr> PISMO tukatka
var g_zebra3_tr1_td_fg_color_hover='#f0e4cd'; // hover fg color (font color) of <td> in second/even <tr> PISMO tukatka

/*editorial */

var g_zebra4_tr0_bg_color='#ecd7a2'; // bg color for half of <tr> (first/odd)
var g_zebra4_tr1_bg_color='#e8d4a0'; // bg color for half of <tr> (second/even)

var g_zebra4_tr0_fg_color='#ff4e00'; // fg color (font color) for half of <tr> (first/odd)
var g_zebra4_tr1_fg_color='#ff4e00'; // fg color (font color) for half of <tr> (second/even)

var g_zebra4_tr0_bg_color_hover='#782a19'; // hover bg color for half of <tr> (first/odd)
var g_zebra4_tr1_bg_color_hover='#782a19'; // hover bg color for half of <tr> (second/even)

var g_zebra4_tr0_fg_color_hover='#f0e4cd'; // hover fg color (font color) for half of <tr> (first/odd)
var g_zebra4_tr1_fg_color_hover='#f0e4cd'; // hover fg color (font color) for half of <tr> (second/even)

var g_zebra4_tr0_td_fg_color_hover='#f0e4cd'; // hover fg color (font color) of <td> in first/odd <tr>
var g_zebra4_tr1_td_fg_color_hover='#f0e4cd'; // hover fg color (font color) of <td> in second/even <tr>

/* ---------- END config -------------- */

var g_zebra1_tr;
var g_zebra1_last_tr=null;
var g_zebra1_tds_cnt;

function process_tags(el,bg,fg)
{
    el.style.backgroundColor=bg;
    el.style.color=fg;

    /*if(window.ie)*/ {
        for(var i1=0; i1<el.getChildren().length; ++i1) {
            process_tags(el.getChildren()[i1],bg,fg);
        }
    }
}

function process_zebra1()
{
    var els;

    els=document.getElementsByTagName('td');
    for(var i1=0; i1<els.length; ++i1) {
        var el=els[i1];

        if(el.className=='zebra1_tr0_col_1') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra1_tr0_col_1_bg_color_hover,g_zebra1_tr0_col_1_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        } else if(el.className=='zebra1_tr0_col_2') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra1_tr0_col_2_bg_color_hover,g_zebra1_tr0_col_2_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        } else if(el.className=='zebra1_tr1_col_1') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra1_tr1_col_1_bg_color_hover,g_zebra1_tr1_col_1_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        } else if(el.className=='zebra1_tr1_col_2') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra1_tr1_col_2_bg_color_hover,g_zebra1_tr1_col_2_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        }
    }
}

var g_authors_sroll=false;

function bind_anchors2()
{
    if(g_authors_sroll)
        return;
    g_authors_sroll=true;

    var els;

    els=document.getElementsByTagName('span');
    for(var i1=0; i1<els.length; ++i1) {
        if(els[i1].className.match('^author_\\w$')) {
            els[i1].my_dont_touch=true;
            els[i1].addEvent('click',function(event)
                {
                    event=new Event(event);
                    event.stop();
                    var author=this.className;
                    if($defined($(author))) {
                        var s=g_scrollers[2].getSize();
                        s.scroll.y=$(author).getTop()-$('scroll2_offset').getTop();
                        do_move(g_scrollers[2],s);
                    }
                }.bind(els[i1])
            );
            els[i1].addEvent('mouseover',function()
                {
                    this.style.textDecoration="underline";
                }.bind(els[i1])
            );
            els[i1].addEvent('mouseout',function()
                {
                    this.style.textDecoration="none";
                }.bind(els[i1])
            );
            els[i1].style.cursor="pointer";
        }
    }
}

function process_zebra2()
{
    var els;

    els=document.getElementsByTagName('tr');
    for(var i1=0; i1<els.length; ++i1) {
        var el=els[i1];

        if(el.className=='zebra2_tr0') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra2_tr0_bg_color_hover,g_zebra2_tr0_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,g_zebra2_tr0_bg_color,g_zebra2_tr0_fg_color);
                }.bind(el)
            );
        } else if(el.className=='zebra2_tr1') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra2_tr1_bg_color_hover,g_zebra2_tr1_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,g_zebra2_tr1_bg_color,g_zebra2_tr1_fg_color);
                }.bind(el)
            );
        }
    }

    bind_anchors2();
}

function process_zebra3()
{
    var els;

    els=document.getElementsByTagName('tr');
    for(var i1=0; i1<els.length; ++i1) {
        var el=els[i1];

        if(el.className=='zebra3_tr0') {
            el.addEvent('mouseover',function()
                {
                    this.style.backgroundColor=g_zebra3_tr0_bg_color_hover;
                    this.style.color=g_zebra3_tr0_fg_color_hover;
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    this.style.backgroundColor=g_zebra3_tr0_bg_color;
                    this.style.color=g_zebra3_tr0_fg_color;
                }.bind(el)
            );
        } else if(el.className=='zebra3_tr1') {
            el.addEvent('mouseover',function()
                {
                    this.style.backgroundColor=g_zebra3_tr1_bg_color_hover;
                    this.style.color=g_zebra3_tr1_fg_color_hover;
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    this.style.backgroundColor=g_zebra3_tr1_bg_color;
                    this.style.color=g_zebra3_tr1_fg_color;
                }.bind(el)
            );
        }
    }

    els=document.getElementsByTagName('td');
    for(var i1=0; i1<els.length; ++i1) {
        var el=els[i1];

        if(el.className=='zebra3_tr0a_td1' || el.className=='zebra3_tr0b_td1' || el.className=='zebra3_tr0a_td2' || el.className=='zebra3_tr0b_td2' || el.className=='zebra3_tr0a_td3' || el.className=='zebra3_tr0b_td3') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra3_tr0_td_bg_color_hover,g_zebra3_tr0_td_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        } else if(el.className=='zebra3_tr1a_td1' || el.className=='zebra3_tr1b_td1' || el.className=='zebra3_tr1a_td2' || el.className=='zebra3_tr1b_td2' || el.className=='zebra3_tr1a_td3' || el.className=='zebra3_tr1b_td3') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra3_tr1_td_bg_color_hover,g_zebra3_tr1_td_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        }
    }
}

function process_zebra4()
{
    var els;

    els=document.getElementsByTagName('td');
    for(var i1=0; i1<els.length; ++i1) {
        var el=els[i1];

        if(el.className=='zebra4_tr0_td') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra4_tr0_bg_color_hover,g_zebra4_tr0_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        } else if(el.className=='zebra4_tr1_td') {
            if(el.innerHTML=='')
                continue;
            el.addEvent('mouseover',function()
                {
                    process_tags(this,g_zebra4_tr1_bg_color_hover,g_zebra4_tr1_fg_color_hover);
                }.bind(el)
            );

            el.addEvent('mouseout',function()
                {
                    process_tags(this,'','');
                }.bind(el)
            );
        }
    }
}

