/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var ids;

$("document").ready( function() {
   $("tbody tr:odd").addClass("odd");

   $("tbody tr").mouseover( function(){
      $(this).addClass("over");
   });

   $("tbody tr").mouseout( function(){
      $(this).removeClass("over");
   });

   $(".item_table_list tr:odd").removeClass("odd");
   $(".item_table_list tr").mouseover( function(){
      $(this).removeClass("over");
   });

   $(".menu_header").next().hide();
   $(".selected").next().show();
   $(".menu_header").click(function(){
       $(this).next().slideToggle(100);
       
   });

   $('.form_fieldset').coolfieldset({speed:"fast"});

   //alert(window.location.pathname);
   $("a").each(function(){
       var str = $(this).attr('href');
       var loc = window.location.pathname;
      if( (loc.indexOf( str ) !== -1) && (str != '/jd_framework/admin') ) {
         $(this).parents("li").show();
      }

   });

   $('#checkAll').click(
       function()
       {
          $("INPUT[type='checkbox']").attr('checked', $('#checkAll').is(':checked'));

       }
    )

   $("#bulkTrash").click(function(event) {
        //alert("bulk trash");
        event.preventDefault();
        var ids = "";
        var id = 0;

        // $('input[type=checkbox]').each(function(index) {

        //     if(this.checked) {
                 //alert("chevked");
        //         id = $(this).val();
        //         ids += id + ",";
        //     }
        //  });
        var ids = $('#chk:checked').map(function() {
          return $(this).val();
        }).get().join(',');


        var ref = $("#bulkTrash").attr('href') + ids;
        document.location.href = ref;
   })

  

});

