
function openWin (url, parmWidth, parmHeight, scrollBars, paramName)
{
	var x = screen.width;
	var y = screen.height;
	var windowName = (paramName==null) ?  'win' + Math.floor (Math.random() * 9999) : paramName;
	var scroll = (scrollBars!=null) ? scrollBars : 1;
	
	var winWidth = (null == parmWidth) ? (x * 0.5) : parmWidth;
	var winHeight = (null == parmHeight) ? (y * 0.7) : parmHeight;
    var winLeft = (x - winWidth) / 2;
	var winTop = (y - winHeight) / 2;
	
	
	var openStr = 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=' + scroll + ',resizable=0,width=' + winWidth + ',height=' + winHeight +',left=' + winLeft + ',top=' + winTop;
	newWin = window.open (url, windowName, openStr);
	if(parseInt(navigator.appVersion) >= 4 && newWin != null)
 		newWin.focus();
 		
 	if (newWin == null) 
 	    alert('An attempt to open a new window has been denied. This may be the result of a pop-up blocker.\nPlease configure any pop-up blockers to allow pop-ups from this site.');
}

// ----------------------------------------------------------------

// Simulate clicking on the first child anchor tag found
function followLink (node) {
    var lnk = getFirstChildByTagName (node, "a");
    
    if (lnk != null)
        self.location.href = lnk.href;
}

// ----------------------------------------------------------------

function addClassName(el, name)
{
	// Remove the class name if it already exists in the element's class name
	// list.

	removeClassName(el, name);

	// Add the class name to the element's current list of class names.

	if (el.className.length > 0)
		name = " " + name;
	el.className += name;
}

// ----------------------------------------------------------------

function removeClassName(el, name)
{
	// If the element has no class names, exit.

	if (el.className == null)
		return;

	// Rebuild the list of class names on the element but exclude the specified
	// class name.

	var newList = new Array();
	var curList = el.className.split(" ");
	for (var i = 0; i < curList.length; i++)
		if (curList[i] != name)
			newList.push(curList[i]);
	el.className = newList.join(" ");
}

// ----------------------------------------------------------------

function cancelEvent(e)
{
  if (!e) e = event;
  e.cancelBubble = true;
}
