function vIE(){return (navigator.appName=='Microsoft Internet Explorer')?parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]):10;}

$(document).ready(function() {
$('#innerRight').cycle({
    fx:    'fade', 
    timeout: 6000,
    startingSlide:  (Math.floor(Math.random() * 3 + 1) - 1)
});
$('#box1').cycle({
    fx:    'fade', 
    timeout: 6000,
    startingSlide:  (Math.floor(Math.random() * 3 + 1) - 1)
});

jQuery.extend(jQuery.validator.messages, { required: '', email: '' });

$("#emailAlert").validate({
 submitHandler: function(form) {
   saveEmail();
 }
});

function saveEmail() {
jQuery.ajax({
	type: "POST",
	url: "processEmail.php?e=" + $('#emailInput').val(),
	beforeSend: function(request) {},
	success: function(data) {
		if(data != 'error' && data != 'exists') {
			$('#eaMsg').empty().css('text-align','center').css('padding-right','15px').html(data);
		} 
		if(data == 'exists') {
			jAlert('This email address is already in our system. Please use a different email address.', 'Email Alert Error');			
		}
		if(data == 'error') {
			jAlert('An error occured saving your email address! Please try again.', 'Email Alert Error');
		}
	},
	error: function(request, status, error) {
		jAlert('An error occured saving your email address! Please try again.', 'Email Alert Error');
	}
});
}
})
