$(document).ready(function () {
    $(".news-container .news-item").jCarouselLite({
        btnNext: ".module-nav .next",
        btnPrev: ".module-nav .prev",
        vertical: true,
        speed: 500,
        visible: 1
    });
    if ($(".all-news .all-news-inner ul li").length > 4) {
        $(".all-news .all-news-inner").jCarouselLite({
            btnNext: ".module-nav .next",
            btnPrev: ".module-nav .prev",
            vertical: true,
            speed: 500,
            visible: 4,
            scroll: 4
        });
    }
    else {
        $(".all-news .module-nav").hide();
    }
    if ($(".product-slider-inner ul li").length > 4) {
        var counterSlider = 0;
        $(".product-slider .product-slider-inner").jCarouselLite({
            btnNext: ".product-slider .next-slider",
            btnPrev: ".product-slider .prev-slider",
            speed: 800,
            auto: 5000,
            visible: 0,
            scroll: 1
        });
        $(".product-slider .next-slider").click(function (e) {
            counterSlider += 5;
            if (counterSlider == 5 || counterSlider == 10 || counterSlider == 15) {
                $(".product-slider .product-slider-header ul li a").eq((counterSlider / 5)).click();
            }
        });

        $(".product-slider .product-slider-header ul li a").click(function () {
            if (!$(this).hasClass("clicked")) {
                $(".product-slider ul li a").removeClass("clicked");
                $(this).addClass("clicked");
            } else {
                $(this).removeClass("clicked");
            }
        });
    }
    else {
        $(".product-slider .product-slider-header ul, .product-slider .next-slider, .product-slider .prev-slider").css("visibility", "hidden");
    }
    $(".body-shadow").css({
    //marginLeft : (($(window).width()-500)/2)+"px"
});

$(window).load(function () {
    $(".bottom").css({
    //left : ($(window).width() - $(".bottom").width())/2
})
$(".cover-image, .cover-image .cover-pattern").css({
    height: $(".cover-image > img").height()
});

$(".search-box input").focus(function () {
    $(this).parents("div.search-box").addClass("focus");
}).blur(function () {
    $(this).parents("div.search-box").removeClass("focus");
}).keypress(function (e) {
    if (e.keyCode == "13") {
        e.preventDefault();
        eval($("a#SearchFormButton").attr("href"));
    }
});

$("input[type='text'][title!=''].hasTitle").attr("value", function () {
    return $(this).attr("title");
}).focus(function () {
    if ($(this).val() == $(this).attr("title")) {
        $(this).val("");
    }
}).blur(function () {
    if ($(this).val() == "") {
        $(this).val($(this).attr("title"));
    }
});
});

$(".iconset").mouseover(function () {
    $(this).addClass("hovered");
}).mouseout(function () {
    $(this).removeClass("hovered");
}).mousedown(function () {
    $(this).addClass("clicked");
}).mouseup(function () {
    $(this).removeClass("clicked");
});

//$(".cover-image.content.subpage").next().css("margin-top",-70);

$(".left-area .left-menu ul.sub>li").hover(
		function () {
		    $(this).addClass("hovered-menu");
		},
		function () {
		    $(this).removeClass("hovered-menu");
		}
	);

$(".shop-area").hover(
		function () {
		    $(this).find("div.shop-list").stop(false, true).fadeIn();
		},
		function () {
		    $(this).find("div.shop-list").stop(false, true).fadeOut().show();
		}
	);

setTimeout(function () {
    $(".body .wrapper .cover-pattern").css("zoom", "100%");
}, 50);

if ($("select.customSelectBox").length > 0) {
    $("select.customSelectBox").selectbox();
}

if ($(".body .bottom.type1 .content").length > 0) {
    $(".body .bottom.type1 .content").jScrollPane({
        scrollbarWidth: 15,
        dragMaxHeight: 32
    }).removeClass("content").addClass("scrollable").wrap("<div class='content'></div>");
}

$("ul.subOpened li:last a").css("border", "none");
$("li.last-menu a").css("border", "none");

var uls = $("ul.opened ul.clearfix");

uls.each(function () {
    if ($(this).find("li").length == 0) {
        $(this).remove();
    }

});



});

