
var gallery_step		= 10;
var gallery_time		= 50;
var gallery_breite		= 0;

var gallery_direction	= "left";
var gallery_moving		= false;
var gallery_move_timer	= false;

var gallery_i = 0;

function move()
{
	gallery_breite = (getWidth('first_row') > getWidth('second_row')) ? getWidth('first_row') : getWidth('second_row');
	if( (this.gallery_i <= 0 && this.gallery_direction == 'left') || (this.gallery_i >= -(this.gallery_breite - getWidth('gallery_rect')) && this.gallery_direction == 'right') )
	{
		document.getElementById('first_row').style.left = this.gallery_i;
		document.getElementById('second_row').style.left = this.gallery_i;
		
		if( this.gallery_direction == 'left' )				
			this.gallery_i += this.gallery_step;
		else
			this.gallery_i -= this.gallery_step;
	}
}

function start_stop_move(direction)
{
	this.gallery_direction = direction;
	
	if( this.gallery_move_timer == false )
	{
		this.gallery_move_timer = window.setInterval( "move()", this.gallery_time );
	} else {
		window.clearInterval( this.gallery_move_timer );
		this.gallery_move_timer = false;
	}
}

function getHeight(obj) {
	var ret=0;
	if (typeof obj != 'object') {
		obj = document.getElementById(obj);
	}
	if (obj.offsetHeight) {
		return obj.offsetHeight;
	}
}

function getWidth(obj) {
	var ret=0;
	if (typeof obj != 'object') {
		obj = document.getElementById(obj);
	}
	if (obj.offsetWidth) {
		return obj.offsetWidth;
	}
}

