$(document).ready(function()
{
   $('div.test').qtip(
   { 
	  // Since we're only creating one modal, give it an ID so we can style it
      id: 'modal',
      content: {
         text: $('div:hidden'),
         title: {
            text: 'Inscription newsletter',
            button: true
         }
      },
      position: {
		// ...at the center of the viewport
         my: 'center',
         at: 'center',
         target: $(window)
      },
      show: {
		 // Show it on click...
         event: 'click',
         solo: true, // ...and hide all other tooltips...
         modal: true // ...and make it modal
      },
      hide: false,
      style: 'ui-tooltip-light ui-tooltip-rounded'
   });
   
   if($('div.test').data('qtip') != undefined)
	   $('div.test').data('qtip').show();
  
  $('input.send').live('click', function() {
	var regEx = '^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$';
	var value = $('input.mail').val();
	var result = value.match(regEx);
	if(!result) {
		chaine = "L'adresse email entrée n'est pas valide.";
		$('div.flash').html('<br /><b><FONT COLOR="red">'+chaine+'</FONT></b><br />');
	} else {
		$('form.newsletterClass').submit();
	}
	
	
});
});
