$(document).ready(function(){

	// initialises the jScrollPane.
	$('#y124_ort, #y124_genre, #y124_biograf, #y323, #y178, #x340').jScrollPane();

	// Removes "Fri text" text from search
	$("#MovieFilterText").val("Fri text").click(function(){
		$(this).val("");
	});

	// Bevaka
	$('.bevaka').hide();
	$('ul#bevaka li a.button_bevaka').click(function(){
		$(this).next().slideToggle("200");
		return false;
	});	

	// Tipsa
	$('.tipsa').hide();
	$('ul#tipsa li a').click(function(){
		$('.tipsa').slideToggle("200");
		return false;
	});	
	
                             // Toggle the search.
                            $('a.toggle').click(function(){
                                $(this).parent('div').next('div').slideToggle("fast");
                                return false;
                            });
                            
                            // Enkel lista / Detaljerad lista
                            $('#extend').toggle(function(){
                                $(this).html("Enkel lista").addClass("enkel");
                                       $('div.detaljerat_content:hidden').slideDown("fast");
                                       return false;
                                },function(){
                                $(this).html("Detaljerad lista").removeClass("enkel");
                                    $('div.detaljerat_content:visible').slideUp("fast");
                                    return false;
                            });   

	
	
});

  // Get a reference to the PageRequestManager.
  var prm = Sys.WebForms.PageRequestManager.getInstance();
 
  // Using that prm reference, hook _initializeRequest
  // and _endRequest, to run our code at the begin and end
  // of any async postbacks that occur.
  prm.add_initializeRequest(InitializeRequest);
  prm.add_endRequest(EndRequest);
 
  // Executed anytime an async postback occurs.
  function InitializeRequest(sender, args) 
  {
    // Change the Container div's CSS class to .Progress.
    $get('loading').className = 'progress';
 
    // Get a reference to the element that raised the postback,
    //   and disables it.
    $get(args._postBackElement.id).disabled = true;
  }
 
  // Executed when the async postback completes.
  function EndRequest(sender, args) 
  {
    // Change the Container div's class back to .Normal.
    $get('loading').className = 'normal';
 
    // Get a reference to the element that raised the postback
    //   which is completing, and enable it.
    $get(sender._postBackSettings.sourceElement.id).disabled = false;
  }