﻿var bAnimation = true;
var mAnimation = true;
var lastBlock = 0;
var nextBlock = -1;
var ftx = -1;
var maxWidth = 480;
var minWidth = 75;


$(window).load(function () {
    MainAnimation();
   });

$(document).ready(function() {
    $("div#haber-sayilar ul li a").each(function(i) { var n = i; $(this).bind("mouseenter", function(e) { ShowMainNews(n); ftx = n; mAnimation = false; }); $(this).bind("mouseleave", function(e) { mAnimation = true; }); });
    $('#front-images').cycle({ fx: 'turnDown' });
    
    /* Arama */
    var tMsg = "Aranacak kelimeyi girin...", tSearch = $('#txtSearch'), imgSearch = $('#SearchSiteImg');
    tSearch.val(tMsg);
    tSearch.click(function() { if ($(this).val() == tMsg) $(this).val(''); }).blur(function() { if ($(this).val() == '') $(this).val(tMsg); }).keyup(function(e) { if (e.which == 13) imgSearch.click(); });
    imgSearch.click(function() { if (tSearch.val() == tMsg || tSearch.val().length < 3) { alert('Arama yapmak için en az 3 karakter girmelisiniz'); tSearch.val('').focus(); return false; } document.location.href = "/arama.aspx?q=" + tSearch.val(); return false; });
    
    
    
});
function MainAnimation() { if (mAnimation) { ftx++; if (ftx > 4) { ftx = 0; } ShowMainNews(ftx); } setTimeout('MainAnimation()', 3000); }
function ShowMainNews(n) { $("div#haber-resimler a img").hide(); $("div#haber-resimler a img").eq(n).show(); $("div#haber-basliklar h3").hide(); $("div#haber-basliklar h3").eq(n).show(); var getpx = 20*n; $("div#haber-sayilar").css("background-position","0 -"+getpx+"px"); }
function SearchSite() {
    var val = document.forms[0].txtSearch.value;
    if (val.length < 3) {
        alert('Arama yapmak için en az 3 karakter girmelisiniz.');
        document.forms[0].txtSearch.focus();
    } else {
        document.location.href = "/arama.aspx?q=" + val;
    }

}

function SearchTxt(e) {

    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
        SearchSite();
        return false;
    }
    else
        return true;

}    

