

/**
 * Fix email addresses!
 * @date: 		28 August 2006
 * @author: 	aluis@corefactor.pt
 */
 
 function fixEmails() {
	
	var as = window.document.getElementsByTagName( "a" );
	for( i=0;i<as.length;i++ ) {
			if( as[i].href.match( /mailto/ ) && as[i].className.match(/reversed/) ) {
					mail_reversed = as[i].innerHTML;

					mail_ok = "";
					salt ="REVERSETHIS";
					
					for( j = mail_reversed.length - salt.length-1;j>=0;j--) {
						if( mail_ok.charAt)
							mail_ok += mail_reversed.charAt( j );
						else
							mail_ok += mail_reversed[j];
					}

					as[i].innerHTML = mail_ok;
					as[i].href = "mailto:" + mail_ok;
			}
	}
	
 }


function hideTalks () {
		
		invited = window.document.getElementById("invitedspeakers_page");
		if( invited ) {

			h4s = invited.getElementsByTagName("h4");
			
			for(i=0;i<h4s.length;i++) {
				h4 = h4s[i];
				txt = " &larr; click title for details";

				if( !h4.innerHTML.match ( /Separation Logic Semantics for Communicating Processes/ ) )
					h4.innerHTML += txt;
			}
			

			ps = invited.getElementsByTagName("p");

			for( i=0;i<ps.length;i++ ) {
					p=ps[i];

					if ( p.className.match( /tohide/ ) )
						p.style.display = "none";
			}
			
			
		}
}

var lastTalk = null;

function showTalk(id) {

		if( lastTalk && lastTalk.parentNode.id != id)
			lastTalk.style.display = "none";
			
		div = window.document.getElementById(id);
		if( div ) {
			ps = div.getElementsByTagName("p");
			p = ps[0];
			if( p.style.display != "block" )
				p.style.display = "block";
			else
				p.style.display = "none";
			lastTalk = p;
		}
}
function hijackTalks() {
	
		invited = window.document.getElementById("invitedspeakers_page");
		if( invited ) {

			as = invited.getElementsByTagName("a");
			
			for(i=0;i<as.length;i++) {
					a = as[i];
					if( a.className.match( /talk-title/ ) ) {
							a.onclick = function () {
									showTalk( this.parentNode.parentNode.id );
									return false;
							}
					}
					
			}

		}
	
}

window.onload = function() {
	fixEmails();
	hideTalks();
	hijackTalks();
	
	// add JS functions to run on Window.onLoad event
}