function tibe_camera(time,picture_el){
	this.time = time;
	this.picture_el = picture_el;
	this.play_time_out=null;
}
tibe_camera.prototype.rewind = function(time){
	this.pause();
	var new_time = this.time - time;
	this.change_picture(new_time,"tibe_camera_obj.rewind("+time+")");
}
tibe_camera.prototype.fast_rewind = function(){
	this.pause();
	var new_time = this.time - (24 * 60 * 60);
	this.change_picture(new_time,"tibe_camera_obj.fast_rewind()");
}
tibe_camera.prototype.slow_rewind = function(){
	this.pause();
	var new_time = this.time - (60 * 60);
	this.change_picture(new_time,"tibe_camera_obj.slow_rewind()");
}
tibe_camera.prototype.forward = function(time){
	this.pause();
	var new_time = this.time + time;
	this.change_picture(new_time,"tibe_camera_obj.forward("+time+")");
}

tibe_camera.prototype.fast_forward = function(){
	this.pause();
	var new_time = this.time + (24 * 60 * 60);
	this.change_picture(new_time,"tibe_camera_obj.fast_forward()");
}
tibe_camera.prototype.slow_forward = function(){
	this.pause();
	var new_time = this.time + (60 * 60);
	this.change_picture(new_time,"tibe_camera_obj.slow_forward()");
}
tibe_camera.prototype.change_picture = function(time,callback){
	if (this.play_time_out != null)
		clearTimeout(this.play_time_out);
	if(
		(time > this.start_time)
		&&(time < this.end_time)
	){
		this.time = time;
		this.set_display_time();
		$(this.picture_el).removeEvents('load');
		$(this.picture_el).addEvent('load', function(){
		    eval(callback);
		});
		this.next_path = EDIT_CORE.JSSiteRoot+'site/camera/show_picture.php?time='+time
		this.play_time_out = setTimeout('tibe_camera_obj.set_next_path()',100);

		//this.play_time_out = setTimeout(callback,500);
	}
}
tibe_camera.prototype.play = function(time){
	this.forward(time);
	//alert(this.end_time+" - "+)
}
tibe_camera.prototype.pause = function(time){
	$(this.picture_el).removeEvents('load');
	if (this.play_time_out != null)
		clearTimeout(this.play_time_out);
}
tibe_camera.prototype.set_display_time = function(time){
	var dato = new Date((this.time*1000)).toLocaleString();
	$(this.display_text_el).set('text', dato);
}
tibe_camera.prototype.set_next_path = function(){
	this.picture_el.src = this.next_path;
}

