﻿function customScroll() {
    $('.scroll-pane').jScrollPane({ verticalDragMinHeight: 59, verticalDragMaxHeight: 59, horizontalDragMinWidth: 14, horizontalDragMaxWidth: 14 });
}

$(document).ready(function () {

    $("#header .search .typetext").keyup(function () {
        var headerTypeVal = $("#header .search .typetext").val().length;
        if (headerTypeVal > 2) {
            $("#header .min-live-search").css("display", "block");
            $("#header .search .search-close").show();
        }
    });

    $("#header .search .search-close").click(function () {
        $(this).hide();
        $("#header .min-live-search").css("display", "none");
    });

    $("#header .search-close").click(function () {
        $("#header .typetext").val("");
    });

    $("#footer-band .search .typetext").keyup(function () {
        var headerTypeVal = $("#footer-band .search .typetext").val().length;
        if (headerTypeVal > 2) {
            $("#footer-band .min-live-search").css("display", "block");
            $("#footer-band .search .search-close").show();
            $('html,body').animate({ scrollTop: 2000 }, 1000);
        }
    });

    $("#footer-band .search .search-close").click(function () {
        $(this).hide();
        $("#footer-band .min-live-search").css("display", "none");
    });

    $("#footer-band .search-close").click(function () {
        $("#footer-band .typetext").val("");
    });

    $("#featured-container .next").click(function () {
        $this = $(this);
        $("ul.slider").animate({ "left": "-625px" });
        $this.addClass("disable");
        $("#featured-container .prev").removeClass("disable");
    });

    $("#featured-container .prev").click(function () {
        $this = $(this);
        $("ul.slider").animate({ "left": "0" });
        $this.addClass("disable");
        $("#featured-container .next").removeClass("disable");
    });

    $(".gridview .twelvegridview").click(function () {
        $("#happy-moments .pagination").hide();
        $(".six-col").fadeOut("slow").hide();
        $(".twelve-col").fadeIn("slow").show();
        $(".sixgridview").removeClass("selected");
        $(this).addClass("selected");
    });

    $(".gridview .sixgridview").click(function () {
        $("#happy-moments .pagination").show();
        $(".twelve-col").fadeOut("slow").hide();
        $(".six-col").fadeIn("slow").show();
        $(".twelvegridview").removeClass("selected");
        $(this).addClass("selected");
    });

    var sixColWidth = $("#happy-moments .six-col-wrap li:first").width();
    sixWrapWidth = sixColWidth * 2;
    $("#happy-moments .six-col-wrap").width(sixWrapWidth);
    $("#happy-moments .prev").addClass("disable");

    $("#happy-moments .next").click(function () {
        $this = $(this);
        $("ol.six-col-wrap").animate({ "left": -sixColWidth });
        $this.addClass("disable");
        $("#happy-moments .prev").removeClass("disable");
    });

    $("#happy-moments .prev").click(function () {
        $this = $(this);
        $("ol.six-col-wrap").animate({ "left": "0" });
        $this.addClass("disable");
        $("#happy-moments .next").removeClass("disable");
    });

    $(".six-col .col").children("a").hover(
        function () {
            $this = $(this);
            $this.next(".hlink").hide();
            $this.children(".detail-box").show();
        },
        function () {
            $this = $(this);
            $this.children(".detail-box").hide();
            $this.next(".hlink").show();
        }
    );

    $(".socialmedia-wrap .context:not(:first)").hide();
    $(".social-tabs li a:first").addClass("active");
    customScroll();
    $(".social-tabs li a").click(function () {
        var indexTabLink = $(".social-tabs li a").index(this);
        $(".socialmedia-wrap .context").hide().eq(indexTabLink).show();
        $(".social-tabs li a").removeClass("active").eq(indexTabLink).addClass("active");
        customScroll();
        $("#twitter ul li span").next("a").addClass("date");
    });

    $("#twitter").getTwitter({
        userName: "ulkerden",
        numTweets: 15,
        loaderText: "Lütfen bekleyiniz...",
        slideIn: true,
        showHeading: false,
        showProfileLink: false
    });
    
});
  
