$(window).load(function () {



});

$(document).ready(function () {



    $('.topmenu ul li').hover(function () {
        $("ul", this).slideDown();
    },
	function () {
	    $("ul", this).stop(true, true).slideUp();
	});

    //    $('.btn').click(function () {
    //        $(this).animate({ marginTop: "-10px", opacity: "0" }, 300);
    //        $(".cufon", this).css("display", "none");
    //    })

    if ($.browser.msie && parseInt($.browser.version) == 7) {
        $('.btn span').css({ 'padding-top': '4px', 'height': '19px' })
        $('.topmenu').css("height", "23px");
        $('.haberliste p').css("float", "left");
        $('.etkinlikcerceve').css("top", "54px");
    }

    $(".scrollable").scrollable();

    if ($('.ekipmanlar').length > 0) {
        $('#icerik').css({ 'padding-top': '40px', 'margin-top': '-31px' });
        $('#sliderwrapper').css("height", "416px");
        if ($.browser.msie && parseInt($.browser.version) == 7) {
            $('.ekipmanlar').css("margin-top", "-2px");
        } else {
        }
        var items = $('.items div').length;
        var items = (items / 2) - 7;
        $('.right').click(function () {
            var itemsleft = $('.items').css("left");
            var itemsleft2 = itemsleft.substring(0, itemsleft.length - 2);
            var sinama2 = parseFloat(itemsleft2);
            var sinama2 = sinama2 - 130;
            var sinama1 = items * 130;
            var sinama1 = (sinama1 - sinama1) - sinama1;
            if (sinama1 == sinama2) { $(this).removeClass("next"); };
        });
        $('.left').click(function () {
            var itemsleft = $('.items').css("left");
            var itemsleft2 = itemsleft.substring(0, itemsleft.length - 2);
            var sinama2 = parseFloat(itemsleft2);
            var sinama2 = sinama2 - 130;
            var sinama1 = items * 130;
            var sinama1 = (sinama1 - sinama1) - sinama1;
            if (sinama1 > sinama2) { $('.right').addClass("next"); };
        });

    }

    Cufon.replace('.topmenu ul li a, .modulb, .btn, .btn2, .etkinlik span, .leftmenu ul li a, .icerikdiv h1, .icerikdiv2 h1', { fontFamily: 'Impact', hover: true, hoverables: { a: true} });

    $('.topmenu ul li:last').css("margin-right", "0px");
    $('.modul:first').css("margin-left", "0px");

    $('.cot').html('<div class="cot1"></div><div class="cot2"></div><div class="cot3"></div>');
    $('.cot').hover(function () {
        $('.cot2').animate({ left: "-10px" }, 100);
        $('.cot3').animate({ left: "-20px" }, 150);
    },
	function () {
	    $('.cot2').animate({ left: "0px" }, 100);
	    $('.cot3').animate({ left: "0px" }, 150);
	});

    if ($('.haberliste').length > 0) {

        $('.haberlistecerceve:eq(1)').css("background-position", "0px -47px");
        $('.haberliste:gt(1)').addClass("diger");
        $('.haberliste:gt(1) .haberlistecerceve, .haberliste:gt(1) img, .haberliste:gt(1) span').remove();

        if ($('.haberliste').length > 2) {
            for (i = 2; i < $('.haberliste').length; i++) {
                var prgrf = $(".haberliste:eq(" + i + ") p").html();
                var nwprgrf = prgrf.substr(0, 38)
                $(".haberliste:eq(" + i + ") p").html("" + nwprgrf + "");
                $(".haberliste:eq(" + i + ") p").append("...");
            }
        }

        var prgrf = $(".haberliste:eq(0) p").html();
        var nwprgrf = prgrf.substr(0, 75)
        $(".haberliste:eq(0) p").html("" + nwprgrf + "");
        $(".haberliste:eq(0) p").append("...");

        if ($('.haberliste').length > 1) {
            
                var prgrf = $(".haberliste:eq(1) p").html();
                var nwprgrf = prgrf.substr(0, 75)
                $(".haberliste:eq(1) p").html("" + nwprgrf + "");
                $(".haberliste:eq(1) p").append("...");
            
        }
    }

    $('.alblink:eq(1)').css("left", "76px");
    $('.alblink:eq(2)').css("left", "152px");
    $('.alblink:eq(3)').css("left", "228px");

    $('.logolar').hover(function () {
        $(this).animate({ top: "12px" }, 200);
    },
	function () {
	    $(this).animate({ top: "22px" }, 200);
	    $(this).animate({ top: "20px" }, 50);
	    $(this).animate({ top: "22px" }, 50);
	});

    $('#beycon').hover(function () {
        $(this).animate({ top: "55px" }, 200);
    },
	function () {
	    $(this).animate({ top: "60px" }, 200);
	    $(this).animate({ top: "58px" }, 50);
	    $(this).animate({ top: "60px" }, 50);
	});

});


