
function row2height() {
	var elm = document.getElementById('row2');
	elm.style.height = 'auto';
	var x = elm.offsetHeight;
	elm.style.height = x + "px";
}

function row4height() {
	var elm = document.getElementById('row4');
	elm.style.height = 'auto';
	var x = elm.offsetHeight;
	elm.style.height = x + "px";
}

function bodyonload() {
	row2height();
	row4height();
}

function getElem(elm, sens)
{
	do
	{
		elm = (sens > 0) ? elm.nextSibling : elm.previousSibling;
	}
	while (elm.nodeType != 1 && elm != document.body);
	return (elm);
}

function has_attribute(element, attribute) {
    var attributeNode = element.getAttributeNode(attribute);
    if (attributeNode && attributeNode.specified)
           return true;
    return false;
}


function change_class(link, elm, condition)
{
	if (has_attribute(elm, "class") && elm.className.indexOf("tree") >= 0)
	{
		elm.setAttribute("class", (condition > 0) ? "tree replie" : "tree deplie");
		elm.setAttribute("className", (condition > 0) ? "tree replie" : "tree deplie");
		link.innerHTML = (condition > 0) ? '[+]' : '[-]';
	}
}

function change_class_abstract(link, elm, condition)
{
	if (has_attribute(elm, "class") && elm.className.indexOf("tree") >= 0)
	{
		elm.setAttribute("class", (condition > 0) ? "tree replie" : "tree deplie");
		elm.setAttribute("className", (condition > 0) ? "tree replie" : "tree deplie");
		link.innerHTML = (condition > 0) ? '[+]' : '[-]';
	}
}


function toggle_pliage(link, position)
{
	var elm = link
	iteration = (position >0) ? position : -position;
	do {
		elm = getElem(elm, position);
		iteration = iteration - 1;
	} while (iteration > 0);

	change_class(link, elm, elm.className.indexOf("deplie"));
	return (false);
}


function toggle_pliage_abstract(link, position, force)
{
	var elm = link
	iteration = (position >0) ? position : -position;
	do {
		elm = getElem(elm, position);
		iteration = iteration - 1;
	} while (iteration > 0);

	
	if(force == null) {
		condition = elm.className.indexOf("deplie");
	} else condition = force;
	change_class_abstract(link, elm, condition);
}


function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function switch_all_abstracts(state)
{
	var tableElems = getElementsByClass("presentationlist",null,"table");
	var elsLen = tableElems.length;
	for ( i = 0; i < elsLen; i++) {
	 var linkElements = getElementsByClass("viewabstract",tableElems[i],"a");
	 linklen = linkElements.length;
	 for(j = 0; j < linklen; j++) {
		toggle_pliage_abstract(linkElements[j],1,state);		
	 }
	}

}


