
function hasParent(dv, id) {
	if (!dv.parentNode) {return false;}
	if (dv.parentNode.id == id) {return dv.parentNode;}
	return hasParent(dv.parentNode, id);
}

function showTab(dv) {  
	var dvTabs = hasParent(dv, 'tabs');
	if (dvTabs) {dvTabs.className = dv.id;}
}
// clears top search box text
function clearSearchBox()
		{
	document.simple.query.value = "";
	}	
				
// create comments popup window
function popup (url, width, height, windowname) {
	if (!width) var width = 580;
	if (!height) var height = 420;
	if (!windowname) var windowname = 'popup_'+ new Date().getTime();
	if (url.indexOf('?') != -1) url += '&layout=popup';	else url += '?layout=popup';
	var left = screen.width/2 - width/2;
	var top = screen.height/2 - height/2;
	window.open(url, windowname, 'width='+width+',height='+height+',toolbar=0,resizable=1,scrollbars=1,left='+left+',top='+top);
	return false;
}

function showD() {
    // shows multiple layers
    // does not work in NS4 with nested layers
    var args = showD.arguments;
    for (var i=0; i<(args.length); i++) {
		if (document.getElementById) { 		// IE5, NS6
			if (document.getElementById(args[i])) document.getElementById(args[i]).style.display = 'inline';
		} else if (document.all) { 			// IE4
            if (document.all[args[i]]) document.all[args[i]].style.display = 'inline';
        } else if (document.layers) {		// NS4
            if (document.layers[args[i]]) document.layers[args[i]].display = 'inline';
        }
    }
}
function hideD() {
    // hides multiple layers
    // does not work in NS4 with nested layers
    var args = hideD.arguments;
    for (var i=0; i<(args.length); i++) {
		if (document.getElementById) { 		// IE5, NS6
			if (document.getElementById(args[i])) document.getElementById(args[i]).style.display = 'none';
		} else if (document.all) { 			// IE4
            if (document.all[args[i]]) document.all[args[i]].style.display = 'none';
        } else if (document.layers) {		// NS4
            if (document.layers[args[i]]) document.layers[args[i]].display = 'none';
        }
    }
}