 function refresh_comments(a, b, c, d, e) {
    var f = mint.Request();
    f.OnSuccess = function () {
        document.getElementById('comments_view').innerHTML = this.responseText
    };
    f.AddParam("type", '1');
    f.AddParam("ctype", a);
    f.AddParam("cdb", b);
    f.AddParam("ccol", c);
    f.AddParam("cid", d);
    f.AddParam("row", e);
    f.method = "POST";
    f.Send(BASE + "includes/comments_ajax.php")
};

function delete_comment(a, b, c, d, e) {
    var f = mint.Request();
    f.OnSuccess = function () {
        document.getElementById('comments_view').innerHTML = this.responseText
    };
    f.AddParam("type", '2');
    f.AddParam("ctype", a);
    f.AddParam("cdb", b);
    f.AddParam("ccol", c);
    f.AddParam("cid", d);
    f.AddParam("comment_id", e);
    f.method = "POST";
    f.Send(BASE + "includes/comments_ajax.php")
};

function edit_comment(a, b, c, d, e) {
    var f = mint.Request();
    f.OnSuccess = function () {
        document.getElementById('comments_edits').innerHTML = this.responseText;
        document.getElementById('comments_edits').style.display = "block"
    };
    f.AddParam("type", '5');
    f.AddParam("ctype", a);
    f.AddParam("cdb", b);
    f.AddParam("ccol", c);
    f.AddParam("cid", d);
    f.AddParam("comment_id", e);
    f.method = "POST";
    f.Send(BASE + "includes/comments_ajax.php")
};

function add_comment(a, b, c, d) {
    var e = mint.Request();
    e.OnSuccess = function () {
        if (document.inputform.comment_name) {
            document.inputform.comment_name.value = ""
        }
        document.inputform.comment_message.value = "";
        document.getElementById('comments_view').innerHTML = this.responseText
    };
    if (!document.inputform.comment_name) {
        var f = ""
    } else {
        var f = document.inputform.comment_name.value
    }
    var g = document.inputform.comment_message.value;
    e.AddParam("type", '3');
    e.AddParam("ctype", a);
    e.AddParam("cdb", b);
    e.AddParam("ccol", c);
    e.AddParam("cid", d);
    e.AddParam("comment_name", f);
    e.AddParam("comment_message", g);
    e.method = "POST";
    e.Send(BASE + "includes/comments_ajax.php")
};

function update_comment(a, b, c, d) {
    document.getElementById('comments_edits').style.display = "none";
    var e = mint.Request();
    e.OnSuccess = function () {
        document.getElementById('comments_view').innerHTML = this.responseText
    };
    var f = document.ed_com.comment_message.value;
    var g = document.ed_com.comment_id.value;
    e.AddParam("type", '4');
    e.AddParam("ctype", a);
    e.AddParam("cdb", b);
    e.AddParam("ccol", c);
    e.AddParam("cid", d);
    e.AddParam("comment_id", g);
    e.AddParam("comment_message", f);
    e.method = "POST";
    e.Send(BASE + "includes/comments_ajax.php")
};

function get_incat_gallery2(a, b, c) {
    var d = mint.Request();
    d.OnSuccess = function () {
        document.getElementById('gallery-incat-div').innerHTML = this.responseText
    };
    d.AddParam("cat", a);
    d.AddParam("incat", b);
    d.AddParam("error", c);
    d.method = "POST";
    d.Send(BASE + "infusions/pro_gallery/add_ajax.php")
};

function gallery_full_view(a) {
    var b = mint.Request();
    b.OnSuccess = function () {
        document.getElementById('picture_full_view').innerHTML = this.responseText
    };
    b.AddParam("id", a);
    b.method = "POST";
    b.Send(BASE + "infusions/pro_gallery/gallery_ajax.php")
};

function refresh_threads() {
    var a = mint.Request();
    a.OnSuccess = function () {
        document.getElementById('C-newposts-list').innerHTML = this.responseText
    };
    a.method = "POST";
    a.Send(BASE + "themes/Grafa_X1/site/content/glowna/nowe_posty_data.php")
};

function infractions_show(a, b, c) {
    document.getElementById('c-infractions' + c + '-div').style.display = 'block';
    var d = mint.Request();
    d.OnSuccess = function () {
        document.getElementById('c-infractions' + c + '-div').innerHTML = this.responseText
    };
    d.AddParam("option", a);
    d.AddParam("id", b);
    d.AddParam("type", c);
    d.method = "POST";
    d.Send(BASE + "infusions/infraction/add.php")
};

function infractions_send(a, b, c) {
    var d = mint.Request();
    d.OnSuccess = function () {
        document.getElementById('c-infractions' + c + '-div').innerHTML = this.responseText
    };
    if (c == '1') {
        var e = document.infraction_vv1.infraction_add_message.value
    } else if (c == '2') {
        var e = document.infraction_vv2.infraction_add_message.value
    } else if (c == '3') {
        var e = document.infraction_vv3.infraction_add_message.value
    } else if (c == '4') {
        var e = document.infraction_vv4.infraction_add_message.value
    }
    d.AddParam("option", a);
    d.AddParam("id", b);
    d.AddParam("type", c);
    d.AddParam("message", e);
    d.method = "POST";
    d.Send(BASE + "infusions/infraction/add.php")
};

function adel_ph(a, b) {
    document.getElementById('c-gallery-del-ad-div').style.display = 'block';
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('c-gallery-del-ad-div').innerHTML = this.responseText
    };
    c.AddParam("option", a);
    c.AddParam("id", b);
    c.method = "POST";
    c.Send(BASE + "infusions/pro_gallery/del_admin.php")
};

function adel_ph2(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('c-gallery-del-ad-div').innerHTML = this.responseText
    };
    var d = document.g_adm_del.g_adm_del_message.value;
    c.AddParam("option", a);
    c.AddParam("id", b);
    c.AddParam("message", d);
    c.method = "POST";
    c.Send(BASE + "infusions/pro_gallery/del_admin.php")
};

function check_this(b, c, d) {
    frm = document.forms[b];
    for (a = 0; a < frm.elements.length; a++) {
        if (frm.elements[a].name == c) {
            frm.elements[a].checked = d
        }
    }
};

