var image_scroll_images;
var image_scroll_articles;
var image_scroll_links;
var image_scroll_link_name;
var image_scroll_image_index = 0;
var image_scroll_control_id1;
var image_scroll_control_id2;
var image_scroll_control_step_width = 0;
var image_scroll_control_step_delay = 0;
var image_scroll_control_base_height = 0;
var image_scroll_max_width = 0;
var image_scroll_hide_show_opacity = 0;
var image_scroll_image_show_time = 0;
var image_scroll_main_control;

var image_show_window_images;
var image_show_window_name;
var image_show_window_label_text_name;
var image_show_window_text_src;
var image_show_window_image_index = 0;
var image_show_window_form_name;

var forms_to_center = "";

var menu_show_opacity = 0;
var menu_show_opacity_timeout = 20;
var menu_show_opacity_add_value = 10;
var menu_show_selected_menu_name;
var menu_show_menu_items_name;
var menu_show_hideing_enable = false;
var menu_show_menuids = "";

var navi = "";

var mouse_x = 0;
var mouse_y = 0;

var articlechange_articles = "";
var articlechange_htmlcontrolname = "";
var articlechange_hideshowtimeout = 25;
var articlechange_opacitychange = 25;
var articlechange_htmlindex = 0;
var articlechange_element_opacty = 0;
var articlechange_vartimeout = 0;

var articlechange_articles_2 = "";
var articlechange_htmlcontrolname_2 = "";
var articlechange_hideshowtimeout_2 = 25;
var articlechange_opacitychange_2 = 25;
var articlechange_htmlindex_2 = 0;
var articlechange_element_opacty_2 = 0;
var articlechange_vartimeout_2 = 0;

var articlechange_articles_3 = "";
var articlechange_htmlcontrolname_3 = "";
var articlechange_hideshowtimeout_3 = 25;
var articlechange_opacitychange_3 = 25;
var articlechange_htmlindex_3 = 0;
var articlechange_element_opacty_3 = 0;
var articlechange_vartimeout_3 = 0;

var articlechange_articles_4 = "";
var articlechange_htmlcontrolname_4 = "";
var articlechange_hideshowtimeout_4 = 25;
var articlechange_opacitychange_4 = 25;
var articlechange_htmlindex_4 = 0;
var articlechange_element_opacty_4 = 0;
var articlechange_vartimeout_4 = 0;

var window_scroll_x = 0;
var window_scroll_y = 0;

var mseparator1 = "v|||v";
var mseparator2 = "c|||c";

var background_change_count_1_name = "";
var background_change_count_1_images;
var background_change_count_1_index;
var background_change_count_1_timeout;

var page_settings_scrollbarx = 0;
var page_settings_scrollbary = 0;

var counter_0_name = "";
var counter_0_timeout = 0;
var counter_0_max = 0;
var counter_0_value = 0;
var counter_0_value_str = "";
var counter_0_height = 0;
var counter_0_name_1 = "";
var counter_0_name_2 = "";
var counter_0_http = "";
var counter_0_digits = 0;
var counter_0_change_px = 20;
var counter_0_next_image = "";

var counter_1_name = "";
var counter_1_timeout = 0;
var counter_1_max = 0;
var counter_1_value = 0;
var counter_1_value_str = "";
var counter_1_height = 0;
var counter_1_name_1 = "";
var counter_1_name_2 = "";
var counter_1_http = "";
var counter_1_digits = 0;
var counter_1_change_px = 20;
var counter_1_next_image = "";

var scrolling_element_ids = "";

function menu_hide(v_menu_show_menuids)
{
    menu_show_menuids = v_menu_show_menuids;
    menu_show_hideing_enable = true;
    this.setTimeout("menu_clear_elapsed()", 100);
}

function menu_clear_elapsed()
{
    if (menu_show_hideing_enable)
        menu_clear(menu_show_menuids);
}

function menu_clear(v_menu_show_menuids)
{
    menu_show_hideing_enable = false;
    
    var rows = v_menu_show_menuids.split(":");
    for(r = 0; r < rows.length; r++)
    {
        var cells = rows[r].split("|");
        
        if(document.getElementById(cells[1]).style.display == 'block' && !(element_is_mouse_over(cells[0]) || element_is_mouse_over(cells[1])))
        {
            element_hide(cells[1]);
            element_set_css_class_name(cells[2], cells[3]);
            bordered_menu_set_css1(4, rows[r]);
        }
    }
}

function menu_submenu_mouse_over(menu_cell_id, menu_cell_css, link_id, link_css, sec_link_id, sec_link_css)
{
    element_set_css_class_name(menu_cell_id, menu_cell_css);
    element_set_css_class_name(link_id, link_css);
    if(sec_link_id.length > 0)
    {
        element_set_css_class_name(sec_link_id, sec_link_css);
    }
}

function menu_sub_borderedmenu_mouse_over(vborderedmenu, link_id, link_css, link_id1, link_css1)
{
    bordered_menu_set_css(vborderedmenu);
    element_set_css_class_name(link_id, link_css);
    if (link_id1.length > 0)
    {
        element_set_css_class_name(link_id1, link_css1);
    }
}

function menu_show_single(vborderedmenu, link_id, link_css)
{
        bordered_menu_set_css(vborderedmenu);
        element_set_css_class_name(link_id, link_css);
}

