
var DHTML = (document.getElementById || document.all || document.layers);

var alertTimerId = 0;
var currentlayer = null;

function clearMenu ( )
{
    alertTimerId = setTimeout ( "clearCurrentMenu()", 2000 );
}

function clearCurrentMenu ( )
{
    if (currentlayer != null) {
        currentlayer.style.visibility = 'hidden';
        currentlayer = null;
	};
	if (alertTimerId != 0) clearTimeout ( alertTimerId );
	alertTimerId = 0;
}



function show_layer(obj,flag)
{
	if (!DHTML) return;
	clearCurrentMenu();
	var x = new getObj(obj);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
	currentlayer = x;
}

function flip_show_layer(obj)
{
	if (!DHTML) return;
	var x = new getObj(obj);
	if (x.style.visibility != 'visible') {x.style.visibility = 'visible'}
	else {x.style.visibility = 'hidden'};
}

function is_layer_visable(obj)
{
	if (!DHTML) return;
	var x = new getObj(obj);
	if (x.style.visibility != 'visible') {return false};
	return true;
}


function getObj(name)
{
  if (document.all)
  {
	this.obj = document.all[name];
	this.objtype = typeof this.obj;
	if (!(this.objtype =="undefined"))
	{
		this.style = document.all[name].style;
    	this.objWidth = document.all[name].offsetWidth;
	    this.objHeight = document.all[name].offsetHeight;
	};
  }  else if (document.getElementById)
  {
	this.obj = document.getElementById(name);
this.objtype = typeof this.obj;
	if (!(this.obj)) this.objtype ="undefined";
	if (this.obj)
	{
	this.style = document.getElementById(name).style;
	this.objHeight = document.defaultView.getComputedStyle(this.obj, "").getPropertyValue("height");
		this.objWidth = document.defaultView.getComputedStyle(this.obj, "").getPropertyValue("width");
	};
  }  
  else if (document.layers)
  {
   	this.obj = document.layers[name];
	this.objtype = typeof this.obj;
	if (!(this.objtype =="undefined"))
	{
		this.style = document.layers[name];
		this.objWidth = document.layers[name].clip.width;
		this.objHeight = document.layers[name].clip.height;
	};
 }
}

function urlencode(str) {
	var result = "";

	for (i = 0; i < str.length; i++) {
		if (str.charAt(i) == " ") result += "+";
		else result += str.charAt(i);
	}

	return escape(result);
}

function show_question_div(obj,flag)
{
	if (!DHTML) return;
	var x = new getObj(obj);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
}