/*
 * phpGolem assorted functions
 * 
 * Copyright (C) 2003/2006
 * by Davide S. Casali
 * www.digitalhymn.com
 *
 */


/**
 * This swaps the current 'display' status of the item identified by a specific id
 *
 * @param	id string
 */
function switchdis(strdiv)
{
	if (document.getElementById)
	{
		// DOM3 = IE5+, NS6+, FF0.7+
		fdisplay = document.getElementById(strdiv).style.display;
		
		if (fdisplay == 'block')
		{
			document.getElementById(strdiv).style.display = 'none';
		}
		else
		{
			document.getElementById(strdiv).style.display = 'block';
		}
	}
}

/**
 * This function clears the anti-spam character from the specified email address and calls the
 * correct email program handler.
 *
 * @param	to email address
 * @param	optional subject
 * @param	optional alert box text
 */
function mailto(to, subject, boxtext)
{
	// defaults
	subject = subject || '';
	boxtext = boxtext || 'Press OK to send a mail to';
	
	// decrypt mail (spam sux)
	to = to.replace(/#/g, "@");
	to = to.replace(/~/g, ".");
	to = to.replace(/&/g, "");
	to = to.replace(/\*/g, "");
	to = to.replace(/ /g, "");

	if (confirm(boxtext + ' ' + to + ''))
	{
		window.location = "mailto:" + to + "?subject=" + subject;
	}
}