Index: extensions/Piwecard/admin/admin_configuration.php
===================================================================
--- extensions/Piwecard/admin/admin_configuration.php	(revision 20250)
+++ extensions/Piwecard/admin/admin_configuration.php	(revision 20254)
@@ -10,4 +10,13 @@
 	$configuration = array();
 
+	$configuration['nb_max_recipients'] = $_POST['ecard_nb_max_recipients'];
+	
+	if (intval($configuration['nb_max_recipients']) == 0) {
+		$configuration['nb_max_recipients'] = 1;
+		$piwecard->config['nb_max_recipients'] = $configuration['nb_max_recipients'];
+	} else {
+		$piwecard->config['nb_max_recipients'] = intval($configuration['nb_max_recipients']);
+	}
+	
 	$configuration['validity'] = $_POST['ecard_validity_list'];
 	$configuration['validity'] = explode(',', $configuration['validity']);
@@ -103,4 +112,6 @@
 }
 
+$template->assign('ecard_nb_max_recipients',((isset($configuration['nb_max_recipients'])) ? $configuration['nb_max_recipients'] : $piwecard->config['nb_max_recipients']));
+
 if (isset($errors['validity'])) {
 	$piwecard->config['validity'] = null;
Index: extensions/Piwecard/admin/template/admin_configuration.tpl
===================================================================
--- extensions/Piwecard/admin/template/admin_configuration.tpl	(revision 20250)
+++ extensions/Piwecard/admin/template/admin_configuration.tpl	(revision 20254)
@@ -79,10 +79,11 @@
 
 function piwecard_checkForm(form) {
-	var guestEmailOK = piwecard_checkField(form.ecard_default_guest_email, 1, true);
-	var subjectOK = piwecard_checkField(form.ecard_email_subject, 0);
-	var messageTextOK = piwecard_checkField(form.ecard_email_message_text, 0);
-	var messageHTMLOK = piwecard_checkField(form.ecard_email_message_html, 0);
-	
-	if(guestEmailOK && subjectOK && messageTextOK && messageHTMLOK)
+	var nbMaxRecipientsOK = piwecard_checkField(form.ecard_nb_max_recipients, 2, 'inline');
+	var guestEmailOK = piwecard_checkField(form.ecard_default_guest_email, 1, 'block', true);
+	var subjectOK = piwecard_checkField(form.ecard_email_subject, 0, 'block');
+	var messageTextOK = piwecard_checkField(form.ecard_email_message_text, 0, 'block');
+	var messageHTMLOK = piwecard_checkField(form.ecard_email_message_html, 0, 'block');
+	
+	if(nbMaxRecipientsOK && guestEmailOK && subjectOK && messageTextOK && messageHTMLOK)
 		return true;
 	else
@@ -120,4 +121,9 @@
 			<legend>{'piwecard_configuration'|@translate}</legend>
 			<div class="ecard_form_line">
+				<label for="ecard_nb_max_recipients">{'piwecard_nb_max_recipients'|@translate} </label>
+				<input type="text" maxlength="3" size="3" name="ecard_nb_max_recipients" id="ecard_nb_max_recipients" value="{$ecard_nb_max_recipients}" />
+				<span class="ecard_error" id="ecard_nb_max_recipients_error">{'piwecard_error'|@translate} {'piwecard_error_integer'|@translate}</span>
+			</div>
+			<div class="ecard_form_line">
 				{'piwecard_validity_list'|@translate}
 				<span class="ecard_error" id="ecard_validity_list_error" style="{$ecard_errors.validity.style_error_text}">{'piwecard_error'|@translate} {'piwecard_error_validity_list'|@translate}</span>
@@ -179,5 +185,4 @@
 			</div>
 		</fieldset>
-
 		<fieldset>
 			<legend>{'piwecard_email_configuration'|@translate}</legend>
@@ -208,17 +213,17 @@
 			</div>
 			<div class="ecard_form_line ecard_email_config">
-				<label for="ecard_default_guest_email">{'piwecard_default_guest_email'|@translate}</label><span class="ecard_error" id="ecard_default_guest_email_error" style="{$ecard_errors.default_guest_email.style_error_text}">{'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</span>
+				<label for="ecard_default_guest_email">{'piwecard_default_guest_email'|@translate}</label><span class="ecard_error" id="ecard_default_guest_email_error" style="{$ecard_errors.default_guest_email.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</span>
 				<input type="text" maxlength="50" name="ecard_default_guest_email" id="ecard_default_guest_email" {$ecard_errors.default_guest_email.style_error_input} value="{$ecard_default_guest_email}" onblur="piwecard_checkField(this, 1, true);" />
 			</div>
 			<div class="ecard_form_line ecard_email_config">
-				<label for="ecard_email_subject">{'piwecard_email_subject'|@translate}*</label><span class="ecard_error" id="ecard_email_subject_error" style="{$ecard_errors.email_subject.style_error_text}">{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>
+				<label for="ecard_email_subject">{'piwecard_email_subject'|@translate}*</label><span class="ecard_error" id="ecard_email_subject_error" style="{$ecard_errors.email_subject.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>
 				<input type="text" maxlength="255" name="ecard_email_subject" id="ecard_email_subject" {$ecard_errors.email_subject.style_error_input} value="{$ecard_email_subject}" />
 			</div>
 			<div class="ecard_form_line ecard_email_config">
-				<label for="ecard_email_message_text">{'piwecard_email_message_text'|@translate}*</label><span class="ecard_error" id="ecard_email_message_text_error" style="{$ecard_errors.email_message.text.style_error_text}">{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>
+				<label for="ecard_email_message_text">{'piwecard_email_message_text'|@translate}*</label><span class="ecard_error" id="ecard_email_message_text_error" style="{$ecard_errors.email_message.text.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>
 				<textarea name="ecard_email_message_text" id="ecard_email_message_text" {$ecard_errors.email_message.text.style_error_input}>{$ecard_email_message_text}</textarea>
 			</div>
 			<div class="ecard_form_line ecard_email_config">
-				<label for="ecard_email_message_html">{'piwecard_email_message_html'|@translate}*</label><span class="ecard_error" id="ecard_email_message_html_error" style="{$ecard_errors.email_message.html.style_error_text}">{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>
+				<label for="ecard_email_message_html">{'piwecard_email_message_html'|@translate}*</label><span class="ecard_error" id="ecard_email_message_html_error" style="{$ecard_errors.email_message.html.style_error_text}"> {'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</span>
 				<textarea name="ecard_email_message_html" id="ecard_email_message_html" {$ecard_errors.email_message.html.style_error_input}>{$ecard_email_message_html}</textarea>
 			</div>
Index: extensions/Piwecard/admin/template/admin_management.tpl
===================================================================
--- extensions/Piwecard/admin/template/admin_management.tpl	(revision 20250)
+++ extensions/Piwecard/admin/template/admin_management.tpl	(revision 20254)
@@ -4,5 +4,5 @@
 {literal}
 function piwecard_checkForm(form) {
-	var nbPageOK = piwecard_checkField(form.ecard_nb_ecard_page, 2);
+	var nbPageOK = piwecard_checkField(form.ecard_nb_ecard_page, 2, 'inline');
 	
 	if(nbPageOK)
Index: extensions/Piwecard/css/admin.css
===================================================================
--- extensions/Piwecard/css/admin.css	(revision 20250)
+++ extensions/Piwecard/css/admin.css	(revision 20254)
@@ -43,4 +43,7 @@
 }
 
+#ECardAdminConfiguration  #ecard_nb_max_recipients {
+	text-align: center;
+}
 
 #ECardAdminManagement .ecard_line {
Index: extensions/Piwecard/include/piwecard.class.php
===================================================================
--- extensions/Piwecard/include/piwecard.class.php	(revision 20250)
+++ extensions/Piwecard/include/piwecard.class.php	(revision 20254)
@@ -252,5 +252,6 @@
 							'recipient_email' 	=> l10n('piwecard_recipient_email'),
 							'copy'				=> $this->config['sender_copy'] ? 'checked="checked"' : '',
-							'changemail' 		=> (!isset($user['email']) OR $this->config['sender_email_change']) ? '' : 'disabled="disabled"'
+							'changemail' 		=> (!isset($user['email']) OR $this->config['sender_email_change']) ? '' : 'disabled="disabled"',
+							'nb_max_recipients' => $this->config['nb_max_recipients'],
 							)
 					);
@@ -414,4 +415,8 @@
 	//Send an email
 	function mail($email_infos) {
+		global $conf, $page, $lang_info;
+		$template_mail = new Template(PIWECARD_MAIL_PATH.'template');
+		$smarty = $template_mail->smarty;
+		
 		$from = $email_infos['from_name']." <".$email_infos['from_email'].">";
 		$subject = encode_mime_header(trim(preg_replace('#[\n\r]+#s', '', $email_infos['subject'])));
@@ -433,8 +438,16 @@
 			$headers .= 'Content-Transfer-Encoding: 8bit'."\n";
 			$message .= $email_infos['message']['text'];
+			$smarty->assign(array(
+									'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'],
+									'GALLERY_URL' => get_absolute_root_url(),
+									'MAIL' => get_webmaster_mail_address(),
+								)
+			);
+			$message .= $smarty->fetch('mail_text.tpl');
+			$message = utf8_decode($message);
 		} else {
 			$headers .= 'MIME-Version: 1.0'."\n";
 			$headers .= 'Content-Type: multipart/alternative; boundary="'.$boundary.'"';
-			$message  .= 'This is a multi-part message in MIME format'."\n\n";
+			$message .= 'This is a multi-part message in MIME format'."\n\n";
 			$message .= '--'.$boundary."\n";
 			$message .= 'Content-Type: text/plain; charset="'.get_pwg_charset().'"'."\n";
@@ -444,5 +457,15 @@
 			$message .= 'Content-Type: text/html; charset="'.get_pwg_charset().'"'."\n";
 			$message .= 'Content-Transfer-Encoding: binary;'."\n\n";
-			$message .= $email_infos['message']['html']."\n\n";
+			$smarty->assign(array(
+									'CONTENT_ENCODING' => get_pwg_charset(),
+									'GALLERY_URL' => get_absolute_root_url(),
+									'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'],
+									'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
+									'MAIL' => get_webmaster_mail_address(),
+									'MESSAGE_HTML' => $email_infos['message']['html'],
+								)
+			);
+			$message .= $smarty->fetch('mail_html.tpl');
+			$message .= "\n\n";
 			$message .= '--'.$boundary."--\n";
 		}
Index: extensions/Piwecard/install/default_values.inc.php
===================================================================
--- extensions/Piwecard/install/default_values.inc.php	(revision 20250)
+++ extensions/Piwecard/install/default_values.inc.php	(revision 20254)
@@ -9,4 +9,5 @@
 
 //Configuration parameters
+$ecard_default_values['nb_max_recipients'] = 5;						//Max number of recipients
 $ecard_default_values['validity'] = array('0', '5', '10', '15');	//Number of days a card is available
 $ecard_default_values['validity_default'] = '10'; 					//Default number of days a card is available
Index: extensions/Piwecard/js/piwecard.js
===================================================================
--- extensions/Piwecard/js/piwecard.js	(revision 20250)
+++ extensions/Piwecard/js/piwecard.js	(revision 20254)
@@ -1,8 +1,9 @@
-function piwecard_checkField(element, elementType, nullIsOK) {
+function piwecard_checkField(element, elementType, display, nullIsOK) {
 	var TEXT = 0;
 	var EMAIL = 1;
 	var NUMBER = 2;
 	
-	optionalArg = (typeof nullIsOK === "undefined") ? false : nullIsOK;
+	nullIsOK = (typeof nullIsOK === "undefined") ? false : nullIsOK;
+	display = (typeof display === "undefined") ? 'inline' : display;
 	
 	if (nullIsOK && element.value === '') {
@@ -12,10 +13,8 @@
 			case TEXT:
 				if (element.value == '' || element.className.indexOf("ecard_defaultTextActive") > 0) {
-					document.getElementById(element.id+'_error').style.display = 'block';
-					element.className += " ecard_error_input";
+					add_error_style(element, display);
 					return false;
 				} else {
-					document.getElementById(element.id+'_error').style.display = 'none';
-					element.className = element.className.replace( /(?:^|\s)ecard_error_input(?!\S)/g , '');
+					remove_error_style(element);
 					return true;
 				}
@@ -24,10 +23,8 @@
 				var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 				if (!filter.test(element.value)) {
-					document.getElementById(element.id+'_error').style.display = 'block';
-					element.className += " ecard_error_input";
+					add_error_style(element, display);
 					return false;
 				} else {
-					document.getElementById(element.id+'_error').style.display = 'none';
-					element.className = element.className.replace( /(?:^|\s)ecard_error_input(?!\S)/g , '');
+					remove_error_style(element);
 					return true;
 				}
@@ -35,13 +32,12 @@
 			case NUMBER:
 				if (element.value == '') {
-					document.getElementById(element.id+'_error').style.display = 'inline';
-					element.className += " ecard_error_input";
+					add_error_style(element, display);
 					return false;
 				} else {
 					if (parseFloat(element.value) % 1 == 0){
+						remove_error_style(element);
 						return true;
 					} else {
-						document.getElementById(element.id+'_error').style.display = 'inline';
-						element.className += " ecard_error_input";
+						add_error_style(element, display);
 						return false;
 					}
@@ -54,2 +50,12 @@
 	}
 }
+
+function add_error_style(element, display) {
+	document.getElementById(element.id+'_error').style.display = display;
+	element.className += " ecard_error_input";
+}
+
+function remove_error_style(element) {
+	document.getElementById(element.id+'_error').style.display = 'none';
+	element.className = element.className.replace( /(?:^|\s)ecard_error_input(?!\S)/g , '');
+}
Index: extensions/Piwecard/language/en_UK/plugin.lang.php
===================================================================
--- extensions/Piwecard/language/en_UK/plugin.lang.php	(revision 20250)
+++ extensions/Piwecard/language/en_UK/plugin.lang.php	(revision 20254)
@@ -29,4 +29,5 @@
 //admin_configuration.tpl
 $lang['piwecard_configuration'] 				= 'Standard configuration';
+$lang['piwecard_nb_max_recipients']				= 'Maximum number of recipients by e-card';
 $lang['piwecard_validity_list']					= 'List of validity periods in days (0 for unlimited)';
 $lang['piwecard_ecard_derivative']				= 'Choose the size of the image in the e-card:';
Index: extensions/Piwecard/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/Piwecard/language/fr_FR/plugin.lang.php	(revision 20250)
+++ extensions/Piwecard/language/fr_FR/plugin.lang.php	(revision 20254)
@@ -29,4 +29,5 @@
 //admin_configuration.tpl
 $lang['piwecard_configuration'] = 'Configuration de base';
+$lang['piwecard_nb_max_recipients']	= 'Nombre maximum de destinataire par carte virtuelle';
 $lang['piwecard_validity_list'] = 'Liste des durées de validité en jours (0 pour illimité)';
 $lang['piwecard_ecard_derivative'] = 'Choix de la taille de l\'image dans la carte virtuelle :';
Index: extensions/Piwecard/mail/template/mail_html.tpl
===================================================================
--- extensions/Piwecard/mail/template/mail_html.tpl	(revision 20254)
+++ extensions/Piwecard/mail/template/mail_html.tpl	(revision 20254)
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="{$lang_info.code}" dir="{$lang_info.direction}">
+<head>
+<title>Piwigo Mail</title>
+<meta http-equiv="Content-Type" content="text/html; charset={$CONTENT_ENCODING}">
+<style>
+{literal}
+body {
+	font-family: Univers, Helvetica, Optima;
+	font-size:12px;
+	margin:0px;
+	padding:0px;
+	background-color: #DDDDDD;
+}
+#the_page {
+	margin: 0px;
+	padding: 0px;
+	text-align: left;
+}
+#content {
+	margin: 0px;
+	padding: 30px 0px 0px 30px;
+	width: 732px;
+}
+hr {
+	width: 632px;
+	margin-left: 0;
+}
+#copyright {
+	font-size: 10px;
+	margin: 0px;
+	padding: 25px 0px 32px 62px;
+}
+img {
+	margin: 10px;
+}
+{/literal}
+</style>
+</head>
+<body>
+	<div id="the_page">
+		<div id="content" class="content">
+			{$MESSAGE_HTML}
+		</div>
+		<div id="copyright">
+			<hr>
+			{'Sent by'|@translate}
+			<a href="{$GALLERY_URL}">{$GALLERY_TITLE}</a>
+			- {'Powered by'|@translate}
+			<a href="http://piwigo.org" class="Piwigo">
+			<span class="Piwigo">Piwigo</span></a>
+			{$VERSION}
+
+			- {'Contact'|@translate}
+			<a href="mailto:{$MAIL}">{'Webmaster'|@translate}</a>
+		</div>
+	</div>
+</body>
+</html>
Index: extensions/Piwecard/mail/template/mail_text.tpl
===================================================================
--- extensions/Piwecard/mail/template/mail_text.tpl	(revision 20254)
+++ extensions/Piwecard/mail/template/mail_text.tpl	(revision 20254)
@@ -0,0 +1,5 @@
+
+-- 
+{'Sent by'|@translate} "{$GALLERY_TITLE}" {$GALLERY_URL}
+{'Contact'|@translate} {$MAIL}
+{'Powered by'|@translate} Piwigo {$VERSION}
Index: extensions/Piwecard/main.inc.php
===================================================================
--- extensions/Piwecard/main.inc.php	(revision 20250)
+++ extensions/Piwecard/main.inc.php	(revision 20254)
@@ -20,4 +20,5 @@
 define('PIWECARD_INC_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/include/');
 define('PIWECARD_INSTALL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/install/');
+define('PIWECARD_MAIL_PATH', PHPWG_PLUGINS_PATH . PIWECARD_DIR . '/mail/');
 define('PIWECARD_TABLE', $prefixeTable . 'piwecard');
 define('PIWECARD_ADMIN',   get_root_url() . 'admin.php?page=plugin-'.PIWECARD_DIR);
Index: extensions/Piwecard/template/ecard.tpl
===================================================================
--- extensions/Piwecard/template/ecard.tpl	(revision 20250)
+++ extensions/Piwecard/template/ecard.tpl	(revision 20254)
@@ -11,6 +11,11 @@
 		height:"90%",
 		onComplete:function(){
+			{/literal}var nbMaxRecipients = {$ecard.nb_max_recipients};{literal}	
 			$("#cboxLoadedContent").css('background-color', $("#the_page #content").css('background-color'));
-			$(".ecard_defaultText").blur();
+			$(".ecard_defaultText").each(function(){
+				defaultTextFocusOut($(this));
+			});
+			if (nbMaxRecipients <= 1)
+				$('#ecard_add_recipient').css("display", "none");
 		}
 	});
