Index: extensions/Piwecard/admin/admin_configuration.php
===================================================================
--- extensions/Piwecard/admin/admin_configuration.php	(revision 20311)
+++ extensions/Piwecard/admin/admin_configuration.php	(revision 20320)
@@ -3,5 +3,5 @@
 
 global $template, $page;
- 
+
 $piwecard = get_plugin_data($plugin_id);
 
Index: extensions/Piwecard/admin/template/admin_configuration.tpl
===================================================================
--- extensions/Piwecard/admin/template/admin_configuration.tpl	(revision 20311)
+++ extensions/Piwecard/admin/template/admin_configuration.tpl	(revision 20320)
@@ -1,4 +1,5 @@
 {include file='include/colorbox.inc.tpl'}
 
+{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
 {combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
 {combine_script id='piwecard' load="footer" path='plugins/Piwecard/js/piwecard.js'}
@@ -8,4 +9,31 @@
 {footer_script require="piwecard"}
 {literal}
+var queuedManager = $.manageAjax.create('queued', { 
+	queue: true,  
+	cacheResponse: false,
+	maxRequests: 3
+});
+
+function previewEmail(format_message, message) {
+	queuedManager.add({
+		type: 'GET', 
+		url: 'ws.php', 
+		data: {method: 'pwg.piwecard.previewEmail', format: 'json', format_message: format_message, message: message},
+		dataType: 'json',
+		success: (function(data) {
+			if (data.stat =='ok') {
+				$("#previewEmail").html(data.result.message);
+				$.colorbox({
+					inline:true,
+					href:"#previewEmail",
+					onComplete:function(){
+						$("#cboxLoadedContent").css('text-align', 'left');
+					}
+				});
+			}
+		})
+	});
+};
+
 $(document).ready(function(){
 	if ($("#ecard_email_format_text").prop('checked') == true) {
@@ -75,4 +103,17 @@
 			}
 		}
+	});
+	
+	$('#showPreviewTextMessage').click(function () {
+		var format_message = 'text';
+		var message = $('#ecard_email_message_text').val();
+		
+		previewEmail(format_message, message);
+	});
+	$('#showPreviewHTMLMessage').click(function () {
+		var format_message = 'html';
+		var message = $('#ecard_email_message_html').val();
+
+		previewEmail(format_message, message);
 	});
 });
@@ -162,5 +203,5 @@
 					<input type="checkbox" name="ecard_image_border" id="ecard_image_border" {$ecard_image_border} value="1" />
 					<label for="ecard_image_border"> {'piwecard_image_border'|@translate}</label>
-					(<a href="#" id="showPreviewImageBorder" title="{'piwecard_preview'|@translate}">{'piwecard_preview'|@translate}</a>)
+					(<a href="javascript:void(0);" id="showPreviewImageBorder" title="{'piwecard_preview'|@translate}">{'piwecard_preview'|@translate}</a>)
 				</div>
 				<div id="ecard_image_border_options">
@@ -222,10 +263,10 @@
 			<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>
-				(<a href="#" id="showPreviewTextMessage" title="{'piwecard_preview'|@translate}">{'piwecard_preview'|@translate}</a>)
+				(<a href="javascript:void(0);" id="showPreviewTextMessage" title="{'piwecard_preview'|@translate}">{'piwecard_preview'|@translate}</a>)
 				<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>
-				(<a href="#" id="showPreviewHTMLMessage" title="{'piwecard_preview'|@translate}">{'piwecard_preview'|@translate}</a>)
+				(<a href="javascript:void(0);" id="showPreviewHTMLMessage" title="{'piwecard_preview'|@translate}">{'piwecard_preview'|@translate}</a>)
 				<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>
@@ -260,2 +301,6 @@
 	</div>
 </div>
+<div style="display:none">
+	<div id="previewEmail">
+	</div>
+</div>
Index: extensions/Piwecard/include/piwecard.class.php
===================================================================
--- extensions/Piwecard/include/piwecard.class.php	(revision 20311)
+++ extensions/Piwecard/include/piwecard.class.php	(revision 20320)
@@ -180,6 +180,5 @@
 			
 			if (!empty($page['category'])) {
-				// Gets all upper categories from the image category to test 
-				//	- if the upper category is activated for this function
+				// Gets all upper categories from the image category
 				$query = 'SELECT * FROM '.CATEGORIES_TABLE.' WHERE id = '.pwg_db_real_escape_string($page['category']['id']).';';
 				$cat = pwg_db_fetch_assoc(pwg_query($query));
@@ -477,5 +476,7 @@
 		global $page, $conf;
 		
+		$border_config = $this->config['image_border'];
 		$smarty->assign(array(
+								'BORDER' => (($border_config['display']) ? 'border-style: '.$border_config['style'].'; border-width: '.$border_config['width'].'; border-color: #'.$border_config['color'].';' : ''),
 								'CONTENT_ENCODING' => get_pwg_charset(),
 								'GALLERY_URL' => get_absolute_root_url(),
Index: extensions/Piwecard/mail/template/mail_html.tpl
===================================================================
--- extensions/Piwecard/mail/template/mail_html.tpl	(revision 20311)
+++ extensions/Piwecard/mail/template/mail_html.tpl	(revision 20320)
@@ -34,6 +34,7 @@
 img {
 	margin: 10px;
-}
 {/literal}
+	{$BORDER}
+{rdelim}
 </style>
 </head>
Index: extensions/Piwecard/main.inc.php
===================================================================
--- extensions/Piwecard/main.inc.php	(revision 20311)
+++ extensions/Piwecard/main.inc.php	(revision 20320)
@@ -70,3 +70,12 @@
 	$template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.PIWECARD_PATH . 'css/piwecard.css">');
 }
+
+/* +-----------------------------------------------------------------------+
+ * | AJAX Methods                                                          |
+ * +-----------------------------------------------------------------------+ */
+add_event_handler('ws_add_methods', 'piwecard_ws_add_methods');
+
+function piwecard_ws_add_methods($arr) {
+	require_once('admin/ws_functions.inc.php');
+}
 ?>
