﻿$(document).ready(function () {
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-22755826-3']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
    $('#slides').slides({
        preload: true,
        preloadImage: 'Contents/img/loading.gif',
        play: 5000,
        pause: 2500,
        hoverPause: true,
        animationStart: function (current) {
            $('.caption').animate({
                bottom: -35
            }, 100);
            if (window.console && console.log) {
                console.log('animationStart on slide: ', current);
            };
        },
        animationComplete: function (current) {
            $('.caption').animate({
                bottom: 0
            }, 200);
            if (window.console && console.log) {
                console.log('animationComplete on slide: ', current);
            };
        },
        slidesLoaded: function () {
            $('.caption').animate({
                bottom: 0
            }, 200);
        }
    });

    $("body").click(function (e) {
        if ($(e.target).attr('id') == "searchKey") {
            $("#searchKey").val("");
        }
        else {
            $("#searchKey").val("Tìm kiếm");
        }
    });
    $('#searchKey').keyup(function (e) {
        if (e.keyCode == 13) {
            window.location = "/tags/search/" + jQuery.trim($("#searchKey").val()) + "/games.html";
        }
    });
    $("#imgSearch").click(function () {
        window.location = "/tags/search/" + jQuery.trim($("#searchKey").val()) + "/games.html";
    });
});
function isNull() {
    var searchkey = document.getElementById("searchKey").value;
    if (searchkey == "") {
        return false;
    }
}


