﻿$(document).ready(function () {

    $("#iller").change(function () {
        var cid = $(this).val();

        $.ajax({
            type: 'GET',
            url: "/ilceler.ashx?jx_id=" + cid,
            cache: false,
            success: function (gostert) {
                $('#ilceliste').html(gostert);

                $("#ilceler").change(function () {
                    var cid = $(this).val();

                    $.ajax({
                        type: 'GET',
                        url: "/magazalar.ashx?jx_id=" + cid,
                        cache: false,
                        success: function (gostert) {
                            $('#magazaliste').html(gostert);
                            $('#mcs_container2').show();
                            $("#mcs_container2").mCustomScrollbar("vertical", 400, "easeOutCirc", 1.05, "auto", "yes", "yes", 10);
				$("a[rel='lightbox']").colorbox({ slideshow: true, slideshowSpeed: 5000 });

                        }
                    });
                    //$('#sonuc' + id).toggle(500);

                    return false;
                });


            }
        });
        //$('#sonuc' + id).toggle(500);

        return false;
    });

    //**//
    $('#maillistkayit').click(function () {
        $('#jxsonuc').show(100);
        var email = $("input#eemail").val();

        var dataString = 'email=' + email;

        $.ajax({
            type: "POST",
            data: dataString,
            url: "/mail_liste_ekle.ashx",
            success: function (goster) {
                $('#jxsonuc').html(goster);
            }
        });

        return false;
    });


    $('#menu0').click(function () {

        $("#left").animate({ width: 'toggle' });
        $("#menu-w").animate({ width: 'toggle' });
    });


    $('#menu1').click(function () {

        $("#left").animate({ width: 'toggle' });
        $("#menu-w").animate({ width: 'toggle' });
    });


    $('#magaza0').click(function () {
        $("#magazalar").animate({ width: 'toggle' });
        $("#magaza-w").animate({ width: 'toggle' });


    });

    $('#magaza1').click(function () {
        $("#magazalar").animate({ width: 'toggle' });
        $("#magaza-w").animate({ width: 'toggle' });


    });

    jQuery("#mcs_container").height($(window).height() - 120);
    jQuery("#mcs_container2").height($(window).height() - 230);


        jQuery("#mcs_container").height($(window).height() - 120);
        jQuery("#mcs_container2").height($(window).height() - 230);

        if ($(window).height() < 650) { jQuery("#left-bottom").hide(); }
        else { jQuery("#left-bottom").show(); }


    $(window).bind("resize", function () {
        jQuery("#mcs_container").height($(window).height() - 120);
        jQuery("#mcs_container2").height($(window).height() - 230);

        if ($(window).height() < 650) { jQuery("#left-bottom").hide(); }
        else { jQuery("#left-bottom").show(); }


    });


    //** main menu **//


    jQuery("#nav li").hover(
			function () {


			    if ($('ul', this).is(':hidden')) {
			        $('ul', this).slideDown(400);
			    }
			},

			function () {

			    if ($('ul', this).is(':visible')) {
			        $('ul', this).hide();
			    }
			}

			);



    //** acilir kapanir **//

    jQuery('a#toggle').click(function () {
        var toggleelement = this
        var toggleid = $(toggleelement).attr('name');

        jQuery('#' + toggleid).toggle(300);
        //location.href = "#tavsiye";
        jQuery('html,body').animate({ scrollTop: $("#tavsiye").offset().top }, 'slow');


        return false;
    });



    //** light box**//

    jQuery("a[rel='photo']").colorbox({ slideshow: true, slideshowSpeed: 5000 });
    jQuery(".thickbox").colorbox({ iframe: true, innerWidth: 608, innerHeight: 342 });
    jQuery("#popme").colorbox({ open: true, inline: true, href: "#popup" });
    jQuery("#fullmap").colorbox({ iframe: true, width: "90%", height: "90%" });
});








