﻿function roll(obj, over)
{
	if (!obj)
		return
	
	if (over)
		src = '/Templates/media/images/' + obj.id + '_over.gif'
	else
		src = '/Templates/media/images/' + obj.id + '.gif'
	
	obj.src = src;
}

var menu_timer = null
var menu = null
var menu_body = null

function menu_open(obj)
{
	menu_hold()
	menu_close()

	menu = obj
	menu_body = document.getElementById(obj.id + '_body')
	
	menu_body.style.display = 'block'
}

function menu_close()
{
	if (!menu && !menu_body)
		return 

	menu_body.style.display = 'none'
	
	menu = null
	menu_body = null
}

function menu_start_close()
{
	menu_timer = window.setTimeout(menu_close, 25)
}

function menu_hold()
{
	if (menu_timer)
	{
		window.clearTimeout(menu_timer)
		menu_timer = null
	}
}

var submenu_timer = null
var submenu = null
var submenu_body = null

function submenu_open(obj)
{
	submenu_hold()
	submenu_close()

	submenu = obj
	submenu_body = document.getElementById(obj.id + '_body')
	submenu_parent = document.getElementById(obj.id)
	
	submenu_body.style.display = 'block'
	submenu_body.style.left = '200px'
	submenu_body.style.top = submenu_parent.offsetTop + 'px'
}

function submenu_close()
{
	if (!submenu && !submenu_body)
		return 

	submenu_body.style.display = 'none'
	
	submenu = null
	submenu_body = null
}

function submenu_start_close()
{
	submenu_timer = window.setTimeout(submenu_close, 25)
}

function submenu_hold()
{
	if (submenu_timer)
	{
		window.clearTimeout(submenu_timer)
		submenu_timer = null
	}
}