function rating_ajax(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('c-gallery-rating-ajax').innerHTML = this.responseText
    };
    c.AddParam("vote", a);
    c.AddParam("item", b);
    c.method = "POST";
    c.Send(BASE + "infusions/pro_gallery/rating_ajax.php")
};

function open_sb() {
    newwindow = window.open('http://grafa.biz/infusions/shoutbox_panel/shoutbox.php', '_0', 'width=585,height=540,status=no,toolbar=no,menubar=no,location=no,scrollbars=no')
};

function observe_user(a, b, c) {
    var d = mint.Request();
    d.OnSuccess = function () {
        document.getElementById('lobserv-view-list').innerHTML = this.responseText
    };
    d.method = "POST";
    d.AddParam("page", a);
    d.AddParam("item", b);
    d.AddParam("option", c);
    d.Send(BASE + "infusions/observe/view.php")
};

function catalogs_add_us(a) {
    document.getElementById('c-catalogs-add-user').style.display = 'block';
    var b = mint.Request();
    b.OnSuccess = function () {
        document.getElementById('c-catalogs-add-user').innerHTML = this.responseText
    };
    b.AddParam("user", a);
    b.method = "POST";
    b.Send(BASE + "infusions/catalogs/add_catalog.php")
};

function catalogs_show(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById("catalog_id_" + a).innerHTML = this.responseText
    };
    c.method = "POST";
    c.AddParam("catalog", a);
    c.AddParam("user", b);
    c.Send(BASE + "infusions/catalogs/view_catalogs.php")
};

function catalogs_add_img(a, b, c) {
    var d = mint.Request();
    d.OnSuccess = function () {
        catalogs_show(a, c)
    };
    d.method = "POST";
    d.AddParam("catalog", a);
    d.AddParam("picture", b);
    d.AddParam("user", c);
    d.Send(BASE + "infusions/catalogs/add_image.php")
};

function edit_picture(a, b) {
    document.getElementById('c-edit_pic-div').style.display = 'block';
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('c-edit_pic-div').innerHTML = this.responseText
        $('form[name="f_edit_pic"] input[name="edit_pic_file"]').click(function(){
    		$('form[name="f_edit_pic"]').attr('action', '/infusions/pro_gallery/edit.php');
    		$('form[name="f_edit_pic"] input[name="edit_pic_save"]').hide();
    		$('form[name="f_edit_pic"] input[name="edit_pic_save_p"]').show();
    	});
    };
    c.AddParam("tt", a);
    c.AddParam("id", b);
    c.method = "POST";
    c.Send(BASE + "infusions/pro_gallery/edit_ajax.php")
};

function save_picture(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('c-edit_pic-div').innerHTML = this.responseText
    };
    var d = document.f_edit_pic.edit_pic_desc.value;
    var e = document.f_edit_pic.edit_pic_name.value;
    var f = document.f_edit_pic.edit_pic_cat.value;
    var g = document.f_edit_pic.pic_incat.value;
    c.AddParam("id", b);
    c.AddParam("tt", a);
    c.AddParam("message", d);
    c.AddParam("name", e);
    c.AddParam("cat", f);
    c.AddParam("incat", g);
    c.method = "POST";
    c.Send(BASE + "infusions/pro_gallery/edit_ajax.php")
};

function rating_download(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('download-main-file-rating' + b).innerHTML = this.responseText
    };
    c.method = "POST";
    c.AddParam("vote", a);
    c.AddParam("item", b);
    c.Send(BASE + "infusions/download/rating_download.php")
};

function movie_rating(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('c-vtuts-show-b-rating').innerHTML = this.responseText
    };
    c.method = "POST";
    c.AddParam("vote", a);
    c.AddParam("item", b);
    c.Send(BASE + "infusions/movie/rating.php")
};

function video_rating(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('u-video-show-b-rating').innerHTML = this.responseText
    };
    c.method = "POST";
    c.AddParam("vote", a);
    c.AddParam("item", b);
    c.Send(BASE + "infusions/movie_user/rating.php")
};

function get_vvtuts_video(a) {
    var b = mint.Request();
    b.OnSuccess = function () {
        jQuery('.SP-videotut-more-c').html(this.responseText)
    };
    b.method = "POST";
    b.AddParam("cat_id", a);
    b.Send(BASE + "themes/Grafa_X1/site/content/videotutorials/pozostale_data.php")
};

function informations_options(a, b) {
    var c = mint.Request();
    c.OnSuccess = function () {
        document.getElementById('p-informations-vw').innerHTML = this.responseText
    };
    c.method = "POST";
    c.AddParam("type", a);
    c.AddParam("id", b);
    c.Send(BASE + "infusions/informations/options.php")
};

function user_status_desc() {
    var c = mint.Request();
    var message = jQuery('input[name=my_status_txt]').val();
    c.method = "POST";
    c.AddParam("action", 1);
    c.AddParam("message", message);
    c.Send(BASE + "includes/user_status.php")
};

function user_status_wnw() {
    if (!jQuery('.B-panel_usera .desc-pop').css('display') || jQuery('.B-panel_usera .desc-pop').css('display') == 'none') {
        jQuery('.B-panel_usera .desc-pop').css('display', 'block')
    } else {
        jQuery('.B-panel_usera .desc-pop').css('display', 'none')
    }
};

function user_status_status(status) {
    var c = mint.Request();
    c.OnSuccess = function () {
        jQuery('.B-panel_usera .desc-pop-c a').attr('className', 'desc_status_0');
        jQuery('.B-panel_usera .desc-pop-c a:eq(' + (status == 0 ? 1 : (status == 1 ? 0 : status)) + ')').attr('className', 'desc_status_1');
        jQuery('.B-panel_usera .desc-pop').css('display', 'none');
        if (status == '0') {
            jQuery('img#my_status_img').attr('src', BASE + 'themes/Grafa_X1/images/icons/x1_icon83.png')
        } else if (status == '1') {
            jQuery('img#my_status_img').attr('src', BASE + 'themes/Grafa_X1/images/icons/x1_icon82.png')
        } else if (status == '2') {
            jQuery('img#my_status_img').attr('src', BASE + 'themes/Grafa_X1/images/icons/x1_icon85.png')
        } else if (status == '3') {
            jQuery('img#my_status_img').attr('src', BASE + 'themes/Grafa_X1/images/icons/x1_icon86.png')
        }
    };
    c.method = "POST";
    c.AddParam("action", 2);
    c.AddParam("status", status);
    c.Send(BASE + "includes/user_status.php")
};

