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.pxTop = function(o)
	{
		for(var y=-document.documentElement.scrollTop; o != null; o = o.offsetParent) y+=o.offsetTop;
		return y;
	}
	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)
		{
			var totalY = 0;
			for(var i=0;i<N;i++)
			{
				var o = icons[i];
				var H = parseInt(o.style.height);
				if(ov && ov.className=="dockicon")
				{
					if(ov!=ovk)
					{
						ovk=ov;
					}
					if(M) H = Math.max((s*Math.cos(((pxTop(o)+H/2)-xm)/sMax)),sMin);
					s = Math.min(sMax,s+1);
				}
				else
				{
					s = Math.max(s-1,sMin);
					H = Math.max(H-N,sMin);
				}
				o.style.width = H*128/70+"px";
				o.style.height = H+"px";
				totalY += H;
			}
			totalY -= i * 80;
			totalY /= 2;
			totalY = 40 - totalY;
			document.getElementById("dock").style.paddingTop = totalY + "px";
			if(s >= sMax) M = false;
		}
	}
}
document.onmousemove = function(e)
{
	if(window.event) e=window.event;
	xm = (e.y || e.clientY);
	if(xm!=xmb){
		M = true;
		xmb = xm;
	}
	ov = (e.target)?e.target:((e.srcElement)?e.srcElement:null);
}
window.onload = function()
{
	dock = new dock("dock", 60, 85);
	setInterval("dock.run()", 16);
}
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
 
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
 
    return vars;
}