function menu_show(vmenu, vmainmenu, vborderedmenu, link_id, link_css, add_x, add_y, v_menu_show_menuids)
{
    if(document.getElementById(vmenu).style.display != 'block')
    {
        var showing = menu_show_selected_menu_name != vmenu;
        menu_clear(v_menu_show_menuids);

        var hideing = navi != "IE6" && navi != "IE7" && navi != "IE8";

        if(showing)
        {
            menu_show_selected_menu_name = vmenu;
            menu_show_opacity = 10;
            if(hideing)
                element_set_opacity(vmenu, menu_show_opacity);
        }

        bordered_menu_set_css(vborderedmenu);
        element_set_css_class_name(link_id, link_css);

        var height = element_get_height(vmainmenu);
        var x = math_add(element_get_x(vmainmenu), add_x);
        var y = math_add(element_get_y(vmainmenu), add_y);
        element_set_x(vmenu, x);
        element_set_y(vmenu, math_add(y, height));

        element_show(vmenu);

        if(showing && hideing)
        {
            this.setTimeout("menu_show_inc_opacity()", menu_show_opacity_timeout);
        }
    }
}

function menu_show_inc_opacity()
{
    menu_show_opacity = math_add(menu_show_opacity, menu_show_opacity_add_value);
    if(menu_show_opacity > 100)
    {
        menu_show_opacity = 100;
        element_set_opacity(menu_show_selected_menu_name, menu_show_opacity);
    }
    else
    {
        element_set_opacity(menu_show_selected_menu_name, menu_show_opacity);
        this.setTimeout("menu_show_inc_opacity()", menu_show_opacity_timeout);
    }
}

function menu_show_vertical(vborderedmenu, link_id, link_css)
{
    bordered_menu_set_css(vborderedmenu);
    element_set_css_class_name(link_id, link_css);
}

function image_scroll_set_css_width(vimage, vcss, width)
{
    element_set_css_class_name(vimage, "" + vcss + "_width_" + width);
}

function imagescroll_scrolling_start()
{
    image_scroll_image_index++;
    if(image_scroll_image_index > image_scroll_images.length - 1)
    {
        image_scroll_image_index = 0;
    }

    image_scroll_max_width = element_get_width(image_scroll_control_id1);

    element_set_css_class_name(image_scroll_control_id2, image_scroll_images[image_scroll_image_index]);
    element_set_width(image_scroll_control_id2, 0);

    this.setTimeout("imagescroll_move()", image_scroll_control_step_delay);
}

function imagescroll_move()
{
    var c1w = element_get_width(image_scroll_control_id1);
    var c2w = element_get_width(image_scroll_control_id2);

    var heighta = element_get_height(image_scroll_control_id1);
    var heightb = element_get_height(image_scroll_control_id2);

    if(c1w - image_scroll_control_step_width > 0)
    {
        var widtha = c1w - image_scroll_control_step_width;
        var widthb = math_add(c2w, image_scroll_control_step_width);


        element_set_width(image_scroll_control_id1, widtha);
        element_set_height(image_scroll_control_id1, heighta);

        element_set_width(image_scroll_control_id2, widthb);
        element_set_height(image_scroll_control_id2, heightb);

        this.setTimeout("imagescroll_move()", image_scroll_control_step_delay);
    }
    else
    {
        element_set_css_class_name(image_scroll_control_id1, image_scroll_images[image_scroll_image_index]);
        element_set_width(image_scroll_control_id1, image_scroll_max_width);
        
        element_set_width(image_scroll_control_id2, 0);
        element_set_height(image_scroll_control_id2, heightb);

        if(image_scroll_link_name.length > 0)
        {
            document.getElementById(image_scroll_link_name).innerHTML = image_scroll_articles[image_scroll_image_index];
            document.getElementById(image_scroll_link_name).href = image_scroll_links[image_scroll_image_index];
        }
        this.setTimeout("imagescroll_scrolling_start()", image_scroll_image_show_time);
    }
}

function imagescroll_scrolling(vid1, vid2, width, delay, images, showtime, articles, links, link_name, show_type, maincontrol)
{
    image_scroll_images = images.split("|");
    image_scroll_articles = articles.split("|");
    image_scroll_links = links.split("|");
    image_scroll_link_name = link_name;
    image_scroll_main_control = maincontrol;
    
    image_scroll_max_width = document.getElementById(vid1).width;
    image_scroll_control_base_height = document.getElementById(vid1).height;

    image_scroll_control_id1 = vid1;
    image_scroll_control_id2 = vid2;
    image_scroll_control_step_width = width;
    image_scroll_control_step_delay = delay;
    image_scroll_image_show_time = showtime;

    if(document.getElementById(image_scroll_control_id2) != null)
    {
        document.getElementById(image_scroll_control_id2).src = image_scroll_images[image_scroll_image_index];
        document.getElementById(image_scroll_control_id2).width = 0;
    }

    if(show_type == "IMAGESCROLLERBASE" || show_type == "IMAGESCROLLERTEXTRIGHT" || show_type == "IMAGESCROLLERTEXTBUTTOM")
    {
        this.setTimeout("imagescroll_scrolling_start()", image_scroll_image_show_time);
    }
    else if(show_type == "IMAGESCROLLERALPHACHGANGE" || show_type == "IMAGESCROLLERALPHACHGANGETEXTRIGTH" || show_type == "IMAGESCROLLERALPHACHGANGETEXTBUTTOM")
    {
        this.setTimeout("imagescroll_hideing_start()", image_scroll_image_show_time);
    }
}

function imagescroll_hideing_start()
{
    image_scroll_image_index++;
    if(image_scroll_image_index > image_scroll_images.length - 1)
    {
        image_scroll_image_index = 0;
    }

    image_scroll_hide_show_opacity = 100;

    this.setTimeout("imagescroll_hideing()", image_scroll_control_step_delay);
}

