/* dev/global.js */


var coupons = false;


window.addEvent('domready', function() {
	
	// elist input style
	if (window.webkit) {
		$('email').setStyle('top', '-5px');
	} else if (window.gecko) {
		$('email').setStyle('top', '-1px');
	}
	
	// alert coupon code
	$('coupon').addEvent('click', function(e) {
		showCoupons();
		return true;
	});

});


function noSpam(string) {
	window.location = 'mailto:'+string.split('[at]').join('@');
}


function joinElist() {
	var email = $('email').value;
	var post = 'email='+email;
	var url = '/dev/elist.php';
	var ajax = new Ajax(url, {method: 'post', update: 'message', postBody: post}).request();
}


function showCoupons() {
	if (coupons) {
		var message = "Enjoy an Eleven2 coupon code on us:\n\n";
		coupons.each(function(coupon) {
			message += "+ "+coupon+"\n";
		});
		alert(message);	
	}
}