function displ(ddd) {
	if (document.getElementById(ddd).style.display == 'none') {
		document.getElementById(ddd).style.display = 'block'
	} else {
		document.getElementById(ddd).style.display = 'none'
	}
}

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20517516-1']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

$(document).ready(function() {
    $('#email').keyup(function() {
        if (/^(\S+)@([a-z0-9-]+)(\.)([a-z]{2,4})(\.?)([a-z]{0,4})+$/.test($(this).val())) {
            $('#subscribeButton').removeAttr('disabled');
        } else { $('#subscribeButton').attr('disabled','disabled')}; 
    });
});

function subscribe() {
    $.ajax ({
        type: 'POST',
        url: '/ajaxhandler/subscribeForm.php',
        data: 'email=' + $('#email').val(),
        beforeSend: function() {
            $('#subscribeButton').attr('disabled','disabled');
        },
        success: function(data) {
            $('#subscribeBlock').html('<p>'+data+'</p>');
        },
        afterSend: function() {
            $('#subscribeButton').removeAttr('disabled');
        }
    });
    return false;
}
