jQuery.noConflict();

// download selected files
function downloadFiles(){
   // check if more than one files are selected.
   if( jQuery(":checkbox:checked").length == 0 ){
      alert("ダウンロードするファイルを選択してください。");
      return;
   }else{
      document.forms[0].method='POST';
      document.forms[0].action='download';
      document.forms[0].submit();

      document.forms[0].method='GET';
      document.forms[0].action='list';
      document.forms[0].target='_self';
   }
}

function addToMyBox(){
   // check if more than one files are selected.
   if( jQuery(":checkbox:checked").length == 0 ){
      alert("ファイルを選択してください。");
      return;
   }else{
      window.open('/download/mybox', 'MyBox', 'width=640,height=600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1').focus();

      document.forms[0].method='POST';
      document.forms[0].action='myboxadd';
      document.forms[0].target='MyBox';
      document.forms[0].submit();
      
      document.download.method='GET';
      document.download.action='list';
      document.download.target='_self';
   }
}

function deleteFiles(){
   // check if more than one files are selected.
   if( jQuery(":checkbox:checked").length == 0 ){
      alert("ファイルを選択してください。");
      return;
   }else{
      document.download.method='POST';
      document.download.action='myboxdelete';
      document.download.submit();
   }
}

function allCheck(){
   jQuery(':checkbox').attr('checked','checked');
   jQuery('.allCheck').hide();
   jQuery('.allClear').show();
}

function allClear(){
   jQuery(':checkbox').removeAttr('checked');
   jQuery('.allClear').hide();
   jQuery('.allCheck').show();
}
