/**
 * This JavaScript is property of Virtualuna, i.e. the author A.Salim Doost
 * (c) 2007 - forever
 * Copying, code theft, etc. is not allowed, at least not without agreement of the author. 
 */

	var posArray = new Array(); // this global array saves the position/state of the animation
	var dirArray = new Array(); // this global array saves the direction of the animation (fw or bw)
	
	/*
	 * this function should be called for initialization, i.e. onload of body
	 */
	function init(num)
	{
		for(i=0; i<num; i++)
		{
			posArray[i] = 0;
			dirArray[i] = "none";
		}
	}
		
	/*
	 * handles mouseover event of a navbtn, hence initiates the animation
	 * in forward direction
	 * nr is the number of the navbtn (used to get id)
	 */
	function navbtn_mouseover(nr)
	{
		dirArray[nr] = "fw";
		movefw(nr);
	}
			
	/*
	 * handles mouseout event of a navbtn, hence initiates the animation
	 * in backward direction
	 * nr is the number of the navbtn (used to get id)
	 */
	function navbtn_mouseout(nr)
	{
		dirArray[nr] = "bw";
		movebw(nr);
	}
	
	/*
	 * moves the animation exactly one step in forward direction
	 * nr is the number of the navbtn (used to get id)
	 */
	function movefw(nr)
	{
		var id = "imagepart" + nr;
		var idr = "reflimg" + nr; // reflection-image id
	
		var h = posArray[nr];
		if(h<7 && dirArray[nr] == "fw")
		{
			h = h+1;
			var f = (100-h)/100.0;
			
			document.getElementById(id).style.top = h + "px";
			document.getElementById(idr).style.top = (15-h) + "px";
	
			posArray[nr] = h;
			window.setTimeout("movefw('" + nr + "');", 50);
		}
	}
	
	/*
	 * moves the animation exactly one step in backward direction
	 * nr is the number of the navbtn (used to get id)
	 */
	function movebw(nr)
	{
		var id = "imagepart" + nr;
		var idr = "reflimg" + nr; // reflection-image id
	
		var h = posArray[nr];
		if(h>0 && dirArray[nr] == "bw")
		{
			h = h-1;
			var f = (100-h)/100.0;
	
			document.getElementById(id).style.top = h + "px";
			document.getElementById(idr).style.top = (15-h) + "px";
	
			posArray[nr] = h;
			window.setTimeout("movebw('" + nr + "');", 50);
		}
	}
	
