PageSourceSearch

https://www.bizmakebiz.co.il/Scripts/common.js?v=1026

js bizmakebiz.co.il collected 2026-10-02 07:34:46 UTC 118,409 bytes, 3,705 lines download raw bytes

1$.curCSS = function (element, attrib, val) {
2  $(element).css(attrib, val);
3};
4function capitaliseFirstLetter(string) {
5  return string.charAt(0).toUpperCase() + string.slice(1);
6}
7
8jQuery.fn.outerHTML = function () {
9  return jQuery('<div />').append(this.clone()).html();
10};
11
12/* doLinks script */
13
14function linkify(inputText, options) {
15
16  this.options = { linkClass: 'url', targetBlank: true };
17
18  this.options = $.extend(this.options, options);
19
20  inputText = inputText.replace(/\u200B/g, "");
21
22  //URLs starting with http://, https://, or ftp://
23  var replacePattern1 = /(src="|href="|">|\s>)?(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;ï]*[-A-Z0-9+&@#\/%=~_|ï]/gim;
24  var replacedText = inputText.replace(replacePattern1, function ($0, $1) { return $1 ? $0 : '<a  href="' + $0 + '"' + 'target="_blank"' + '>' + $0 + '</a>'; });
25
26  //    //URLS starting with www and not the above
27  //    var replacePattern2 = /(src="|href="|">|\s>|https?:\/\/|ftp:\/\/)?www\.[-A-Z0-9+&@#\/%?=~_|!:,.;ï]*[-A-Z0-9+&@#\/%=~_|ï]/gim;
28  //    var replacedText = replacedText.replace(replacePattern2, function ($0, $1) { return $1 ? $0 : '<a class="' + this.options.linkClass + '" href="http://' + $0 + '"' + (this.options.targetBlank ? 'target="_blank"' : '') + '>' + $0 + '</a>'; });
29
30  //    //Change email addresses to mailto:: links
31  //    var replacePattern3 = /([\.\w]+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
32  //    var replacedText = replacedText.replace(replacePattern3, '<a class="' + this.options.linkClass + '" href="mailto:$1">$1</a>');
33
34  return replacedText;
35}
36
37$.fn.doLinks = function () {
38  this.each(function () {
39    $(this).html(linkify($(this).html()));
40  });
41}
42
43$.fn.BuildExpanders = function (options) {
44  this.each(function () {
45    $(this).expander({
46      slicePoint: options != undefined && options.slicePoint != undefined ? options.slicePoint : 200  // default is 100
47    });
48  });
49}
50
51
52function htmlEncode(value) {
53  if (value) {
54    return $('<div/>').text(value).html();
55  } else {
56    return '';
57  }
58}
59
60function htmlDecode(value) {
61  if (value) {
62    return $('<div/>').html(value).text();
63  } else {
64    return '';
65  }
66}
67
68function DisableButton(id) {
69  $('#' + id).unbind('click').bind('click', function (e) {
70    return false;
71  });
72}
73
74
75var searchInitialized = false;
76var defaultSearchWatermark = "";
77
78function Search(query) {
79  if (searchInitialized && query != "") {
80    return true;
81  }
82  return false;
83}
84
85function ShowHide(id) {
86  $("#" + id).animate({ height: "toggle" }, { duration: 1 });
87}
88
89
90String.prototype.insert = function (index, string) {
91  if (index > 0)
92    return this.substring(0, index) + string + this.substring(index, this.length);
93  else
94    return string + this;
95};
96
97String.format = function (text) {
98  //check if there are two arguments in the arguments list
99  if (arguments.length <= 1) {
100    //if there are not 2 or more arguments there's nothing to replace
101    //just return the original text
102    return text;
103  }
104  //decrement to move to the second argument in the array
105  var tokenCount = arguments.length - 2;
106
107  for (var token = 0; token <= tokenCount; token++) {
108    //iterate through the tokens and replace their placeholders from the original text in order
109    text = text.replace(new RegExp("\\{" + token + "\\}", "gi"), arguments[token + 1]);
110  }
111  return text;
112};
113
114function SelectAll(id) {
115  document.getElementById(id).focus();
116  document.getElementById(id).select();
117}
118
119function InitJCarouselLite(elementClass, nextButtonClass, prevButtonClass, verticalList, visibleCount, padding) {
120  $("." + elementClass).jCarouselLite({
121    btnNext: "." + nextButtonClass,
122    btnPrev: "." + prevButtonClass,
123    vertical: verticalList,
124    visible: visibleCount,
125    li_padding: padding,
126    circular: false
127  });
128}
129
130function InitJcrop(ImageWidth, ImageHeight, CropImageWidth, CropImageHeight, forceMinSize, cropImage) {
131
132  var aspectRatio = ((CropImageWidth + 0.0) / CropImageHeight);
133
134  var x = ImageWidth / 2 - CropImageWidth / 2;
135  var y = ImageHeight / 2 + (ImageWidth / aspectRatio) / 2;
136
137  $('#jcrop_target').Jcrop({
138    setSelect: [0, y, ImageWidth, y - (ImageWidth / aspectRatio)],
139    aspectRatio: aspectRatio,
140    onSelect: cropImage,
141    //boxWidth: aspectRatio == 1 ? CropImageWidth : 0,
142    minSize: forceMinSize == true ? [CropImageWidth, CropImageHeight] : [0, 0]
143  });
144}
145
146
147
148function InitCropsy(image_id) {
149  $('#' + image_id).cropsy({
150    max_scale: 2,
151    mask_padding: 40
152  });
153}
154
155function OpenBMBPopup(content) {
156
157  var bmbModal = $("#bmbModal");
158  
159  $(bmbModal).find(".modal-body").html(content);
160  $(bmbModal).find("#bmbModalLabel").html("הגדרות");
161  var bmbModalSubmitBtn = $(bmbModal).find(".bmbModalSubmitBtn");
162  if (bmbModalSubmitBtn != undefined && bmbModalSubmitBtn.length > 0) {
163    $(bmbModal).find('#bmbModalSaveBtn').click(function (e) {
164      e.preventDefault();
165      $(bmbModalSubmitBtn).click();
166    });
167  }
168  $(bmbModal).modal('show');
169}
170
171
172
173function CloseBMBPopup() {
174
175  $("#bmbModal").modal('hide');
176}
177
178function OpenBMBPopupBodyOnly(content) {
179
180  var bmbModal = $("#bmbModalBodyOnly");
181  $(bmbModal).find(".modal-body").html(content);
182  var bmbModalSubmitBtnBodyOnly = $(bmbModal).find(".bmbModalSubmitBtnBodyOnly");
183  $("#bmbModalBodyOnly").on("hidden.bs.modal", function (e) {
184    $(bmbModalSubmitBtnBodyOnly).click();
185  });
186  $(bmbModal).modal('show');
187}
188
189function OpenBMBModalWindow(content, smallModal, mediumModal) {
190
191
192  var modalSize = "modal-lg";
193  if (typeof mediumModal !== 'undefined' && mediumModal === true) {
194    modalSize = "modal-md";
195  }
196  if (typeof smallModal !== 'undefined' && smallModal === true) {
197    modalSize = "modal-sm";
198  }
199
200  var bmbModal = $("#BizModalWindow");
201  $(bmbModal).find(".modal-dialog").addClass(modalSize);
202  $(bmbModal).find(".modal-body").html('');
203  $(bmbModal).find(".modal-body").html(content);
204  
205  $(bmbModal).modal('show');
206
207  if ($(window).height() < 730) {
208    $('.modal-content').css('margin-top', '10%');
209  }
210}
211
212
213
214//AddToPopupContainer and ShowPopupContainer are OpenPopup seperated for two function 
215function AddToPopupContainer(content) {
216  var popupContainerArea = $('#popupContainer').find('#popupContainerArea');
217  $(popupContainerArea).empty();
218  $(popupContainerArea).append(content);
219  $(popupContainerArea).append("<div class='clear'></div>");
220}
221
222function ShowPopupContainer() {
223  $('#popupButton').click();
224}
225
226function OpenPopup(content) {
227  var popupContainerArea = $('#popupContainer').find('#popupContainerArea');
228  $(popupContainerArea).empty();
229  $(popupContainerArea).append(content);
230  $(popupContainerArea).append("<div class='clear'></div>");
231  $('#popupButton').click();
232}
233
234//this opens the same popup all the time (for never changing popups)
235function ReOpenPopup(content) {
236  var popupContainerArea = $('#popupContainer').find('#popupContainerArea');
237  if ($.trim($(popupContainerArea).html()) === '') {
238    $(popupContainerArea).append(content);
239    $(popupContainerArea).append("<div class='clear'></div>");
240  }
241  $('#popupButton').click();
242}
243
244function HidePopupStyle(content) {
245  $("#popupContainer").css("border", "none");
246  $("#popupContainer").css("background", "Transparent");
247  $("#popupContainerClose").css("background", "none");
248  $("#popupContainerClose").css("width", "0px");
249  $("#popupContainerClose").css("height", "0px");
250}
251
252function ClosePopup() {
253  $("#popupContainerClose").click();
254  $('#popupContainer').find('#popupContainerArea').empty();
255}
256
257function GetValue(value) {
258  var result = "";
259  var startIndex = value.indexOf("[");
260  var endIndex = value.indexOf("]");
261
262  if (startIndex != -1 && endIndex != -1) {
263    var number = value.substring(startIndex + 1, endIndex);
264
265    number = parseFloat(number);
266
267    if (isNaN(number) == false) {
268      result = number;
269    }
270  }
271}
272
273/***********************************************
274* Limit number of checked checkboxes script- by JavaScript Kit (www.javascriptkit.com)
275* This notice must stay intact for usage
276* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
277***********************************************/
278
279function CheckBoxLimit(checkgroup, limit) {
280  var checkgroup = checkgroup;
281  var limit = limit;
282  for (var i = 0; i < checkgroup.length; i++) {
283    checkgroup[i].onclick = function () {
284      var checkedcount = 0;
285      for (var i = 0; i < checkgroup.length; i++)
286        checkedcount += (checkgroup[i].checked) ? 1 : 0;
287      if (checkedcount > limit) {
288        alert(" קבוצות" + limit + "באפשרותך לבחור מקסימום ");
289        this.checked = false;
290      }
291    }
292  }
293}
294
295/* ----------------------------------- Ajax form ----------------------------------- */
296
297function showHandlerResponse(data) {
298  // 'data' is the json object returned from the server
299
300  //show the action buttons and hide the process button
301  $(".blue_gradient_button").show();
302  $(".blue_button").show();
303  $(".process_button").hide();
304
305  var result = data.Success;
306  var title = '';
307  var redirectUrl = data.RedirectUrl;
308  var showDialog = data.ShowDialog;
309  var message = data.Message;
310  if (data.Success) {
311    title = SuccessText;
312  }
313  else {
314    title = ErrorText;
315    var start = data.Message.indexOf(":") === -1 ? 0 : data.Message.indexOf(":") + 1;
316    var end = data.Message.indexOf("--") === -1 ? data.Message.length : data.Message.indexOf("--");
317    message = data.Message.substring(start, end);
318  }
319  if (data.ShowDialog) {
320    ShowModalAlert(title, message, redirectUrl);
321  }
322  else {
323    if (redirectUrl !== '') {
324      window.location = redirectUrl;
325    }
326  }
327}
328
329function showBizModalDialog(title, body, redirectUrl) {
330    var modelResult = '<div class="modal fade in bizModal noBorderRadius" tabindex="-1" role="dialog" id="bizModal">'
331        + '<div class="modal-dialog" role="document">'
332        + '<div class="modal-content">'
333        + '<div class="modal-header">'
334        + '<p class="modal-title">' + title + '</p>'
335        + ' </div>'
336        + '<div class="modal-body padding_15">'
337        + '<p>' + body + '</p>'
338        + '</div>'
339        + '</div>'
340        + '</div>'
341        + '</div>';
342
343  $('body').append(modelResult);
344
345
346  $('#bizModal').on('hide.bs.modal', function (e) {
347      if (redirectUrl !== '') {
348          window.location = redirectUrl;
349      }
350  });
351
352    var bizModalParent = $(bizModal).parent();
353
354
355  $('#bizModal').on('shown.bs.modal', function (e) {
356
357  });
358
359
360  var bizModal = $('#bizModal').modal('show');
361
362  
363
364}
365
366function showBizModal(data) {
367  
368  $(".blue_gradient_button").show();
369  $(".blue_button").show();
370  $(".process_button").hide();
371  $('#approvePublicServiceRequest').show();
372
373  if (data.Title === "" || data.Title === undefined) {
374    data.Title = "הודעה מערכת";
375  }
376
377  if (data.Data !== "") {
378    showBizModalDialog(data.Title, data.Data, data.RedirectUrl);
379  } else {
380    showBizModalDialog(data.Title, data.Message, data.RedirectUrl);
381  }
382
383
384}
385
386
387
388function IsFormValid(formId, hideErrorAlert) {
389  var result = false;
390  var form = $("#" + formId);
391  if (form !== undefined && form.length > 0) {
392    var validator = $("#" + formId)[0].validator;
393    if (validator !== undefined) {
394        result = validator.IsValid(); 
395    }
396  }
397  if (result === false && hideErrorAlert === false) {
398    ShowModalAlert(ErrorText, ErrorOnPage, '');
399  }
400  return result;
401}
402
403
404function SendLead(memberId) {
405  document.location.href = "/Members/" + memberId + "/SendLead/#DoBusiness";
406}
407function SendMessage(memberId) {
408  document.location.href = "/Members/" + memberId + "/SendMessage/#DoBusiness";
409}
410
411function AddFavorite(memberId) {
412  var result = NetworkAction("AddFavorite", memberId);
413  if (result.Success == true) {
414    $("#addFavorite_" + memberId + "_container").hide();
415    $("#deleteFavorite_" + memberId + "_container").show();
416    $("#addFavorite_" + memberId).hide();
417    $("#deleteFavorite_" + memberId).show();
418  }
419  else {
420    showHandlerResponse(result);
421  }
422}
423function Follow(memberId) {   
424  var result = NetworkAction("FollowMember", memberId);
425  if (result.Success == true) {
426    $("#follow_" + memberId + "_container").hide();
427    $("#unFollow_" + memberId + "_container").show();
428    $("#follow_" + memberId).hide();
429    $("#unFollow_" + memberId).show();
430  }
431  else {
432    showHandlerResponse(result);
433  }
434  return result;
435}
436
437function UnFollow(memberId) {
438    var result = NetworkAction("UnFollowMember", memberId);
439    if (result.Success == true) {
440        $("#follow_" + memberId + "_container").show();
441        $("#unFollow_" + memberId + "_container").hide();
442        $("#follow_" + memberId).show();
443        $("#unFollow_" + memberId).hide();
444    }
445    return result;
446}
447
448function DeleteFavorite(memberId) {
449  var result = NetworkAction("DeleteFavorite", memberId);
450  if (result.Success == true) {
451    $("#addFavorite_" + memberId + "_container").show();
452    $("#deleteFavorite_" + memberId + "_container").hide();
453    $("#addFavorite_" + memberId).show();
454    $("#deleteFavorite_" + memberId).hide();
455  }
456}
457
458
459function NetworkAction(action, memberId) {
460
461  var result = false;
462  $.ajax({
463    type: "POST",
464    dataType: "json",
465    url: "/Handlers/MemberHandler.ashx?action=" + action + "&MemberId=" + memberId,
466    contentType: "application/json; charset=utf-8",
467    success: function (data) { result = data; },
468    async: false
469  });
470  return result;
471}
472
473
474
475/* ----------------------------------- Ajax form ----------------------------------- */
476
477/* ----------------------------------- Balloons ------------------------------------ */
478
479function NewMessagesBalloonVisibilty() {
480
481  if ($(".newMessagesBalloon").length > 0 && $(".newMessagesBalloon").is(':visible') == true) {
482    $(".newMessagesBalloon").hide();
483    $(".messagesArrow").hide();
484  }
485  else {
486
487    $(".newServiceRequestsBalloon").hide();
488    $(".leadsArrow").hide();
489    $(".newNotificationsBalloon").hide();
490    $(".notificationsArrow").hide();
491    $(".newFollowersBalloon").hide();
492    $(".followersArrow").hide();
493
494    $("#balloonContainer").html("<div class='memberNotificationBalloon newMessagesBalloon' style='text-align: center;'><img src='/images/PleaseWait_small.gif'/>&nbsp;</div>");
495    SetMemberBalloonsPosition();
496
497    $.ajax({
498      type: "POST",
499      dataType: "json",
500      url: "/Handlers/MemberHandler.ashx?action=GetMessagesBalloon",
501      contentType: "application/json; charset=utf-8",
502      success: function (result) {
503        $("#balloonContainer").html(result.Data);
504        SetMemberBalloonsPosition();
505        $(".newMessagesBalloon").show();
506        $(".messagesArrow").show();
507        if (SiteDirection == "rtl") {
508          if ($.browser.webkit == true) {
509            $(".messagesArrow").css("left", "-220px");
510          }
511        }
512      }
513    });
514  }
515}
516
517function NewServiceRequestsBalloonVisibilty() {
518
519  if ($(".newServiceRequestsBalloon").length > 0 && $(".newServiceRequestsBalloon").is(':visible') == true) {
520    $(".newServiceRequestsBalloon").hide();
521    $(".leadsArrow").hide();
522  }
523  else {
524    $(".newMessagesBalloon").hide();
525    $(".messagesArrow").hide();
526    $(".newNotificationsBalloon").hide();
527    $(".notificationsArrow").hide();
528    $(".newFollowersBalloon").hide();
529    $(".followersArrow").hide();
530
531    $("#balloonContainer").html("<div class='memberNotificationBalloon newServiceRequestsBalloon' style='text-align: center;'><img src='/images/PleaseWait_small.gif'/>&nbsp;</div>");
532    SetMemberBalloonsPosition();
533
534    $.ajax({
535      type: "POST",
536      dataType: "json",
537      url: "/Handlers/MemberHandler.ashx?action=GetServiceRequestsBalloon",
538      contentType: "application/json; charset=utf-8",
539      success: function (result) {
540
541        $("#balloonContainer").html(result.Data);
542        SetMemberBalloonsPosition();
543        $(".newServiceRequestsBalloon").show();
544        $(".leadsArrow").show();
545        if (SiteDirection == "rtl") {
546          if ($.browser.webkit == true) {
547            $(".leadsArrow").css("left", "-170px");
548          }
549        }
550      }
551    });
552  }
553}
554
555
556var triggerAzureTrackEvent = function (EventName, isMobile) {
557  var appInsights = window.appInsights;
558  var params = new Object();
559  if (isMobile == true) {
560    params.View = "Mobile";
561  } else {
562    params.View = "Desktop";
563  }
564    appInsights.trackEvent(EventName, params);
565    console.log("common normal");
566}
567
568function NewNotificationsBalloonVisibilty() {
569
570  if ($(".newNotificationsBalloon").length > 0 && $(".newNotificationsBalloon").is(':visible') == true) {
571    $(".newNotificationsBalloon").hide();
572    $(".notificationsArrow").hide();
573  }
574  else {
575    $(".newMessagesBalloon").hide();
576    $(".messagesArrow").hide();
577    $(".newServiceRequestsBalloon").hide();
578    $(".leadsArrow").hide();
579    $(".newFollowersBalloon").hide();
580    $(".followersArrow").hide();
581
582    $("#balloonContainer").html("<div class='memberNotificationBalloon newNotificationsBalloon' style='text-align: center;'><img src='/images/PleaseWait_small.gif'/>&nbsp;</div>");
583    SetMemberBalloonsPosition();
584
585    $.ajax({
586      type: "POST",
587      dataType: "json",
588      url: "/Handlers/MemberHandler.ashx?action=GetNotificationsBalloon",
589      contentType: "application/json; charset=utf-8",
590      success: function (result) {
591
592        $("#balloonContainer").html(result.Data);
593        SetMemberBalloonsPosition();
594        $(".newNotificationsBalloon").show();
595        $(".notificationsArrow").show();
596        if (SiteDirection == "rtl") {
597          if ($.browser.webkit == true) {
598            $(".notificationsArrow").css("left", "-115px");
599          }
600        }
601      }
602    });
603  }
604}
605
606function NewFollowersBalloonVisibilty() {
607
608  if ($(".newFollowersBalloon").length > 0 && $(".newFollowersBalloon").is(':visible') == true) {
609    $(".newFollowersBalloon").hide();
610  }
611  else {
612    $(".newMessagesBalloon").hide();
613    $(".messagesArrow").hide();
614    $(".newServiceRequestsBalloon").hide();
615    $(".leadsArrow").hide();
616    $(".newNotificationsBalloon").hide();
617    $(".notificationsArrow").hide();
618
619    $("#balloonContainer").html("<div class='memberNotificationBalloon newFollowersBalloon' style='text-align: center;'><img src='/images/PleaseWait_small.gif'/>&nbsp;</div>");
620    SetMemberBalloonsPosition();
621
622    $.ajax({
623      type: "POST",
624      dataType: "json",
625      url: "/Handlers/MemberHandler.ashx?action=GetFollowersBalloon",
626      contentType: "application/json; charset=utf-8",
627      success: function (result) {
628
629        $("#balloonContainer").html(result.Data);
630        SetMemberBalloonsPosition();
631        $(".newFollowersBalloon").show();
632        if (SiteDirection == "rtl") {
633          if ($.browser.webkit == true) {
634            $(".followersArrow").css("left", "-70px");
635          }
636        }
637        $(".followersArrow").show();
638      }
639    });
640  }
641}
642
643function HideMemberBalloons() {
644  $(".newMessagesBalloon").hide();
645  $(".newServiceRequestsBalloon").hide();
646  $(".newNotificationsBalloon").hide();
647  $(".newFollowersBalloon").hide();
648  $(".notificationsArrow").hide();
649  $(".followersArrow").hide();
650  $(".leadsArrow").hide();
651  $(".messagesArrow").hide();
652}
653
654function SetMemberBalloonsPosition() {
655  var left = 0;
656  if (SiteDirection == "ltr") {
657    left = 960;
658    $(".newMessagesBalloon").css("left", left - 300);
659    $(".newServiceRequestsBalloon").css("left", left - 410);
660    $(".newNotificationsBalloon").css("left", left - 360);
661    $(".newFollowersBalloon").css("left", left - 210);
662  }
663  else {
664    var windowWidth = document.documentElement.clientWidth;
665    left = -960;
666    $(".newMessagesBalloon").css("left", left + 10);
667    $(".newServiceRequestsBalloon").css("left", left + 10);
668    $(".newNotificationsBalloon").css("left", left + 10);
669    $(".newFollowersBalloon").css("left", left + 80);
670  }
671}
672
673/* ----------------------------------- Balloons ------------------------------------ */
674
675/* ----------------------------------- Image Slider ------------------------------------ */
676
677function CreateImageSlider() {
678  $('#slides').slides({
679    preload: true,
680    preloadImage: '/images/slides/loading.gif',
681    play: 5000,
682    pause: 2500,
683    hoverPause: true
684  });
685
686  $('.sliderImageLink').click(function (e) {
687    e.preventDefault();
688  });
689
690}
691
692
693
694/* ----------------------------------- Image Slider ------------------------------------ */
695
696
697
698/* ----------------------------------- Credit Store ------------------------------------ */
699
700function AttachAddToWishListEvent() {
701  $(".addToWishList").on('click', function (e) {
702    e.preventDefault();
703    $('#creditProductForm').find("#action").val("AddToWishList");
704    var creditProductId = $(this).attr("creditProductId");
705    $('#creditProductForm').find("#creditProductId").val(creditProductId);
706    $('#creditProductForm').submit();
707  });
708}
709function AttachRemoveFromWishListEvent() {
710  $(".removeFromWishList").on('click', function (e) {
711    e.preventDefault();
712    $('#creditProductForm').find("#action").val("RemoveFromWishList");
713    var creditProductId = $(this).attr("creditProductId");
714    $('#creditProductForm').find("#creditProductId").val(creditProductId);
715    $('#creditProductForm').submit();
716  });
717}
718/* ----------------------------------- Credit Store ------------------------------------ */
719
720/* ----------------------------------- wall item ----------------------------------- */
721
722
723
724function GetWallItemComments(WallItemId) {
725  var handlerUrl = "/Handlers/WallHandler.ashx?action=GetComments&WallItemId=" + WallItemId;
726  var result = "";
727
728  jQuery.ajax({ url: handlerUrl, success: function (data) { result = data; }, async: false });
729
730  $('#comments_' + WallItemId).html(result);
731}
732
733
734function DeleteWallItemComment(WallItemCommentId) {
735  var handlerUrl = "/Handlers/WallHandler.ashx?action=DeleteComment&WallItemCommentId=" + WallItemCommentId;
736  var result = "";
737
738  jQuery.ajax({ url: handlerUrl, success: function (data) { result = data; }, async: false });
739
740  return result;
741
742}
743
744function mobile_tablet_detect() {
745  var ismobile = (/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(navigator.userAgent.toLowerCase()));
746  var istablet = (/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase()));
747  return ismobile || istablet;
748}
749
750var VariantsArrayObj = "";
751function GetVariantsArrayObj(VariantsArray) {
752    VariantsArrayObj = JSON.parse(htmlDecode(VariantsArray));
753  if (VariantsArrayObj == "") {
754    VariantsArrayObj = [];
755  }
756  return VariantsArrayObj;
757}
758
759function GetSelectedVariant() {
760  var VariantObj = null;
761  var options = $("select[id*='option']");
762  var firstOptionChoiceIndex = options.first().find("option:selected").index();
763  var firstOptionChoiceId = options.first().find("option:selected").val();
764  var secondOptionChoiceId = "";
765  var secondOptionChoiceIndex = -1;
766  if (options.length > 1) {
767    secondOptionChoiceIndex = options.last().find("option:selected").index();
768    secondOptionChoiceId = options.last().find("option:selected").val();
769  }
770  if (firstOptionChoiceIndex != 0 && secondOptionChoiceIndex != 0) {
771    if (secondOptionChoiceIndex != -1) {
772      for (var i = 0; i < VariantsArrayObj.length; i++) {
773        var obj = VariantsArrayObj[i]
774        if (obj.FirstOptionChoice.Id == firstOptionChoiceId && obj.SecondOptionChoice.Id == secondOptionChoiceId) {
775          VariantObj = obj;
776          break;
777        }
778      }
779    }
780    else {
781      for (var i = 0; i < VariantsArrayObj.length; i++) {
782        var obj = VariantsArrayObj[i]
783        if (obj.FirstOptionChoice.Id == firstOptionChoiceId) {
784          VariantObj = obj;
785          break;
786        }
787      }
788    }
789  }
790  return VariantObj;
791}
792var ApplyMentionsPlugin = null;
793var NotifiyPostMentions = null;
794/* ----------------------------------- wall item ----------------------------------- */
795$(document).ready(function () {
796
797  /* ----------------------------------- jQuery UI ----------------------------------- */
798  var isMobileOrTablet = mobile_tablet_detect();
799  if (isMobileOrTablet == false) {
800    $(".topMenu").addClass("fixedPosition");
801    //$("#popupContainer").addClass("fixedPosition");
802  }
803  else {
804    $(".topLoginWrapper").addClass("topLoginForMobile");
805    $(".topLoginWrapper").removeClass("fixedPosition");
806  }
807
808  $("div.expander").BuildExpanders({ slicePoint: 600 });
809
810  $("div.smallExpander").BuildExpanders({ slicePoint: 200 });
811
812  $("div.facebookTabExpander").BuildExpanders({ slicePoint: 100 });
813
814  /*-----------------Process button--------------------*/
815  $("a").not('#readMoreExpander').not(".image_button").not(".link_button").on('click', function () {
816    $.lastClicked = $(this).attr("id");
817  });
818
819  $("form").on('submit', function (event) {
820
821    var action = $(this).attr("action");
822    if ($.lastClicked != undefined && action != "" && action.indexOf(".ashx") != -1 && $(this).attr("id") != "shareForm" && $(this).attr("id") != "postStatusForm") {
823      if ($("#" + $.lastClicked).attr("href") == undefined || $("#" + $.lastClicked).attr("href") == "") {
824        $("#" + $.lastClicked).hide();
825        $("#process_button_" + $.lastClicked).show();
826      }
827    }
828  });
829
830
831
832  $("a").not('#readMoreExpander').not(".image_button").not(".link_button").click(function () {
833    $.lastClicked = $(this).attr("id");
834  });
835
836  $("form").submit(function (event) {
837    var action = $(this).attr("action");
838    if ($.lastClicked != undefined && action != "" && action.indexOf(".ashx") != -1 && $(this).attr("id") != "shareForm" && $(this).attr("id") != "postStatusForm") {
839      if ($("#" + $.lastClicked).attr("href") == undefined || $("#" + $.lastClicked).attr("href") == "") {
840        $("#" + $.lastClicked).hide();
841        $("#process_button_" + $.lastClicked).show();
842      }
843    }
844  });
845  /*-----------------Process button--------------------*/
846
847  $("p").doLinks();
848
849  $("#keepSignedIn").attr("checked", true);
850
851  var UI_DatePicker_DateFormat = 'dd/mm/yy';
852
853  //$('.date').livequery(function (e) {
854    if ($('.date').length > 0) {
855        $('.date').datepicker({ dateFormat: UI_DatePicker_DateFormat });
856    }
857  //});
858
859    if ($('#slides').length > 0) {
860        CreateImageSlider();
861    }
862    if ($(".lightbox").length > 0) {
863        $(".lightbox").lightBox(); // Select all links with lightbox class
864    }
865
866  $(".birthdate_control_day").change(function (e) {
867    var day = $(this).val();
868    var month = $(".birthdate_control_month").val();
869    var year = $(".birthdate_control_year").val();
870    var id = $(this).attr("controlId");
871    if (day != '' && month != '' && year != '') {
872      $("#" + id).val("1");
873    }
874    else {
875      $("#" + id).val("");
876    }
877  });
878
879  $(".birthdate_control_month").change(function (e) {
880    var month = $(this).val();
881    var day = $("select[id*='birth_date_day']").val();
882    var year = $(".birthdate_control_year").val();
883    var id = $(this).attr("controlId");
884
885    if (day != '' && month != '' && year != '') {
886      $("#" + id).val("1");
887    }
888    else {
889      $("#" + id).val("");
890    }
891
892  });
893
894  $(".birthdate_control_year").change(function (e) {
895    var year = $(this).val();
896    var month = $(".birthdate_control_month").val();
897    var day = $(".birthdate_control_day").val();
898    var id = $(this).attr("controlId");
899
900    if (day != '' && month != '' && year != '') {
901      $("#" + id).val("1");
902    }
903    else {
904      $("#" + id).val("");
905    }
906
907  });
908
909  $(".offline").click(function (e) {
910    e.preventDefault();
911    if ($(this).hasClass('eventGuestRegistrationWindow') == false) {
912      $.ajax({
913        type: "POST",
914        dataType: "json",
915        url: "/Handlers/MemberHandler.ashx?action=GetLoginWindow&ReturnUrl=" + document.location.pathname,
916        contentType: "application/json; charset=utf-8",
917        success: function (data) {
918
919          if (data.Success) {
920
921            OpenPopup(data.Data);
922            $('#popupContainer').css('width', '450px');
923          }
924        }
925      });
926    }
927  });
928
929
930
931
932  $('#groupRegistrationForm').ajaxForm({
933    dataType: 'json',
934    success: showHandlerResponse
935  });
936
937  $('#approveAutomaticallyMemberToGroup').click(function (event) {
938    event.preventDefault();
939    if ($(this).hasClass("notPaying")) {
940      $.ajax({
941        type: "POST",
942        dataType: "json",
943        url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowGroup",
944        contentType: "application/json; charset=utf-8",
945        success: function (data) {
946          if (data.Success) {
947            OpenPopup(data.Data);
948          }
949        }
950      });
951    }
952    else {
953      ShowTextAreaModalDialog(NotesTitle, function (notes) {
954        $('#groupRegistrationForm').find('#action').val('CloseGroupRegistrationWithoutPayment');
955        $('#groupRegistrationForm').find('#notes').val(notes);
956        $('#groupRegistrationForm').submit();
957      }, '');
958    }
959  });
960
961  $(".sendRequestImageButton").click(function (e) {
962    e.preventDefault();
963
964    var array = $(this).attr("id").split('_');
965    var memberId = array[1];
966
967    $('#bidReceiver').val(memberId);
968    $('#SendLeadModal').modal('show');
969
970    //var urlAjax = "/Handlers/ServiceRequestHandler.ashx?action=GetContactMemberWindow&MemberId=" + memberId;
971
972    //$.ajax({
973    //    type: "POST",
974    //    dataType: "json",
975    //    url: urlAjax,
976    //    contentType: "application/json; charset=utf-8",
977    //    success: function (data) {
978
979    //        if (data.Success) {
980    //            OpenPopup(data.Data);
981    //        }
982    //    }
983    //});
984  });
985
986
987    $('.HeaderSendLead,.memberContactSendLead').click(function (e) {
988        e.preventDefault();        
989        var sendRequestImageButtonDiv = $(this).find('.sendRequestImageButton');
990        if ($(this).hasClass('memberContactSendLead')) {
991            sendRequestImageButtonDiv = $(this);
992        }
993        var array = $(sendRequestImageButtonDiv).attr("id").split('_');
994        var memberId = array[1];
995        $('#bidReceiver').val(memberId);
996        $('#SendLeadModal').modal('show');
997        //var urlAjax = "/Handlers/ServiceRequestHandler.ashx?action=GetContactMemberWindow&MemberId=" + memberId;
998
999        //$.ajax({
1000        //    type: "POST",
1001        //    dataType: "json",
1002        //    url: urlAjax,
1003        //    contentType: "application/json; charset=utf-8",
1004        //    success: function (data) {
1005
1006        //        if (data.Success) {
1007        //            OpenPopup(data.Data);
1008        //        }
1009        //    }
1010        //});
1011    });
1012  $(".sendCredit").click(function (e) {
1013    e.preventDefault();
1014    var array = $(this).attr("id").split('_');
1015    var memberId = array[1];
1016
1017    var urlAjax = "/Handlers/ServiceRequestHandler.ashx?action=GetSendCreditWindow&MemberId=" + memberId;
1018
1019    $.ajax({
1020      type: "POST",
1021      dataType: "json",
1022      url: urlAjax,
1023      contentType: "application/json; charset=utf-8",
1024      success: function (data) {
1025
1026        if (data.Success) {
1027          OpenPopup(data.Data);
1028        }
1029      }
1030    });
1031  });
1032
1033  $('.HeaderSendCredit').click(function (e) {
1034    e.preventDefault();
1035    var sendCreditDiv = $(this).find('.sendCredit');
1036    var array = $(sendCreditDiv).attr("id").split('_');
1037    var memberId = array[1];
1038
1039    var urlAjax = "/Handlers/ServiceRequestHandler.ashx?action=GetSendCreditWindow&MemberId=" + memberId;
1040
1041    $.ajax({
1042      type: "POST",
1043      dataType: "json",
1044      url: urlAjax,
1045      contentType: "application/json; charset=utf-8",
1046      success: function (data) {
1047
1048        if (data.Success) {
1049          OpenPopup(data.Data);
1050        }
1051      }
1052    });
1053  })
1054
1055
1056
1057  $(".contactMember").click(function (e) {
1058    e.preventDefault();
1059
1060    var array = $(this).attr("id").split('_');
1061    var memberId = array[1];
1062
1063    var urlAjax = "/Handlers/ServiceRequestHandler.ashx?action=GetContactMemberWindow&MemberId=" + memberId;
1064
1065    $.ajax({
1066      type: "POST",
1067      dataType: "json",
1068      url: urlAjax,
1069      contentType: "application/json; charset=utf-8",
1070      success: function (data) {
1071
1072        if (data.Success) {
1073          OpenPopup(data.Data);
1074        }
1075      }
1076    });
1077  });
1078
1079
1080
1081  $(".infoAboutCredits").click(function (event) {
1082    event.preventDefault();
1083    $.ajax({
1084      type: "POST",
1085      dataType: "json",
1086      url: "/Handlers/ServiceRequestHandler.ashx?action=GetCreditsInfo",
1087      contentType: "application/json; charset=utf-8",
1088      success: function (data) {
1089        if (data.Success) {
1090          OpenPopup(data.Data);
1091        }
1092      }
1093    });
1094  });
1095
1096  $(".infoAboutClosedLeadReport").click(function (event) {
1097    event.preventDefault();
1098    $.ajax({
1099      type: "POST",
1100      dataType: "json",
1101      url: "/Handlers/ServiceRequestHandler.ashx?action=GetReportClosedLeadInfo",
1102      contentType: "application/json; charset=utf-8",
1103      success: function (data) {
1104        if (data.Success) {
1105          OpenPopup(data.Data);
1106        }
1107      }
1108    });
1109  });
1110
1111  $(".infoAboutFacebookPage").click(function (event) {
1112    event.preventDefault();
1113    $.ajax({
1114      type: "POST",
1115      dataType: "json",
1116      url: "/Handlers/SocialNetworkHandler.ashx?action=GetFacebookPageInfo",
1117      contentType: "application/json; charset=utf-8",
1118      success: function (data) {
1119        if (data.Success) {
1120          OpenPopup(data.Data);
1121        }
1122      }
1123    });
1124  });
1125
1126  $(".infoAboutFacebookPageTab").click(function (event) {
1127    event.preventDefault();
1128    $.ajax({
1129      type: "POST",
1130      dataType: "json",
1131      url: "/Handlers/SocialNetworkHandler.ashx?action=GetFacebookPageTabInfo",
1132      contentType: "application/json; charset=utf-8",
1133      success: function (data) {
1134        if (data.Success) {
1135          OpenPopup(data.Data);
1136        }
1137      }
1138    });
1139  });
1140
1141  /*-------------------------------------------------Product-----------------------------------------------------*/
1142
1143
1144  function GetProductSelectedOptions(VariantObj) {
1145    var choicesNames = "";
1146    if (VariantObj != null) {
1147      //set variables
1148      choicesNames = "(" + VariantObj.FirstOptionChoice.Name;
1149
1150      if (VariantObj.SecondOptionChoice.Id != "00000000-0000-0000-0000-000000000000") {
1151        choicesNames += ", " + VariantObj.SecondOptionChoice.Name + ")";
1152      }
1153      else {
1154        choicesNames += ")";
1155      }
1156    }
1157    return choicesNames;
1158  }
1159
1160  $("select[id*='option']").change(function (e) {
1161
1162    var VariantObj = GetSelectedVariant();
1163
1164    var valid = (VariantObj == null) || (!VariantObj.IsActive) ? false : true;
1165
1166    if (valid) {
1167      var addedPrice = parseFloat(VariantObj.FirstOptionChoice.Price) + parseFloat(VariantObj.SecondOptionChoice.Price);
1168      var productPrice = parseFloat($("#itemForm").find("#ProductPrice").val());
1169      var totalPrice = (productPrice + addedPrice).toFixed(2);
1170      $(".productPrice").html(totalPrice);
1171      var description = $(".product-description");
1172      if (description.length > 0) {
1173        $(description).attr("data-price", totalPrice);
1174        $(description).attr("data-options", GetProductSelectedOptions(VariantObj));
1175      }
1176      //alert($(".jCarouselLiteProductImagesList li[filename='" + VariantObj.ProductFile.Attachment.FileName + "']").length);
1177      //var index = $(".jCarouselLiteProductImagesList li[filename='" + VariantObj.ProductFile.Attachment.FileName + "']").first().index();
1178      //alert(index);
1179      //if (index != -1) {
1180      //$('.jCarouselLiteProductImagesList').jCarouselLiteScrollTo(index);
1181      //}
1182    }
1183    else {
1184      var productPrice = $("#itemForm").find("#ProductPrice").val();
1185      var productPrice = parseFloat(productPrice).toFixed(2);
1186      $(".productPrice").html(productPrice);
1187      var description = $(".product-description");
1188      if (description.length > 0) {
1189        $(description).attr("data-price", totalPrice);
1190        $(description).attr("data-options", "");
1191      }
1192
1193      if (VariantObj != null && !VariantObj.IsActive) {
1194        ShowModalAlert(ErrorText, "השילוב לא קיים כרגע במערכת", "");
1195      }
1196      //$('.jCarouselLiteProductImagesList').jCarouselLite('first');
1197    }
1198  });
1199
1200  /*-------------------------------------------------End of Product-----------------------------------------------------*/
1201
1202  $(".orderService").click(function (e) {
1203    e.preventDefault();
1204
1205    var array = $(this).attr("id").split('_');
1206    var serviceId = array[1];
1207    var memberId = array[2];
1208
1209    var urlAjax = "";
1210    if ($(this).hasClass("unregistered") == true) {
1211
1212      var userSource = "Member";
1213      if ($(this).hasClass("facebookProfile") == true) {
1214        userSource = "Facebook";
1215      }
1216
1217      urlAjax = "/Handlers/ServiceRequestHandler.ashx?action=GetCreateServiceRequestWindow&ServiceId=" + serviceId + "&MemberId=" + memberId + "&UserSource=" + userSource;
1218
1219    }
1220    else {
1221      urlAjax = "/Handlers/ServiceHandler.ashx?action=GetOpenLeadWindow&ServiceId=" + serviceId + "&MemberId=" + memberId;
1222    }
1223
1224    $.ajax({
1225      type: "POST",
1226      dataType: "json",
1227      url: urlAjax,
1228      contentType: "application/json; charset=utf-8",
1229      success: function (data) {
1230
1231        if (data.Success) {
1232          //OpenPopup(data.Data);
1233          OpenBMBModalWindow(data.Data, false, true);
1234        }
1235      }
1236    });
1237  });
1238
1239  $(".doBusinessLink").on('click', function (e) {
1240    e.preventDefault();
1241    var memberId = $(this).attr("memberId");
1242    var urlAjax = "/Handlers/ServiceHandler.ashx?action=GetOpenLeadWindow&ServiceId=0&MemberId=" + memberId;
1243
1244    $.ajax({
1245      type: "POST",
1246      dataType: "json",
1247      url: urlAjax,
1248      contentType: "application/json; charset=utf-8",
1249      success: function (data) {
1250
1251        if (data.Success) {          
1252          OpenPopup(data.Data);
1253          centerPopup();
1254        }
1255      }
1256    });
1257  });
1258
1259  $(".openSendMessageWindow").on('click', function (e) {
1260    e.preventDefault();
1261
1262    if ($(this).hasClass("notPaying")) {
1263      $.ajax({
1264        type: "POST",
1265        dataType: "json",
1266        url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowMessages",
1267        contentType: "application/json; charset=utf-8",
1268        success: function (data) {
1269          if (data.Success) {
1270            OpenPopup(data.Data);
1271          }
1272        }
1273      });
1274    }
1275    else {
1276      var memberId = $(this).attr("memberId").split("_");
1277      var subject = $(this).attr("subject");
1278
1279      $.ajax({
1280        type: "POST",
1281        dataType: "json",
1282        url: "/Handlers/MessageHandler.ashx?action=GetSendMessageWindow&MemberId=" + memberId + "&Subject=" + subject,
1283        contentType: "application/json; charset=utf-8",
1284        async: false,
1285        success: function (response) {
1286          if (response.Success) {
1287            var share_div = $(response.Data);
1288            OpenPopup(share_div);
1289          }
1290        }
1291      });
1292    }
1293  });
1294
1295    $('.HeaderContact,.tenderProviderContact, .event-participator-contact').click(function (e) {
1296        e.preventDefault();
1297
1298        var contactMemberDiv = $(this).find('.openSendMessageWindowHeader');
1299        var contactMemberDiv01 = $(this).find('.contactMember');
1300        if ($(this).hasClass("tenderProviderContact") && $(this).hasClass('openSendMessageWindowHeader')) {
1301           
1302            contactMemberDiv = $(this);
1303        } else if ($(this).hasClass("event-participator-contact") && $(this).hasClass('openSendMessageWindowHeader')) {
1304            console.log("ere"); 
1305            contactMemberDiv = $(this);
1306        };
1307
1308    if ($(contactMemberDiv).length === 1) {
1309      if ($(contactMemberDiv).hasClass("notPaying")) {
1310        $.ajax({
1311          type: "POST",
1312          dataType: "json",
1313          url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowMessages",
1314          contentType: "application/json; charset=utf-8",
1315          success: function (data) {
1316            if (data.Success) {
1317              OpenPopup(data.Data);
1318            }
1319          }
1320        });
1321      }
1322      else {
1323
1324        var memberId = $(contactMemberDiv).attr("memberId").split("_");
1325        var subject = $(this).attr("subject");
1326
1327        $.ajax({
1328          type: "POST",
1329          dataType: "json",
1330          url: "/Handlers/MessageHandler.ashx?action=GetSendMessageWindow&MemberId=" + memberId[1] + "&Subject=" + subject,
1331          contentType: "application/json; charset=utf-8",
1332          async: false,
1333          success: function (response) {
1334            if (response.Success) {
1335              var share_div = $(response.Data);
1336              OpenPopup(share_div);
1337            }
1338          }
1339        });
1340      }
1341    } else if ($(contactMemberDiv01).length === 1) {
1342
1343      var array = $(contactMemberDiv01).attr("id").split('_');
1344      var memberId = array[1];
1345
1346      var urlAjax = "/Handlers/ServiceRequestHandler.ashx?action=GetContactMemberWindow&MemberId=" + memberId;
1347
1348      $.ajax({
1349        type: "POST",
1350        dataType: "json",
1351        url: urlAjax,
1352        contentType: "application/json; charset=utf-8",
1353        success: function (data) {
1354
1355          if (data.Success) {
1356            OpenPopup(data.Data);
1357          }
1358        }
1359      });
1360    }
1361
1362  })
1363
1364
1365  $("#addEvent").on('click', function (e) {
1366
1367    if ($(this).hasClass("notPaying")) {
1368      e.preventDefault();
1369      $.ajax({
1370        type: "POST",
1371        dataType: "json",
1372        url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowEvents",
1373        contentType: "application/json; charset=utf-8",
1374        success: function (data) {
1375          if (data.Success) {
1376            OpenPopup(data.Data);
1377          }
1378        }
1379      });
1380    }
1381    else {
1382      return true;
1383    }
1384  });
1385
1386
1387  $("#addCampaign").on('click', function (e) {
1388
1389    if ($(this).hasClass("notPaying")) {
1390      e.preventDefault();
1391      $.ajax({
1392        type: "POST",
1393        dataType: "json",
1394        url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowCampaign",
1395        contentType: "application/json; charset=utf-8",
1396        success: function (data) {
1397          if (data.Success) {
1398            OpenPopup(data.Data);
1399          }
1400        }
1401      });
1402    }
1403    else {
1404      return true;
1405    }
1406  });
1407
1408  $("a[id*='viewPrivateServiceRequest_']").on('click', function (e) {
1409
1410    if ($(this).hasClass("notPaying")) {
1411      e.preventDefault();
1412      $.ajax({
1413        type: "POST",
1414        dataType: "json",
1415        url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowLeads",
1416        contentType: "application/json; charset=utf-8",
1417        success: function (data) {
1418          if (data.Success) {
1419            OpenPopup(data.Data);
1420          }
1421        }
1422      });
1423    }
1424    else {
1425      return true;
1426    }
1427  });
1428
1429  $("a[id*='viewPublicServiceRequest_']").on('click', function (e) {
1430
1431    if ($(this).hasClass("notPaying")) {
1432      e.preventDefault();
1433      $.ajax({
1434        type: "POST",
1435        dataType: "json",
1436        url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowLeads",
1437        contentType: "application/json; charset=utf-8",
1438        success: function (data) {
1439          if (data.Success) {
1440            OpenPopup(data.Data);
1441          }
1442        }
1443      });
1444    }
1445    else {
1446      return true;
1447    }
1448  });
1449
1450  $(".GAEventTracker").on('click', function (e) {
1451    var url = $(this).attr("href");
1452    var category = $(this).attr("category");
1453    var action = $(this).attr("action");
1454
1455    if (e.currentTarget.host != window.location.host) {
1456
1457      var newtab = false;
1458      var isBlank = ($(this).attr('target') == '_blank');
1459
1460      _gaq.push(['_trackEvent', category, action, url, 0]);
1461
1462      if (category != "landingpage") {
1463
1464        if (e.metaKey || e.ctrlKey) {
1465          newtab = true;
1466        }
1467
1468        if (!newtab && !isBlank) {
1469          e.preventDefault();
1470          setTimeout('document.location = "' + url + '"', 100);
1471        }
1472      }
1473    }
1474  });
1475
1476
1477  $("#openGetPremiumBlockWindowBids").click(function (e) {
1478    e.preventDefault();
1479
1480    $.ajax({
1481      type: "POST",
1482      dataType: "json",
1483      url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowBids",
1484      contentType: "application/json; charset=utf-8",
1485      success: function (data) {
1486        if (data.Success) {
1487          OpenPopup(data.Data);
1488        }
1489      }
1490    });
1491  });
1492
1493  $("#allGroups_Open").on('click', function (event) {
1494    event.preventDefault();
1495    $("#allGroups").css("display", "block");
1496    $("#allGroups_Close").css("display", "block");
1497    $(this).css("display", "none");
1498  });
1499
1500  $("#allGroups_Close").on('click', function (event) {
1501    event.preventDefault();
1502    $("#allGroups").css("display", "none");
1503    $("#allGroups_Open").css("display", "block");
1504    $(this).css("display", "none");
1505  });
1506
1507  $('#freeVIPBannerForm').ajaxForm({
1508    dataType: 'json',
1509    success: showHandlerResponse
1510  });
1511
1512  $('#freeVIPBannerBtn').click(function (e) {
1513    e.preventDefault();
1514    $('#freeVIPBannerForm').submit();
1515  });
1516
1517  $("input[id*='addShipping']").change(function (e) {
1518    if ($(this).is(':checked')) {
1519      var parameters = $(this).attr("id").split("_");
1520      var productId = parameters[1];
1521      var memberId = parameters[2];
1522
1523      $.ajax({
1524        type: "POST",
1525        dataType: "json",
1526        url: "/Handlers/ProductHandler.ashx?action=GetProductShippingPrice&OwnerID=" + memberId + "&ProductID=" + productId,
1527        contentType: "application/json; charset=utf-8",
1528        success: function (data) {
1529          if (data.Success) {
1530            $('form[name^=_xclick]').append("<input type='hidden' name='shipping' value='" + data.Data + "' />");
1531          }
1532        }
1533      });
1534    }
1535    else {
1536      $('form[name^=_xclick]').find('input[name^=shipping]').remove();
1537    }
1538
1539  });
1540
1541
1542
1543  /* ----------------------------------- jQuery UI ----------------------------------- */
1544
1545  /* ----------------------------------- Login window -------------------------------- */
1546
1547  $('#joinButton').on('click', function (e) {
1548    e.preventDefault();
1549
1550    location.href = "/SignUp/";
1551
1552    //$("#joinBox").show();
1553    //$("#loginBox").hide();
1554    //if (SiteDirection == "ltr") {
1555    //    $(".DoBusinessArrow").css("left", "135px");
1556    //}
1557    //else {
1558    //    $(".DoBusinessArrow").css("left", "-125px");
1559    //}
1560  });
1561
1562  $('#loginButton').on('click', function (e) {
1563    e.preventDefault();
1564    $("#joinBox").hide();
1565    $("#loginBox").show();
1566    if (SiteDirection == "ltr") {
1567      $(".DoBusinessArrow").css("left", "35px");
1568    }
1569    else {
1570      $(".DoBusinessArrow").css("left", "-35px");
1571    }
1572
1573  });
1574
1575  $('#signInButton').on('click', function (e) {
1576    e.preventDefault();
1577    if (!$('#signInForm').find('.alert-danger').hasClass('hidden')) {
1578      $('#signInForm').find('.alert-danger').addClass('hidden');
1579    }
1580    $('.signin_button ').hide();
1581    $('.divProcessing').show();
1582    $('#signInForm').find('#login').css('border-color', '');
1583    $('#signInForm').find('#password').css('border-color', '');
1584    if ($('#signInForm').find('#login').attr('value') !== '' && $('#signInForm').find('#password').attr('value')) {
1585      $('#signInForm').submit();
1586    } else {
1587      $('.signin_button ').show();
1588      $('.divProcessing').hide();
1589      $('#signInForm').find('#login').css('border-color', 'red');
1590      $('#signInForm').find('#password').css('border-color', 'red');
1591    }
1592
1593  });
1594
1595  $('#signUpMember').on('click', function (e) {
1596    e.preventDefault();
1597    var agree = $('#agree');
1598    if (agree.length > 0 && agree.is(':visible') && !agree.is(':checked')) {
1599      alert(YouMustConfirmTermsAndConditions);
1600      return false;
1601    }
1602    if (IsFormValid("signUpForm") == true) {
1603      $('#signUpForm').submit();
1604    }
1605  });
1606
1607  $('#facebookSignUp').on('click', function (e) {
1608    e.preventDefault();
1609    var returnUrl = FacebookCallBackURL + '?SocialNetworkAction=' + SocialNetworkActionEnum.SignUp + '&SignUpType=1';
1610    FacebookLogin(FacebookAppID, returnUrl);
1611  });
1612
1613  $('#facebookSignIn').on('click', function (e) {
1614    e.preventDefault();
1615    var returnUrl = FacebookCallBackURL + '?SocialNetworkAction=' + SocialNetworkActionEnum.SignIn;
1616    FacebookLogin(FacebookAppID, returnUrl);
1617  });
1618
1619  /* ----------------------------------- Login window -------------------------------- */
1620
1621  /* ----------------------------------- Credit Store ------------------------------------ */
1622  $('#creditProductForm').ajaxForm({
1623    dataType: 'json',
1624    success: function (data) {
1625      if (data.Data != undefined && data.Data != "") {
1626        if (data.Success) {
1627          var result = data.Message.split(':');
1628          if (result[0] == "Add") {
1629            $("#addToWishList_" + result[1]).hide();
1630            $("#removeFromWishList_" + result[1]).show();
1631          }
1632          else {
1633            $("#addToWishList_" + result[1]).show();
1634            $("#removeFromWishList_" + result[1]).hide();
1635          }
1636
1637          $(".jCarouselLiteWishList").empty();
1638          $(".jCarouselLiteWishList").append(data.Data);
1639
1640          if ($("#wishList").children().length > 0) {
1641
1642            InitJCarouselLite("jCarouselLiteWishList", "nextCreditProduct", "prevCreditProduct", true, 2, 0);
1643            AttachAddToWishListEvent();
1644            AttachRemoveFromWishListEvent();
1645          }
1646        }
1647      }
1648      //            else {
1649      //                showHandlerResponse(data);
1650      //            }
1651    }
1652  });
1653
1654  /* ----------------------------------- Credit Store ------------------------------------ */
1655
1656  /*-------------------------------------Member Box------------------------------------*/
1657
1658  $("#memberBoxDropOpen").click(function (e) {
1659    e.preventDefault();
1660
1661    var me = $(this);
1662    if ($(".memberBox2").is(":visible") == false) {
1663      $(".memberBox2").show();
1664      $(".memberBox2Container").addClass("memberBox2ContainerOpen");
1665      $(".memberBox2Container").removeClass("memberBox2Container");
1666    }
1667    else {
1668      $(".memberBox2").hide();
1669      $(".memberBox2ContainerOpen").addClass("memberBox2Container");
1670      $(".memberBox2ContainerOpen").removeClass("memberBox2ContainerOpen");
1671    }
1672    return false;
1673  });
1674  $("#memberBoxDropOpenMobile").click(function (e) {
1675    e.preventDefault();
1676
1677    var me = $(this);
1678    if ($(".memberBox2").is(":visible") == false) {
1679      $(".memberBox2").show();
1680      $(".memberBox2Container").addClass("memberBox2ContainerOpen");
1681      $(".memberBox2Container").removeClass("memberBox2Container");
1682    }
1683    else {
1684      $(".memberBox2").hide();
1685      $(".memberBox2ContainerOpen").addClass("memberBox2Container");
1686      $(".memberBox2ContainerOpen").removeClass("memberBox2ContainerOpen");
1687    }
1688    return false;
1689  });
1690
1691  $(document).click(function (e) {
1692    if ($(".memberBox2").is(":visible") == true) {
1693      $(".memberBox2").hide();
1694      $(".memberBox2ContainerOpen").addClass("memberBox2Container");
1695      $(".memberBox2ContainerOpen").removeClass("memberBox2ContainerOpen");
1696    }
1697  });
1698  /*-------------------------------------Member Box------------------------------------*/
1699
1700  /* ----------------------------------- Balloons ------------------------------------ */
1701  $(document).click(function (e) {
1702    HideMemberBalloons();
1703  });
1704
1705
1706  function GetMessagesBaloon() {
1707    NewMessagesBalloonVisibilty();
1708    var me = $(this);
1709    $.ajax({
1710      type: "POST",
1711      dataType: "json",
1712      url: "/Handlers/MemberHandler.ashx?action=ClearNewMessagesCount",
1713      contentType: "application/json; charset=utf-8",
1714      success: function (data) {
1715        if (data.Success) {
1716          $(".messagesCount").html("&nbsp;");
1717          $(".messagesCount").removeClass("redBaloon");
1718        }
1719      },
1720      async: false
1721    });
1722  }
1723
1724  function GetNotificationsBaloon() {
1725    NewNotificationsBalloonVisibilty();
1726    var me = $(this);
1727    $.ajax({
1728      type: "POST",
1729      dataType: "json",
1730      url: "/Handlers/MemberHandler.ashx?action=ClearNewNotificationsCount",
1731      contentType: "application/json; charset=utf-8",
1732      success: function (data) {
1733        if (data.Success) {
1734          $(".notificationsCount").html("&nbsp;");
1735          $(".notificationsCount").removeClass("redBaloon");
1736        }
1737      },
1738      async: false
1739    });
1740  }
1741
1742  function GetFollowersBaloon() {
1743    NewFollowersBalloonVisibilty();
1744    var me = $(this);
1745    $.ajax({
1746      type: "POST",
1747      dataType: "json",
1748      url: "/Handlers/MemberHandler.ashx?action=ClearNewFollowersCount",
1749      contentType: "application/json; charset=utf-8",
1750      success: function (data) {
1751        if (data.Success) {
1752          $(".followersCount").html("&nbsp;");
1753          $(".followersCount").removeClass("redBaloon");
1754        }
1755      },
1756      async: false
1757    });
1758  }
1759
1760  //$(".messagesCount").click(function (e) {
1761  //  e.preventDefault();
1762  //  GetMessagesBaloon();
1763  //  return false;
1764  //});
1765
1766  //$(".newMessagesImage").click(function (e) {
1767  //  e.preventDefault();
1768  //  GetMessagesBaloon();
1769  //  return false;
1770  //});
1771
1772  $(".newServiceRequestsImage").click(function (e) {
1773    e.preventDefault();
1774    NewServiceRequestsBalloonVisibilty();
1775    return false;
1776  });
1777
1778  $(".serviceRequestsCount").click(function (e) {
1779    e.preventDefault();
1780    NewServiceRequestsBalloonVisibilty();
1781    return false;
1782  });
1783
1784  $(".newNotificationsImage").click(function (e) {
1785    e.preventDefault();
1786    GetNotificationsBaloon();
1787    return false;
1788  });
1789
1790
1791  $(".notificationsCount").click(function (e) {
1792    e.preventDefault();
1793    GetNotificationsBaloon();
1794    return false;
1795  });
1796
1797  $(".newFollowersImage").click(function (e) {
1798    e.preventDefault();
1799    GetFollowersBaloon();
1800    return false;
1801  })
1802
1803  $(".followersCount").click(function (e) {
1804    e.preventDefault();
1805    GetFollowersBaloon();
1806    return false;
1807  });
1808
1809  SetMemberBalloonsPosition();
1810
1811  $('#serviceRequestBalloonForm').on('submit', function () {
1812    $('#serviceRequestBalloonForm').ajaxSubmit({
1813      resetForm: false,
1814      success: function formRefresh(result) {
1815        var response = eval("(" + result + ")");
1816        if (response.Success) {
1817          var div = $('.newServiceRequestsBalloon').find('.serviceRequestId_' + response.Data);
1818          if (div.length > 0) {
1819            div.css("display", "none");
1820            if (response.RedirectUrl != undefined && response.RedirectUrl != '') {
1821              window.location = response.RedirectUrl;
1822            }
1823          }
1824        }
1825      }
1826    });
1827    return false;
1828  });
1829
1830  $('.denyPrivateServiceRequestBalloon').on('click', function (event) {
1831    event.preventDefault();
1832
1833    var serviceRequestId = $(this).attr('rel');
1834
1835    $('#serviceRequestBalloonForm').find('#action').val('DenyPrivateServiceRequest');
1836    $('#serviceRequestBalloonForm').find('#serviceRequestId').val(serviceRequestId);
1837    $('#serviceRequestBalloonForm').submit();
1838  });
1839
1840  $('.denyPublicServiceRequestBalloon').on('click', function (event) {
1841    event.preventDefault();
1842
1843    var serviceRequestId = $(this).attr('rel');
1844
1845    $('#serviceRequestBalloonForm').find('#action').val('DenyPublicServiceRequest');
1846    $('#serviceRequestBalloonForm').find('#serviceRequestId').val(serviceRequestId);
1847    $('#serviceRequestBalloonForm').submit();
1848  });
1849
1850
1851  /* ----------------------------------- Balloons ----------------------------------- */
1852
1853  /* ----------------------------------- watermarked input ----------------------------------- */
1854
1855
1856
1857  $('[watermark]').on('focusin', function (e) {
1858
1859    if ($(this).attr('value') == $(this).attr('watermark')) {
1860      $(this).val('');
1861      $(this).removeClass('watermarkEmpty');
1862    }
1863  });
1864
1865  $('[watermark]').on('focusout', function (e) {
1866
1867    if ($(this).attr('value') == '') {
1868      $(this).val($(this).attr('watermark'));
1869      $(this).addClass('watermarkEmpty');
1870    }
1871  });
1872
1873  /* ----------------------------------- watermarked input ----------------------------------- */
1874
1875  /* ----------------------------------- wall item ----------------------------------- */
1876
1877  $('.commentContainer').on('mouseover', function (event) {
1878    var commentId = $(this).attr('commentId');
1879    $('#delete_' + commentId).removeClass('hidden');
1880  });
1881
1882  $('.commentContainer').on('mouseout', function (event) {
1883    var commentId = $(this).attr('commentId');
1884    $('#delete_' + commentId).addClass('hidden');
1885  });
1886
1887
1888  $('.deleteComment').on('click', function (event) {
1889    var me = $(this);
1890    ShowConfirmAlert(function () {
1891
1892      event.preventDefault();
1893
1894      var commentId = me.attr('cid');
1895      var result = DeleteWallItemComment(commentId);
1896
1897      if (result == 'True') {
1898        $('#comment_' + commentId).remove();
1899      }
1900    });
1901
1902  });
1903
1904
1905
1906  $('.showAllComments').on('click', function (event) {
1907    event.preventDefault();
1908    GetWallItemComments($(this).attr('wallItemId'));
1909    $(this).addClass('hidden');
1910  });
1911
1912
1913    $('.commentFieldToggler').on('click', function (event) {
1914        console.log("common");
1915    var wallItemId = $(this).attr('WallItemId');
1916    $('#commentField_' + wallItemId).removeClass('hidden');
1917    $('#commentField_' + wallItemId).css('display', 'block');
1918    //$(this).addClass('invisible');
1919    $(this).css('display', 'none');
1920    $('#item_' + wallItemId).autogrow();
1921    $('#item_' + wallItemId).focus();
1922  });
1923
1924
1925  /* ----------------------------------- wall item ----------------------------------- */
1926
1927  /* ----------------------------------- topic ----------------------------------- */
1928
1929
1930    $(document).ready(function () {
1931        if ($("img[id*='image_attachments']").length > 0) {
1932            $("img[id*='image_attachments']").BMBImageUpload({ multiple: true });
1933        }
1934  });
1935
1936
1937  $("#topicMessageFieldForm").on('submit', function () {
1938
1939    $("#topicMessageFieldForm").ajaxSubmit({
1940      resetForm: false,
1941      success: function formRefresh(response) {
1942
1943        result = eval("(" + response + ")");
1944
1945
1946
1947          if (result.Success) {
1948
1949              var topicId = $(result.Data).attr("topicId");
1950              $('#messages_' + topicId).append(result.Data);
1951
1952              $('#item_' + topicId).val('');
1953              $('#item_' + topicId).css('height', '61px');
1954
1955              $('.mentionMember').mentionsInput('getMentions', function (data) {                  
1956                  if (data.length > 0) {
1957                      var messageOwner = $(result.Data).attr("member");
1958                      NotifiyPostMentions(this, "TopicComment", topicId, data, messageOwner);
1959                  }
1960              });
1961          } else {
1962              showHandlerResponse(result);
1963          }
1964        $('#messageField_' + topicId).addClass('hidden');
1965        $('.messageFieldToggler[topicid="' + topicId + '"').removeClass('invisible');
1966        //remove attachments from edit mode
1967        $('#multipleUploadContainer_attachments_' + topicId).find(".qq-upload-success").remove();
1968        $('#attachments_' + topicId).val("");
1969
1970        $("p").doLinks();
1971        $("#addMessageToTopic_" + topicId).show();
1972        $(".process_button").hide();
1973      }
1974    });
1975    return false;
1976  });
1977
1978  function AddTopicMessage(TopicId, MessageText, Attachments) {
1979
1980    MessageText = GetMentions(MessageText);
1981    MessageText = escape(MessageText);
1982
1983    $("#topicMessageFieldForm").find("#TopicId").val(TopicId);
1984    $("#topicMessageFieldForm").find("#Attachments").val(Attachments);
1985    $("#topicMessageFieldForm").find("#MessageText").val(MessageText);
1986    $("#topicMessageFieldForm").submit();
1987
1988
1989  }
1990
1991
1992  function DeleteTopicMessage(TopicMessageId) {
1993    var handlerUrl = "/Handlers/ForumHandler.ashx?action=DeleteTopicMessage&TopicMessageId=" + TopicMessageId;
1994    var result = "";
1995
1996    jQuery.ajax({ url: handlerUrl, success: function (data) { result = data; }, async: false });
1997
1998    return result;
1999
2000  }
2001
2002
2003
2004
2005  function ShowTopicMassageAttachmentsSlider(TopicMessageId) {
2006    var handlerUrl = "/Handlers/ForumHandler.ashx?action=GetTopicMessageAttachmentsSlider&TopicMessageId=" + TopicMessageId;
2007    var result = "";
2008
2009    jQuery.ajax({ url: handlerUrl, success: function (data) { result = data; }, async: false });
2010
2011    return result;
2012  }
2013
2014
2015
2016  $('.messageContainer').on('mouseover', function (event) {
2017    var messageId = $(this).attr('messageId');
2018    $('#delete_' + messageId).removeClass('hidden');
2019  });
2020
2021  $('.messageContainer').on('mouseout', function (event) {
2022    var messageId = $(this).attr('messageId');
2023    $('#delete_' + messageId).addClass('hidden');
2024  });
2025
2026
2027  $('.deleteMessage').on('click', function (event) {
2028
2029    var me = $(this);
2030    ShowConfirmAlert(function () {
2031
2032      event.preventDefault();
2033
2034      var messageId = me.attr('mid');
2035      var result = DeleteTopicMessage(messageId);
2036      var response = eval("(" + result + ")");
2037      if (response.Success == true) {
2038        $('#message_' + messageId).remove();
2039      }
2040    });
2041
2042  });
2043
2044
2045  $('.messageFieldToggler').on('click', function (event) {
2046    var topicId = $(this).attr('TopicId');
2047    $('#messageField_' + topicId).removeClass('hidden');
2048    $(this).addClass('invisible');
2049    $('#item_' + topicId).autogrow();
2050    $('#item_' + topicId).focus();
2051  });
2052
2053
2054  $('.topicMessageSubmit').on('click', function (event) {
2055
2056    event.preventDefault();
2057
2058    var topicId = $(this).attr('topicId');
2059    var messageText = new String($('#item_' + topicId).val());
2060
2061    var messageAttachments = new String($('#attachments_' + topicId).val());
2062    $(this).hide();
2063    $('#process_button_addMessageToTopic_' + topicId).show();
2064    if (messageText !== '') {
2065
2066      messageText = messageText.replace(/\n/g, '*br*');
2067      if ($(this).hasClass("notPaying")) {
2068        $.ajax({
2069          type: "POST",
2070          dataType: "json",
2071          url: "/Handlers/MemberHandler.ashx?action=GetPremiumBlockWindowForum",
2072          contentType: "application/json; charset=utf-8",
2073            success: function (data) {
2074              if (data.Success) {
2075                  OpenPopup(data.Data);
2076              } 
2077          }
2078        });
2079      }
2080      else {
2081        AddTopicMessage(topicId, messageText, messageAttachments);
2082      }
2083    }
2084    else {
2085      alert("message content is required");
2086    }
2087
2088
2089  });
2090
2091  $('.topicMessageImage').on('click', function (event) {
2092    event.preventDefault();
2093  });
2094
2095  /* ----------------------------------- topic ----------------------------------- */
2096
2097  /* ----------------------------------- memberBoxSignIn ----------------------------------- */
2098
2099  $('#memberBoxSignInButton').click(function (e) {
2100    e.preventDefault();
2101    if ($('#login').hasClass('watermarkEmpty') == false && $('#password').hasClass('watermarkEmpty') == false) {
2102      $('#memberBoxSignInForm').submit();
2103    }
2104  });
2105
2106  $('#password').bind("keydown", function (e) {
2107    if (e.keyCode == 13) {
2108      if ($('#signInButton').length > 0) {
2109        $('#signInButton').click();
2110      }
2111    }
2112  });
2113
2114  $("#signInPopupForm").find('#password').bind("keydown", function (e) {
2115    if (e.keyCode == 13) {
2116      if ($('#signInPopupButton').length > 0) {
2117        $('#signInPopupButton').click();
2118      }
2119    }
2120  });
2121
2122  $("#signUpPopupForm").find('#password').bind("keydown", function (e) {
2123    if (e.keyCode == 13) {
2124      if ($('#registerMember').length > 0) {
2125        $('#registerMember').click();
2126      }
2127    }
2128  });
2129
2130  /* ----------------------------------- memberBoxSignIn ----------------------------------- */
2131
2132
2133
2134  $("#openBuy").hover(function (e) {
2135    $(".buyArrow").show();
2136  },
2137    function (e) {
2138      $(".buyArrow").hide();
2139    });
2140
2141  $("#openSell").hover(function (e) {
2142    $(".sellArrow").show();
2143  },
2144    function (e) {
2145      $(".sellArrow").hide();
2146    });
2147
2148  $("#openPromote").hover(function (e) {
2149    $(".promoteArrow").show();
2150  },
2151    function (e) {
2152      $(".promoteArrow").hide();
2153    });
2154
2155  /* ----------------------------------- communityMenu ----------------------------------- */
2156  $(document).click(function (e) {
2157    if ($("#communityMenu").is(":visible") == true) {
2158      $("#communityMenu").hide();
2159      $(".communityArrow").hide();
2160    }
2161  });
2162
2163  $("#openCommunityMenu").hover(function (e) {
2164    e.preventDefault();
2165    $("#communityMenu").show();
2166    $(".communityArrow").show();
2167    return false;
2168  });
2169
2170  $("#openCommunityMenu").click(function (e) {
2171    $("#communityMenu").show();
2172    $(".communityArrow").show();
2173    return false;
2174  });
2175
2176  /* ----------------------------------- communityMenu ----------------------------------- */
2177
2178
2179
2180  /* ----------------------------------- sub menus --------------------------------------- */
2181
2182  $(document).click(function (e) {
2183    if ($("#eventTopMenu").is(":visible") == true) {
2184      $("#eventTopMenu").hide();
2185      $(".eventArrow").hide();
2186    }
2187
2188    if ($("#blogTopMenu").is(":visible") == true) {
2189      $("#blogTopMenu").hide();
2190      $(".blogArrow").hide();
2191    }
2192
2193    if ($("#bidTopMenu").is(":visible") == true) {
2194      $("#bidTopMenu").hide();
2195      $(".bidArrow").hide();
2196    }
2197
2198    if ($("#groupTopMenu").is(":visible") == true) {
2199      $("#groupTopMenu").hide();
2200      $(".groupArrow").hide();
2201    }
2202
2203    if ($("#creditTopMenu").is(":visible") == true) {
2204      $("#creditTopMenu").hide();
2205      $(".creditArrow").hide();
2206    }
2207
2208    if ($("#campaignTopMenu").is(":visible") == true) {
2209      $("#campaignTopMenu").hide();
2210      $(".campaignArrow").hide();
2211    }
2212
2213    if ($("#tutorialTopMenu").is(":visible") == true) {
2214      $("#tutorialTopMenu").hide();
2215      $(".tutorialArrow").hide();
2216    }
2217
2218    if ($("#helpTopMenu").is(":visible") == true) {
2219      $("#helpTopMenu").hide();
2220      $(".helpArrow").hide();
2221    }
2222  });
2223
2224  $(".subTopMenu").mouseout(function (e) {
2225    $(this).hide();
2226  });
2227
2228  $(".subTopMenu").mouseover(function (e) {
2229    $(this).show();
2230  });
2231
2232  $("#openEventTopMenu").hover(function (e) {
2233    e.preventDefault();
2234    $("#eventTopMenu").show();
2235    //$(".eventArrow").show();
2236    //var eventOffset = ($('.topMenuContent span').width() - ($('#openEventTopMenu').position().left + $('#openEventTopMenu').outerWidth()));
2237    //$(".eventTopMenu").css('right', eventOffset + "px")
2238
2239
2240    $("#blogTopMenu").hide();
2241    //$(".blogArrow").hide();
2242
2243    $("#bidTopMenu").hide();
2244    //$(".bidArrow").hide();
2245
2246    $("#groupTopMenu").hide();
2247    //$(".groupArrow").hide();
2248
2249    $("#creditTopMenu").hide();
2250    //$(".creditArrow").hide();
2251
2252    $("#campaignTopMenu").hide();
2253    //$(".campaignArrow").hide();
2254
2255    $("#tutorialTopMenu").hide();
2256    //$(".tutorialArrow").hide()
2257    return false;
2258  });
2259
2260  $("#openBlogTopMenu").hover(function (e) {
2261    e.preventDefault();
2262    $("#blogTopMenu").show();
2263    //$(".blogArrow").show();
2264    //var blogOffset = ($('.topMenuContent span').width() - ($('#openBlogTopMenu').position().left + $('#openBlogTopMenu').outerWidth()));
2265    //$(".blogTopMenu").css('right', blogOffset + "px")
2266
2267
2268    $("#eventTopMenu").hide();
2269    //$(".eventArrow").hide();
2270
2271    $("#bidTopMenu").hide();
2272    //$(".bidArrow").hide();
2273
2274    $("#groupTopMenu").hide();
2275    //$(".groupArrow").hide();
2276
2277    $("#creditTopMenu").hide();
2278    //$(".creditArrow").hide();
2279
2280    $("#campaignTopMenu").hide();
2281    //$(".campaignArrow").hide();
2282
2283    $("#tutorialTopMenu").hide();
2284    //$(".tutorialArrow").hide()
2285    return false;
2286  });
2287
2288  $("#openBidTopMenu").hover(function (e) {
2289    e.preventDefault();
2290    $("#bidTopMenu").show();
2291    //$(".bidArrow").show();
2292    //var bidOffset = ($('.topMenuContent span').width() - ($('#openBidTopMenu').position().left + $('#openBidTopMenu').outerWidth()));
2293    //$(".bidTopMenu").css('right', bidOffset + "px")
2294
2295
2296    $("#eventTopMenu").hide();
2297    //$(".eventArrow").hide();
2298
2299    $("#blogTopMenu").hide();
2300    //$(".blogArrow").hide();
2301
2302    $("#groupTopMenu").hide();
2303    //$(".groupArrow").hide();
2304
2305    $("#creditTopMenu").hide();
2306    //$(".creditArrow").hide();
2307
2308    $("#campaignTopMenu").hide();
2309    //$(".campaignArrow").hide();
2310
2311    $("#tutorialTopMenu").hide();
2312    //$(".tutorialArrow").hide()
2313    return false;
2314  });
2315
2316  $("#openCampaignTopMenu").hover(function (e) {
2317    e.preventDefault();
2318    $("#campaignTopMenu").show();
2319    //$(".campaignArrow").show();
2320    //var campaignOffset = ($('.topMenuContent span').width() - ($('#openCampaignTopMenu').position().left + $('#openCampaignTopMenu').outerWidth()));
2321    //$(".campaignTopMenu").css('right', campaignOffset + "px")
2322
2323
2324    $("#bidTopMenu").hide();
2325    //$(".bidArrow").hide();
2326
2327    $("#eventTopMenu").hide();
2328    //$(".eventArrow").hide();
2329
2330    $("#blogTopMenu").hide();
2331    //$(".blogArrow").hide();
2332
2333    $("#groupTopMenu").hide();
2334    //$(".groupArrow").hide();
2335
2336    $("#creditTopMenu").hide();
2337    //$(".creditArrow").hide();
2338
2339    $("#tutorialTopMenu").hide();
2340    //$(".tutorialArrow").hide()
2341    return false;
2342  });
2343
2344  $("#openGroupTopMenu").hover(function (e) {
2345    e.preventDefault();
2346    $("#groupTopMenu").show();
2347    //$(".groupArrow").show();
2348    //var groupOffset = ($('.topMenuContent span').width() - ($('#openGroupTopMenu').position().left + $('#openGroupTopMenu').outerWidth()));
2349    //$(".groupTopMenu").css('right', groupOffset + "px")
2350
2351
2352    $("#bidTopMenu").hide();
2353    //$(".bidArrow").hide();
2354
2355    $("#eventTopMenu").hide();
2356    //$(".eventArrow").hide();
2357
2358    $("#blogTopMenu").hide();
2359    //$(".blogArrow").hide();
2360
2361    $("#creditTopMenu").hide();
2362    //$(".creditArrow").hide();
2363
2364    $("#campaignTopMenu").hide();
2365    //$(".campaignArrow").hide();
2366
2367    $("#tutorialTopMenu").hide();
2368    //$(".tutorialArrow").hide()
2369    return false;
2370  });
2371
2372  $("#openCreditTopMenu").hover(function (e) {
2373    e.preventDefault();
2374
2375    $("#creditTopMenu").show();
2376    $(".creditArrow").show();
2377    //var creditOffset = ($('.topMenuContent span').width() - ($('#openCreditTopMenu').position().left + $('#openCreditTopMenu').outerWidth()));
2378    //$(".creditTopMenu").css('right', creditOffset + "px")
2379
2380
2381    $("#groupTopMenu").hide();
2382    //$(".groupArrow").hide();
2383
2384    $("#bidTopMenu").hide();
2385    //$(".bidArrow").hide();
2386
2387    $("#eventTopMenu").hide();
2388    //$(".eventArrow").hide();
2389
2390    $("#blogTopMenu").hide();
2391    //$(".blogArrow").hide();
2392
2393    $("#campaignTopMenu").hide();
2394    //$(".campaignArrow").hide();
2395
2396    $("#tutorialTopMenu").hide();
2397    //$(".tutorialArrow").hide();
2398    return false;
2399  });
2400
2401  $("#openTutorialTopMenu").hover(function (e) {
2402    e.preventDefault();
2403
2404    $("#tutorialTopMenu").show();
2405    $(".tutorialArrow").show();
2406    //var tutorialOffset = ($('.topMenuContent span').width() - ($('#openTutorialTopMenu').position().left + $('#openTutorialTopMenu').outerWidth()));
2407    //$(".tutorialTopMenu").css('right', tutorialOffset + "px")
2408
2409
2410    $("#creditTopMenu").hide();
2411    //$(".creditArrow").hide();
2412
2413    $("#groupTopMenu").hide();
2414    //$(".groupArrow").hide();
2415
2416    $("#bidTopMenu").hide();
2417    //$(".bidArrow").hide();
2418
2419    $("#eventTopMenu").hide();
2420    //$(".eventArrow").hide();
2421
2422    $("#blogTopMenu").hide();
2423    //$(".blogArrow").hide();
2424
2425    $("#campaignTopMenu").hide();
2426    //$(".campaignArrow").hide();
2427    return false;
2428  });
2429
2430  $("#openHelpTopMenu").hover(function (e) {
2431    e.preventDefault();
2432
2433    $("#helpTopMenu").show();
2434    $(".helpArrow").show();
2435    return false;
2436  });
2437
2438  /* ----------------------------------- sub menus --------------------------------------- */
2439
2440  /* ----------------------------------- header search ----------------------------------- */
2441
2442  function PerformSearch(SearchCategory, SearchText) {
2443
2444    var url = '';
2445    switch (SearchCategory) {
2446
2447      case "Events":
2448
2449        if (SearchText == '') {
2450          url = "/Search/Events/Everything/";
2451        }
2452        else {
2453          url = "/Search/Events/" + SearchText + "/";
2454        }
2455
2456        break;
2457
2458      case "Members":
2459
2460        if (SearchText == '') {
2461          url = "/Members/";
2462        }
2463        else {
2464          url = "/Search/Members/" + SearchText + "/";
2465        }
2466
2467        break;
2468      case "Groups":
2469
2470        if (SearchText == '') {
2471          url = "/Search/Groups/Everything/";
2472        }
2473        else {
2474          url = "/Search/Groups/" + SearchText + "/";
2475        }
2476
2477        break;
2478      case "Blogs":
2479
2480        if (SearchText == '') {
2481          url = "/Blogs/";
2482        }
2483        else {
2484          url = "/Search/Blogs/" + SearchText + "/";
2485        }
2486
2487        break;
2488
2489      case "Services":
2490
2491        url = "/Search/Services/" + SearchText + "/";
2492
2493        break;
2494
2495      case "Products":
2496
2497        url = "/Search/Products/" + SearchText + "/";
2498
2499        break;
2500      case "Campaigns":
2501
2502        if (SearchText == '') {
2503          url = "/Search/Campaigns/Everything/";
2504        }
2505        else {
2506          url = "/Search/Campaigns/" + SearchText + "/";
2507        }
2508
2509        break;
2510      case "Bids":
2511
2512        if (SearchText == '') {
2513          url = "/Search/Bids/Everything/";
2514        }
2515        else {
2516          url = "/Search/Bids/" + SearchText + "/";
2517        }
2518
2519        break;
2520      case "CreditProducts":
2521
2522        if (SearchText == '') {
2523          url = "/CreditStore/Everything/";
2524        }
2525        else {
2526          url = "/CreditStore/" + SearchText + "/";
2527        }
2528
2529        break;
2530      default:
2531
2532    }
2533
2534
2535    //        if (url.indexOf("\"") != -1) {
2536    //            url = url.replace("\"", "++");
2537    //        }
2538
2539    //        if (url.indexOf("'") != -1) {
2540    //            url = url.replace("'", "+");
2541    //        }
2542
2543    if (url != '') {
2544      document.location.href = url;
2545    }
2546
2547  }
2548
2549  $(".searchCategoryMenu").mouseout(function (e) {
2550    $(this).hide();
2551  });
2552
2553  $(".searchCategoryMenu").mouseover(function (e) {
2554    $(this).show();
2555  });
2556
2557  $(document).click(function (e) {
2558    if ($(".searchCategoryMenu").is(":visible") == true) {
2559      $(".searchCategoryMenu").hide();
2560    }
2561  });
2562
2563  $("input[id*='searchTextHeader']").bind("keydown", function (e) {
2564    if (e.keyCode == 13) {
2565      e.preventDefault();
2566      $("img[id*='searchButton']").click();
2567    }
2568  });
2569
2570  $("#searchButton_buySearch").click(function (e) {
2571    e.preventDefault();
2572    var searchInput = $("#searchTextHeader_buySearch");
2573    if (searchInput.attr('value') == searchInput.attr('watermark')) {
2574      searchInput.val('');
2575    }
2576
2577    var searchCategory = $("#searchCategoryHeader_buySearch").val();
2578    var searchText = searchInput.val();
2579
2580    PerformSearch(searchCategory, searchText);
2581
2582  });
2583
2584  $("#searchButton_headerSearch").click(function (e) {
2585    e.preventDefault();
2586    var searchInput = $("#searchTextHeader_headerSearch");
2587    if (searchInput.attr('value') == searchInput.attr('watermark')) {
2588      searchInput.val('');
2589    }
2590
2591    var searchCategory = $("#searchCategoryHeader_headerSearch").val();
2592    var searchText = searchInput.val();
2593    searchText = searchText.replace(/\s+$/g, '');
2594    PerformSearch(searchCategory, searchText);
2595  });
2596  $("#searchButton_headerSearch_01").click(function (e) {
2597    e.preventDefault();
2598    var searchInput = $("#searchTextHeader_headerSearch_01");
2599    if (searchInput.attr('value') == searchInput.attr('watermark')) {
2600      searchInput.val('');
2601    }
2602
2603    var searchCategory = $("#searchCategoryHeader_headerSearch_01").val();
2604    var searchText = searchInput.val();
2605    // alert(searchCategory);
2606    PerformSearch(searchCategory, searchText);
2607
2608  });
2609  $("#searchButton_headerSearch_01_mobile").click(function (e) {
2610    e.preventDefault();
2611    var searchInput = $("#searchTextHeader_headerSearch_01_mobile");
2612    if (searchInput.attr('value') == searchInput.attr('watermark')) {
2613      searchInput.val('');
2614    }
2615
2616    var searchCategory = $("#searchCategoryHeader_headerSearch_01_mobile").val();
2617    var searchText = searchInput.val();
2618    // alert(searchCategory);
2619    PerformSearch(searchCategory, searchText);
2620
2621  });
2622
2623  $("#searchButton_Responsive_headerSearch").click(function (e) {
2624    e.preventDefault();
2625    var searchInput = $("#searchTextHeader_Responsive_headerSearch");
2626    if (searchInput.attr('value') == searchInput.attr('watermark')) {
2627      searchInput.val('');
2628    }
2629    var searchCategory = $("#searchCategoryHeader_Responsive_headerSearch").val();
2630    var searchText = searchInput.val();
2631    // alert(searchCategory);    
2632
2633    PerformSearch(searchCategory, searchText);
2634
2635  });
2636
2637  function OpenSearchCategoryMenu(element) {
2638    var id = $(element).attr('searchBoxId');
2639    $("#searchCategoryMenu_" + id).show();
2640  }
2641
2642  $(".openSearchCategoryMenu").hover(function () {
2643    OpenSearchCategoryMenu($(this));
2644  },
2645    function () {
2646      OpenSearchCategoryMenu($(this));
2647    }
2648  );
2649
2650  $(".openSearchCategoryMenu").click(function (e) {
2651    e.preventDefault();
2652    var id = $(this).attr('searchBoxId');
2653    if ($("#searchCategoryMenu_" + id).is(":visible") == true) {
2654      $("#searchCategoryMenu_" + id).hide();
2655    }
2656    else {
2657      $("#searchCategoryMenu_" + id).show();
2658    }
2659    return false;
2660  });
2661
2662  $(".searchCategoryMenuItemSelected").click(function (e) {
2663    e.preventDefault();
2664    var id = $(this).attr('searchBoxId');
2665    var category = $(this).attr('category');
2666    var categoryText = $(this).html();
2667    $("#searchCategoryMenu_" + id).hide();
2668    $("#searchCategoryHeader_" + id).val(category);
2669    $("#selectedSearchCategory_" + id).html(categoryText);
2670  });
2671
2672  $(".searchCategoryMenuItem").click(function (e) {
2673    e.preventDefault();
2674    var id = $(this).attr('searchBoxId');
2675    var category = $(this).attr('category');
2676    var categoryText = $(this).html();
2677    $("#searchCategoryMenu_" + id).hide();
2678    $("#searchCategoryHeader_" + id).val(category);
2679    $("#selectedSearchCategory_" + id).html(categoryText);
2680  });
2681
2682  $("a[id*='searchTextHeader']").on('focusin', function () {
2683
2684    if (!searchInitialized) {
2685      $(this).removeClass("searchWatermark");
2686      defaultSearchWatermark = $(this).val();
2687      $(this).val("");
2688      searchInitialized = true;
2689    }
2690  });
2691
2692  $("a[id*='searchTextHeader']").on('focusout', function () {
2693
2694    if (searchInitialized) {
2695      if (jQuery.trim($(this).val()) == "") {
2696        $(this).val(defaultSearchWatermark);
2697        $(this).addClass("searchWatermark");
2698        searchInitialized = false;
2699      }
2700    }
2701  });
2702
2703  $('#searchButton').bind('click', function () {
2704    return Search($("#query_input").val());
2705  });
2706
2707  /* ----------------------------------- header search ----------------------------------- */
2708
2709  //    $(document).ready(function () {
2710
2711  //        //        $('.tag').click(function (e) {
2712  //        //            e.preventDefault();
2713  //        //            $('#tagSearchText').attr('value', $(this).text());
2714  //        //            $('#tagSearchForm').submit();
2715
2716  //        //        });
2717
2718  //        //        $('.communityTag').click(function (e) {
2719  //        //            e.preventDefault();
2720  //        //            $('#communityTagSearchText').attr('value', $(this).text());
2721  //        //            $('#communityTagSearchForm').submit();
2722
2723  //        //        });
2724
2725  //    });
2726
2727  /* ----------------------------------- sign up ----------------------------------- */
2728
2729  $('.sign_up_for_free').click(function (e) {
2730    e.preventDefault();
2731    window.location = '/SignUp/';
2732  });
2733
2734  /* ----------------------------------- sign up ----------------------------------- */
2735
2736  /* ----------------------------------- pager ----------------------------------- */
2737
2738  $('.PagerButton').on('click', function (e) {
2739    e.preventDefault();
2740    var data = new String($(this).attr('rel')).split(',');
2741    $('#pageNumber').val(data[0]);
2742    $('#' + data[1]).submit();
2743  });
2744
2745  /* ----------------------------------- pager ----------------------------------- */
2746
2747  /* ----------------------------------- filter ----------------------------------- */
2748
2749  $('[Filter]').click(function (e) {
2750    e.preventDefault();
2751    var data = new String($(this).attr('Filter')).split(',');
2752    $('#' + data[1]).val(data[2])
2753    if ($('#pageNumber').length > 0) {
2754      $('#pageNumber').val('1'); // reset pager to 1st page
2755    }
2756    if ($('#leadStatus').length > 0) {
2757      $('#leadStatus').val(''); // reset leadStatus to empty
2758    }
2759    if ($('#creditProductCategory').length > 0) {
2760      $('#creditProductCategory').val(''); // reset credit product category
2761    }
2762    if ($('#maxPrice').length > 0) {
2763      $("#maxPrice").val("0"); // reset credit max price
2764    }
2765    $('#' + data[0]).submit();
2766  });
2767
2768  $('[PopupFilter]').on('click', function (e) {
2769    e.preventDefault();
2770    var data = new String($(this).attr('PopupFilter')).split(',');
2771    $("div[id*='" + data[0] + "']").addClass("hidden");
2772    $('#' + data[0] + "_" + data[1]).removeClass("hidden");
2773    $('[PopupFilter]').removeClass("selected");
2774    $(this).addClass("selected");
2775  });
2776
2777  /* ----------------------------------- filter ----------------------------------- */
2778
2779  /* ----------------------------------- home menu ----------------------------------- */
2780
2781  $("#moneyAccountLink").click(function (e) {
2782    e.preventDefault();
2783    $("#moneyAccount").slideToggle('fast');
2784
2785  });
2786
2787  //    $("#myBusinessLink").click(function (e) {
2788  //        e.preventDefault();
2789  //        $("#myBusiness").slideToggle('fast');
2790
2791  //    });
2792
2793  $("#myPremiumLink").click(function (e) {
2794    e.preventDefault();
2795    $("#myPremium").slideToggle('fast');
2796
2797  });
2798
2799  var selectedHomeSideMenuItem = $(".selected");
2800  if (selectedHomeSideMenuItem.length > 0) {
2801    var secondLevel = selectedHomeSideMenuItem.closest(".secondLevel");
2802    if (secondLevel.length > 0) {
2803      secondLevel.closest('span').css('display', 'inline');
2804    }
2805  }
2806
2807  /* ----------------------------------- home menu ----------------------------------- */
2808
2809
2810  /*-----------------------------------Ambassadors-----------------------------------*/
2811
2812  $('.getMemberDetailsLink').click(function (event) {
2813    event.preventDefault();
2814
2815    var MemberDetaildId = $(this).attr('id');
2816
2817    var myId = "#id_" + $(this).attr('id');
2818
2819    if ($(myId).hasClass('created')) {
2820      $(myId).removeClass('created');
2821      $(myId).html("");
2822    }
2823    else {
2824      var firstname = "";
2825
2826      $.ajax({
2827        type: "POST",
2828        dataType: "json",
2829        url: "/Handlers/GroupHandler.ashx?action=GetGroupMemberDetails&UserId=" + $(this).attr('id'),
2830        contentType: "application/json; charset=utf-8",
2831        success: function (data) {
2832          if (data.Success) {
2833            var res = JSON.parse(data.Data);
2834            if (data.Data != "[]") {
2835
2836              $('.iconsHeader').remove();
2837
2838
2839              var table = $('<table></table>').addClass('GroupMemberResult');
2840
2841              for (var i = 0; i < res.length; i++) {
2842                var PurchaseDate = ParseDateFormat(res[i].PurchaseDate);
2843
2844
2845
2846
2847
2848                var row = $('<tr></tr>');
2849
2850                for (var i = 0; i < res.length; i++) {
2851                  var EndPurchaseDate = ParseDateFormat(res[i].EndTime);
2852                  var IntroCalls = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: -56px 0px;';
2853                  var Education = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: -56px 0px;';
2854                  var GroupVisits = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: -56px 0px; ';
2855                  var BundleID = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: -56px 0px; ';
2856
2857
2858                  if (res[i].IntroCalls > 0) { IntroCalls = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: 20px 0px; ' }
2859                  if (res[i].Education > 0) { Education = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: 20px 0px; ' }
2860                  if (res[i].GroupVisits > 0) { GroupVisits = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: 20px 0px; ' }
2861                  if (res[i].BundleID > 0) { BundleID = 'height: 16px;background-image: url(/Images/CheckState.png);background-position: 20px 0px; ' }
2862                  
2863
2864
2865                  var rowData = $('<tr><td><div class="GroupMemberDetailsRow grid_3" style="padding:0px;margin:0px">' +
2866                    '<h4>' + res[i].FirstName + ' ' + res[i].LastName + '</h4>' +
2867                    '<h5>מסיים התנסות בתאריך: ' + EndPurchaseDate + '</h5></div><div  class="grid_3 iconsValues BackFloat" >' +
2868                    '<ul class="badgeTagUl">' +
2869                    '<li class="badgeTag" style="background-color:' + IntroCalls + '"><a href="#" title="היכרות" class="masterTooltip"></a></li><li class="badgeTag" style="background:' + Education + '"><a href="#" title="הדרכה" class="masterTooltip">'
2870                    + '</a></li><li  class="badgeTag" style="background-color:'
2871                    + GroupVisits + '"><a href="#" title="ביקר בקבוצה" class="masterTooltip">' +
2872                    '</a></li><li  class="badgeTag" style="background-color:'
2873                    + BundleID + '"><a href="#" title="חבר ביז" class="masterTooltip">' +
2874                    '</a></li>' +
2875                    '</ul>' +
2876                    '<ul class="iconsHeader backFloat"><li>היכרות</li><li>הדרכה</li><li>ביקר בקבוצה</li><li>חבר ביז</li></ul><div class="clear spacer5"></div>' +
2877                    '</div></td></tr>'
2878
2879                  );
2880
2881                  row.append(rowData);
2882
2883                }
2884                table.append(row);
2885
2886              }
2887
2888              if (('table').length) {
2889                $(myId).append(table);
2890                $(myId, 'tr:first').after(row);
2891              }
2892              else {
2893                $(myId).append(table);
2894                
2895              }
2896              $(myId).addClass('created');
2897            }
2898
2899          }
2900        }
2901      });
2902    }
2903  });
2904
2905  function ParseDateFormat(date) {
2906    function pad(s) { return (s < 10) ? '0' + s : s; }
2907    var parsePurchaseDate = new Date(parseInt(date.replace(/(^.*\()|([+-].*$)/g, '')));
2908    var PurchaseDateFinal = parsePurchaseDate.getDate() + "/" + pad(parsePurchaseDate.getMonth() + 1) + "/" + parsePurchaseDate.getFullYear();
2909    return PurchaseDateFinal;
2910  }
2911  /*----------------------------------End Ambassadors--------------------------------*/
2912
2913  // Search Container - To all site areas //
2914    var searchContainerOpenState = false;
2915
2916  $('.searchContainer').hide();
2917  $('.mobileSearchIcon').click(function (e) {
2918    e.preventDefault();
2919    if ($('.searchContainer').length > 0) {
2920        $(".searchContainer").animate({ opacity: 'toggle' }, function () {
2921            if ($(".searchContainer").is(":visible")) {
2922                $('.top-menu-container').css('opacity', '0');
2923                $('.mobileSearchIcon #topMenu_searchIcon').addClass('open');
2924                $('.header-search-box-placeholder').addClass('open');
2925                $('#bizSearchTextBox').focus();
2926              
2927            } else {
2928                $('.top-menu-container').css('opacity', '1');
2929                $('.mobileSearchIcon #topMenu_searchIcon').removeClass('open');
2930                $('.header-search-box-placeholder').removeClass('open');
2931               
2932            }
2933        });
2934
2935        
2936    } else {
2937        $(".searchContainer").animate({ opacity: 'toggle' }, function () {
2938            if ($(".searchContainer").is(":visible")) {
2939                $('.top-menu-container').css('opacity', '0');
2940                $('.mobileSearchIcon #topMenu_searchIcon').addClass('open');
2941                
2942            } else {
2943                $('.mobileSearchIcon #topMenu_searchIcon').removeClass('open');
2944                $('.top-menu-container').css('opacity', '1');
2945            }
2946        });
2947      $("#Frontsite_Search_Container").animate({ width: 'toggle' });
2948    }
2949  });
2950
2951
2952  //$('#BizSearch .closeIcon').on('click', function (e) {
2953  //    console.log("here");
2954  //  $(".searchContainer").animate({ width: 'toggle' });//.css('overflow', '');
2955  //})
2956
2957  // #bodyContainer > div:nth-child(2) > div:nth-child(14) > ul > li:nth-child(1) > div:nth-child(1) > div.invitedFriendBlock_InnerUserProfileView.grid_3 > div > a:nth-child(2)
2958  /*---------------------------- Invite Your Friends --------------------------------*/
2959  $('.invitedFriendBlock').each(function () {
2960    var elem = $(this).find('.memberView2 br:lt(2)');
2961    $(elem).remove();
2962    $(this).find('.clear.spacer').first().removeClass('spacer').addClass('spacer10');
2963    $(this).find('p').css('padding-bottom', '0px');
2964  });
2965  //  $('.invitedFriendBlock .memberView2 br').first("br").remove();
2966  /*!---------------------------- Invite Your Friends --------------------------------*/
2967
2968  $('.HeaderMemberChat').on('hover', function () {
2969    $('.bizchat_openChatWindowBtn.HeaderIcon img').css('display', 'block');
2970    $(this).animate({ top: -5 }, 200, 'swing')
2971    $('.bizchat_openChatWindowBtn.HeaderIcon img').animate({ 'margin-top': -57, 'margin-bottom': 32, opacity: 1 }, 200)
2972
2973
2974  })
2975  $('.HeaderMemberChat').mouseleave(function () {
2976    $(this).animate({ top: 0 }, 200, 'swing')
2977    $('.bizchat_openChatWindowBtn.HeaderIcon img').animate({ 'margin-top': -32, 'margin-bottom': 7, opacity: 0 }, 200, '', function () {
2978      $('.bizchat_openChatWindowBtn.HeaderIcon img').css('display', 'none');
2979    })
2980
2981  })
2982
2983    $('.HeaderSendCredit').on('hover', function () {
2984        $(this).animate({ top: -5 }, 200, 'swing');
2985        //$('.sendCredit.HeaderIcon img').css('display', 'block');     
2986        //$('.sendCredit.HeaderIcon img').animate({ 'margin-top': -57, 'margin-bottom': 32, opacity: 1 }, 200)
2987
2988
2989    });
2990    $('.HeaderSendCredit').mouseleave(function () {
2991        $(this).animate({ top: 0 }, 200, 'swing')
2992        //$('.sendCredit.HeaderIcon img').animate({ 'margin-top': -32, 'margin-bottom': 7, opacity: 0 }, 200, '', function () {
2993        //  $('.sendCredit.HeaderIcon img').css('display', 'none');
2994        //})
2995
2996    });
2997    $('.HeaderAskForMeeting').on('hover', function () {
2998        $(this).animate({ top: -5 }, 200, 'swing');
2999        //$('.sendRequestImageButton.HeaderIcon img').css('display', 'block');
3000        //$('.sendRequestImageButton.HeaderIcon img').animate({ 'margin-top': -54, 'margin-bottom': 36, opacity: 1 }, 200)
3001    });
3002    $('.HeaderAskForMeeting').mouseleave(function () {
3003        $(this).animate({ top: 0 }, 200, 'swing');
3004    });
3005    $('.HeaderSendLead').on('hover', function () {
3006        $(this).animate({ top: -5 }, 200, 'swing');
3007        //$('.sendRequestImageButton.HeaderIcon img').css('display', 'block');
3008        //$('.sendRequestImageButton.HeaderIcon img').animate({ 'margin-top': -54, 'margin-bottom': 36, opacity: 1 }, 200)
3009    });
3010    $('.HeaderSendLead').mouseleave(function () {
3011        $(this).animate({ top: 0 }, 200, 'swing')
3012        $('.sendRequestImageButton.HeaderIcon img').animate({ 'margin-top': -25, 'margin-bottom': 7, opacity: 0 }, 200, '', function () {
3013            $('.sendRequestImageButton.HeaderIcon img').css('display', 'none');
3014        });
3015    });
3016
3017  $('.HeaderContact').on('hover', function () {
3018    $('.openSendMessageWindow.HeaderIcon img').css('display', 'block');
3019    $(this).animate({
3020      top: -5
3021    }, 200, 'swing')
3022    $('.openSendMessageWindow.HeaderIcon img').animate({ 'margin-top': -55, 'margin-bottom': 30, opacity: 1 }, 200)
3023
3024
3025    $('.contactMember.HeaderIcon img').css('display', 'block');
3026    $('.contactMember.HeaderIcon img').animate({ 'margin-top': -55, 'margin-bottom': 30, opacity: 1 }, 200)
3027
3028  })
3029  $('.HeaderContact').mouseleave(function () {
3030    $(this).animate({ top: 0 }, 200, 'swing')
3031    $('.openSendMessageWindow.HeaderIcon img').animate({ 'margin-top': -32, 'margin-bottom': 7, opacity: 0 }, 200, '', function () {
3032      $('.openSendMessageWindow.HeaderIcon img').css('display', 'none');
3033    })
3034
3035    $('.contactMember.HeaderIcon img').animate({ 'margin-top': -32, 'margin-bottom': 7, opacity: 0 }, 200, '', function () {
3036      $('.contactMember.HeaderIcon img').css('display', 'none');
3037    })
3038  })
3039
3040  $('.HeaderProfileSettings').on('hover', function () {
3041    $('.ProfileSettingsIcon.HeaderIcon i').css('display', 'block');
3042    $(this).animate({ top: -5 }, 200, 'swing')
3043    $('.ProfileSettingsIcon.HeaderIcon i').animate({ 'margin-top': -50, 'margin-bottom': 31, opacity: 1 }, 200)
3044
3045  })
3046  $('.HeaderProfileSettings').mouseleave(function () {
3047    $(this).animate({ top: 0 }, 200, 'swing')
3048    $('.ProfileSettingsIcon.HeaderIcon i').animate({ 'margin-top': -26, 'margin-bottom': 7, opacity: 0 }, 200, '', function () {
3049      $('.ProfileSettingsIcon.HeaderIcon i').css('display', 'none');
3050    })
3051
3052  })
3053  $('.HeaderChangeCover').on('hover', function () {
3054    $('.ChangeCoverIcon.HeaderIcon img').css('display', 'block');
3055    $(this).animate({ top: -5 }, 200, 'swing')
3056    $('.ChangeCoverIcon.HeaderIcon img').animate({ 'margin-top': -50, 'margin-bottom': 31, opacity: 1 }, 200)
3057
3058  })
3059  $('.HeaderChangeCover').mouseleave(function () {
3060    $(this).animate({ top: 0 }, 200, 'swing')
3061    $('.ChangeCoverIcon.HeaderIcon img').animate({ 'margin-top': -26, 'margin-bottom': 7, opacity: 0 }, 200, '', function () {
3062      $('.ChangeCoverIcon.HeaderIcon img').css('display', 'none');
3063    })
3064
3065  })
3066
3067  $(".HeaderChangeCover").on('click', function (e) {
3068    e.preventDefault();
3069    $.ajax({
3070      type: "POST",
3071      dataType: "json",
3072      url: "/Handlers/MemberHandler.ashx?action=GetChangeMemberCoverWindow",
3073      contentType: "application/json; charset=utf-8",
3074      success: function (data) {
3075        if (data.Success) {
3076          
3077          OpenPopup(data.Data);
3078        }
3079      }
3080    });
3081  });
3082
3083    $(".HeaderAskForMeeting").on('click', function (e) {
3084        e.preventDefault();
3085
3086    });
3087  
3088  $('#WindowCreditsRewardServiceId').on('change', function () {
3089    
3090    if ($(this).val() == '0') {
3091      $('#window_creditsRewardRequestName_Container').removeClass('hidden');
3092    }
3093    else {
3094      $('#window_creditsRewardRequestName_Container').addClass('hidden');
3095    }
3096  });
3097
3098  InitCroppit = function () {
3099
3100    var CoverFileSize = 0;
3101
3102    $('#image-cropper').cropit({
3103      imageBackground: false,
3104      allowDragNDrop: true,
3105      smallImage: 'stretch',
3106      freeMove: false,
3107      'zoom': 1,
3108      exportZoom: 1.5,
3109      onOffsetChange: function () {
3110
3111      },
3112      onImageLoading: function () {
3113
3114        $('.cropit-preview').hide();
3115        $('.cropit-preview-container').css('background-image', 'url("/images/lytebox/loading_white.gif")');
3116        $('.cropit-preview-container').css('background-size', '4%');
3117      },
3118      onImageLoaded: function () {
3119        $('.cropit-preview').show();
3120        if (CoverFileSize > 8) {
3121          ResetPreviewImage();
3122        }
3123      },
3124      onImageError: function (object, number, string) {
3125        
3126        $('.cropit-preview').show();
3127        $('.cropit-preview-container').css('background-image', 'url("/Images/changeCoverWindowIcon.png")');
3128        ShowModalAlert("מידות התמונה אינן תקינות", "גודל בתמונה חייב להיות מינימום 800 פיקסלים לרוחב ו 200 פיקסלים לאורך", '#');
3129        $('.ui-dialog').css('z-index', '100001');
3130        $('.crop-btn').show();
3131        $('.loadingCoverProcess').hide();
3132        $('.cropit-image-input').click();
3133      }
3134    });
3135
3136    var ResetPreviewImage = function () {
3137      $('.cropit-preview').show();
3138      $('.cropit-preview-container').css('background-image', 'url("/Images/changeCoverWindowIcon.png")');
3139      $('.cropit-preview-container').css('background-size', '10%');
3140      var $imagePreview = $('#image-cropper').find('.cropit-preview');
3141      if ($imagePreview.hasClass('cropit-image-loaded')) {
3142        $imagePreview.css('background-image', '').removeClass('cropit-image-loaded');
3143        $('.cropit-preview-image').attr('src', '');
3144        ShowModalAlert("גודל הקובץ אינו תקין", "גודל הקובץ נדרש להיות מתחת ל 4MB", '#');
3145        $('.ui-dialog').css('z-index', '100001')
3146      };
3147    }
3148    $('.cropit-image-input').bind('change', function () {
3149      if ((this.files[0].size / 1024) / 1024 < 8) {
3150        $('#selectCoverBtn,.cropit-preview-image-container').unbind("click");
3151        CoverFileSize = (this.files[0].size / 1024) / 1024;
3152      } else {
3153        CoverFileSize = (this.files[0].size / 1024) / 1024;
3154      }
3155
3156    });
3157    $('.crop-btn').on('click', function (e) {
3158      $('.crop-btn').hide();
3159      $('.loadingCoverProcess').show();
3160      e.preventDefault();
3161      var imageData = $('#image-cropper').cropit('export', {
3162        type: 'image/jpeg',
3163        quality: 1
3164      });
3165
3166      if (imageData != null) {
3167        
3168        $('.hidden-image-data').val(imageData);
3169        window.setTimeout(function () {
3170          $('#CoverImageUpload').submit();
3171        }, 1000);
3172      }
3173      else {
3174        ShowModalAlert("בחר תמונה", "לחץ על הרקע הכחול בכדי לעלות תמונה", '#');
3175        $('.ui-dialog').css('z-index', '100001')
3176        $('.crop-btn').show();
3177        $('.loadingCoverProcess').hide();
3178      }
3179    });
3180
3181    $('.cancel-crop-btn').click(function () {
3182      ClosePopup();
3183    })
3184
3185    $('#selectCoverBtn,.cropit-preview-image-container').click(function () {
3186      $('.cropit-image-input').click();
3187    });
3188
3189    $('#CoverImageUpload').ajaxForm({
3190      dataType: 'json',
3191      success: function (data) {
3192
3193        $.ajax({
3194          type: "POST",
3195          dataType: "json",
3196          url: "/Handlers/MemberHandler.ashx?action=ModifyMemberPremiumBanner&premiumBanner=" + data.filename,
3197          contentType: "application/json; charset=utf-8",
3198          success: function (handlerData) {
3199            ClosePopup();
3200            $('.gridCoverContainer .CommunityCoverImage').css('background-image', 'url("/Media/PremiumBanners/1/' + data.filename + '")');
3201          }
3202        });
3203      },
3204      complete: function () {
3205        $('.crop-btn').show();
3206        $('.loadingCoverProcess').hide();
3207      }
3208    });
3209  }
3210
3211
3212
3213  //--- Comunities ---
3214
3215  InitializeSubCommunitiesSelectbox = function (val) {
3216    if (val != "") {
3217      $.ajax({
3218        url: "/Handlers/CommunityHandler.ashx?action=GetSubCommunitiesByParentDictionary&ParentCommunityId=" + val,
3219      }).done(function (data) {
3220        var jsonObj = jQuery.parseJSON(data);
3221        var JsonDictonary = jQuery.parseJSON(jsonObj.Data);
3222        $('#ParentCommunity').val(val);
3223        $('.subCommunityCheckbxNameContainer').hide();
3224        $('.TenderSubCommunitySelectInputContainerLeft').html('');
3225        $('.subCommunityCheckbxContainer').html('');
3226        $('.TenderSubCommunitySelectInputContainerLeft').append('<div class="subCommunityCheckbxContainer"></div>');
3227
3228        $.each(JsonDictonary, function (key, value) {
3229
3230          var text = value.length > 50 ? value.substring(0, 50) + ".." : value;
3231          //$('.subCommunityCheckbxContainer').append("<div class='checkboxFive'></div>");
3232          var cbx = $("<div class='checkboxFive'></div>");
3233
3234          var e_checkbox = $("<input type='checkbox' class='checkbox pull-right col-xs-1 subCommunityCheckbx' />")
3235            .attr("value", key)
3236            .attr("id", 'sc_' + key)
3237            .attr("name", 'sc_' + key)
3238
3239          var e_text = $('<p class="subCommunityCheckbxName col-xs-11 noPadding ">' + text + '</p>');
3240          var e_label = $('<label for="sc_' + key + '"></label>');
3241
3242          $(cbx).append(e_checkbox);
3243          $(cbx).append(e_label);
3244          $(cbx).append(e_text);
3245          $(cbx).append('<div class="clear"></div>');
3246
3247
3248          $('.subCommunityCheckbxContainer').append(cbx);
3249        });
3250
3251      }).fail(function (error) {
3252        console.log("error:", error)
3253      });
3254    } else {
3255      $('#ParentCommunity').val(val);
3256      $('.subCommunityCheckbxContainer').remove();
3257      $('.subCommunityCheckbxNameContainer').show();
3258    }
3259  }
3260  // ---- Community Tender Code ----
3261  // Temporary disabled
3262
3263  //if ($('#ParentTenderCommunity').length > 0) {
3264  //    $('#ParentTenderCommunity').on('change', function (e) {
3265  //        e.preventDefault();
3266  //        var val = $(this).val();
3267  //        InitializeSubCommunitiesSelectbox(val);
3268  //    });
3269  //}
3270  //$('#SubTenderCommunity_Container').removeClass('normalFloat hidden');
3271  //$('.TenderSubCommunitySelectInputContainerLeft').removeClass('hidden');
3272
3273
3274  InitializeSubCommunitiesCheckBoxes = function (val, userID) {
3275    if (val !== "") {
3276      $.ajax({
3277        url: "/Handlers/CommunityHandler.ashx?action=GetSubCommunitiesByParentDictionary&ParentCommunityId=" + val + "&UserId=" + userID
3278      }).done(function (data) {
3279        var jsonObj = jQuery.parseJSON(data);
3280        var JsonDictonary = jQuery.parseJSON(jsonObj.Data);
3281
3282        $('#ParentCommunity').val(val);
3283        $('.subCommunityCheckbxNameContainer').hide();
3284        $('.TenderSubCommunitySelectInputContainer').html('');
3285        $('.subCommunityCheckbxContainer').html('');
3286        $('.TenderSubCommunitySelectInputContainer').append('<div class="subCommunityCheckbxContainer"></div>');
3287
3288        $.each(JsonDictonary, function (key, value) {
3289          var text = value.length > 15 ? value.substring(0, 15) + ".." : value;
3290          //$('.subCommunityCheckbxContainer').append("<div class='checkboxFive'></div>");
3291          var cbx = $("<div class='checkboxFive'></div>");
3292          var e_checkbox = $("<input type='checkbox' class='checkbox pull-right col-xs-1 subCommunityCheckbx' />")
3293            .attr("value", key)
3294            .attr("id", 'sc_' + key)
3295            .attr("name", 'sc_' + key);
3296
3297          var e_text = $('<p class="subCommunityCheckbxName pull-right noPadding ">' + text + '</p>');
3298          var e_label = $('<label for="sc_' + key + '"></label>');
3299
3300          $(cbx).append(e_checkbox);
3301          $(cbx).append(e_label);
3302          $(cbx).append(e_text);
3303
3304
3305
3306          $('.subCommunityCheckbxContainer').append(cbx);
3307        });
3308
3309        if (Object.keys(JsonDictonary).length === 0) {
3310          $('.TenderSubCommunitySelectInputContainer').parent().addClass('hidden');
3311        }
3312
3313        var e = $.Event("complete");
3314        $(".TenderSubCommunitySelectInputContainer").trigger(e);
3315      }).fail(function (error) {
3316        
3317      });
3318    } else {
3319      $('#ParentCommunity').val(val);
3320      $('.subCommunityCheckbxContainer').remove();
3321      $('.subCommunityCheckbxNameContainer').show();
3322    }
3323  };
3324
3325
3326  ApplyMentionsPlugin = function () {
3327
3328
3329    if ($('.mentionMember').length > 0) {
3330      $('.mentionMember').each(function (key, val) {
3331        //var lastChar;
3332
3333        //var getKeyCode = function (str) {
3334        //    if (!isNaN(str)) {
3335        //        return "0";
3336        //    }
3337        //    return str.charCodeAt(str.length - 1);
3338        //}
3339
3340
3341
3342        var filterAction = $(val).data('action');
3343        
3344
3345        var querystring = "";
3346
3347        var formInput = $(val).closest('form').find('#forumId');
3348        if ($(formInput).length === 0) {
3349          formInput = $(val).closest('form').find('#home_newpost_forum');
3350        }
3351        var forumId = $(formInput).val();
3352        $(formInput).on('change', function (e) {
3353          forumId = this.value;
3354        });
3355
3356
3357        function getQuerystring() {
3358          querystring = "";
3359          if (formInput.val() > 0) {
3360            querystring = "&forumid=" + forumId + "&";
3361          }
3362          else if ($(val).attr("topicid")) {
3363            querystring = "&topicid=" + $(val).attr("topicid") + "&";
3364          }
3365          return querystring;
3366        };
3367
3368
3369        $(val).mentionsInput({
3370          onDataRequest: function (mode, query, callback) {
3371            
3372            if ($('.mentionsError').length > -1) {
3373              $('.mentionsError').remove();
3374            }
3375            $.getJSON('/Handlers/tagHandler.ashx?action=' + filterAction + '&mq=' + query + getQuerystring(), function (responseData) {
3376              if (responseData.Success !== undefined && responseData.Success === false) {
3377                
3378                $(val).after('<p class="red mentionsError">' + responseData.Message + "</p>");
3379              } else {
3380                responseData = _.filter(responseData, function (item) {
3381                  
3382                  item.id = item.Id;
3383                  item.type = "member";
3384                  item.avatar = "/media/members/2/" + item.Photo;
3385                  item.icon = "/media/members/2/" + item.Photo;
3386                  item.name = item.Name;
3387                  return item;
3388                });
3389                responseData = _.filter(responseData, function (item) {
3390                  return (item.name.toLowerCase().indexOf(query.toLowerCase()) > -1);
3391                });
3392                callback.call(this, responseData);
3393              }
3394            });
3395
3396          },
3397          showAvatars: true
3398        });
3399      });
3400    }
3401  };
3402
3403  ApplyMentionsPlugin();
3404  NotifiyPostMentions = function (field, ObjectType, ObjectId, MentionedMembers, messageOwner) {
3405    $.each(MentionedMembers, function (i, obj) {
3406      delete obj.Id;
3407      delete obj.Name;
3408      
3409    });
3410    console.log("NotifiyPostMentions MentionedMembers", MentionedMembers);
3411    var result = false;
3412    var MentionedMembersObj = {};
3413    MentionedMembersObj.ObjectType = ObjectType;
3414    MentionedMembersObj.ObjectId = ObjectId;
3415    MentionedMembersObj.OwnerGuid = messageOwner;
3416    MentionedMembersObj.MentionedMembers = MentionedMembers;
3417
3418    $.ajax({
3419      type: "POST",
3420      dataType: "json",
3421      url: "/Handlers/GenericHandler.ashx?action=SendMentionsInPost",
3422      data: JSON.stringify(MentionedMembersObj),
3423      contentType: "application/json; charset=utf-8",
3424      success: function (resultData) {
3425        console.log("resultData", resultData);
3426        $(field).mentionsInput('reset');
3427        if (resultData) {
3428          result = true;
3429        }
3430      }
3431    });
3432    $(field).mentionsInput('reset');
3433    return result;
3434
3435  }
3436  if ($('.member_lead_form').length > -1) {
3437    var screenWidth = $(window).width();
3438    $(window).scroll(function (event) {
3439      var scroll = $(window).scrollTop();
3440      var lead_form_top_offset = $('.lead_form_container').scrollTop();
3441      if (scroll < 200) {
3442        if ($('.member_lead_form').hasClass('closed_lead_form')) {
3443          $('.closed_lead_form').css('top', '70%');
3444        } else {
3445          $('.lead_form_container').css('top', 380);
3446        }
3447      } else {
3448        $('.lead_form_container').css('top', lead_form_top_offset + 200 - lead_form_top_offset);
3449        $('.closed_lead_form').css('top', '30%');
3450      }
3451    });
3452    if (screenWidth > 1150) {
3453      $('.member_lead_form').removeClass('hidden');
3454      if (screenWidth > 1150 && screenWidth < 1550) {
3455        $('.lead_form_open_form_button').removeClass("hidden");
3456        $('.member_lead_form').addClass('closed_lead_form');
3457        $('.lead_form_container').addClass('animate_lead_form_left');
3458        $('.lead_form_container').css('left', -500);
3459        $('.lead_form_open_form_button').on('click', function (e) {
3460          $('.lead_form_container').css('top', '30%');
3461          $(this).addClass('hidden');
3462          $('.member_lead_form').removeClass('closed_lead_form');
3463          $('.lead_form_container').css('left', 0);
3464        })
3465      } else if (screenWidth > 1550) {
3466        $('.lead_form_container').css('top', 380);
3467      }
3468    }
3469    else if (screenWidth < 1150) {
3470      $('.member_lead_form').addClass('hidden');
3471    }
3472
3473    $('.close_lead_form_link').on('click', function (e) {
3474      e.preventDefault();
3475      $('.lead_form_open_form_button').removeClass('hidden');
3476      $('.member_lead_form').addClass('closed_lead_form');
3477      $('.lead_form_container').css('left', -500);
3478
3479    })
3480
3481  };
3482
3483  if ($('.home_dashboard').length > 0) {
3484    $('.home_dashboard').slick({
3485      dots: true,
3486      infinite: false,
3487      speed: 300,
3488      slidesToShow: 1,
3489      rtl: true,
3490      //swipe:false,
3491      nextArrow: '<i class="fa fa-chevron-left fa-2x slick-next"></i>',
3492      prevArrow: '<i class="fa fa-chevron-right fa-2x slick-prev"></i>'
3493    });
3494  }
3495
3496  if ($('.events_cards_container').length > 0) {
3497    var total_event_cards = $('.events_cards_container .dash_card_event').length;
3498    var event_card_width = $('.dash_card_event').width();
3499    var event_cards_container_width = event_card_width * total_event_cards;
3500    $('.events_cards_container .dash_card_event').first().addClass("active");
3501    $('.events_cards_container').css('right', '9px');
3502
3503
3504    $('.events_cards_container').width(event_cards_container_width);
3505    var current_card = 1;
3506
3507    $('.in_dash_card_arrow.in_dash_card_next').on('click', function (e) {
3508      
3509      if (current_card < total_event_cards) {
3510        var currentPosition = $('.events_cards_container').css('right');
3511        $('.events_cards_container').css('right', parseInt(currentPosition, 10) - event_card_width);
3512        var curentActiveSlide = $('.events_cards_container .dash_card_event');
3513        $('.events_cards_container .dash_card_event').next().addClass("active");
3514        $(curentActiveSlide).removeClass("active");
3515        current_card++;
3516      }
3517    })
3518
3519    $('.in_dash_card_arrow.in_dash_card_prev').on('click', function (e) {
3520      
3521      if (current_card > 1) {
3522        var currentPosition = $('.events_cards_container').css('right');
3523        $('.events_cards_container').css('right', parseInt(currentPosition, 10) + event_card_width);
3524        //var curentActiveSlide = $('.events_cards_container .dash_card_event');
3525        //$('.events_cards_container .dash_card_event').prev().addClass("active");
3526        //$(curentActiveSlide).removeClass("active");
3527        current_card--;
3528      }
3529    });
3530  }
3531
3532  $('.search_Button').on('click', function (e) {
3533    e.preventDefault();
3534    if ($('.searchContainer').length > 0) {
3535      $(".searchContainer").animate({ width: 'toggle' });
3536    }
3537    else {
3538        if ($('.desktopTopMenuContainer').css('display') === 'block') {
3539            $('.desktopTopMenuContainer').css('display', 'none');
3540            $("#Frontsite_Search_Container").animate({ width: 'toggle' }, function () {
3541                $(this).css('overflow', 'visible')
3542            });
3543        
3544            if ($('.desktopHeaderContainer ').hasClass('affix')) {
3545                $('#Frontsite_Search_Container').css('top', '7px');
3546            }
3547            else if ($('.fronSiteHeader').hasClass('innerPage')) {
3548                $('#Frontsite_Search_Container').css('top', '20px');
3549            }
3550            else {
3551                $('#Frontsite_Search_Container').css('top', '45px');
3552
3553                if ($('body').hasClass('FrontHome')) {
3554                    $('#Frontsite_Search_Container').css('border', '0px solid #b2b2b2');
3555                }
3556            }
3557
3558      } else {
3559        $("#Frontsite_Search_Container").animate({ width: 'toggle' }, 400, function () {
3560          $('.desktopTopMenuContainer').css('display', '');
3561        });
3562
3563      }
3564    }
3565  });
3566
3567  //if ($('.FontHome').length > -1 && !$('.FrontHome').hasClass('Mobile')) {
3568  //  $(document).scroll(function () {
3569  //    if ($(this).scrollTop() >= ($('.FrontHome_first_section').offset().top + $('.FrontHome_first_section').height() + 50) &&
3570  //      $(this).scrollTop() <= $('.FrontHome_third_section').offset().top) {
3571  //      $(".FrontHome_first_section").addClass('sticky');
3572  //    } 
3573  //    else {
3574  //      $(".FrontHome_first_section").removeClass('sticky');
3575  //    }
3576
3577  //    if ($(this).scrollTop() >= ($('.FrontHome_fourth_section ').offset().top -60) &&
3578  //      $(this).scrollTop() <= $('.FrontHome_fifth_section').offset().top - 60) {
3579  //      $(".FrontHome_third_section").addClass('sticky');
3580  //    }
3581  //    else {
3582  //      $(".FrontHome_third_section").removeClass('sticky');
3583  //    }
3584  //  });
3585  //}
3586  if ($('.FontHome').length > -1) {
3587
3588    $(document).scroll(function () {
3589      if (($('#videoWrraper').height() > 0 && $(this).scrollTop() >= $('#videoWrraper').height()) ||
3590        ($('.mobile_bg').height() > 0 && $(this).scrollTop() >= $('.mobile_bg').height())) {
3591        if ($('.up_arrow').length === 0) {
3592          if ($('.FrontHome').hasClass('Mobile')) {
3593            $('body').append('<span class="up_arrow"><a href="#" class="up_arrow_button"><i class="fas fa-arrow-circle-up"></i></a></span>');
3594          } else {
3595            $('body').append('<span class="up_arrow"><a href="#" class="up_arrow_button"><i class="fas fa-arrow-circle-up"></i></a></span>');
3596          }
3597          $('.up_arrow_button').on('click', function (e) {
3598            e.preventDefault();
3599            var body = $("html, body");
3600            body.animate({ scrollTop: 0 }, 500, 'swing', function () {
3601              $('.up_arrow').remove();
3602            });
3603
3604          });
3605        }
3606      } else if ($(this).scrollTop() <= $('#videoWrraper').height()) {
3607        $('.up_arrow').remove();
3608      }
3609    });
3610  }
3611
3612
3613  //$('.virtualNumberButton').on('click', function (e) {
3614  //  e.preventDefault();
3615  //  var memberId = $(this).attr('id').split("_")[1];
3616  //  $(this).attr('disabled', 'disabled');
3617  //  $(this).find(".fa-phone-square").remove();
3618  //  $(this).prepend('<i class="fas fa-sync fa-spin"></i>');
3619  //  var self = this;
3620  //  setTimeout(function () {
3621
3622  //    $.ajax({
3623  //      type: "POST",
3624  //      dataType: "json",
3625  //      url: "/Handlers/MemberHandler.ashx?action=GetVirtualNumber&MemberId=" + memberId,
3626  //      contentType: "application/json; charset=utf-8",
3627  //      success: function (data) {
3628  //        if (data.Success) {
3629  //          var virtualNumber = JSON.parse(data.JsonResult);
3630  //          $(self).parent().find('.virtualNumberContainer').append('<a href="tel:' + virtualNumber.VirtualPhoneNumber + '">' + virtualNumber.VirtualPhoneNumber + '</a>');
3631  //          $(self).parent().find('.virtualNumberContainer').removeClass('hidden');
3632  //          $(self).remove();
3633  //        }
3634  //      },
3635  //      complete: function () {
3636  //        $(self).attr('disabled', '');
3637  //        $(this).find(".fa-sync").remove();
3638  //      }
3639  //    });
3640  //  }, 2000);
3641
3642  //});
3643
3644
3645
3646    $('.getMemberPhoneNumber').on('click', function (e) {
3647        e.preventDefault();
3648        var memberId = $(this).attr('id').split("_")[1];
3649        $(this).attr('disabled', 'disabled');
3650        $(this).find(".fa-phone-square").remove();
3651        $(this).prepend('<i class="fas fa-sync fa-spin"></i>');
3652        var self = this;
3653        setTimeout(function () {
3654
3655            $.ajax({
3656                type: "POST",
3657                dataType: "json",
3658                url: "/Handlers/MemberHandler.ashx?action=RecordPhoneContactCount&MemberId=" + memberId + '&pageUrl=' + window.location.href,
3659                contentType: "application/json; charset=utf-8",
3660                success: function (data) {
3661                    if (data.Success) {
3662                        var phoneNumber = JSON.parse(data.JsonResult);                                               
3663                        $(self).parent().find('.phoneNumberContainer').append('<a href="tel:' + phoneNumber + '">' + phoneNumber + '</a>');
3664                        $(self).parent().find('.phoneNumberContainer').removeClass('hidden');
3665                        $(self).remove();
3666                    }
3667                },
3668                complete: function () {
3669                    $(self).attr('disabled', '');
3670                    $(this).find(".fa-sync").remove();
3671                }
3672            });
3673        }, 2000);
3674
3675    });
3676
3677
3678  /// End document ready
3679});
3680
3681var GetMentions = function (messageText) {
3682  var result = messageText;
3683  $('.mentionMember').mentionsInput('getMentions', function (data) {
3684    
3685    if (data.length > 0) {
3686      var newText = messageText;
3687
3688      $.each(data, function (i, obj) {
3689        if (messageText.indexOf(obj.name) > -1) {
3690          newText = newText.replace(obj.name, "@@" + obj.id + ";;");
3691        } else if (messageText.indexOf(obj.value) > -1) {
3692          newText = newText.replace(obj.value, "@@" + obj.id + ";;");
3693        }
3694      });
3695
3696
3697      result = newText;
3698    }
3699  });
3700
3701
3702  return result;
3703};
3704
3705

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.