// JavaScript Document

// ================================================================
//                   ------ dock menu -------
// script by Gerard Ferrandez - Ge-1-doot - February 2006
// http://www.dhteumeuleu.com
// ================================================================

var xm = xmb = ov = 0;
var M = true;

function dock(dock, sMin, sMax)
{
	this.icons = document.getElementById(dock).getElementsByTagName('img');
	this.N = this.icons.length;
	this.s = sMin;
	this.ovk = 0;
	this.pxLeft = function(o)
	{
		for(var x=-document.documentElement.scrollLeft; o != null; o = o.offsetParent) x+=o.offsetLeft;
		return x;
	}
	for(var i=0;i<this.N;i++)
	{
		with(this.icons[i])
		{
			style.width = sMin+"px";
			style.height = sMin+"px";
			className = "dockicon";
		}
	}
	this.run = function()
	{
		with(this)
		{
			for(var i=0;i<N;i++)
			{
				var o = icons[i];
				var W = parseInt(o.style.width);
				if(ov && ov.className=="dockicon")
				{
					if(ov!=ovk)
					{
						ovk=ov;	
						/*
						if(navigator.appName == "Microsoft Internet Explorer"){
							document.getElementById("legend").innerHTML = ov.lang;
							document.getElementById("legend2").innerHTML = ov.lang;
							
							x = 0;
							y = 0;
							if(o.x){
								x = ov.x;
								y = ov.y;
							}
							else{
								x = ov.offsetLeft;
								y = ov.offsetTop;
							}
							y = y -20;
							document.getElementById('legend').style.top = y + "px";
							document.getElementById('legend').style.left = x + "px";
	
							document.getElementById('legend2').style.top = y+1 + "px";
							document.getElementById('legend2').style.left = x+1 + "px";
						}	
						else{*/
							document.getElementById("legend3").innerHTML = ov.lang;
						//}				
					}

					if(M) W = Math.max((s*Math.cos(((pxLeft(o)+W/2)-xm)/sMax)),sMin);
					s = Math.min(sMax,s+1);
				}
				else
				{
					s = Math.max(s-1,sMin);
					W = Math.max(W-N,sMin);					
				}
				o.style.width = W+"px";
				o.style.height = W+"px";
				
				

				
			}
			if(s >= sMax) M = false;
		}
	}
}
document.onmousemove = function(e)
{
	if(window.event) e=window.event;
	xm = (e.x || e.clientX);
	if(xm!=xmb){
		M = true;
		xmb = xm;
	}
	ov = (e.target)?e.target:((e.srcElement)?e.srcElement:null);
}

function initDock()
{
	dock = new dock("dock", 55, 100);
	setInterval("dock.run()", 16);
	bodyHeight = parseInt(document.body.clientHeight);
	bodyWidth = parseInt(document.body.clientWidth);
	document.getElementById('dockcontainer').style.top = "555px";
	document.getElementById('dockcontainer').style.left = "0px";
}

function showLegend(){
	document.getElementById('legend').style.display = "";
	document.getElementById('legend2').style.display = "";
	document.getElementById('legend3').style.display = "";
}
function hideLegend(){
	document.getElementById('legend').style.display = "none";
	document.getElementById('legend2').style.display = "none";
	document.getElementById('legend3').style.display = "none";
}
