/*
 * mathopt.js
 *
 * javascript functions for the mathopt web site
 * Michael Engelhart - January 14, 2010
 */

function less(obj)
{
	handle = document.getElementById(obj);
	if (typeof(handle.show_details) != "undefined" && handle.show_details == true)
	{
		Effect.SlideUp(obj+"Details", { duration: 0.5 });
		handle.show_details = false;
		handle_name = document.getElementById(obj+"Name"); handle_name.style.fontWeight = "normal";
	}
	return false;
}

function more(obj)
{
	handle = document.getElementById(obj);
	if (typeof(handle.show_details) == "undefined" || handle.show_details == false)
	{
		Effect.SlideDown(obj+"Details", { duration: 0.5 });
		handle_name = document.getElementById(obj+"Name"); handle_name.style.fontWeight = "bold";
		handle.show_details = true;
	}
	return false;
}

function details(obj)
{
	handle = document.getElementById(obj);

	if (typeof(handle.show_details) != "undefined" && handle.show_details == true)
	{
		less(obj);
		document.getElementById (obj+"OptionalLink").innerHTML = 'more <img src="http://mathopt.uni-hd.de/IMAGES/more.gif" width="13" height="13" alt="">';
	}
	else if (typeof(handle.show_details) == "undefined" || handle.show_details == false)
	{
		more(obj);
		document.getElementById (obj+"OptionalLink").innerHTML = 'less <img src="http://mathopt.uni-hd.de/IMAGES/less.gif" width="13" height="13" alt="">';
	}

	return false;
}

/*function toggleInfo(articleid,info) {

	var entry = document.getElementById(articleid);
	var add = document.getElementById('add_'+articleid);
	var exp = document.getElementById('exp_'+articleid);
	var mad = document.getElementById('mad_'+articleid);
	var expLink = document.getElementById('expLink_'+articleid);
	var addLink = document.getElementById('addLink_'+articleid);
	
	if (add && info == 'address') {
		if(add.className.indexOf('address') != -1) {
		    if(add.className.indexOf('noshow') == -1) {
                add.className = 'address noshow';
                addLink.innerHTML = 'Show Details';
            } else {
                add.className = 'address';
                addLink.innerHTML = 'Hide Details';
            }
		}
	} else if (exp && info == 'expertise') {
		if(exp.className.indexOf('expertise') != -1) {
		    if(exp.className.indexOf('noshow') == -1) {
                exp.className = 'expertise noshow';
                expLink.innerHTML = 'Show Details';
            } else {
                exp.className = 'expertise';
                expLink.innerHTML = 'Hide Details';
            }
		}
	} else if (mad && info == 'mailaddress') {
		if(mad.className.indexOf('mailaddress') != -1) {
		mad.className.indexOf('noshow') == -1?mad.className = 'mailaddress noshow':mad.className = 'mailaddress';
		}		
	} else { 
		return;
	}

	// check if one or the other is available
	var addshow = false;
	var expshow = false;
	var madshow = false;
	(add && add.className.indexOf('noshow') == -1)? addshow = true: addshow = false;
	(exp && exp.className.indexOf('noshow') == -1)? expshow = true: expshow = false;	
	(mad && mad.className == 'madtex')? madshow = true: madshow = false;
	
	// highlight original entry
	if(entry) {
		if (addshow || expshow || madshow) {
		entry.className = 'entry highlight show';
		} else {
		entry.className = 'entry show';
		}		
	}
	
	// When there's a combination of the three showing, need to add class for correct styling
	if(addshow) {
		(expshow||madshow)?add.className = 'address nextshow':add.className = 'address';
	} 
	if (expshow) {
		madshow?exp.className = 'expertise nextshow': exp.className = 'expertise';
	}
}*/