// JavaScript Document

function Gallery(id,name){
	this.name = name;
	this.id = document.getElementById(id);
	this.elem = document.getElementById(id+'mic');
	this.bottom = 0;
	this.height=65;
	
	this.auto;
	
	
	this.init = function(){
		//alert(this.name);
		this.bottom = -this.height;
		//this.transit(0);
	},
	
	this.play = function(){
		clearInterval(this.auto);
		this.auto = setInterval(this.name+'.up()', 50);
	},
	
	this.mstop = function(){
		clearInterval(this.auto);
		this.auto = setInterval(this.name+'.down()', 50);		
	},
	
	this.transit = function(number1){
		this.elem.style.bottom=this.bottom+'px';
	},
	
	this.up = function(){
		this.bottom+=5;
		if(this.bottom > 0) {
			this.bottom = 0;
			clearInterval(this.auto);
		}
			
		this.transit();
	},
	
	this.down = function(){
		this.bottom-=5;
		if(this.bottom < -this.height) {
			this.bottom = -this.height;
			clearInterval(this.auto);
		}
			
		this.transit();
	}
	
}