function tabs_categories(a) {
    var img_cat_link = BASE + 'themes/Grafa_X1/images/';
    jQuery('ul.C-cats-menu li').css('background-image', '');
    jQuery('ul.C-cats-menu li a').css('background-image', '');
    jQuery('ul.C-cats-menu li h3').css('background-image', '');
    jQuery('.C-cats-links-tab').css('display', 'none');
    jQuery('ul.C-cats-menu li#C-cats-menu_' + a).css('background-image', 'url("' + img_cat_link + 'gx2_37.png")');
    jQuery('ul.C-cats-menu li#C-cats-menu_' + a + ' a').css('background-image', 'url("' + img_cat_link + 'gx2_38.png")');
    jQuery('ul.C-cats-menu li#C-cats-menu_' + a + ' h3').css('background-image', 'url("' + img_cat_link + 'gx2_39.png")');
    jQuery('.C-cats-links-tab#C-cats-tab_' + a).css('display', 'block')
};

function tabs_infop(a) {
    var img_cat_link = BASE + 'themes/Grafa_X1/images/';
    jQuery('.C-infop-menu ul li, .C-infop-menu ul li a, .C-infop-menu ul li h3').css('background-image', '');
    jQuery('.C-infop-c-tab').css('display', 'none');
    jQuery('.C-infop-menu ul li#C-infop-menu_' + a).css('background-image', 'url("' + img_cat_link + 'gx2_70.png")');
    jQuery('.C-infop-menu ul li#C-infop-menu_' + a).addClass('select');
    jQuery('.C-infop-menu ul li#C-infop-menu_' + a + ' a').css('background-image', 'url("' + img_cat_link + 'gx2_71.gif")');
    jQuery('.C-infop-menu ul li#C-infop-menu_' + a + ' h3').css('background-image', 'url("' + img_cat_link + 'gx2_72.png")');
    jQuery('.C-infop-c #C-infop-tab_' + a).css('display', 'block');
    jQuery('.C-infop-menu span a.rss, .C-infop-menu span a.posts, .C-infop-menu a.a_arrow_up, .C-infop-menu a.a_arrow_down').css('display', 'none');
    if (a == '0') {
        jQuery('.C-infop-menu a.posts').css('display', 'block')
    } else if (a == '1') {
        jQuery('.C-infop-menu a.rss').css('display', 'block')
    } else if (a == '3') {
        jQuery('.C-infop-menu a.a_arrow_up, .C-infop-menu a.a_arrow_down').css('display', 'block');
        jQuery('.C-files-c-tab').scrollTo(0);
        window.d_panel_va = '0'
    }
};

function tabs_movies(a) {
    jQuery('.C-movies-c-tab').css('display', 'none');
    jQuery('.C-movies-c #C-movies-tab_' + a).css('display', 'block');
    if (a == '0') {
        window.v_panel_va1 = '0';
        window.v_panel_c = '0'
    } else {
        window.v_panel_va2 = '0';
        window.v_panel_c = '1'
    }
    jQuery('.C-movies-c #C-movies-tab_' + a).scrollTo(0)
};

function start_user_panel() {
    if (jQuery(window).width() < '1200') {
        jQuery('.B-panel_usera .options').css({
            marginLeft: '-300px'
        })
    }
    var p_cookie = jQuery.cookie('user_panel_roll');
    if (p_cookie == 'on_min') {
        jQuery('.B-panel_usera .B-panel_usera-t .name').hide();
        jQuery('.B-panel_usera .B-panel_usera-t a').text('POKAZ PANEL').attr('title', 'POKAZ PANEL');
        jQuery('.B-panel_usera').css({
            display: 'block',
            height: '0px'
        }).animate({
            height: '38px'
        }, 'normal')
    } else if (p_cookie == 'on_max') {
        jQuery('.B-panel_usera').slideToggle('normal')
    } else {
        return false
    }
};

function set_partners_dott(id) {
    jQuery('.B-partners-nav ul li').attr('class', '');
    jQuery('.B-partners-nav ul li:eq(' + (id - 1) + ')').attr('class', 'active')
};

function ready_download(item) {
    var item = item.split(',');
    for (var a = '0'; a < item.length; a++) {
        rating_download('', item[a])
    }
};

function get_themes_mainpage(id) {
    jQuery.post(BASE + "themes/Grafa_X1/site/content/glowna/szablony_data.php", {
        page: id
    }, function (data, status) {
        if (status == "success" && data != "") {
            jQuery('.C-themes-c1').animate({
                opacity: 0
            }, "normal", function () {
                jQuery(this).html(data);
                jQuery('a[rel=lightbox]').lightBox();
                jQuery(this).animate({
                    opacity: 1
                }, "normal")
            });
            if (id == 0) {
                jQuery('#C-themes-up').attr('class', 'a_arrow_up_b')
            } else {
                if (jQuery('#C-themes-up').attr('class') == "a_arrow_up_b") {
                    jQuery('#C-themes-up').attr('class', 'a_arrow_up')
                }
            }
            if (jQuery('#C-themes-down').attr('class') == "a_arrow_down_b") {
                jQuery('#C-themes-down').attr('class', 'a_arrow_down')
            }
            C_themes_page = id
        } else {
            jQuery('#C-themes-down').attr('class', 'a_arrow_down_b')
        }
    }, "html")
};

function get_news_mainpage(id) {
    jQuery.post(BASE + "themes/Grafa_X1/site/content/glowna/aktualnosci_data.php", {
        snews: id
    }, function (data, status) {
        if (status == "success" && data != "") {
            jQuery('.C-actual-news').animate({
                opacity: 0
            }, "normal", function () {
                jQuery(this).html(data);
                jQuery(this).animate({
                    opacity: 1
                }, "normal")
            });
            if (id == 0) {
                jQuery('.C-actual-nav a:eq(0)').attr('class', 'unact')
            } else {
                if (jQuery('.C-actual-nav a:eq(0)').attr('class') == "unact") {
                    jQuery('.C-actual-nav a:eq(0)').attr('class', 'act')
                }
            }
            if (jQuery('.C-actual-nav a:eq(1)').attr('class') == "unact") {
                jQuery('.C-actual-nav a:eq(1)').attr('class', 'act')
            }
            C_news_page = id
        } else {
            jQuery('.C-actual-nav a:eq(1)').attr('class', 'unact')
        }
    }, "html")
};

