<div class="container">
	<table class="display" id="notificationtable" border="0" cellpadding="0" cellspacing="20">
		<tr>
			<td align="right" style="width:110px"><label><span data-i18n="Subject"></span>:</label></td>
			<td><input type="text" id="subject" style="width: 250px; padding: .2em;" class="text ui-widget-content ui-corner-all" /></td>
		</tr>
		<tr>
			<td align="right" style="width:110px"><label><span data-i18n="Message"></span>:</label></td>
			<td><textarea class="text ui-widget-content ui-corner-all" wrap="hard" id="body" name="body" cols="50" rows="7"></textarea></td>
		</tr>
		<tr>
			<td></td>
			<td>
				<a class="btnstyle3" onclick="SendNotification();" data-i18n="Send">Send</a>
			</td>
		</tr>
	</table>
</div>

<script type="text/javascript" charset="utf-8">

function GetNotificationSettings()
{
	var csettings = {};

	csettings.subject=$('#notificationtable #subject').val();
	csettings.body=$("#notificationtable #body").val().replace(/\n/gi,"<br>");
	if ((csettings.subject=="")||(csettings.body==""))
	{
		ShowNotify($.t('Please enter a Subject/Message!'), 2500, true);
		return;
	}
	return csettings;
}

function SendNotification()
{
	var csettings=GetNotificationSettings();
	if (typeof csettings == 'undefined') {
		return;
	}
	
	$.ajax({
		 url: "json.htm?type=command&param=sendnotification&subject=" + encodeURIComponent(csettings.subject) + "&body=" + encodeURIComponent(csettings.body),
		 async: false, 
		 dataType: 'json',
		 success: function(data) {
			ShowNotify($.t("Notification Send"),2500);
			return;
		 },
		 error: function(){
			ShowNotify($.t('Problem Sending Notification!'), 2500, true);
		 }     
	});		
}

$(document).ready(function() {
	$('html').i18n();
} );  
</script>