@@ -41,6 +46,7 @@
 		var num = $('.ecard_name_recipient').length-1;
 		var newNum = new Number(num + 1);
+		{/literal}var nbMaxRecipients = {$ecard.nb_max_recipients}-1;{literal}
 		
-		if (newNum < 5) {
+		if (newNum <= nbMaxRecipients) {
 			var newRecipient = $('#ecard_field_recipient_' + num).clone().attr('id', 'ecard_field_recipient_' + newNum);
 			
@@ -66,12 +72,15 @@
 			$('#ecard_field_recipient_' + num).after(newRecipient);
 		}
+		if (newNum == nbMaxRecipients) {
+			$('#ecard_add_recipient').css("display", "none");
+		}
 	});
 });
 
 function piwecard_checkForm(form) {
-	var titleOK = piwecard_checkField(form.ecard_title, 0);
-	var messageOK = piwecard_checkField(form.ecard_message, 0);
-	var senderNameOK = piwecard_checkField(form.ecard_sender_name, 0);
-	var senderEMailOK = piwecard_checkField(form.ecard_sender_email, 1);
+	var titleOK = piwecard_checkField(form.ecard_title, 0, 'block');
+	var messageOK = piwecard_checkField(form.ecard_message, 0, 'block');
+	var senderNameOK = piwecard_checkField(form.ecard_sender_name, 0, 'block');
+	var senderEMailOK = piwecard_checkField(form.ecard_sender_email, 1, 'block');
 	var recipientNameOK = new Array();
 	var recipientEMailOK = new Array();
@@ -83,15 +92,15 @@
 		var id_name = "ecard_recipient_name_"+nbAdditionalRecipients;
 		var id_email = "ecard_recipient_email_"+nbAdditionalRecipients;
-		recipientEMailOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_email), 1, true);
+		recipientEMailOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_email), 1, 'block', true);
 		if (nbAdditionalRecipients == 0) {
-			recipientNameOK[0] = piwecard_checkField(form.ecard_recipient_name_0, 0);
-			recipientEMailOK[0] = piwecard_checkField(form.ecard_recipient_email_0, 1);
+			recipientNameOK[0] = piwecard_checkField(form.ecard_recipient_name_0, 0, 'block');
+			recipientEMailOK[0] = piwecard_checkField(form.ecard_recipient_email_0, 1, 'block');
 		} else if (recipientEMailOK[nbAdditionalRecipients] && document.getElementById(id_email).value != '') {
-			recipientNameOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_name), 0, true);
+			recipientNameOK[nbAdditionalRecipients] = piwecard_checkField(document.getElementById(id_name), 0, 'block', true);
 		}
 		nbAdditionalRecipients++;
 	}
 	
