// Event.onReady(function() {
//   update_display();
// });


// Event.addBehavior({
//   
//   '#video_category_id:change': function() {
//     update_display();
//   },
//   
//   '#set_type_fliqz:click' : function() {
//     set_type('FliqzVideo');
//     return false;
//   },
// 
//   '#set_type_linked:click' : function() {
//     set_type('LinkedVideo');
//     return false;    
//   }
//   
// });



// Fliqz Callback
function OnUploaded(fileId) {
  $('video_source_id').value=fileId;
  $('video_form').submit();
}

function set_type(class_name) {
  $('type').value = class_name;
  update_display();
};


function update_display() {
  var step2 = $('video_category_id').up('.step');
  step2.hide();
  $('upload').hide();
  $('link').hide();

  if ($('type').value != 'Video') {
    step2.show();

    if ($('video_category_id').value) {
      switch($('type').value) {
        case 'FliqzVideo':
          $('upload').show();
          break;
      
        case 'LinkedVideo':
          $('link').show();        
          break;
      }
    }
  }
};
