function setOpacity(opacity_value, figure) {
 	document.getElementById(figure).style.opacity = opacity_value / 10;
 	document.getElementById(figure).style.filter = 'alpha(opacity=' + opacity_value * 50 + ')';
}

function fadePopup(figure) {
 	var opacity_value = 0;
	for( var i = 0 ; i <= 100 ; i++ ) {
		setTimeout( 'setOpacity(' + (i / 10) + ',"'+figure+'")' , 2 * i );}	
}

function openSlider(reveal, hide) {	
	document.getElementById(hide).style.display = "none";
	document.getElementById(reveal).style.display = "block";
	document.getElementById(reveal).style.opacity = 0;
	document.getElementById(reveal).style.filter = "alpha(opacity = 0)";
	fadePopup(reveal);
}

function closeSlider(hide, reveal) {	
	document.getElementById(hide).style.display = "none";
	document.getElementById(reveal).style.display = "block";
	document.getElementById(reveal).style.opacity = 0;
	document.getElementById(reveal).style.filter = "alpha(opacity = 0)";
	fadePopup(reveal);
}

// isChecked, classON, and classOFF are used on /programs/lectureship/lecturers.html 

function isChecked(link_type) {
if (document.js_control.toggle.checked == true) { 
	 classOFF(link_type);
	} else {
		classON(link_type);
		}
}

function classON(classtocontrol) {
	//Create Array of All HTML Tags
	var allHTMLTags=document.getElementsByTagName("*");

	//Loop through all tags using a for loop
	for (i=0; i<allHTMLTags.length; i++) {
	
	//Get all tags with the specified class name.
	if (allHTMLTags[i].className==classtocontrol) {
		allHTMLTags[i].style.display = "block";
		}
	}
}

function classOFF(classtocontrol) {
	//Create Array of All HTML Tags
	var allHTMLTags=document.getElementsByTagName("*");
	
	//Loop through all tags using a for loop
	for (i=0; i<allHTMLTags.length; i++) {
	
	//Get all tags with the specified class name.
	if (allHTMLTags[i].className==classtocontrol) {
		allHTMLTags[i].style.display = "none";
		}
	}

}
// isChecked, classON, and classOFF are used on /programs/lectureship/lecturers.html 

// print bot proof email link
function printEmail(address, domain) {
	var address;
	var domain;
	
	document.write('<a href="mailto:'+address+'@'+domain+'">'+address+'@'+domain+'</a>');
}

function printNameEmail(name, address, domain) {
	var name;
	var address;
	var domain;
	
	document.write('<a href="mailto:'+address+'@'+domain+'">'+name+'</a>');
}

function toggleText(img, text_block) {
	if (document.getElementById(text_block).style.display == "inline") 
		{
		document.getElementById(img).src = "/img/icon_rightarrow.gif";
		document.getElementById(text_block).style.display = "none";
		} else {
			document.getElementById(img).src = "/img/icon_downarrow.gif";
			document.getElementById(text_block).style.display = "inline";
			}
}