function imagescroll_showing()
{
    image_scroll_hide_show_opacity = math_add(image_scroll_hide_show_opacity, image_scroll_control_step_width);
    if(image_scroll_hide_show_opacity < 100)
    {
        element_set_opacity(image_scroll_main_control, image_scroll_hide_show_opacity);
        this.setTimeout("imagescroll_showing()", image_scroll_control_step_delay);
    }
    else
    {
        image_scroll_hide_show_opacity = 100;
        element_set_opacity(image_scroll_main_control, image_scroll_hide_show_opacity);
        this.setTimeout("imagescroll_hideing_start()", image_scroll_image_show_time);
    }
}

function imagescroll_hideing()
{
    image_scroll_hide_show_opacity -= image_scroll_control_step_width;
    if(image_scroll_hide_show_opacity > 0)
    {
        element_set_opacity(image_scroll_main_control, image_scroll_hide_show_opacity);
        this.setTimeout("imagescroll_hideing()", image_scroll_control_step_delay);
    }
    else
    {
        image_scroll_hide_show_opacity = 0;
        element_set_css_class_name(image_scroll_control_id1, image_scroll_images[image_scroll_image_index]);

        if(image_scroll_link_name.length > 0 && document.getElementById(image_scroll_link_name) != null)
        {
            document.getElementById(image_scroll_link_name).innerHTML = image_scroll_articles[image_scroll_image_index];
            document.getElementById(image_scroll_link_name).href = image_scroll_links[image_scroll_image_index];
        }

        element_set_opacity(image_scroll_main_control, image_scroll_hide_show_opacity);
        
        this.setTimeout("imagescroll_showing()", image_scroll_control_step_delay);
    }
}

function ws_category_subitem_set_css(vbordered, link_id, link_css)
{
    bordered_menu_set_css(vbordered);
    element_set_css_class_name(link_id, link_css);
}

function articlechange_set_data(articles, htmlcontrolname, hideshowtimeout, opacitychange)
{
    articlechange_articles = articles;
    articlechange_htmlcontrolname = htmlcontrolname;
    articlechange_hideshowtimeout = hideshowtimeout;
    articlechange_opacitychange = opacitychange;
}

function articlechange_click(index)
{
    articlechange_htmlindex = index;
    articlechange_element_opacty = 100;
    this.setTimeout("articlechange_hideing()", articlechange_hideshowtimeout);
}

function articlechange_timeout_start(vartimeout)
{
    articlechange_vartimeout = vartimeout;
    this.setTimeout("articlechange_timeout()", articlechange_vartimeout);
}

function articlechange_timeout()
{
    articlechange_htmlindex = math_add(articlechange_htmlindex, 1);
    
    var htmls = articlechange_articles.split(mseparator1);
    if(articlechange_htmlindex >= htmls.length)
        articlechange_htmlindex = 0

    articlechange_element_opacty = 100;
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.getElementById(articlechange_htmlcontrolname).innerHTML = htmls[articlechange_htmlindex];
        this.setTimeout("articlechange_timeout()", articlechange_vartimeout);
    }
    else
    {
        this.setTimeout("articlechange_hideing()", articlechange_hideshowtimeout);
    }
}

function articlechange_hideing()
{
    articlechange_element_opacty = articlechange_element_opacty - articlechange_opacitychange;
    if(articlechange_element_opacty < 0)
        articlechange_element_opacty = 0;
    element_set_opacity(articlechange_htmlcontrolname, articlechange_element_opacty);

    if(articlechange_element_opacty > 0)
    {
        this.setTimeout("articlechange_hideing()", articlechange_hideshowtimeout);
    }
    else
    {
        var htmls = articlechange_articles.split(mseparator1);
        document.getElementById(articlechange_htmlcontrolname).innerHTML = htmls[articlechange_htmlindex];
        this.setTimeout("articlechange_showing()", articlechange_hideshowtimeout);
    }
}

function articlechange_showing()
{
    articlechange_element_opacty = math_add(articlechange_element_opacty, articlechange_opacitychange);
    if(articlechange_element_opacty > 100)
        articlechange_element_opacty = 100;

    element_set_opacity(articlechange_htmlcontrolname, articlechange_element_opacty);

    if(articlechange_element_opacty < 100)
    {
        this.setTimeout("articlechange_showing()", articlechange_hideshowtimeout);
    }
    else
    {
        if(articlechange_vartimeout != 0)
        {
            this.setTimeout("articlechange_timeout()", articlechange_vartimeout);
        }
    }
}

function articlechange_set_data_2(articles, htmlcontrolname, hideshowtimeout, opacitychange)
{
    articlechange_articles_2 = articles;
    articlechange_htmlcontrolname_2 = htmlcontrolname;
    articlechange_hideshowtimeout_2 = hideshowtimeout;
    articlechange_opacitychange_2 = opacitychange;
}

function articlechange_click_2(index)
{
    articlechange_htmlindex_2 = index;
    articlechange_element_opacty_2 = 100;
    this.setTimeout("articlechange_hideing_2()", articlechange_hideshowtimeout_2);
}

function articlechange_timeout_start_2(vartimeout)
{
    articlechange_vartimeout_2 = vartimeout;
    this.setTimeout("articlechange_timeout_2()", articlechange_vartimeout_2);
}

function articlechange_timeout_2()
{
    articlechange_htmlindex_2 = math_add(articlechange_htmlindex_2, 1);

    var htmls = articlechange_articles_2.split(mseparator1);
    if(articlechange_htmlindex_2 >= htmls.length)
        articlechange_htmlindex_2 = 0

    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.getElementById(articlechange_htmlcontrolname_2).innerHTML = htmls[articlechange_htmlindex_2];
        this.setTimeout("articlechange_timeout_2()", articlechange_vartimeout_2);
    }
    else
    {
        articlechange_element_opacty_2 = 100;
        this.setTimeout("articlechange_hideing_2()", articlechange_hideshowtimeout_2);
    }
}

