var mainrules = {

	'body' : function(el)
	{
		if ($('bad-email-error')) {
			alert('Sorry, but it does not look like an email at all. Our secret service advises you to use your real email instead ;)');
		}
		
		if ($('email-exists-error')) {
			alert('Hmm, it seems that we already have your email. No need to worry, you will get our news.');
		}
	},
		
	'.popup' : function(el)
	{
		/**
		 * If A has a class "popup" - open link in new windows
		 */
		el.handleClick = function(event)
		{
			event.stop();
			window.open(el.href, 'popup');
		}

		el.observe('click', el.handleClick);
	},

	'form#signup' : function(el)
	{
		el.handleSubmit = function(e)
		{
			if ($F('email').empty()) {
				e.stop();
				alert('Whaaaat? No email? Are you sure you have no email address to enter?');
			}
			if ($F('email') == 'fuck you') {
				e.stop();
				alert('Fuck to you too, sir!');
			}
			if ($F('email') == 'hello') {
				e.stop();
				alert('Hi to you too, sir! Send us an email - hello@trackdebt.com.');
			}
		}
		
		el.observe('submit', el.handleSubmit);
	}
};
Behaviour.register( mainrules );
