// JavaScript Document
  $(document).ready(function(){
    $("#tabs > ul").tabs();
    $(".content").hide();
		$('<img src="/SiteCollectionImages/arrow-down.png" class="arrow" />').insertAfter('a h4'); 				   
		$("a h4").click(function(){
		if($(this).is(".active")) {
         $(this).toggleClass("active");
		 $('.arrow.active').attr('src','/SiteCollectionImages/arrow-down.png'); // change the image src of the current ACTIVE image to have an INACTIVE state.
         $(this).parent().next(".content").slideToggle();
         return false;
			} else {
			$(".content:visible").slideUp("slow"); // close all visible divs with the class of .content
			$("h4.active").removeClass("active");  // remove the class active from all h1's with the class of .active
			$(this).toggleClass("active");
			$('.arrow.active').attr('src','/SiteCollectionImages/arrow-down.png'); // change the image src of the current ACTIVE image to have an INACTIVE state.
			$(".arrow").addClass('active');
			$(this).siblings('.arrow.active').attr('src','/SiteCollectionImages/arrow-up.png'); // change the image src of the new active image to have an active state.
			$(this).parent().next(".content").slideToggle();
			return false;
		}
	});
    
 	var alternateRowColors = function($table) { 
		$('tbody tr:odd', $table).removeClass('even').addClass('odd') 
		$('tbody tr:even', $table).removeClass('odd').addClass('even') 
	} 

	$('table.sortable').each(function() { 
		var $table = $(this) 
		alternateRowColors($table) 
		$('th', $table).each(function(column) { 
			if ($(this).is('.sort-alpha')) { 
				$(this).addClass('clickable').hover(function() { 
					$(this).addClass('hover') 
				}, function() { 
					$(this).removeClass('hover') 
				}).click(function() { 
					var rows = $table.find('tbody > tr').get() 
					rows.sort(function(a, b) { 
					var keyA = $(a).children('td').eq(column).text().toUpperCase() 
					var keyB = $(b).children('td').eq(column).text().toUpperCase() 
					if (keyA < keyB) return -1 
					if (keyA > keyB) return 1 
					return 0 
				}) 
				$.each(rows, function(index, row) { 
					$table.children('tbody').append(row) 
				}) 
				alternateRowColors($table) 
			}) 
		} 
	}) 
	}) 
	 //add index column with all content.   
 $(".filterable tr:has(td)").each(function(){   
   var t = $(this).text().toLowerCase(); //all row text   
   $("<td class='indexColumn'></td>")   
    .hide().text(t).appendTo(this);   
 });//each tr   
 $("#FilterTextBox").keyup(function(){   
   var s = $(this).val().toLowerCase().split(" ");   
   //show all rows.   
   $(".filterable tr:hidden").show();   
   $.each(s, function(){   
       $(".filterable tr:visible .indexColumn:not(:contains('"  
          + this + "'))").parent().hide();   
   });//each   
 });//key up.   
	$(".viewAll").click(function() {
		$(".filterable tr:hidden").show();
	})
 

	
	
	//hide the all of the element with class accordion_body
	$(".accordion_body").hide();
	
	//slides the element with class "accordion_body" when paragraph with class "accordion_header" is clicked 
	$("div.accordion_header").click(function() {
	
	 	$(this).toggleClass('active');
		$(this).next("div.accordion_body").slideToggle("normal").siblings("div.accordion_body").slideUp("normal");
			
		$(this).siblings("div.accordion_header").removeClass("active");
	}); 
	
		$('#IWantTo').change(function() {
    	$('#taskContainer div').hide('slow');            // added a bit of animation
    	var e = '#' + $(':selected', $(this)).attr('name');
    	$(e).show('slow');                             // while we change the feed
		});

		$('#taskContainer div').hide();


  
    
  });