﻿function SetParameterCookie(sName, sValue, expDate) { var sExpires; if (expDate == "session") { sExpires = ""; } else { sExpires = ";expires=" + (expDate ? expDate : new Date(2021, 10, 4).toGMTString()); } document.cookie = sName + "=" + escape(sValue) + sExpires + ";path=/" + ((location.host.toLowerCase().indexOf("ntvmsnbc.com") >= 0) ? ";domain=ntvmsnbc.com" : ""); }

$(function () {
    if ($(".dropdownStart a")) {
        $(".dropdownStart a").click(function () {
            var selectBox = $(this).parent().parent().find("ul.selectbox");
            if ($(selectBox).hasClass("dn")) {
                $(selectBox).removeClass("dn").hover(function () { }, function () {
                    $(this).addClass("dn");
                });
            } else {
                $(selectBox).addClass("dn");
            };
            return false;
        });
    };


    $("#searchString").labelify({ labelledClass: "labelHighlight" });

    // Login / Signup islemleri
    $("a.signin").click(function () {
        new Boxy($("#signin"), { modal: true, title: "Giriş Yap", closeText: "Kapat", afterShow: function () { this.resize(400, 190); } });
        return false;
    });

    $("a.signup").click(function () {
        new Boxy($("#signup"), { modal: true, title: "Kayıt Ol", closeText: "Kapat", afterShow: function () { this.resize(550, 420); } });
        return false;
    });

    $('#contentFunctions li a.sesame,#contentFunctions li div.sesame').hover(function () {
        if ($(this).hasClass('long')) {
            $(this).stop().animate({ width: 510 });
        } else if ($(this).hasClass('medium')) {
            $(this).stop().animate({ width: 369 });
        } else {
            $(this).stop().animate({ width: 200 });
        }
    },
    function () {
        $(this).stop().animate({ width: 39 });
    });

    $("a#rememberUserName").click(function () {
        $("#signinForm").addClass("dn");
        $("#rememberWhat").attr("value", "u");
        $("#rememberForm").removeClass("dn");
        $("#secondarySigninFunctions").addClass("dn");
        $("#rememberTitle").html("Kullanıcı Adı Hatırlatma");
        return false;
    });
    $("a#rememberUserPass").click(function () {
        $("#signinForm").addClass("dn");
        $("#rememberWhat").attr("value", "p");
        $("#rememberForm").removeClass("dn");
        $("#secondarySigninFunctions").addClass("dn");
        $("#rememberTitle").html("Şifre Hatırlatma");

        return false;
    });
    $("button#cancelRemember").click(function () {
        $("#secondarySigninFunctions").removeClass("dn");
        $("#rememberForm").addClass("dn");
        $("#signinForm").removeClass("dn");
        return false;
    });
    $("#sUuserTerms,#userTermsandConditions").click(function () {
        if ($("#userTermsandConditions").hasClass("dn")) {
            $('#userTermsandConditions div:first').load('/KullanimSozlesmesi.html', function () {
                $("#userTermsandConditions").removeClass("dn");
            });
        } else {
            $("#userTermsandConditions").addClass("dn");
        }
        return false;
    });
    $("p.tac:first").click(function () {
        $("#userTerms").attr('checked', 'checked');
    })

    $('#navContent ul li').hover(function () {
        $(this).addClass('hover');
    }, function () {
        $(this).removeClass('hover');
    });

    $("a.nw").click(function () {
        window.open(this.href);
        return false;
    })

    $("ul.nsTabs").idTabs();
    $("ul.secondaryTabs").idTabs();
    $("#vpContent ul").idTabs();
});

function showLogin() {
  new Boxy($("#signin"), { modal: true, title: "Giriş Yap", closeText: "Kapat", afterShow: function () { this.resize(400, 190); } });
  return false;
}

function getContentsByFilterDateTime(categoryID, type, dateTimeFilter, controlID) {
  $.getJSON("/Content/GetContentByDateTimeFilter/" + categoryID + "/" + type + "/" + dateTimeFilter, null, function (data) {
  	$(controlID).html(data);
  });
}




NTVSporTools = {};
NTVSporTools.URL = {
    RedirectAfter: function (FirstCallUrl, DestinationUrl) {
        $.ajax({
            type: "GET",
            timeout: 1000,
            url: FirstCallUrl,
            complete: function () {
                NTVSporTools.URL.Redirect(DestinationUrl);
            }
        });
    },

    Redirect: function (DestinationUrl) {
        location.href = DestinationUrl;
    }
};


//$(function () {
//    $("#canli_izle").click(function () {
//        NTVSporTools.URL.RedirectAfter("http://ad.reklamport.com/rpclk2.ashx?c=9415642&t=961402&URL=http://www.ntvspor.net/canliyayin", "http://www.ntvspor.net/canliyayin");
//        return false;
//    });
//});