function articlechange_hideing_2()
{
    articlechange_element_opacty_2 = articlechange_element_opacty_2 - articlechange_opacitychange_2;
    if(articlechange_element_opacty_2 < 0)
        articlechange_element_opacty_2 = 0;
    element_set_opacity(articlechange_htmlcontrolname_2, articlechange_element_opacty_2);

    if(articlechange_element_opacty_2 > 0)
    {
        this.setTimeout("articlechange_hideing_2()", articlechange_hideshowtimeout_2);
    }
    else
    {
        var htmls = articlechange_articles_2.split(mseparator1);
        document.getElementById(articlechange_htmlcontrolname_2).innerHTML = htmls[articlechange_htmlindex_2];
        this.setTimeout("articlechange_showing_2()", articlechange_hideshowtimeout_2);
    }
}

function articlechange_showing_2()
{
    articlechange_element_opacty_2 = math_add(articlechange_element_opacty_2, articlechange_opacitychange_2);
    if(articlechange_element_opacty_2 > 100)
        articlechange_element_opacty_2 = 100;

    element_set_opacity(articlechange_htmlcontrolname_2, articlechange_element_opacty_2);

    if(articlechange_element_opacty_2 < 100)
    {
        this.setTimeout("articlechange_showing_2()", articlechange_hideshowtimeout_2);
    }
    else
    {
        if(articlechange_vartimeout_2 != 0)
        {
            this.setTimeout("articlechange_timeout_2()", articlechange_vartimeout_2);
        }
    }
}

function articlechange_set_data_3(articles, htmlcontrolname, hideshowtimeout, opacitychange)
{
    articlechange_articles_3 = articles;
    articlechange_htmlcontrolname_3 = htmlcontrolname;
    articlechange_hideshowtimeout_3 = hideshowtimeout;
    articlechange_opacitychange_3 = opacitychange;
}

function articlechange_click_3(index)
{
    articlechange_htmlindex_3 = index;
    articlechange_element_opacty_3 = 100;
    this.setTimeout("articlechange_hideing_3()", articlechange_hideshowtimeout_3);
}

function articlechange_timeout_start_3(vartimeout)
{
    articlechange_vartimeout_3 = vartimeout;
    this.setTimeout("articlechange_timeout_3()", articlechange_vartimeout_3);
}

function articlechange_timeout_3()
{
    articlechange_htmlindex_3 = math_add(articlechange_htmlindex_3, 1);

    var htmls = articlechange_articles_3.split(mseparator1);
    if(articlechange_htmlindex_3 >= htmls.length)
        articlechange_htmlindex_3 = 0

    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.getElementById(articlechange_htmlcontrolname_3).innerHTML = htmls[articlechange_htmlindex_3];
        this.setTimeout("articlechange_timeout_3()", articlechange_vartimeout_3);
    }
    else
    {
        articlechange_element_opacty_3 = 100;
        this.setTimeout("articlechange_hideing_3()", articlechange_hideshowtimeout_3);
    }
}

function articlechange_hideing_3()
{
    articlechange_element_opacty_3 = articlechange_element_opacty_3 - articlechange_opacitychange_3;
    if(articlechange_element_opacty_3 < 0)
        articlechange_element_opacty_3 = 0;
    element_set_opacity(articlechange_htmlcontrolname_3, articlechange_element_opacty_3);

    if(articlechange_element_opacty_3 > 0)
    {
        this.setTimeout("articlechange_hideing_3()", articlechange_hideshowtimeout_3);
    }
    else
    {
        var htmls = articlechange_articles_3.split(mseparator1);
        document.getElementById(articlechange_htmlcontrolname_3).innerHTML = htmls[articlechange_htmlindex_3];
        this.setTimeout("articlechange_showing_3()", articlechange_hideshowtimeout_3);
    }
}

function articlechange_showing_3()
{
    articlechange_element_opacty_3 = math_add(articlechange_element_opacty_3, articlechange_opacitychange_3);
    if(articlechange_element_opacty_3 > 100)
        articlechange_element_opacty_3 = 100;

    element_set_opacity(articlechange_htmlcontrolname_3, articlechange_element_opacty_3);

    if(articlechange_element_opacty_3 < 100)
    {
        this.setTimeout("articlechange_showing_3()", articlechange_hideshowtimeout_3);
    }
    else
    {
        if(articlechange_vartimeout_3 != 0)
        {
            this.setTimeout("articlechange_timeout_3()", articlechange_vartimeout_3);
        }
    }
}

function articlechange_set_data_4(articles, htmlcontrolname, hideshowtimeout, opacitychange)
{
    articlechange_articles_4 = articles;
    articlechange_htmlcontrolname_4 = htmlcontrolname;
    articlechange_hideshowtimeout_4 = hideshowtimeout;
    articlechange_opacitychange_4 = opacitychange;
}

function articlechange_click_4(index)
{
    articlechange_htmlindex_4 = index;
    articlechange_element_opacty_4 = 100;
    this.setTimeout("articlechange_hideing_4()", articlechange_hideshowtimeout_4);
}

function articlechange_timeout_start_4(vartimeout)
{
    articlechange_vartimeout_4 = vartimeout;
    this.setTimeout("articlechange_timeout_4()", articlechange_vartimeout_4);
}

function articlechange_timeout_4()
{
    articlechange_htmlindex_4 = math_add(articlechange_htmlindex_4, 1);

    var htmls = articlechange_articles_4.split(mseparator1);
    if(articlechange_htmlindex_4 >= htmls.length)
        articlechange_htmlindex_4 = 0

    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.getElementById(articlechange_htmlcontrolname_4).innerHTML = htmls[articlechange_htmlindex_4];
        this.setTimeout("articlechange_timeout_4()", articlechange_vartimeout_4);
    }
    else
    {
        articlechange_element_opacty_4 = 100;
        this.setTimeout("articlechange_hideing_4()", articlechange_hideshowtimeout_4);
    }
}

