﻿function initAdvSearch(show)
{
    if (show)
    {
        //alert( $(button).attr("src") );                
    
        // 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( "moveTo", 6, 1 ) ;
        
    }
    else
    {
        // check the pod isn't already closed
        if(! $( ".basic" ).hasClass( "active" ) )
        {            
            // 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");
        }
    }
}