function get_gallery_mainpage(id) {
    jQuery.post(BASE + "themes/Grafa_X1/site/top/galeria/galeria_data.php", {
        page: id
    }, function (data, status) {
        if (status == "success" && data != "") {
            RevertAll();
            jQuery('.T-gallery-imgs ul').animate({
                opacity: 0
            }, "normal", function () {
                jQuery(this).html(data);
                set_img_zoom();
                jQuery(this).animate({
                    opacity: 1
                }, "normal")
            });
            if (id == 0) {
                jQuery('#T-gallery-up').attr('class', 'a_arrow_up_b')
            } else {
                if (jQuery('#T-gallery-up').attr('class') == "a_arrow_up_b") {
                    jQuery('#T-gallery-up').attr('class', 'a_arrow_up')
                }
            }
            if (jQuery('#T-gallery-down').attr('class') == "a_arrow_down_b") {
                jQuery('#T-gallery-down').attr('class', 'a_arrow_down')
            }
            C_gallery_page = id
        } else {
            jQuery('#T-gallery-down').attr('class', 'a_arrow_down_b')
        }
    }, "html")
};

function lst_templates_panel(a) {
    var b = mint.Request();
    b.OnSuccess = function () {
        if (this.responseText != "") {
            jQuery('.SP-lasttempl-c').append(this.responseText);
            window.t_panel_va1++;
            if (window.t_panel_v1 < window.t_panel_va1) {
                window.t_panel_v1 = window.t_panel_va1
            }
            jQuery('.SP-lasttempl-c').stop().scrollTo({
                top: (parseInt(a + 1) * 445) + 'px',
                left: '0px'
            }, 700)
        }
        jQuery('a[rel=lightbox]').lightBox()
    };
    b.AddParam("page", parseInt(a + 1));
    b.method = "POST";
    b.Send(BASE + "themes/Grafa_X1/site/content/templates/najnowsze_szablony_data.php")
};

function lst_recenzje_panel(a) {
    var b = mint.Request();
    b.OnSuccess = function () {
        if (this.responseText != "") {
            jQuery('#SP-morerecs-c').append(this.responseText);
            window.r_panel_va1++;
            if (window.r_panel_v1 < window.r_panel_va1) {
                window.r_panel_v1 = window.r_panel_va1
            }
            jQuery('#SP-morerecs-c').stop().scrollTo({
                top: '0',
                left: (parseInt(a + 1) * 495) + 'px'
            }, 700)
        }
    };
    b.AddParam("page", parseInt(a + 1));
    b.method = "POST";
    b.Send(BASE + "themes/Grafa_X1/site/content/recenzje/inne_recenzje_data.php")
};

function lst_download_panel(a) {
    var d = mint.Request();
    d.OnSuccess = function () {
        if (this.responseText != "") {
            jQuery('.C-files-c-tab ul').append(this.responseText);
            window.d_panel_va++;
            if (window.d_panel_v < window.d_panel_va) {
                window.d_panel_v = window.d_panel_va
            }
            jQuery('.C-files-c-tab').stop().scrollTo({
                top: (parseInt(a + 1) * 264) + 'px',
                left: '0'
            }, 700)
        }
        jQuery('a[rel=lightbox]').lightBox()
    };
    d.AddParam("page", parseInt(a + 1));
    d.method = "POST";
    d.Send(BASE + "themes/Grafa_X1/site/content/glowna/pliki_data.php")
};

