﻿// Voden General Script
var IsiPhone = navigator.userAgent.indexOf("iPhone") != -1, // Iphone detecting
    IsiPod = navigator.userAgent.indexOf("iPod") != -1, // Ipod detecting
    IsiPad = navigator.userAgent.indexOf("iPad") != -1, // Ipad detecting
    IsiPhoneOS = IsiPhone || IsiPad || IsiPod;

var currentPage = 1;
var isClicked = false;
var subIndexId = -1;
var sClick = false;
var videoName = ["kofastfactsblackberry.flv", "birkadinbirerkekbirbanka.flv", "akbanksosyalmedyacasestudy.flv", "cocopopscokoring.flv", "turkcelleurope.flv", "eyvaheyvahiki.flv", "cocopopsfootbag.flv", "ingpowerisyours.flv", "cocopopsmagician.flv"];


function logFromFlash(str) {
    console.log("Action Script Saying: "+ str);
}


$(document).ready(function () {
    //$("ul.work").randomize("li");
    var pageNumber = $(".pageNumber").html("1");
    $(".second").hide();

    $("ul.work li").mouseenter(function () { // Works bölümünde işlerin üzerine gelindiğinde çerçeve rengi ve açıklama bölümü açma
        $(this).find(".text").animate({ bottom: "10px" }, 100);
        $(this).find(".first").fadeOut(300);
        $(this).find(".second").fadeIn(500);
    });
    $("ul.work li").mouseleave(function () { // Works bölümünde işlerin üzerine gelindiğinde çerçeve rengi ve açıklama bölümü kapama
        $(this).find(".text").animate({ bottom: "-70px" }, 200);
        $(this).find(".second").fadeOut(300);
        $(this).find(".first").fadeIn(500);
    });

    $("ul.work li").click(function () { // Works bölümünde işlere tıklandığında detay popup ve popup sayfalama açma işler sayfalama kapatma
        closeVideo(); //Promo video açık ise kapatma.
        var onId = $(this).attr("targetIndex");
        //var onId = $(this).index() + ((currentPage - 1) * 8);
        $(".workPopup .item").hide();
        $(".workPopup").show();
        $(".workPopup .item:eq(" + onId + ")").fadeIn();
        //$(".workPopup #" + $(this).attr("parentPopup")).fadeIn();
        subIndexId = onId;
        pageNumber.html(parseInt(subIndexId) + 1);

        $(".pagination").hide();
        $(".paginate").fadeIn();

        if (!IsiPhoneOS) {
            if (onId == 0) {
                $(".videoLand").html("");
                $(".item:eq(0)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[6];
                videoPlay1(videoAd1);
            };
            if (onId == 1) {
                $(".videoLand").html("");
                $(".item:eq(1)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[1];
                videoPlay1(videoAd1);
            };
            if (onId == 2) {
                $(".videoLand").html("");
                $(".item:eq(2)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[5];
                videoPlay1(videoAd1);
            };
            if (onId == 3) {
                $(".videoLand").html("");
                $(".item:eq(3)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[2];
                videoPlay1(videoAd1);
            };
            if (onId == 5) {
                $(".videoLand").html("");
                $(".item:eq(5)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[4];
                videoPlay1(videoAd1);
            };
            if (onId == 9) {
                $(".videoLand").html("");
                $(".item:eq(9)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[0];
                videoPlay1(videoAd1);
            };
            if (onId == 13) {
                $(".videoLand").html("");
                $(".item:eq(13)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[3];
                videoPlay1(videoAd1);
            };
            if (onId == 14) {
                $(".videoLand").html("");
                $(".item:eq(14)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[7];
                videoPlay1(videoAd1);
            };
            if (onId == 21) {
                $(".videoLand").html("");
                $(".item:eq(21)").find(".videoLand").html("<div id=\"video1\"></div>");
                var videoAd1 = videoName[8];
                videoPlay1(videoAd1);
            };
        }
    });

    $(".go").click(function () { //Works bölümünde alttaki ileri butonunun çalışması
        if (subIndexId != -1) {
            $(".workPopup .item").hide()
            if (subIndexId >= ($(".workPopup .item").length - 1))
                subIndexId = 0;
            else
                subIndexId++;
            $(".workPopup .item:eq(" + subIndexId + ")").fadeIn();
            pageNumber.html(subIndexId + 1);

            showPage(parseInt(subIndexId / 8) + 1);

            if (!IsiPhoneOS) {
                if (subIndexId == 0) {
                    $(".videoLand").html("");
                    $(".item:eq(0)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[6];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 1) {
                    $(".videoLand").html("");
                    $(".item:eq(1)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[1];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 2) {
                    $(".videoLand").html("");
                    $(".item:eq(2)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[5];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 3) {
                    $(".videoLand").html("");
                    $(".item:eq(3)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[2];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 5) {
                    $(".videoLand").html("");
                    $(".item:eq(5)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[4];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 9) {
                    $(".videoLand").html("");
                    $(".item:eq(9)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[0];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 13) {
                    $(".videoLand").html("");
                    $(".item:eq(13)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[3];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 14) {
                    $(".videoLand").html("");
                    $(".item:eq(14)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[7];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 21) {
                    $(".videoLand").html("");
                    $(".item:eq(21)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[8];
                    videoPlay1(videoAd1);
                };
            }
        }
    });

    $(".back").click(function () { //Works bölümünde alttaki ileri butonunun çalışması
        if (subIndexId != -1) {
            $(".workPopup .item").hide()
            if (subIndexId == 0)
                subIndexId = ($(".workPopup .item").length - 1);
            else
                subIndexId--;
            $(".workPopup .item:eq(" + subIndexId + ")").fadeIn();
            pageNumber.html(subIndexId + 1);

            showPage(parseInt(subIndexId / 8) - 1);

            if (!IsiPhoneOS) {
                if (subIndexId == 0) {
                    $(".videoLand").html("");
                    $(".item:eq(0)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[6];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 1) {
                    $(".videoLand").html("");
                    $(".item:eq(1)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[1];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 2) {
                    $(".videoLand").html("");
                    $(".item:eq(2)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[5];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 3) {
                    $(".videoLand").html("");
                    $(".item:eq(3)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[2];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 5) {
                    $(".videoLand").html("");
                    $(".item:eq(5)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[4];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 9) {
                    $(".videoLand").html("");
                    $(".item:eq(9)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[0];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 13) {
                    $(".videoLand").html("");
                    $(".item:eq(13)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[3];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 14) {
                    $(".videoLand").html("");
                    $(".item:eq(14)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[7];
                    videoPlay1(videoAd1);
                };
                if (subIndexId == 21) {
                    $(".videoLand").html("");
                    $(".item:eq(21)").find(".videoLand").html("<div id=\"video1\"></div>");
                    var videoAd1 = videoName[8];
                    videoPlay1(videoAd1);
                };
            }
        }
    });

    $(".workClose").click(function () { // Works popup bölümünde kapama butonuna tıklandığında detay popup ve popup sayfalama kapama işler sayfalama açma
        closeWorkVideo();
    });

    $("li.map a").click(function () { // Google Maps Popup Kapama
        $(".contPopup").show();
    });
    $(".contClose").click(function () { // Google Maps Popup Kapama
        $(".contPopup").fadeOut(200);
    });

    $(".open").click(function () { // Promo video alanı açma header ve navigasyon kapama
        closeWorkVideo(); //Works video açıksa kapatma
        $(".videoPopup").html("");
        $(".videoPopup").hide();
        $(this).parent().find("div.videoPopup").fadeIn(500);
        $("#header, .sliderkit-nav, .sliderkit-controls").fadeOut(200);
        isClicked = true;

        var clickVideo = $(this).parent().index();
        $(this).prev().prev().html("<div id=\"video\"></div>");
        var videoAd = videoName[clickVideo];
        videoPlay(videoAd);

        if (IsiPhoneOS) {
            $(".videoPopup").hide();
            $("#header, .sliderkit-nav, .sliderkit-controls").show();
            videoAd = videoAd.replace('.flv', '.mov');
            $(".open").attr("href", "http://vodenvideo.filesinvoden.com/flash/" + videoAd);
        }
    });

    // Social Medya iconlarının slider olması
    var liObj = $("ul.icons li");
    var liArr = $.makeArray(liObj);
    var poppedId;
    var idArr = [];
    for (var i = 0; i < liArr.length; i++) { // Default da sayfa açıldığında bütün elementlerin konumlandırılması
        $("ul.icons li:eq(" + i + ")").animate({ left: i * 185 });
        idArr.push(i);
    }
    $("a.twitter").css({ backgroundPosition: '-315px -107px' });
    $(".socialPopUp").fadeIn();

    $(".rightClick").click(function () { // Sağa tıklama ile iconların yer değiştirmesi
        if (sClick == false) {
            sClick = true;

            function buttonControl() { // En sağa gelen butona göre background değişmesi, popup açılıp kapanması ve içerik getirilmesi

                if (idArr[i - 1] == 0) { // Facebook popup
                    $("a.face").css({ backgroundPosition: '0 -107px' });
                    $(".socialPopUp").hide();
                    $(".socialPopUp").fadeIn(500);
                    $(".logos").removeClass("linkedin").addClass("facebook");
                    $("#linkedin").empty();
                    $("#linkedin").attr("id", "facebook")
                    $("#facebook").html("<a href='http://www.facebook.com/voden' target='_blank'><img src='/assets/images/inFacebook.gif' style='margin-top:50px;' /></a>");
                    $("a.links").attr("href", "http://www.facebook.com/voden").html("facebook.com/voden");
                } else {
                    $("a.face").css({ backgroundPosition: '0 0' });
                }

                if (idArr[i - 1] == 1) { // Linked popup
                    $("a.linked").css({ backgroundPosition: '-105px -107px' });
                    $(".socialPopUp").hide();
                    $(".socialPopUp").fadeIn(500);
                    $(".logos").removeClass("vimeo").addClass("linkedin");
                    $("#vimeo").empty();
                    $("#vimeo").attr("id", "linkedin")
                    $("#linkedin").html("<a href='http://www.linkedin.com/company/voden' target='_blank'><img src='/assets/images/inLinkedin.gif' style='margin-top:50px;' /></a>");
                    $("a.links").attr("href", "http://www.linkedin.com/company/voden").html("linkedin.com/company/voden");
                } else {
                    $("a.linked").css({ backgroundPosition: '-105px 0' });
                }

                if (idArr[i - 1] == 2) { // Vimeo popup
                    $("a.vimeo").css({ backgroundPosition: '-210px -107px' });
                    $(".socialPopUp").hide();
                    $(".socialPopUp").fadeIn(500);
                    $(".logos").removeClass("twitter").addClass("vimeo");
                    $("#twitter").empty();
                    $("#twitter").attr("id", "vimeo")
                    $("#vimeo").html("<a href='http://www.vimeo.com/voden' target='_blank'><img src='/assets/images/onVimeo.gif' style='margin-top:50px;' /></a>");
                    $("a.links").attr("href", "http://www.vimeo.com/voden").html("vimeo.com/voden");
                } else {
                    $("a.vimeo").css({ backgroundPosition: '-210px 0' });
                }

                if (idArr[i - 1] == 3) { // Twitter popup
                    $("a.twitter").css({ backgroundPosition: '-315px -107px' });
                    $(".socialPopUp").hide();
                    $(".socialPopUp").fadeIn(500);
                    $(".logos").removeClass("facebook").addClass("twitter");
                    $("#facebook").empty();
                    $("#facebook").attr("id", "twitter")
                    $("#twitter").getTwitter({
                        userName: "vodenagency",
                        numTweets: 2,
                        loaderText: "Loading tweets...",
                        slideIn: false,
                        slideDuration: 750,
                        showHeading: true,
                        headingText: "Latest Tweets",
                        showProfileLink: false,
                        showTimestamp: true
                    });
                    $("a.links").attr("href", "http://www.twitter.com/vodenagency").html("twitter.com/vodenagency");
                } else {
                    $("a.twitter").css({ backgroundPosition: '-315px 0' });
                }
            }

            for (var i = 0; i < liArr.length; i++) {
                if (i != liArr.length - 1) {
                    $("ul.icons li:eq(" + idArr[i] + ")").animate({ left: (i + 1) * 185 }, 500);
                }
                else {
                    buttonControl();
                    $("ul.icons li:eq(" + (idArr[i]) + ")").fadeOut(200, function () {
                        $("ul.icons li:eq(" + (idArr[i - 1]) + ")").css({ left: 0 });
                        $("ul.icons li:eq(" + (idArr[i - 1]) + ")").fadeIn(500);
                        poppedId = idArr.pop();
                        idArr.splice(0, 0, poppedId);
                    });
                }
            }
            setTimeout("slideEnable()", 500);
        }
    });

    // İnsan kaynakları açılır kapanır bölümü
    //if (sClick == false) {
    //    $("#ik").hover(onMouse, blurMouse);
    //} else {
    //    return;
    //}

    //function onMouse() {
    //    $(".postcard").css({ backgroundPosition: '0 -112px' });
    //}
    //function blurMouse() {
    //    $(".postcard").css({ backgroundPosition: '0 0' });
    //}

    //$("a.joinUs").click(function () { // ik forma tıklandığında 
    //    if (sClick == false) { // Açık mı kapalı mı kontrolü yapıyoruz kapalı ise açtırıyoruz değilse kapatıyoruz
    //        sClick = true;
    //        $("#ik").animate({ height: '1080px' });
    //        $(".postcard").css({ backgroundPosition: '-143px -112px' });
    //    }
    //    else {
    //        $("#ik").animate({ height: '132px' });
    //        sClick = false;
    //        $(".postcard").css({ backgroundPosition: '-143px 0' });
    //    }
    //});

    /* Photorama Galeri Seçimi */
    $("a.galleryOne").click(function () { // Galeri bir seçimi
        $(".selected").animate({ top: "0px" });
        for (var y = 0; y < $('#Gallery li img').size(); y++) {
            $('#Gallery li img')[y].src = "/assets/images/photo/galleryOne/" + (y + 1 - (Math.floor(y / 10) * 10)) + ".jpg";
        }
    });
    $("a.galleryTwo").click(function () { // Galeri iki seçimi
        $(".selected").animate({ top: "127px" });
        for (var y = 0; y < $('#Gallery li img').size(); y++) {
             $('#Gallery li img')[y].src = "/assets/images/photo/galleryTwo/" + (y + 1 - (Math.floor(y/10)*10)) + ".jpg";
        }
    });


    // KARANTİNA BÖLGESİ
    $("ul.work li:eq(0)").mouseenter(function () {
        $(this).find(".text").css({ background: "#582d28" });
        $(this).css({ background: "#582d28" });
    });
    $("ul.work li:eq(0)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(1)").mouseenter(function () {//e67c25
        $(this).find(".text").css({ background: "#e67c25" });
        $(this).css({ background: "#e67c25" });
    });
    $("ul.work li:eq(1)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(2)").mouseenter(function () {//b71413
        $(this).find(".text").css({ background: "#b71413" });
        $(this).css({ background: "#b71413" });
    });
    $("ul.work li:eq(2)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(3)").mouseenter(function () {//b71413
        $(this).find(".text").css({ background: "#b71413" });
        $(this).css({ background: "#b71413" });
    });
    $("ul.work li:eq(3)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(4)").mouseenter(function () {//0f335e
        $(this).find(".text").css({ background: "#0f335e" });
        $(this).css({ background: "#0f335e" });
    });
    $("ul.work li:eq(4)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(5)").mouseenter(function () {//0f335e
        $(this).find(".text").css({ background: "#0f335e" });
        $(this).css({ background: "#0f335e" });
    });
    $("ul.work li:eq(5)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(6)").mouseenter(function () {//5b5250
        $(this).find(".text").css({ background: "#5b5250" });
        $(this).css({ background: "#5b5250" });
    });
    $("ul.work li:eq(6)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(7)").mouseenter(function () {//5b5250
        $(this).find(".text").css({ background: "#5b5250" });
        $(this).css({ background: "#5b5250" });
    });
    $("ul.work li:eq(7)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(8)").mouseenter(function () {//5b5250
        $(this).find(".text").css({ background: "#5b5250" });
        $(this).css({ background: "#5b5250" });
    });
    $("ul.work li:eq(8)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(9)").mouseenter(function () {//b71413
        $(this).find(".text").css({ background: "#b71413" });
        $(this).css({ background: "#b71413" });
    });
    $("ul.work li:eq(9)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(10)").mouseenter(function () {//0f335e
        $(this).find(".text").css({ background: "#0f335e" });
        $(this).css({ background: "#0f335e" });
    });
    $("ul.work li:eq(10)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(11)").mouseenter(function () {//e67c25
        $(this).find(".text").css({ background: "#e67c25" });
        $(this).css({ background: "#e67c25" });
    });
    $("ul.work li:eq(11)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(12)").mouseenter(function () {//b71413
        $(this).find(".text").css({ background: "#b71413" });
        $(this).css({ background: "#b71413" });
    });
    $("ul.work li:eq(12)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(13)").mouseenter(function () {//582d28
        $(this).find(".text").css({ background: "#582d28" });
        $(this).css({ background: "#582d28" });
    });
    $("ul.work li:eq(13)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(14)").mouseenter(function () {//e67c25
        $(this).find(".text").css({ background: "#e67c25" });
        $(this).css({ background: "#e67c25" });
    });
    $("ul.work li:eq(14)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(15)").mouseenter(function () {//e67c25
        $(this).find(".text").css({ background: "#e67c25" });
        $(this).css({ background: "#e67c25" });
    });
    $("ul.work li:eq(15)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(16)").mouseenter(function () {
        $(this).find(".text").css({ background: "#689629" });
        $(this).css({ background: "#689629" });
    });
    $("ul.work li:eq(16)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(17)").mouseenter(function () {//689629
        $(this).find(".text").css({ background: "#689629" });
        $(this).css({ background: "#689629" });
    });
    $("ul.work li:eq(17)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(18)").mouseenter(function () {//b71413
        $(this).find(".text").css({ background: "#b71413" });
        $(this).css({ background: "#b71413" });
    });
    $("ul.work li:eq(18)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(19)").mouseenter(function () {//3f81a0
        $(this).find(".text").css({ background: "#3f81a0" });
        $(this).css({ background: "#3f81a0" });
    });
    $("ul.work li:eq(19)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(20)").mouseenter(function () {//e67c25
        $(this).find(".text").css({ background: "#e67c25" });
        $(this).css({ background: "#e67c25" });
    });
    $("ul.work li:eq(20)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(21)").mouseenter(function () {//582d28
        $(this).find(".text").css({ background: "#582d28" });
        $(this).css({ background: "#582d28" });
    });
    $("ul.work li:eq(21)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(22)").mouseenter(function () {//e67c25
        $(this).find(".text").css({ background: "#e67c25" });
        $(this).css({ background: "#e67c25" });
    });
    $("ul.work li:eq(22)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    $("ul.work li:eq(23)").mouseenter(function () {//b71413
        $(this).find(".text").css({ background: "#b71413" });
        $(this).css({ background: "#b71413" });
    });
    $("ul.work li:eq(23)").mouseleave(function () {
        $(this).css({ background: "#fff" });
    });

    // promo thumb rollover
    $("#thumbs li").find(".second").hide();
    $("#thumbs li").mouseenter(function () {
        $(this).find(".first").hide();
        $(this).find(".second").show();
    });
    $("#thumbs li").mouseleave(function () {
        $(this).find(".second").hide();
        $(this).find(".first").show();
    });
})

function slideEnable() {
    sClick = false;
}

function closeVideo() { // Promo alanında flash player içerisinden kapatma fonksiyonu
    $(".videoPopup").fadeOut(200);
    $(".videoPopup").css("display", "none");
    $("#header, .sliderkit-nav, .sliderkit-controls").fadeIn(500);
    isClicked = false;
}

function closeWorkVideo() {
    $(".videoLand").html("");
    $(".workPopup").fadeOut(200);
    $(".paginate").hide();
    $(".pagination").fadeIn();
}

(function ($) { // Works alanının random gelmesi
    $.fn.randomize = function (childElem) {
        return this.each(function () {
            var $this = $(this);
            var elems = $this.children(childElem);

            elems.sort(function () { return (Math.round(Math.random()) - 0.5); });

            $this.empty();

            for (var i = 0; i < elems.length; i++)
                $this.append(elems[i]);
        });
    }
})(jQuery);
