$(document).ready(function() {
			
			if($("#email").val()!=''){
				$('label[for=email]').hide();
			}
			$('#email').focus(function(){
				$('label[for=email]').animate({opacity:'.25'}, 100);
				$("#btnSubscribe").removeClass('error loading success');
			});
			$('#email').blur(function(){
				if($("#email").val()==''){
					$('label[for=email]').css('display', 'block');
					$('label[for=email]').animate({opacity:'1'}, 100);
				}
			});
			$('#email').keyup(function(event){
				if(event.keyCode != 9 ){
					$('label[for=email]').animate({opacity:'0'}, 100, function(){
						$(this).css('display', 'none');
					});
				}
			});
	
			$("#newsletter").submit(function(){
				$("#btnSubscribe").addClass('loading');
				$.ajax({
					url: 'include/connect.php',
					type: 'POST',
					dataType: 'html',
					data: $("#newsletter").serialize(),
					success: function(msg) {
						if(msg=="Success"){
							$("#btnSubscribe").removeClass('error loading');
							$("#btnSubscribe").addClass('success');
							$('#notification').html("You will be the first! For any other issues please contact us on info@housemusic.ru");
							$('#notification').fadeIn('slow').delay(5000).fadeOut('slow'); 
							$('#text').delay(5000).fadeOut(800);
							$('#newsletter').delay(5000).fadeOut(800);
						} else{
							$("#btnSubscribe").addClass('error');
							$('#notification').html(msg);
							$('#notification').fadeIn('slow').delay(4000).fadeOut('slow'); 					
						}
						
					},
					error: function() {
						$("#btnSubscribe").addClass('error');
					}
				});
				return false;
			});
	});