function lst_video_panel(a, b) {
    var d = mint.Request();
    d.OnSuccess = function () {
        if (this.responseText != "") {
            jQuery('#C-movies-tab_' + a).append(this.responseText);
            if (a == '0') {
                window.v_panel_va1++;
                if (window.v_panel_v1 < window.v_panel_va1) {
                    window.v_panel_v1 = window.v_panel_va1
                }
            } else {
                window.v_panel_va2++;
                if (window.v_panel_v2 < window.v_panel_va2) {
                    window.v_panel_v2 = window.v_panel_va2
                }
            }
            jQuery('#C-movies-tab_' + a).stop().scrollTo({
                top: '0',
                left: (parseInt(b + 1) * 495) + 'px'
            }, 700)
        }
    };
    d.AddParam("page", parseInt(b + 1));
    d.AddParam("id", a);
    d.method = "POST";
    d.Send(BASE + "themes/Grafa_X1/site/content/glowna/filmy_data.php")
};
jQuery(document).ready(function () {
    if (typeof(active_sortable) != "undefined") {
        jQuery("#right-panel").sortable({
            axis: 'y',
            cursor: 'move',
            handle: 'h2',
            forcePlaceholderSize: true,
            opacity: 0.5,
            items: '.main_move_panel',
            placeholder: 'main_move_panel_pholder',
            revert: true,
            scrollSensitivity: 100,
            scrollSpeed: 30,
            tolerance: 'pointer',
            update: function () {
                var move_order = jQuery(this).sortable("toArray");
                var new_move_order = "";
                for (a = '0'; a < move_order.length; a++) {
                    new_move_order += move_order[a].replace('main_move_panel_', '');
                    new_move_order += "."
                }
                if (new_move_order != "") {
                    jQuery.cookie('user_move_panels', new_move_order.substring(0, (move_order.length * 2) - 1), {
                        path: '/',
                        domain: '',
                        expires: 999
                    })
                }
            }
        })
    }
    jQuery('.T-umenu-c-links').scrollTo(0);
    var T_menu_act = 1;
    var T_menu_height = Number(jQuery('.T-umenu-c-links').css('height').replace('px', ''));
    var T_menu_sum = jQuery('.T-umenu-c-links ul li').length / 4;
    if (T_menu_sum > 1) {
        jQuery('.T-umenu-c-nav').css('display', 'block');
        jQuery('#T-umenu-up').click(function () {
            if (T_menu_act > 1) {
                jQuery('.T-umenu-c-links').stop().scrollTo({
                    top: (T_menu_act - 2) * T_menu_height + 'px',
                    left: '0px'
                }, 400);
                --T_menu_act;
                if (T_menu_act > 1) {
                    jQuery('#T-umenu-up').attr('class', 'a_arrow_up')
                } else {
                    jQuery('#T-umenu-up').attr('class', 'a_arrow_up_b')
                }
                if (T_menu_act < T_menu_sum) {
                    jQuery('#T-umenu-down').attr('class', 'a_arrow_down')
                } else {
                    jQuery('#T-umenu-down').attr('class', 'a_arrow_down_b')
                }
            }
        });
        jQuery('#T-umenu-down').click(function () {
            if (T_menu_act < T_menu_sum) {
                jQuery('.T-umenu-c-links').stop().scrollTo({
                    top: T_menu_act * T_menu_height + 'px',
                    left: '0px'
                }, 400);
                ++T_menu_act;
                if (T_menu_act > 1) {
                    jQuery('#T-umenu-up').attr('class', 'a_arrow_up')
                } else {
                    jQuery('#T-umenu-up').attr('class', 'a_arrow_up_b')
                }
                if (T_menu_act < T_menu_sum) {
                    jQuery('#T-umenu-down').attr('class', 'a_arrow_down')
                } else {
                    jQuery('#T-umenu-down').attr('class', 'a_arrow_down_b')
                }
            }
        })
    }
    jQuery('.T-mainmenu-sb a').css('visibility', 'visible');
    var T_gall_act = 0;
    jQuery('.T-gallery-nav').css('display', 'block');
    jQuery('.T-mainmenu-sb a').click(function () {
        open_sb()
    });
    var form_names = new Array('input[name=stext]', 'input[name=user_name]', 'input[name=user_pass]');
    var form_values = new Array();
    var form_names_str = '';
    for (var a = 0; a < form_names.length; a++) {
        form_names_str += form_names[a] + ',';
        form_values[jQuery(form_names[a]).attr('name')] = jQuery(form_names[a]).val()
    }
    jQuery(form_names_str).focus(function () {
        if (jQuery(this).val() == form_values[jQuery(this).attr('name')]) {
            jQuery(this).val('')
        }
    });
    jQuery(form_names_str).blur(function () {
        if (jQuery(this).val() == '') {
            jQuery(this).val(form_values[jQuery(this).attr('name')])
        }
    });
    jQuery('.C-infop-menu span a.posts').css('display', 'block');
    jQuery('.C-infop-menu span a.posts').click(function () {
        refresh_threads()
    });
    jQuery('.C-themes-nav a').css('visibility', 'visible');
    jQuery('.C-movies-t ul, .C-movies-nav').css('visibility', 'visible');
    var B_partn_act = 1;
    var B_partn_sum = jQuery('.B-partners-img').length;
    if (B_partn_sum > 1) {
        for (var a = 1; a < B_partn_sum; a++) {
            jQuery('.B-partners-nav ul').append(document.createElement('li'))
        }
        jQuery('.B-partners-nav').css('visibility', 'visible');
        jQuery('#B-partners-left').click(function () {
            if (B_partn_act > 1) {
                jQuery('.B-partners-img:eq(' + (B_partn_act - 1) + ')').animate({
                    left: '1050px'
                }, 600);
                --B_partn_act;
                jQuery('.B-partners-img:eq(' + (B_partn_act - 1) + ')').animate({
                    left: '0px'
                }, 600);
                if (B_partn_act > 1) {
                    jQuery('#B-partners-left').attr('class', 'a_arrow_left')
                } else {
                    jQuery('#B-partners-left').attr('class', 'a_arrow_left_b')
                }
                if (B_partn_act < B_partn_sum) {
                    jQuery('#B-partners-right').attr('class', 'a_arrow_right')
                } else {
                    jQuery('#B-partners-right').attr('class', 'a_arrow_right_b')
                }
                set_partners_dott(B_partn_act)
            }
        });
        jQuery('#B-partners-right').click(function () {
            if (B_partn_act < B_partn_sum) {
                jQuery('.B-partners-img:eq(' + (B_partn_act - 1) + ')').animate({
                    left: '-1050px'
                }, 600);
                ++B_partn_act;
                jQuery('.B-partners-img:eq(' + (B_partn_act - 1) + ')').animate({
                    left: '0px'
                }, 600);
                if (B_partn_act > 1) {
                    jQuery('#B-partners-left').attr('class', 'a_arrow_left')
                } else {
                    jQuery('#B-partners-left').attr('class', 'a_arrow_left_b')
                }
                if (B_partn_act < B_partn_sum) {
                    jQuery('#B-partners-right').attr('class', 'a_arrow_right')
                } else {
                    jQuery('#B-partners-right').attr('class', 'a_arrow_right_b')
                }
                set_partners_dott(B_partn_act)
            }
        })
    }
    jQuery('.B-info-up').click(function () {
        scroll(0, 0)
    });
    set_img_zoom();
    if (navigator.appName != 'Microsoft Internet Explorer') {
        jQuery('div.C-thread-user').corner('6px');
        jQuery('td.C-thread-vpost-l').corner('tl 6px');
        jQuery('td.C-thread-vpost-r').corner('tr 6px');
        jQuery('.templates-file-li1 li, .templates-file-li2 li').corner('5px')
    }
    jQuery('.spec-panel-t a.roll_user_profile').css('display', 'block');
    jQuery('.spec-panel-t a.roll_user_profile').click(function () {
        var user_roll_id = jQuery(this).attr('id').replace('roll_user_profile_', '');
        if (jQuery.cookie('roll_profile_' + user_roll_id) == null) {
            jQuery.cookie('roll_profile_' + user_roll_id, '0', {
                path: '/',
                domain: '.grafa.biz',
                expires: 365
            });
            jQuery(this).attr('class', 'a_arrow_down roll_user_profile')
        } else {
            jQuery.cookie('roll_profile_' + user_roll_id, null, {
                path: '/',
                domain: '.grafa.biz',
                expires: 0
            });
            jQuery(this).attr('class', 'a_arrow_up roll_user_profile')
        }
        jQuery(this).parent().parent().parent().parent().find('div.spec-panel-c').slideToggle('normal')
    });
    jQuery('.spec-panel-t a.roll_user_profile').each(function () {
        var user_roll_id = jQuery(this).attr('id').replace('roll_user_profile_', '');
        if (jQuery.cookie('roll_profile_' + user_roll_id) == '0') {
            jQuery(this).parent().parent().parent().parent().find('div.spec-panel-c').slideToggle('1');
            jQuery(this).attr('class', 'a_arrow_down roll_user_profile')
        }
    });
    var img_cat_link = BASE + 'themes/Grafa_X1/images/';
    jQuery('.T-info-menu .T-info-menu-1 ul li').hover(function () {
        jQuery('.T-info-menu .T-info-menu-1 ul li').css({
            'width': '44px',
            'background-image': 'none'
        });
        jQuery('.T-info-menu .T-info-menu-1 ul li a').css({
            'width': '28px',
            'margin': '0px 8px'
        });
        jQuery(this).css({
            'width': '64px',
            'background-image': 'url("' + img_cat_link + 'gx2_123.gif")'
        });
        jQuery(this).find('a').css({
            'width': '64px',
            'margin': '0px'
        })
    }, function () {
        jQuery(this).css({
            'width': '44px',
            'background-image': 'none'
        });
        jQuery(this).find('a').css({
            'width': '28px',
            'margin': '0px 8px'
        });
        jQuery('.T-info-menu .T-info-menu-1 ul li.active').css({
            'width': '64px',
            'background-image': 'url("' + img_cat_link + 'gx2_123.gif")'
        });
        jQuery('.T-info-menu .T-info-menu-1 ul li.active a').css({
            'width': '64px',
            'margin': '0px'
        })
    });
    jQuery('.videotut-video .code a').click(function () {
        jQuery(this).parent().find('textarea').focus().select()
    });
    jQuery('.SP-videotut-more select').change(function () {
        get_vvtuts_video(this.value)
    });
    start_user_panel();
    jQuery('.B-panel_usera').hover(function () {
        jQuery(this).css('background-color', '#000')
    }, function () {
        jQuery(this).css('background-color', 'transparent')
    });
    jQuery('.T-umenu-c-links ul li a[title=ZALOGUJ SIE], .T-umenu-c-links ul li a[title=MOJE KONTO]').click(function () {
        var p_cookie = jQuery.cookie('user_panel_roll');
        var cookie_val = null;
        if (p_cookie == null) {
            jQuery('.B-panel_usera .B-panel_usera-t .name').show();
            jQuery('.B-panel_usera .B-panel_usera-t a').text('UKRYJ PANEL').attr('title', 'UKRYJ PANEL');
            jQuery('.B-panel_usera').css({
                display: 'block',
                height: '0px'
            }).animate({
                height: '212px'
            }, 'slow');
            cookie_val = 'on_max'
        } else {
            jQuery('.B-panel_usera').animate({
                height: '0px'
            }, 'slow')
        }
        jQuery.cookie('user_panel_roll', cookie_val, {
            path: '/',
            domain: '.grafa.biz',
            expires: 365
        })
    });
    jQuery('.B-panel_usera .B-panel_usera-t a').click(function () {
        var p_cookie = jQuery.cookie('user_panel_roll');
        var cookie_val = '';
        if (p_cookie == 'on_min') {
            jQuery('.B-panel_usera .B-panel_usera-t .name').show();
            jQuery('.B-panel_usera .B-panel_usera-t a').text('UKRYJ PANEL').attr('title', 'UKRYJ PANEL');
            jQuery('.B-panel_usera').animate({
                height: '212px'
            }, 'slow');
            cookie_val = 'on_max'
        } else if (p_cookie == 'on_max') {
            jQuery('.B-panel_usera .B-panel_usera-t .name').hide();
            jQuery('.B-panel_usera .B-panel_usera-t a').text('POKAZ PANEL').attr('title', 'POKAZ PANEL');
            jQuery('.B-panel_usera').animate({
                height: '38px'
            }, 'slow');
            cookie_val = 'on_min'
        }
        if (cookie_val != '') {
            jQuery.cookie('user_panel_roll', cookie_val, {
                path: '/',
                domain: '.grafa.biz',
                expires: 365
            })
        }
    });
    jQuery('input[name=my_status_btn]').click(function () {
        user_status_desc()
    });
    jQuery('.B-panel_usera .options .opis-l').click(function () {
        user_status_wnw()
    });
    jQuery('.B-panel_usera .options .desc-pop .desc-pop-c a').click(function () {
        user_status_status(jQuery(this).attr('rel'))
    });
    jQuery('a[rel=lightbox]').lightBox();
    jQuery('ul.C-cats-menu li').each(function (a) {
        jQuery(this).attr('id', 'C-cats-menu_' + a)
    });
    jQuery('.C-cats-links-tab').each(function (a) {
        jQuery(this).attr('id', 'C-cats-tab_' + a)
    });
    jQuery('ul.C-cats-menu li').click(function () {
        tabs_categories(jQuery(this).attr('id').replace('C-cats-menu_', ''))
    });
    jQuery('ul.C-cats-menu').css('display', 'block');
    tabs_categories('0');
    jQuery('.C-infop-menu ul li').each(function (a) {
        jQuery(this).attr('id', 'C-infop-menu_' + a)
    });
    jQuery('.C-infop-c-tab').each(function (a) {
        jQuery(this).attr('id', 'C-infop-tab_' + a)
    });
    jQuery('.C-infop-menu ul li').click(function () {
        tabs_infop(jQuery(this).attr('id').replace('C-infop-menu_', ''))
    });
    jQuery('.C-infop-menu ul li').css('display', 'block');
    tabs_infop('0');
    jQuery('.C-movies-t ul li').each(function (a) {
        jQuery(this).attr('id', 'C-movies-menu_' + a)
    });
    jQuery('.C-movies-c .C-movies-c-tab').each(function (a) {
        jQuery(this).attr('id', 'C-movies-tab_' + a)
    });
    jQuery('.C-movies-t ul li').click(function () {
        tabs_movies(jQuery(this).attr('id').replace('C-movies-menu_', ''))
    });
    tabs_movies('0');
    jQuery('a#SP-more-catalogs').click(function () {
        jQuery('.SP-panel3 .SP-catalogs-more').slideToggle('normal');
        return false
    });
    jQuery('#c_sett_check').click(function () {
        jQuery(".centrum_sett ul li input").attr('checked', 'true');
        return false
    });
    jQuery('#c_sett_uncheck').click(function () {
        jQuery(".centrum_sett ul li input").attr('checked', '');
        return false
    });
    jQuery('.centrum_no_premium_cennik a').click(function () {
        jQuery('.centrum_no_premium_cennik .c_buy_premium').hide('normal');
        var this_c_div = jQuery(this).attr('rel');
        if (jQuery('#' + this_c_div).css('display') == "none") {
            jQuery('#' + this_c_div).show('normal')
        }
        return false
    });
    jQuery('.cm-faq-c-list-t').click(function () {
        jQuery(this).parent().children('.cm-faq-c-list-c').slideToggle('slow');
        if (jQuery(this).children('.cm-faq-c-list-t2').find('a').attr('class') == 'a_arrow_down') {
            var this_img = 'a_arrow_up'
        } else {
            var this_img = 'a_arrow_down'
        }
        jQuery(this).children('.cm-faq-c-list-t2').find('a').attr('class', this_img);
        return false
    });
    jQuery.scrollTo.defaults.axis = 'xy';
    jQuery('.C-files-c-tab').scrollTo(0);
    jQuery.scrollTo(0);
    window.d_panel_v = '0';
    window.d_panel_va = '0';
    jQuery('a#C-files-up').click(function () {
        if (window.d_panel_va > '0') {
            window.d_panel_va--;
            jQuery('.C-files-c-tab').stop().scrollTo({
                top: (window.d_panel_va * 264) + 'px',
                left: '0'
            }, 700)
        }
    });
    jQuery('a#C-files-down').click(function () {
        if (window.d_panel_v > window.d_panel_va) {
            window.d_panel_va++;
            jQuery('.C-files-c-tab').stop().scrollTo({
                top: (window.d_panel_va * 264) + 'px',
                left: '0'
            }, 700)
        } else {
            lst_download_panel(window.d_panel_va)
        }
    });
    jQuery('.C-movies-c .C-movies-c-tab').scrollTo(0);
    window.v_panel_c = '0';
    window.v_panel_v1 = '0';
    window.v_panel_v2 = '0';
    window.v_panel_va1 = '0';
    window.v_panel_va2 = '0';
    jQuery('a#C-movies-left').click(function () {
        if ((window.v_panel_c == '0' && window.v_panel_va1 > '0') || (window.v_panel_c == '1' && window.v_panel_va2 > '0')) {
            if (window.v_panel_c == '0') {
                window.v_panel_va1--
            } else {
                window.v_panel_va2--
            }
            jQuery('#C-movies-tab_' + window.v_panel_c).stop().scrollTo({
                top: '0',
                left: (window.v_panel_c == '0' ? (window.v_panel_va1 * 495) : (window.v_panel_va2 * 495)) + 'px'
            }, 700)
        }
    });
    jQuery('a#C-movies-right').click(function () {
        if ((window.v_panel_c == '0' && window.v_panel_v1 > window.v_panel_va1) || (window.v_panel_c == '1' && window.v_panel_v2 > window.v_panel_va2)) {
            if (window.v_panel_c == '0') {
                window.v_panel_va1++
            } else {
                window.v_panel_va2++
            }
            jQuery('#C-movies-tab_' + window.v_panel_c).stop().scrollTo({
                top: '0',
                left: (window.v_panel_c == '0' ? (window.v_panel_va1 * 495) : (window.v_panel_va2 * 495)) + 'px'
            }, 700)
        } else {
            lst_video_panel(window.v_panel_c, (window.v_panel_c == '0' ? window.v_panel_va1 : window.v_panel_va2))
        }
    });
    jQuery('.SP-lasttempl-c').scrollTo(0);
    window.t_panel_v1 = '0';
    window.t_panel_va1 = '0';
    jQuery('a#SP-lasttempl-b-up').click(function () {
        if (window.t_panel_va1 > '0') {
            window.t_panel_va1--;
            jQuery('.SP-lasttempl-c').stop().scrollTo({
                top: window.t_panel_va1 * 445 + 'px',
                left: '0px'
            }, 700)
        }
    });
    jQuery('a#SP-lasttempl-b-down').click(function () {
        if (window.t_panel_v1 > window.t_panel_va1) {
            window.t_panel_va1++;
            jQuery('.SP-lasttempl-c').stop().scrollTo({
                top: window.t_panel_va1 * 445 + 'px',
                left: '0px'
            }, 700)
        } else {
            lst_templates_panel(window.t_panel_va1)
        }
    });
    jQuery('#cm-recs-more-c').scrollTo(0);
    window.r_panel_v1 = '0';
    window.r_panel_va1 = '0';
    jQuery('#SP-morerecs-b-left').click(function () {
        if (window.r_panel_va1 > '0') {
            window.r_panel_va1--;
            jQuery('#SP-morerecs-c').stop().scrollTo({
                top: '0',
                left: window.r_panel_va1 * 495 + 'px'
            }, 700)
        }
    });
    jQuery('#SP-morerecs-b-right').click(function () {
        if (window.r_panel_v1 > window.r_panel_va1) {
            window.r_panel_va1++;
            jQuery('#SP-morerecs-c').stop().scrollTo({
                top: '0',
                left: window.r_panel_va1 * 495 + 'px'
            }, 700)
        } else {
            lst_recenzje_panel(window.r_panel_va1)
        }
    });
    window.C_themes_page = 0;
    jQuery('#C-themes-up').click(function () {
        if (C_themes_page > 0) {
            get_themes_mainpage(C_themes_page - 1)
        }
    });
    jQuery('#C-themes-down').click(function () {
        get_themes_mainpage(C_themes_page + 1)
    });
    window.C_gallery_page = 0;
    jQuery('#T-gallery-up').click(function () {
        if (C_gallery_page > 0) {
            get_gallery_mainpage(C_gallery_page - 1)
        }
    });
    jQuery('#T-gallery-down').click(function () {
        get_gallery_mainpage(C_gallery_page + 1)
    });
    window.C_news_page = 0;
    jQuery('.C-actual-nav a:eq(0)').click(function () {
        if (C_news_page > 0) {
            get_news_mainpage(C_news_page - 1)
        }
    });
    jQuery('.C-actual-nav a:eq(1)').click(function () {
        get_news_mainpage(C_news_page + 1)
    })
    
    $('input[name="site"]').click(function(){
		if($(this).val()=='1'){
			$('#add-gallery #message').show();
			$('form[name="pic"]').attr('action', 'http://pomoc.grafy.biz/infusions/pro_gallery/add.php');
			get_cats_gallery(0, 0, 0, 0, 1);
			if($('#add-gallery input[name="lock"]').val()!=undefined){
				$('#add-gallery #lock').hide();
			}
		}else{
			$('form[name="pic"]').attr('action', '/infusions/pro_gallery/add.php');
			get_cats_gallery(0, 0, 0, 0, 0);
			$('#add-gallery #message').hide();
			$('#add-gallery #lock').show();
		}
	})
	$('#a_rules').toggle(function(){
			$('#box_rules').slideDown();
		},function(){
			$('#box_rules').slideUp();
	});
	
	$('input[name="submit_app"]').click(function(){
		var name = $('.contests-right .form input[name="name"]').val()
		var email = $('.contests-right .form input[name="email"]').val() 
		var address = $('.contests-right .form input[name="address"]').val() 
		var text = $('.contests-right .form textarea[name="text"]').val()
		var cid = $('.contests-right .form input[name="cid"]').val()
		var uid = $('.contests-right .form input[name="uid"]').val()
		
		if(name!='' && address!='' && text!=''){
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			if(!emailReg.test(email)){     
				alert('Niepoprawny adres E-mail')
			}else{
				$.ajax({
			    	type: 'POST',
			    	url:  '/includes/contest_submit_app.php',
			    	data: { name: name, 
							email: email, 
							address: address, 
							text: text,
							cid: cid,
							uid: uid
					},
					beforeSend: function(){
						$('.contests-right .form .loader').show();
					},
			    	success: function(msg) {
						$('.contests-right .form .loader').hide();
						$('.contests-right .form .msg').html(msg)
						$('.contests-right .form input[name="name"]').val('')
						$('.contests-right .form input[name="email"]').val('') 
						$('.contests-right .form input[name="address"]').val('') 
						$('.contests-right .form textarea[name="text"]').val('')
					},
			    	error: function (XMLHttpRequest, textStatus, errorThrown) {
			    		alert('Error');
			    	}
				});
			}
		}else
			alert('Wypełnij wszystkie pola');
			
	});
	
	$('#choose-sort').change(function(){ 
		window.location.href = $(this).val();
	});
	
	$('#user_picture_week_votes a').click(function(){
		$.ajax({
	    	type: 'POST',
	    	url:  '/infusions/pro_gallery/work_of_week_ratting.php',
	    	data: { vote: $(this).attr('title'), pid: $('#user_picture_week_votes li:last').children('input[name="pid"]').val()},
	    	beforeSend: function(){
	    		$('#user_picture_week_votes li .up, #user_picture_week_votes li .down').hide();
	    	},
	    	success: function(data) {
	    		$('#user_picture_week_votes li div span').html(data);
	    	},
	    	error: function (XMLHttpRequest, textStatus, errorThrown) {
	    		alert('Error');
	    	}
		}); 
	})
	
	$('a.toolTip').mouseover(function(){
		toolTip($(this).attr('title'));
	});
	$('a.toolTip').mouseout(function(){
		toolTip();
	});
	
	$('form[name="order_product"]').submit(function(){
		var error = false;
		$('form[name="order_product"] .data-form li').each(function(){
			var val = $(this).children('input').val();
			if(val==''){
				error = true;
			}
		});
		if(error){
			alert('Wypełnij wszystkie pola formularzy!');
			return false;
		}else{
			if(!confirm('Czy na pewno chcesz wymienić punkty na tą nagrodę? Operacja jest nieodwracalna.'))
				return false;
		}
		
		
	});
    
});