-	for (var i=0; i<=nbAdditionalRecipients; i++) {
+	for (var i=0; i<nbAdditionalRecipients; i++) {
 		if (recipientNameOK[i] && recipientEMailOK[i]) {
 			allRecipientNamesOK = true;
@@ -120,10 +129,10 @@
 					<div class="ecard_error" id="ecard_title_error">{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</div>
 					<span class="ecard_label">{'Title'|@translate}<span class="ecard_mandatory_fields">*</span> :</span>
-					<span class="ecard_input_right"><input name="ecard_title" type="text" id="ecard_title" class="ecard_defaultText" title="{$ecard.title}"></span>
+					<span class="ecard_input_right"><input name="ecard_title" type="text" id="ecard_title" class="ecard_defaultText" title="{$ecard.title}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></span>
 				</div>
 				<div class="ecard_field">
 					<div class="ecard_error" id="ecard_message_error">{'piwecard_error'|@translate} {'piwecard_error_text'|@translate}</div>
 					<span class="ecard_label">{'piwecard_message'|@translate}<span class="ecard_mandatory_fields">*</span> :</span>
-					<span class="ecard_input_right"><textarea name="ecard_message" id="ecard_message" class="ecard_defaultText" title="{$ecard.message}"></textarea></span>
+					<span class="ecard_input_right"><textarea name="ecard_message" id="ecard_message" class="ecard_defaultText" title="{$ecard.message}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></textarea></span>
 				</div>
 			</fieldset>
@@ -134,6 +143,6 @@
 					<div class="ecard_error" id="ecard_sender_email_error">{'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</div>
 					<span class="ecard_label">{'piwecard_sender'|@translate}<span class="ecard_mandatory_fields">*</span> :</span>
-					<span class="ecard_name"><input name="ecard_sender_name" type="text" id="ecard_sender_name" maxlength="100" value="{$ecard.sender_name}"></span>
-					<span class="ecard_email"><input name="ecard_sender_email" type="text" id="ecard_sender_email" maxlength="100" {$ecard.changemail} value="{$ecard.sender_email}"></span>
+					<span class="ecard_name"><input name="ecard_sender_name" type="text" id="ecard_sender_name" maxlength="100" value="{$ecard.sender_name}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></span>
+					<span class="ecard_email"><input name="ecard_sender_email" type="text" id="ecard_sender_email" maxlength="100" {$ecard.changemail} value="{$ecard.sender_email}"  onblur="piwecard_checkField(this, 1, 'block');" onfocus="remove_error_style(this);"></span>
 				</div>
 				<div class="ecard_field" id="ecard_field_recipient_0">
@@ -141,6 +150,6 @@
 					<div class="ecard_error" id="ecard_recipient_email_0_error">{'piwecard_error'|@translate} {'piwecard_error_email'|@translate}</div>
 					<span class="ecard_label">{'piwecard_recipient'|@translate}<span class="ecard_mandatory_fields">*</span> :</span>
-					<span class="ecard_name ecard_name_recipient"><input name="ecard_recipient_name[0]" type="text" id="ecard_recipient_name_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_name}"></span>
-					<span class="ecard_email"><input name="ecard_recipient_email[0]" type="text" id="ecard_recipient_email_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_email}"></span>
+					<span class="ecard_name ecard_name_recipient"><input name="ecard_recipient_name[0]" type="text" id="ecard_recipient_name_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_name}" onblur="piwecard_checkField(this, 0, 'block');" onfocus="remove_error_style(this);"></span>
+					<span class="ecard_email"><input name="ecard_recipient_email[0]" type="text" id="ecard_recipient_email_0" class="ecard_defaultText" maxlength="100" title="{$ecard.recipient_email}" onblur="piwecard_checkField(this, 1, 'block');" onfocus="remove_error_style(this);"></span>
 				</div>
 				<a href="javascript:void(0)" id="ecard_add_recipient">{'piwecard_add_recipient'|@translate}</a>