function articlechange_hideing_4()
{
    articlechange_element_opacty_4 = articlechange_element_opacty_4 - articlechange_opacitychange_4;
    if(articlechange_element_opacty_4 < 0)
        articlechange_element_opacty_4 = 0;
    element_set_opacity(articlechange_htmlcontrolname_4, articlechange_element_opacty_4);

    if(articlechange_element_opacty_4 > 0)
    {
        this.setTimeout("articlechange_hideing_4()", articlechange_hideshowtimeout_4);
    }
    else
    {
        var htmls = articlechange_articles_4.split(mseparator1);
        document.getElementById(articlechange_htmlcontrolname_4).innerHTML = htmls[articlechange_htmlindex_4];
        this.setTimeout("articlechange_showing_4()", articlechange_hideshowtimeout_4);
    }
}

function articlechange_showing_4()
{
    articlechange_element_opacty_4 = math_add(articlechange_element_opacty_4, articlechange_opacitychange_4);
    if(articlechange_element_opacty_4 > 100)
        articlechange_element_opacty_4 = 100;

    element_set_opacity(articlechange_htmlcontrolname_4, articlechange_element_opacty_4);

    if(articlechange_element_opacty_4 < 100)
    {
        this.setTimeout("articlechange_showing_4()", articlechange_hideshowtimeout_4);
    }
    else
    {
        if(articlechange_vartimeout_4 != 0)
        {
            this.setTimeout("articlechange_timeout_4()", articlechange_vartimeout_4);
        }
    }
}

function articlechange_button_mouseover(cell_id, cell_css, label_id, label_css)
{
    element_set_css_class_name(cell_id, cell_css);
    element_set_css_class_name(label_id, label_css);
}

function background_change_1_start(v_background_change_count_1_name, v_background_change_count_1_images, v_background_change_count_1_timeout)
{
    background_change_count_1_name = v_background_change_count_1_name;
    background_change_count_1_images = v_background_change_count_1_images.split(mseparator1);
    background_change_count_1_index = 0;
    background_change_count_1_timeout = v_background_change_count_1_timeout;
    this.setTimeout("background_change_1_change()", background_change_count_1_timeout);
}

function background_change_1_change()
{
    document.getElementById(background_change_count_1_name).style.backgroundImage = background_change_count_1_images[background_change_count_1_index];

    background_change_count_1_index++;
    if(background_change_count_1_index >= background_change_count_1_images.length)
    {
        background_change_count_1_index = 0;
    }

    this.setTimeout("background_change_1_change()", background_change_count_1_timeout);
}

function button_mouseover(cell_id, cell_css, label_id, label_css)
{
    element_set_css_class_name(cell_id, cell_css);
    element_set_css_class_name(label_id, label_css);
}

function imageshow_show(form_name, img_name, img_index, img_src, label_text_name, text_src)
{
    image_show_window_name = img_name;
    image_show_window_images = img_src.split("|");
    image_show_window_image_index = img_index;
    image_show_window_label_text_name = label_text_name;
    image_show_window_text_src = text_src.split("|");
    image_show_window_form_name = form_name;

    imageshow_set_image_index();
    form_show_1(form_name, "CENTER");
}

function dialogshow_show(form_name)
{
    form_show_1(form_name, "CENTER");
}

function imageshow_set_image_index()
{
    var vimg = document.getElementById(image_show_window_name);
    vimg.src = image_show_window_images[image_show_window_image_index];
    document.getElementById(image_show_window_label_text_name).innerHTML = image_show_window_text_src[image_show_window_image_index];
}

function imageshow_set_image_previous()
{
    image_show_window_image_index--;
    if(image_show_window_image_index < 0)
        image_show_window_image_index = 0;
    imageshow_set_image_index();
    image_show_to_center();
}

function imageshow_set_image_next()
{
    image_show_window_image_index++;
    if(image_show_window_image_index >= image_show_window_images.length)
        image_show_window_image_index = image_show_window_images.length - 1;
    imageshow_set_image_index();
    image_show_to_center();
}

function image_show_to_center()
{
    var sub_form = image_show_window_form_name + "_subform";
    add_forms_to_center(sub_form);
    this.setTimeout("form_show_1_to_center()", 500);
}

function add_forms_to_center(name)
{
    forms_to_center += name + "|";
}

function form_show_1(form_name, position)
{
    element_show(form_name);
    
    var sub_form = form_name + "_subform";
    
    if(position == "CENTER")
    {
        element_set_y(form_name, 0);
        element_set_x(form_name, 0);
        element_set_height(form_name, document_get_height());
        
        element_set_position(sub_form, "absolute");
        element_set_y(sub_form, window_scroll_y);
        element_set_x(sub_form, form_center_position_x(sub_form));
        image_show_to_center();
    }
}

function form_show_1_to_center()
{
    var st = forms_to_center.split('|');
    
    for(i = 0; i < st.length; i++)
    {
        if(st[i].length > 0)
            element_set_x(st[i], form_center_position_x(st[i]));
    }
    forms_to_center = "";
}

function form_show(form_name, position)
{
    form_show_1(form_name, position);
}

function form_hide_not_contains(form_name, cont_control)
{
    if(!element_is_contains_xy(cont_control, mouse_x, mouse_y))
    {
        form_hide(form_name);
    }
}

function form_hide(form_name)
{
   element_hide(form_name);
}

function form_center_position_x(form_name)
{
    var x = ((window_get_width() / 2) - (element_get_width(form_name) / 2));
    if(x < 0)
        return x * -1;
    return x;
}

