var current_v = null;
  function startVideo(which)
  {
			if (current_v) {
				if (current_v != this) {
					current_v.pause();
					current_v.currentTime(0);
				}
			}
			which.play();
  }
function playit(which)
{
	var target = this;
	if ( this.id == undefined ) {
		target = which;
	}
	if (target.paused()) {
		if (current_v) {
			if (current_v != this) {
				current_v.pause();
				current_v.currentTime(0);
			}
		}
		target.play();
	}
	else {
		target.pause();
	}
}
  function changeCurrent()
  {
	current_v = this;
  }
  function handleerror()
  {
	this.load();
  }
  function initVideo(what)
  {
		what.addEvent('click', playit);
		what.addEvent('touchstart', playit);
		what.addEvent('play', changeCurrent);
  }
  jQuery(document).ready(function()
  {
	jQuery(document).on('click touchstart', '.overlay.init',
		function(ev)
		{
			jQuery(this).removeClass('init');
			playit( _V_( jQuery('.video-js', this).attr('id') ) );
		}
	);
	  jQuery('.video-js').each(function(i,v)
	  	{
			_V_(jQuery(v).attr('id')).ready(
				function()
				{
					this.addEvent('error', handleerror);
					initVideo(this);
				}
			);
	  	}
	 );
  }
  );