/*
Copyright: Webmaster of www.icp.ac.ru (Alex):
Tested with (OS=Windows):
IE6 (can also wirk on IE5.5, I didn't test, if you don't have IE6, just update your IE)
NN6, NN7, Mozilla (if you use NN4, accept my deepest condolences)
Opera 5, Opera 6, Opera 7

Alex (webmaster@icp.ac.ru)
If you like how it works, feel free to use it, just put some words about where you got the script from.
*/
DOM = (document.getElementById) ? 1 : 0;
N6=(DOM && parseInt(navigator.appVersion) >= 5) ? 1:0; // =o( Sorry, there is something wrong with time evaluation in N6+/Mozilla

sh=(N6) ? 40:10;
var yoff=-129;
var ymin=-170;
var ymax=32;
var main_index=1;

function move(inc) {
	yoff += inc;
	z=ymax-yoff;
	if (yoff<ymax && yoff >ymin) document.getElementById("menu").style.top=yoff;

	if (N6) {
		if (inc>0) {
			if (yoff<0) {
				setTimeout("move(30)",5);
				} 
			else {
				if (z > 80) setTimeout("move(30)",5);
				else if (z <= 31 && z > 9) setTimeout("move(8)",5); 
				else if (z <= 9 && z >= 3) setTimeout("move(2)",5);
				else if (z <= 3 && z >= 1) setTimeout("move(1)",5);
				else if (z < 1) {setTimeout("move(0)",5);set_buttons('du');}
				}
			}
		}

	else {
		if (inc>0) {
			if (yoff<0) {
				setTimeout("move(10)",5);
				} 
			else {
				if (z > 20) setTimeout("move(10)",5);
				else if (z <= 20 && z > 10) setTimeout("move(5)",5); 
				else if (z <= 10 && z >= 1) setTimeout("move(1)",5);
				else if (z < 1) {setTimeout("move(0)",5);set_buttons('du');}
				}
			}
		}
	if (inc<0) {
		if (yoff<=ymin) setTimeout("move(0)",5); else {setTimeout("move(-sh)",5);set_buttons('dd');}
		}
	}

function set_buttons (which_one) {
	if (which_one == 'du') {document.getElementById("du").style.left = 0;document.getElementById("dd").style.left = -50;}
	else {document.getElementById("du").style.left = -50;document.getElementById("dd").style.left = 0;}
	}

function baloon_hide () {
	document.getElementById('baloonmenu').style.visibility='hidden';
	document.getElementById('baloonmap').style.visibility='hidden';
	document.getElementById('baloonhome').style.visibility='hidden';
	}

function baloon_show (which_one) {
	baloon_hide();
	if (which_one == 'd') {
		document.getElementById("baloonmenuimg").src="http://www.icp.ac.ru/images/inner/baloon_menu_d.gif";
		which_one='menu';
		}
	if (which_one == 'u') {
		document.getElementById("baloonmenuimg").src="http://www.icp.ac.ru/images/inner/baloon_menu_u.gif";
		which_one='menu';
		}
	w_o=eval('document.getElementById(\"baloon' + which_one + '\")');
	w_o.style.visibility='visible';
	}

function bottom_baloons(which_one) {
	document.getElementById("bottombaloons").src="http://www.icp.ac.ru/images/inner/" + which_one + ".gif";
	}