function form_center_position_y(form_name)
{
    var y = ((window_get_height() / 2) - (element_get_height(form_name) / 2));
    if(y < 0)
        return y * -1;
    return y;
}

function counter_0_set_data(v_counter_name, counter_value, v_counter_max, v_counter_timeout, v_counter_http, v_counter_digits)
{
    counter_0_name = v_counter_name;
    var names = counter_0_name.split(';');
    
    counter_0_max = v_counter_max;
    counter_0_value = counter_value;
    counter_0_timeout = v_counter_timeout;
    counter_0_http = v_counter_http;
    counter_0_digits = v_counter_digits;
    counter_0_height = element_get_height(names[0]);

    counter_0_value_str = string_fill_0("" + counter_0_value, counter_0_digits);
    var str_index = 0;
    for(i = 0; i < names.length; i+=2)
    {
        var img = "" + counter_0_http + counter_0_value_str.charAt(str_index) + ".png";
        element_set_background(names[i], img);
        str_index++;
    }

    counter_0_increase();
}

function counter_0_increase()
{
    counter_0_value_str = string_fill_0("" + counter_0_value, counter_0_digits);
    if(parseInt(counter_0_value) < parseInt(counter_0_max))
    {
        counter_0_value++;
        counter_0_scroll_1();
    }
}

function counter_0_scroll_1()
{
    var names = counter_0_name.split(';');
    var v_str = string_fill_0("" + counter_0_value, counter_0_digits);
    for(i = 0; i < counter_0_value_str.length; i++)
    {
        if(v_str.charAt(i) != counter_0_value_str.charAt(i))
        {
            counter_0_name_1 = names[i*2];
            counter_0_name_2 = names[i*2+1];

            counter_0_next_image = "" + counter_0_http + v_str.charAt(i) + ".png";
            
            element_set_background(counter_0_name_2, counter_0_next_image);

            var temp = "";

            for(t = 0; t < counter_0_value_str.length; t++)
            {
                if(t == i)
                {
                    temp += v_str.charAt(t);
                }
                else
                {
                    temp += counter_0_value_str.charAt(t);
                }
            }
            counter_0_value_str = temp;

            counter_0_scroll_2();
            
            return;
        }
    }

    this.setTimeout("counter_0_increase()", counter_0_timeout);
}

function counter_0_scroll_2()
{
    var v_height = element_get_height(counter_0_name_1);
    v_height -= counter_0_change_px;
    if (v_height > 0)
    {
        element_set_height(counter_0_name_1, v_height);
        element_set_height(counter_0_name_2, math_add(element_get_height(counter_0_name_2), counter_0_change_px));
        this.setTimeout("counter_0_scroll_2()", 50);
    }
    else
    {
        element_set_background(counter_0_name_1, counter_0_next_image);
        element_set_height(counter_0_name_2, 0);
        element_set_height(counter_0_name_1, counter_0_height);
        counter_0_scroll_1();
    }
}

function counter_1_set_data(v_counter_name, counter_value, v_counter_max, v_counter_timeout, v_counter_http, v_counter_digits)
{
    counter_1_name = v_counter_name;
    var names = counter_1_name.split(';');

    counter_1_max = v_counter_max;
    counter_1_value = counter_value;
    counter_1_timeout = v_counter_timeout;
    counter_1_http = v_counter_http;
    counter_1_digits = v_counter_digits;
    counter_1_height = element_get_height(names[0]);

    counter_1_value_str = string_fill_0("" + counter_1_value, counter_1_digits);
    var str_index = 0;
    for(i = 0; i < names.length; i+=2)
    {
        var img = "" + counter_1_http + counter_1_value_str.charAt(str_index) + ".png";
        element_set_background(names[i], img);
        str_index++;
    }

    counter_1_increase();
}

function counter_1_increase()
{
    counter_1_value_str = string_fill_0("" + counter_1_value, counter_1_digits);
    if(parseInt(counter_1_value) < parseInt(counter_1_max))
    {
        counter_1_value++;
        counter_1_scroll_1();
    }
}

function counter_1_scroll_1()
{
    var names = counter_1_name.split(';');
    var v_str = string_fill_0("" + counter_1_value, counter_1_digits);
    for(i = 0; i < counter_1_value_str.length; i++)
    {
        if(v_str.charAt(i) != counter_1_value_str.charAt(i))
        {
            counter_1_name_1 = names[i*2];
            counter_1_name_2 = names[i*2+1];

            counter_1_next_image = "" + counter_1_http + v_str.charAt(i) + ".png";

            element_set_background(counter_1_name_2, counter_1_next_image);

            var temp = "";

            for(t = 0; t < counter_1_value_str.length; t++)
            {
                if(t == i)
                {
                    temp += v_str.charAt(t);
                }
                else
                {
                    temp += counter_1_value_str.charAt(t);
                }
            }
            counter_1_value_str = temp;

            counter_1_scroll_2();

            return;
        }
    }

    this.setTimeout("counter_1_increase()", counter_1_timeout);
}

function counter_1_scroll_2()
{
    var v_height = element_get_height(counter_1_name_1);
    v_height -= counter_1_change_px;
    if (v_height > 0)
    {
        element_set_height(counter_1_name_1, v_height);
        element_set_height(counter_1_name_2, math_add(element_get_height(counter_1_name_2), counter_1_change_px));
        this.setTimeout("counter_1_scroll_2()", 50);
    }
    else
    {
        element_set_background(counter_1_name_1, counter_1_next_image);
        element_set_height(counter_1_name_2, 0);
        element_set_height(counter_1_name_1, counter_1_height);
        counter_1_scroll_1();
    }
}

