var video_callbacks = {

  viewThumbnails : function(result){
    $('divVideoThumbs').innerHTML = result;
  	$('divVideoThumbs').scrollTop=0;
  },
  viewVideo : function(result){
    $('divVideoPanel').innerHTML = result;
  }
}

var ajaxVid = new ajaxVideo(video_callbacks);

function AjaxVideoClass() {
  this.speed = 'low';
  this.video_id = -1;
  this.autoplay = "false";
}
AjaxVideoClass.prototype = {

  //set incoming options
  init : function(speed){
    this.speed = speed;
  },
  set_speed : function(speed, video_id){
    this.speed = speed;
    this.video_id = video_id;
    this.load_video(this.video_id, this.autoplay);
  },
  load_thumbs : function(set_id, search_str){
    ajaxVid.viewThumbnails(set_id, search_str);
  },
  load_video : function(video_id, autoplay){
    if(!Object.isNumber(video_id) && video_id < 1){
      video_id = -1;
    }
    this.video_id = video_id;
    this.autoplay = autoplay;

    ajaxVid.viewVideo(video_id, this.speed, this.autoplay);
  },
  toggle_text : function(){
    if($('divTextVersion').style.display == 'none'){
      $('divTextVersion').style.display = 'block';
    }
    else{
      $('divTextVersion').style.display = 'none';
    }
  }
}