
function emailClicked(link_id)
{
	var email = link_id;
	//document.getElementById(link_id).href = "mailto:" + decodeEmail(email);
	//document.getElementById(link_id).click();
	//document.getElementById(link_id).href = "javascript:void(0);";
	window.location = "mailto:" + decodeEmail(email);

	return false;
}
			

//**********************************
// algorithm 
//**********************************
function encodeEmail(email)
{
	var encodedEmail = '';
	var currChar;
	var currCode;
	var currCharCode;
	
	for (var i=0;i<email.length;i++)
	{
		currChar = email.charAt(i);
		currCode = newCode = currChar.charCodeAt(0);
		if ((i+1)%2 == 0)
			newCode = currChar.charCodeAt(0)*2;
		else
			if ((i+1)%3 == 0)
				newCode = currChar.charCodeAt(0)*3;
		
		newCode += 1;
		currCharCode = '0' + newCode; 
		if (currCharCode.length > 3)
			currCharCode = currCharCode.substr(1);
			
		encodedEmail = encodedEmail + currCharCode;
	}
		
	return encodedEmail;
}



function decodeEmail(email)
{
	var decodedEmail = '';
	var currChar;
	var currCode;
	var currCharCode;
	var i=0;
	var place = 0;
	while (i<email.length)
	{
		currCharCode = parseInt(email.substr(i,3),10);
		currCharCode -= 1;
		if ((place + 1)%2 == 0)
			currCharCode = currCharCode / 2;
		else
			if ((place + 1)%3 == 0)
				currCharCode = currCharCode / 3;
				
		currChar = String.fromCharCode(currCharCode)
					
		decodedEmail = decodedEmail + currChar;
		i = i + 3;
		place += 1;
	}
	
	return decodedEmail;
}