﻿function initAdvSearch() {

    $(".advanced").click(function(e) {

        e.preventDefault();

        // check the pod isn't already open
        if (!$(".advanced").hasClass("active")) {            

            //$("#district-map").show();

            $(".advSearchContainer").slideDown(1000);

            // make the advanced search button active        
            $(".advanced").addClass("active");

            // make the basic search button inactive
            $(".basic").removeClass("active");

            // set the level slider to the original positions
            $("#sldLevel").slider('option', 'values', [0, 6]);
        }
    });


    $(".basic").click(function(e) {

        e.preventDefault();

        // check the pod isn't already closed
        if (!$(".basic").hasClass("active")) {            

            //$("#district-map").hide();

            // go to the top of the page first
            window.scrollTo(0, 0)

            $(".advSearchContainer").slideUp(1000);

            // make the basic button active
            $(".basic").addClass("active");

            // make the advanced button inactive
            $(".advanced").removeClass("active");

        }
    });
}    
//    if (show)
//    {
//        $( "#district-map" ).show();
//    
//        // slide open                
//        $(".advSearchContainer").slideDown(1000);                        
//        
//        // make the advanced search button active        
//        $(".advanced").attr("src", $(".advanced").attr("src"));
//        $(".advanced").addClass("active");
//        
//        // make the basic search button inactive
//        $(".basic").attr("src", $(".basic").attr("src").replace("_on", ""));
//        $(".basic").removeClass("active");
//        
//        
//        // set the level slider to the original positions
//        $( "#sldLevel" ).slider('option', 'values', [0,6]);        
//        
//    }
//    else
//    {
//        // check the pod isn't already closed
//        if(! $( ".basic" ).hasClass( "active" ) )
//        {            
//            $( "#district-map" ).hide();
//        
//            // go to the top of the page first
//            window.scrollTo(0,0);

//            // slide shut
//            $(".advSearchContainer").slideUp(1000);
//            
//            // make the basic button active
//            $(".basic").attr("src", $(".basic").attr("src") );
//            $(".basic").addClass("active");
//            
//            // make the advanced button inactive
//            $(".advanced").attr("src", $(".advanced").attr("src").replace("_on", "") );
//            $(".advanced").removeClass("active");
//        }
//    }