var isDOM = (document.getElementById  ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers          ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

w = screen.width;
h = screen.height;

function getRef(id)
	{
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
	}

function getSty(id) { return (isNS4 ? getRef(id) : getRef(id).style); } 

function forceImageLoad (theImage) { eval("document.images['"+theImage.name+"'].src='" + theImage.src + "' "); }

function ask_if_is_sure (prompt_text, url) { if (confirm(prompt_text)) self.location = url; }
function openWin(windowURL,windowName,windowFeatures) { return window.open(windowURL,windowName,windowFeatures); }

function PopWin (url,width,height,name)
	{
	var left = (w - width) / 2;
	var top = (h - height) / 2;
	options = "left="+left+",top="+top+",width="+width+",height="+height;
	options += ",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0,fullscreen=no"
	openWin (url, name, options );
	}

function PopWinScroll (url,width,height,name)
	{
	if (height <= 0) { var top = 10; var height = h-80; }
	else { var top = (h - height) / 2; }
	if (width <= 0) { var left = 10; var width = w-20; }
	else { var left = (w - width) / 2; }
	options = "left="+left+",top="+top+",width="+width+",height="+height;
	options +=",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0,fullscreen=no"
	openWin (url, name, options );
	}

function toggleDivDisplay(div) { s = getSty(div); s.display = (s.display == 'none') ? 'block' : 'none'; }
function hideDivDisplay(div) { s = getSty(div); s.display = 'none'; }
function showDivDisplay(div) { s = getSty(div); s.display = 'block'; }

function confirm_delete (a)
{
	var del = confirm("Are you sure you want to delete "+a+"?");
	
	if (del)
		return true ;
	else
		return false ;
}

function showHMenu (n)
{
	d = document.getElementById (n);
	d.style.visibility = 'visible';
	d.style.zIndex = 11;
}
function hideHMenu (n)
{
	d = document.getElementById (n);
	d.style.visibility = 'hidden';
	d.style.zIndex = 10;
}
function toggleHMenu (n)
{
	d = document.getElementById (n);
	d.style.visibility = (d.style.visibility == 'hidden' ) ? 'visible' : 'hidden';
}