function set_img_zoom() {
    jQuery('.T-gallery-imgs ul li img, #c-gal-categories-c1 ul li img, .choose-cats .list li a img').each(function () {
        jQuery(this).mouseover(function () {
            var imgs_size = jQuery(this).attr('alt');
            if (imgs_size != null && imgs_size.length > 1) {
                var a_imgs_size = new Array();
                a_imgs_size = imgs_size.split('x');
                if (a_imgs_size.length == 2) {
                    var imgs_width = parseInt(a_imgs_size[0]);
                    var imgs_height = parseInt(a_imgs_size[1]);
                    PopEx(this, -(imgs_width / 2 / 2), -(imgs_height / 2 / 2), imgs_width, imgs_height, 20, 'T-gallery-zoom')
                }
            }
        })
    })
};
function get_cats_gallery(cat, incat, error3, error4, help){
	get_cat(cat, incat, error3, help);
	get_incat(cat, incat, error4, help);
}
function get_cat(cat, incat, error, help){
	$.ajax({
    	type: 'POST',
    	url:  '/infusions/pro_gallery/add_ajax.php',
    	data: { cat: cat, 
				incat: incat,
				error: error,
				help: help,
				action: 'cat'},
    	success: function(data) {
				$('#gallery-cats-div').html(data);
    	},
    	error: function (XMLHttpRequest, textStatus, errorThrown) {
    		alert('Error');
    	}
	}); 
}
function get_incat(cat, incat, error, help){
	$.ajax({
    	type: 'POST',
    	url:  '/infusions/pro_gallery/add_ajax.php',
    	data: { cat: cat, 
				incat: incat,
				error: error,
				help: help,
				action: 'incat'},
    	success: function(data) {
				$('#gallery-incat-div').html(data);
    	},
    	error: function (XMLHttpRequest, textStatus, errorThrown) {
    		alert('Error');
    	}
	}); 
}