function textbox_enter(event, var_redirect)
{
    if(event.keyCode == 13)
    {
        __doPostBack(var_redirect, '');
    }
}

function doPostBack(var_id)
{
    __doPostBack(var_id, '');
}

function window_get_width()
{
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.body.offsetWidth;
        return document.body.offsetWidth;
    }
    window.innerWidth;
    return window.innerWidth;
}

function window_get_height()
{
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.body.offsetHeight;
        return document.body.offsetHeight;
    }
    window.innerHeight;
    return window.innerHeight;
}

function document_get_width()
{
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.body.clientWidth;
        return document.body.clientWidth;
    }
    document.body.clientWidth;
    return document.body.clientWidth;
}

function document_get_height()
{
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.body.clientHeight;
        return document.body.clientHeight;
    }
    document.body.clientHeight;
    return document.body.clientHeight;
}

function window_get_r_height()
{
    return window.innerHeight;
}

function window_get_y()
{
    return window.pageYOffset;
}

function window_set_y(y)
{
    window.scroll(window_get_x(), y);
}

function window_get_x()
{
    return window.pageXOffset;
}

function window_set_x(x)
{
    window.scroll(x, window_get_y());
}

function element_get_height(vname)
{
    var vcontrol = document.getElementById(vname);
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
        return vcontrol.offsetHeight;
    return vcontrol.clientHeight;
}

function element_get_width(vname)
{
    var vcontrol = document.getElementById(vname);
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
        return vcontrol.offsetWidth;
    return vcontrol.clientWidth;
}

function element_get_x(vname)
{
    var vcontrol = document.getElementById(vname);
    var x = vcontrol.offsetLeft;

    vcontrol = vcontrol.offsetParent;
    while(vcontrol != null)
    {
        x = math_add(x, vcontrol.offsetLeft);
        vcontrol = vcontrol.offsetParent;
    }

    return x;
}

function element_get_y(vname)
{
    var vcontrol = document.getElementById(vname);
    var y = vcontrol.offsetTop;

    vcontrol = vcontrol.offsetParent;
    while(vcontrol != null)
    {
        y = math_add(y, vcontrol.offsetTop);
        vcontrol = vcontrol.offsetParent;
    }
    
    return y;
}

function element_is_mouse_over(vname)
{
    return element_is_contains_xy(vname, mouse_x, mouse_y);
}

function element_is_contains_xy(vname, mx, my)
{
    var ex = element_get_x(vname);
    var ey = element_get_y(vname);
    var ew = element_get_width(vname);
    var eh = element_get_height(vname);

    return (mx >= ex) && (mx <= math_add(ex, ew)) && (my >= ey) && (my <= math_add(ey, eh));
}

function element_set_opacity(obj_name, opacity_value)
{
    if(document.getElementById(obj_name) != null)
    {
        if(navi == "FI3")
        {
            document.getElementById(obj_name).style.MozOpacity = opacity_value / 100;
        }
        else if(navi == "OP")
        {
            document.getElementById(obj_name).style.opacity = opacity_value / 100;
        }
        else if(navi == "IE6" || navi == "IE7" || navi == "IE8")
        {
            document.getElementById(obj_name).style.filter = 'alpha(opacity=' + opacity_value + ')';
        }
        else
        {
            document.getElementById(obj_name).style.opacity = opacity_value / 100;
        }
    }
}

function element_set_css_class_name(obj_name, class_name)
{
    if(document.getElementById(obj_name) != null)
    {
        document.getElementById(obj_name).className = class_name;
    }
}

function element_set_width(obj_name, width)
{
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.getElementById(obj_name).style.width = width;
    }
    else
    {
        document.getElementById(obj_name).style.width = width + "px";
    }
}

function element_set_height(obj_name, height)
{
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        document.getElementById(obj_name).style.height = height;
    }
    else
    {
        document.getElementById(obj_name).style.height = height + "px";
    }
}

function element_set_position(obj_name, v_value)
{
    document.getElementById(obj_name).style.position = v_value;
}

function element_set_x(obj_name, x)
{
    if(navi == "IE6" || navi == "IE7")
    {
        document.getElementById(obj_name).style.left = (x - util_get_parent_x(obj_name)) + "px";
    }
    else
    {
        document.getElementById(obj_name).style.left = x + "px";
    }
}

function element_set_y(obj_name, y)
{
    if(navi == "IE6" || navi == "IE7")
    {
        document.getElementById(obj_name).style.top = (y - util_get_parent_y(obj_name)) + "px";
    }
    else
    {
        document.getElementById(obj_name).style.top = y + "px";
    }
}

function element_set_background(obj_name, src_picture)
{
    document.getElementById(obj_name).style.backgroundImage = "url(" + src_picture + ")";
}

function bordered_menu_set_css(vborderedmenu)
{
    bordered_menu_set_css1(0, vborderedmenu);
}

function bordered_menu_set_css1(start_index, vborderedmenu)
{
    var st = vborderedmenu.split("|");
    for(i = start_index; i < st.length; i += 2)
    {
        element_set_css_class_name(st[i], st[ math_add(i, 1)]);
    }
}

function element_hide(vname)
{
    document.getElementById(vname).style.display = 'none';
}

function element_show(vname)
{
    document.getElementById(vname).style.display = 'block';
}

function element_set_image(vname, vsrc)
{
    var control = document.getElementById(vname);
    if(navi == "IE6" || navi == "IE7")
    {
        var width =  element_get_width(vname);
        var height =  element_get_height(vname);

        control.setAttribute('src', 'templ_img/blank.gif');
        control.style.background = "none";

        element_set_width(vname, width);
        element_set_height(vname, height);
    }
    else
    {
        control.setAttribute('src', vsrc);
    }
}

