var maxHeight = 125;
var m1 = null;
var m2 = null;
var m3 = null;
var m4 = null;
var m5 = null;

function closer(index) {
    this.popup = document.getElementById("spanMenuPlace" + index);
    this.whatToDo = 0;
    this.name = "m" + index;
}
closer.prototype.ShowHideMenu = function(whatHaveToDo){
	var timerShowSpan;
	var CurrentSize;
	
	var popup = this.popup;
	
	if ((whatHaveToDo>-1)&&(whatHaveToDo<3)) {
	    this.whatToDo = whatHaveToDo;
	}
	
	if (popup.style.height=="") {
			popup.style.height="10px";
	}
	
	CurrentSize = popup.style.height.slice(0,popup.style.height.length-2);
	CurrentSize--;
	
	if (this.whatToDo == 1){
		popup.style.visibility = "visible";
		if (CurrentSize<(maxHeight-10)) {
			timerShowSpan = setTimeout(this.name + ".ShowHideMenu()",20)
			popup.style.height=parseInt(CurrentSize+10) + "px";
		}
		else{
			this.whatToDo = 0;
			popup.style.height=parseInt(maxHeight) + "px";
		}
	}
	if (this.whatToDo == 2){
		if (CurrentSize>10) {
			timerShowSpan = setTimeout(this.name + ".ShowHideMenu()",20)
			popup.style.height=parseInt(CurrentSize-10) + "px";
		}
		else{
			this.whatToDo = 0;
			popup.style.height="1px";
			popup.style.visibility = "hidden";
		}
	}
}
closer.prototype.changeMenuOnMouseOver = function(whichMenu,typeOfEvent){
	if (typeOfEvent=="out") {
		this.ShowHideMenu("2");
		if (whichMenu.src.slice(whichMenu.src.toLowerCase().length-5) == 'n.png' ) {
			whichMenu.src = whichMenu.src.slice(0,whichMenu.src.toLowerCase().length-6) + "off.png";
		}
	}
	else{
		this.ShowHideMenu("1");
		if (whichMenu.src.slice(whichMenu.src.toLowerCase().length-5) == 'f.png' ) {
			whichMenu.src = whichMenu.src.slice(0,whichMenu.src.toLowerCase().length-7) + "on.png";
		}
	}
}

function init() {
    m1 = new closer(1);
    m2 = new closer(2);
    m3 = new closer(3);
    m4 = new closer(4);
	m5 = new closer(5);
}