$(document).ready(function() {

    //highlights the current in a menu by comparing the links to the current URL path
    var links = $("#main .nav ul").find("a");

    links.each(function () {
        if (window.location.pathname.indexOf($(this).attr("href")) != -1) {
            $(this).parent().addClass("selected");
        }
    });

    //highlights the current in a menu by comparing the links to the current URL path
    links = $("#sidebar ul").find("a");

    links.each(function () {
        if (window.location.pathname.indexOf($(this).attr("href")) != -1) {
            $(this).parent().addClass("selected");
        }
    });

    function formatText(index, panel) {
        return index + "";
    }

    $(function() {

        $('.anythingSlider').anythingSlider({
            easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
            autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
            delay: 6000,                    // How long between slide transitions in AutoPlay mode
            startStopped: false,            // If autoPlay is on, this can force it to start stopped
            animationTime: 350,             // How long the slide transition takes
            hashTags: true,                 // Should links change the hashtag in the URL?
            buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
            pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
            startText: "Slideshow",             // Start text
            stopText: "Durdur",               // Stop text
            navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
        });

    });

    $(function() {
        //vars
        var conveyor = $(".content-conveyor", $("#footerSlider")),
	item = $(".item", $("#footerSlider"));

        //set length of conveyor
        conveyor.css("width", item.length * parseInt(item.css("width")));

        //config
        var sliderOpts = {
            max: (item.length * parseInt(item.css("width"))) - parseInt($(".viewer", $("#footerSlider")).css("width")),
            slide: function(e, ui) {
                conveyor.css("left", "-" + ui.value + "px");
            }
        };

        //create slider
        $("#sliderNav").slider(sliderOpts);
    });

    $("#footerSlider img[title]").tooltip('#jq-tooltip-holder');

    $("#footerSlider .item:first:child").addClass('first');

    //jQuery Google Maps
    /*
    $('#map_canvas').googleMaps({
    markers: {
    latitude: 41.030031,
    longitude: 28.988907,
    icon: {
    image: 'http://farms.spacesheep.net/akademietkinlik/Assets/Imgs/icons/graybox.png',
    shadow: 'http://farms.spacesheep.net/akademietkinlik/Assets/Imgs/icons/shadow.png',
    iconSize: '65, 51',
    shadowSize: '91, 34'
    }
    }
    });
    */

    $('#map_canvas').googleMaps({
        markers: {
            latitude: 41.030031,
            longitude: 28.988907
        }
    });
    
    /*
    if ($.browser.msie && $.browser.version.substr(0, 1) < 9) {
        $(function() {

            $("#Route")
                .mouseover(function() {
                    $(this)
                        .data("origWidth", $(this).css("width"))
                        .css("width", "auto");
                });

            //.mouseout(function() {
            //    $(this).css("width", $(this).data("origWidth"));
            //});
            // Closes any open menus when mouse click occurs anywhere else on the page
            $(document).click(function() { closemenu(); });

            // Function to close set menu
            var closemenu = function() {
                $("#Route").css("width", $("#Route").data("origWidth"));
            }

        });
    }
    */

    // ColorBox
    $("a[rel='gallery-item']").colorbox();

    // Paging
    $(".gallery ul").quickPager({ pageSize: "35" });

});


