/**
* dsNav.js: common functions for use with the Divided Sky website. Includes
* email address decoding.
* by: Rich Banister
*/

/**
* Convert an encoded address and open a mailto using
* that address.
*/
function unencAndMail(encoded_addy){
	open("mailto:"+dsAddressUnencode(encoded_addy));
}

/**
* Take an address in the form "user at domain dot tldomain" and 
* convert it to user@domain.tldomain. Encoding addresses like this
* supposedly (according to me) prevents spamage. But I'm not so
* sure.
*/
function dsAddressUnencode(address){
	//basically we want to take an address that will be in the form:
	//	<name> at <server> dot <domain>
	//and we need it to look like:
	//	name@server.domain

	var temp = "";
	//find occurence of " at "
	i = address.indexOf(" at ");
	//change to "@"
	temp = temp + address.substring(0,i) + "@"

	//find occurence of " dot "
	j = address.indexOf(" dot ");
	//change to "."
	temp = temp + address.substring(i+4,j) + ".";

	//terminate string	
	temp = temp + address.substring(j+5, address.length);
	return temp;
}
