var openMenu=null;
var menuTimer=null;

function el(elm)
	{
	var ret=document.getElementById(elm);
	if (ret)
		{ return ret; }
	else
		{ return null; }
	}
	
function hideshow(elm,vis)
	{
	if (!elm) { return; }
	if ((elm.style.display!=vis))
		{ elm.style.display=vis; }
	}
	
function startTimeout(dur)
	{ menuTimer= setTimeout("hideMenu()", dur); }
	
function resetTimeout()
	{
	if (menuTimer) clearTimeout(menuTimer);
	menuTimer = null;
	}
	
function hideMenu()
	{
	if (openMenu)
		{ hideshow(openMenu, 'none'); }
	openMenu=null;
	} 

function showMenu(id)
	{
	var newMenu=el("ddm" + id);
	if (newMenu==openMenu) { return;}
	if (!newMenu) { return; }
	if (openMenu)
		{ hideMenu(); }
	openMenu=newMenu;
	hideshow(openMenu, "block"); 
	resetTimeout();
	}
	
function openPhoto(i)
	{
	artPhoto = window.open("photo.asp?aid="+i, "artPhoto", "resizable=yes,status=no,scrollbars=yes, width=100, height=100");
	artPhoto.focus();
	}
	
function openQT(i)
	{
	artVideo = window.open("video.asp?vid="+i, "artVideo", "resizable=no, status=no, scrollbars=no, width=200, height=165");
	artVideo.focus();
	}
	
function popWindow() 
	{
	// new url,winname, width, height
	args=popWindow.arguments;
	//sizestr='width='+args[2];
	w=args[2];
	h=args[3];
	s=args[4];
	r=args[5];
	if (s=='scroll')
		{scrollbar=",scrollbars=yes";}
	else
		{
		scrollbar="";
		if (w>=screen.width)
			{ 
			w=screen.width-100; 
			scrollbar=",scrollbars=yes";
			}
		if (h>=screen.height)
			{ 
			h=screen.height-150; 
			scrollbar=",scrollbars=yes";
			}
		}
	if (r=='resize')
		{scrollbar+=",resizable=yes";}
	sizestr='width='+w;
	sizestr+=',height='+h;
	midx=(screen.width - w) / 2;
	midy=(screen.height - h) / 2;
	sizestr+=',left='+midx;
	sizestr+=',top='+midy;
	sizestr+=scrollbar;
  	popupWin = window.open(args[0], args[1], sizestr)
	}
	
