All pastes #90044 Raw Edit

Anonymous

public javascript v1 · immutable
#90044 ·published 2006-07-17 08:13 UTC
rendered paste body
addLoadListener(initEvents);	       /* test */var myInterval;var interval = 500;/********/function initEvents()	{	var countries = document.getElementById("menuCountries");	var divcountries = document.getElementById("countries");	countries.onmouseover = function(){myInterval = setInterval(show(), interval);}; 	divcountries.onmouseover = function(){myInterval = setInterval(show(), interval);}; 	countries.onmouseout = function(){myInterval = setInterval(hide(), interval);}; 	divcountries.onmouseout = function(){myInterval = setInterval(hide(), interval);};	return true;	}function show()	{       var countries = document.getElementById("countries");       var currentHeight = countries.offsetHeight;	var targetHeight = Number(100);	var newHeight = currentHeight + 12;	countries.style.height = newHeight + "px";	if (countries.style.display == "none"){	countries.style.display = "block";	}	if (currentHeight > 99){		clearInterval(myInterval);	}	return false;}function hide(){       	var countries = document.getElementById("countries");	var currentHeight = countries.offsetHeight;	var targetHeight = "0";	var newHeight = currentHeight - 12;					countries.style.height = newHeight + "px";	if (currentHeight < "14"){		countries.style.display = "none";	}	if (currentHeight < 0){		clearInterval(myInterval);}return false;}function interva(currentHeight, targetHeight)	{	maxSpeed = "2";	minSpeed = "40";	interval = currentHeight / targetHeight * 50;	if (interval < maxSpeed)		{		interval = maxSpeed;		}	if (interval > minSpeed)		{		interval = minSpeed;		}	return interval;	}	function addLoadListener(fn){  if (typeof window.addEventListener != 'undefined')  {    window.addEventListener('load', fn, false);  }  else if (typeof document.addEventListener != 'undefined')  {    document.addEventListener('load', fn, false);  }  else if (typeof window.attachEvent != 'undefined')  {    window.attachEvent('onload', fn);  }  else  {    var oldfn = window.onload;    if (typeof window.onload != 'function')    {      window.onload = fn;    }    else    {      window.onload = function()      {        oldfn();        fn();      };    }  }}