function system_redirect(var_url)
{
    system_redirect_new_window(var_url, "");
}

function system_redirect_new_window(var_url, var_window)
{
    if(var_window == "NEW")
    {
        window.open(var_url, '_blank');
    }
    else
    {
        window.location = var_url;
    }
}

function navigator_get_version()
{
    if(navigator.appName.toUpperCase().indexOf("MICROSOFT") > -1)
    {
        if(navigator.appVersion.indexOf("MSIE 6.0") > -1)
        {
            return "IE6";
        }
        else if(navigator.appVersion.indexOf("MSIE 7.0") > -1)
        {
            return "IE7";
        }
        else if(navigator.appVersion.indexOf("MSIE 8.0") > -1)
        {
            return "IE8";
        }
    }
    if(navigator.appName.toUpperCase().indexOf("OPERA") > -1)
    {
        return "OP";
    }
    if(navigator.appVersion.toUpperCase().indexOf("SAFARI") > -1)
    {
        return "SA";
    }
    if(navigator.appVersion.toUpperCase().indexOf("CHROME") > -1)
    {
        return "CH";
    }
    return "FI3"
}

function mouse_get_x()
{
    return window.event.clientX;
}

function mouse_get_y()
{
    return window.event.clientY;
}

function math_add(number1, number2)
{
    return (parseInt(number1) + parseInt(number2));
}

function util_get_parent_x(obj_name)
{
    var parent = document.getElementById(obj_name).offsetParent;
    var mx = 0;
    while(parent != null)
    {
        mx = math_add(mx, parent.offsetLeft);
        parent = parent.offsetParent;
    }
    return mx;
}

function util_get_parent_y(obj_name)
{
    var parent = document.getElementById(obj_name).offsetParent;
    var my = 0;
    while(parent != null)
    {
        my = math_add(my, parent.offsetTop);
        parent = parent.offsetParent;
    }
    return my;
}

function set_mouse_position(e)
{
    if(navi == "IE6" || navi == "IE7" || navi == "IE8")
    {
        if(typeof(window.pageYOffset) == 'number')
        {
            window_scroll_x = window.pageXOffset;
            window_scroll_y = window.pageXOffset;
        }
        else if(document.body && ( document.body.scrollLeft || document.body.scrollTop ))
        {
            window_scroll_x = document.body.scrollLeft;
            window_scroll_y = document.body.scrollTop;
        }
                else if(document.body && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ))
        {
            window_scroll_x = document.documentElement.scrollLeft;
            window_scroll_y = document.documentElement.scrollTop;
        }
        mouse_x = math_add(window.event.clientX, window_scroll_x);
        mouse_y = math_add(window.event.clientY, window_scroll_y);
    }
    else
    {
        window_scroll_x = window.scrollX;
        window_scroll_y = window.scrollY;
        mouse_x = math_add(e.clientX, window_scroll_x);
        mouse_y = math_add(e.clientY, window_scroll_y);
    }
}

function string_fill_0(str, digits)
{
    var temp = "";
    if(parseInt(str.length) > parseInt(digits))
    {
        temp = str.substring(0, digits);
    }
    else
    {
        for(i = 0; i < parseInt(digits) - parseInt(str.length); i++)
        {
            temp += "0";
        }
        temp += str;
    }

    return temp;
}

function set_window_scrolling(ids)
{
    scrolling_element_ids = ids;
}

function on_window_scrcrolling()
{
    var image_control = document.getElementById(image_show_window_form_name);
    if(image_control != null)
    {
        //element_set_y(image_show_window_form_name, window_get_y());
    }

    if(scrolling_element_ids.length > 0)
    {
        var seids = scrolling_element_ids.split(';');
        for(i = 0; i < seids.length; i++)
        {
            document.getElementById(seids[i]).style.position="relative";
            if(seids[i].length > 0)
            {
                element_set_y(seids[i], window_get_y());
            }
        }
    }

    set_page_settings(window_get_x(), window_get_y());
}

function set_page_settings(scrollbarx, scrollbary)
{
    page_settings_scrollbarx = scrollbarx;
    page_settings_scrollbary = scrollbary;
    document.getElementById("page_settings").value = page_settings_scrollbarx + "|" + page_settings_scrollbary;
}

function get_page_settings()
{
    var vals = document.getElementById("page_settings").value.split('|');
    page_settings_scrollbarx = parseInt(vals[0]);
    page_settings_scrollbary = parseInt(vals[1]);

    if (page_settings_scrollbarx > 0)
    {
        window_set_x(page_settings_scrollbarx);
    }
    if (page_settings_scrollbary > 0)
    {
        window_set_y(page_settings_scrollbary);
    }
}

function set_cookie(name, val)
{
    var vals = document.cookie.toString().split(';');

    var temp = "";
    var new_cookie = true;
    for(i = 0; i < vals.length; i++)
    {
        var row = vals[i].split('=');
        if (row[0] == name)
        {
            row[1] = val;
            new_cookie = false;
        }
        temp += row[0] + "=" + row[1] + ";";
    }

    if(new_cookie)
    {
        temp += name + "=" + val + ";";
    }

    document.cookie = temp;
}

function get_cookie(name)
{
    var vals = document.cookie.split(';');

    for(i = 0; i < vals.length; i++)
    {
        var row = vals[i].split('=');
        if (row[0] == name)
        {
            return row[1];
        }
    }

    return "";
}

function set_base_data()
{
    navi = navigator_get_version();
    get_page_settings();

    if(navi == "IE6" || navi == "IE7")
    {
        document.onmousemove = set_mouse_position;
        window.onscroll = on_window_scrcrolling;
    }
    else
    {
        document.onmousemove = set_mouse_position;
        window.onscroll = on_window_scrcrolling;
    }
}


