function validateEmail(email) {
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email))
		return false;
	else 
		return true;
}

function requestEventKey()
{
	new PopUp({
		title:'Your invitation email contains the event key. Enter your email address to request the event key from the host(s).',
		okText:'Email host(s) now for the event key',
		defaultInput: defInput,
		prompt:true,
		titleStyles: { 'color':'#707070', 'font-size':'1em', 'font-weight':'normal' },
		okAction: function( text ) {
			if ( text != '' && validateEmail(text))
				new Request.JSON({ url:'eventKey.do?event='+eventId, onComplete: function( resp ) {
					if ( resp.success )
						alert('Thank you, your request for the event\'s key has been to sent to the event host(s).');
					else
						alert('Could not send request. Please enter a valid email.');
				}}).POST({'command':'requestEventKey','email':text});
			else
				alert("invalid email, please try again");
		}
	}).show();	
}

