;$("#subscribelink").click(function(){DisplaySubscription();});function DisplaySubscription(){$('#subscriptionFirstName').val(''),$('#subscriptionEmail').val(''),$('#SubscriptionContainer .dataForm:first').show();$('#SubscriptionContainer .success:first').hide();$('#SubscriptionContainer .dataFormError').hide();$('#subscriptionFinishButton').removeClass('disabled');displayModalPanel('SubscriptionContainer');};function CloseSubscriptionsDialog(){if($('#SubscriptionContainer').is(':visible')){$.unblockUI();}};function SubscriptionProgressBarDisplay(displayFlag,mess,field){var messField;if(displayFlag){if(field=='email')$('#emailErrorMessage').hide();else $('#firstNameErrorMessage').hide();}else{if(field=='email')messField=$('#emailErrorMessage');else messField=$('#firstNameErrorMessage');messField.show();messField.html(mess);}};function SendSubscriptionFunction(){var firstName=$.trim($('#subscriptionFirstName').val()),email=$.trim($('#subscriptionEmail').val()),button=$('#subscriptionFinishButton'),subscr_type="Common",validated=true;button.addClass('disabled');if(email==''){SubscriptionProgressBarDisplay(false,errorMessage.GetMessageByType('emailEmpty'),'email');validated=false;}else if(!ASC.Mail.Utility.IsValidEmail(email)){SubscriptionProgressBarDisplay(false,errorMessage.GetMessageByType('emailIncorrect'),'email');validated=false;}else{SubscriptionProgressBarDisplay(true,null,'email');}
if(firstName==''){SubscriptionProgressBarDisplay(false,errorMessage.GetMessageByType('firstNameEmpty'),'firstName');validated=false;}else{SubscriptionProgressBarDisplay(true,null,'firstName');}
if(validated){try{Poster.SendSubscription(firstName,email,subscr_type,callback);function callback(response){if(response&&response.status=='error'){console.log(response.message);}
$('#SubscriptionContainer .dataForm:first').hide();$('#SubscriptionContainer .success:first').show();}}catch(err){button.removeClass('disabled');console.log(err);}}else{button.removeClass('disabled');}};$("#SubscriptionContainer .CloseCross").on("click",function(){$.unblockUI();});