function rot( t, u, v ) {  return String.fromCharCode( ( ( t - u + v ) % ( v * 2 ) ) + u ); }  
function rot13( s ) {  var b = [], c, i = s.length,   a = 'a'.charCodeAt(), z = a + 26,   A = 'A'.charCodeAt(), Z = A + 26;  while(i--) {   c = s.charCodeAt( i );   if( c>=a && c<z ) { b[i] = rot( c, a, 13 ); }   else if( c>=A && c<Z ) { b[i] = rot( c, A, 13 ); }   else { b[i] = s.charAt( i ); }  }  return b.join( '' ); }  
function rot5( s ) {  var b = [], c, i = s.length,   a = '0'.charCodeAt(), z = a + 10;  while(i--) {   c = s.charCodeAt( i );   if( c>=a && c<z ) { b[i] = rot( c, a, 5 ); }   else { b[i] = s.charAt( i ); }  }  return b.join( '' ); }  
function rot135( s ) {  return rot13( rot5( s ) ); }

/* one day when IE is up to speed, use getElementsByClassName instead... */
function decodeLinks(bIncludeDivs)
{
	var links = document.getElementsByTagName('a');
	var re = /\S/i;
	for (var i = 0; i < links.length; i++)
	{
		var link = links[i];
		if (link.className != 'r13contact')
			continue;
		var pl = link.getAttribute('priv');
		var email = rot13(pl);
		link.href = 'mailto:' + email;
		if (link.innerHTML.match(re) == null)
		{
			link.innerHTML = email;
		}
	}

	// Bubble tooltip cannot handle a link in the tooltip so we use a div instead
	if(bIncludeDivs)
	{
		var links = document.getElementsByTagName('div');
		var re = /\S/i;
		for (var i = 0; i < links.length; i++)
		{
			var link = links[i];
			if (link.className != 'r13contact')
				continue;
			var pl = link.getAttribute('priv');
			var email = rot13(pl);
			link.href = 'mailto:' + email;
			if (link.innerHTML.match(re) == null)
			{
				link.innerHTML = email;
			}
		}
	}
}

