$(function() {

	

	// EMAIL POPUP
	$('#emailAlertContainer').click(function(){
		$("#emailAlert").modal({
			minWidth: 450,
			minHeight: 500
		});
		return false;
	});

	$('#emailAlertContainer').hover(
		function(){
			$('img', 'a.emailAlertLink').attr('src', 'img/robotstore/email-alerts-hov.jpg');
		},
		function(){
			$('img', 'a.emailAlertLink').attr('src', 'img/robotstore/email-alerts.jpg');			
		}
	);
	
	$('a.closeBtn', '#emailAlert').click(function(){
		$.modal.close();		
		return false;
	});
	

	$("#subscribe-btn").click(function(){
		$(this).parents('form').submit();
		return false;
	})


	
    // FORM VALIDATION
	$("#emailAlertForm").validate({
		errorElement: "p",
	  	wrapper: "li",
		errorPlacement: function(error, element) {
			element.parents('li').after(error);
   		},
		rules: {
			email: {
				required: true,
				email: true
			},
			'Customer Type': {
				required: true
			}
		},
		messages: {
		    'Customer Type': "Please select a customer type",
		    email: {
		        required: "Please provide your email address",
       		    email: "Your email address must be in the format of name@domain.com"
		    }
	    }		
	});
	
	

	
});


