PageSourceSearch

https://neptun.or-zse.hu/oktato/javascript/neptun.js

js or-zse.hu collected 2026-10-01 12:18:48 UTC 113,296 bytes, 3,386 lines download raw bytes

1// JScript File
2/// <reference name="MicrosoftAjax.js" />
3/// <reference path="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"/>
4/// <reference path="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.js"/>
5
6var pageisdirty = false;
7var modalisdirty = false;
8var beforeleavestring = ''; // tartalmazza nyelvesitve azt a szoveget, amit a mentendo mezok ele fog betenni
9var beforeleavemodalstring = ''; // tartalmazza azon szoveget, amit a modal bezarasakor a mentendo mezok ele fog betenni
10var progressalerttypediv = 'progress';  // folyamatjelző div elem id
11function On_Leave(sender) {
12  if (pageisdirty) {
13    return GetConfirmText(null);
14  }
15  return;
16}
17
18function ResetDirty(ismodal) {
19  if (ismodal)
20    modalisdirty = false;
21  else
22    pageisdirty = false;
23}
24
25function GetConfirmText(selecteddivid) {
26  PageMethods.RaiseLeaveEvent();
27
28  var sdactrls = null;
29  if (selecteddivid != null)
30    sdactrls = $('#' + selecteddivid + ' :input[isdirty=true]');
31  else
32    sdactrls = $('input[isdirty=true]');
33  var szovegek = beforeleavestring + ' ';
34  if (sdactrls.length > 0) {
35    for (var i = 0; i < sdactrls.length; i++) {
36      if (sdactrls[i].clientifentifiername) {
37        szovegek += sdactrls[i].clientifentifiername + ', ';
38      }
39    }
40  }
41  return szovegek;
42}
43
44function OnChangedIsDirty(sender) {
45  // megkeresem az osszes SDAModalPopup2-ot es megnezem, hogy ez a control a gyereke-e
46  var contains = $('div[sdamodal=true] :input[id=' + sender + ']');
47  var iscontain = contains.length > 0;
48
49  if (iscontain == false)
50    pageisdirty = true;
51  else
52    modalisdirty = true;
53
54  var ctrl = $get(sender);
55  if (ctrl)
56    ctrl.isdirty = true;
57}
58
59
60//function InitializeDateChanger() {
61//
62//        //        $("#datepicker").datepicker({ inline: true });
63
64//        var datesArray = ['11/13/2012', '11/14/2012', '11/15/2012'];
65
66//        $('.turn-me-into-datepicker')
67//        //.datepicker({ inline: true, changeMonth:true, changeYear:true })
68//            .datepicker({ showStatus: true,
69//                autoSize: true,
70//                showOn: 'both',
71//                buttonImageOnly: true,
72//                changeMonth: true,
73//                changeYear: true,
74//                showButtonPanel: true,
75//                showOtherMonths: true,
76//                beforeShowDay: function (date) {
77//var theday = (date.getMonth()+1) +'/'+
78//date.getDate()+ '/' +
79//date.getFullYear();
80//return [true,$.inArray(theday, datesArray) >=0?"specialDate":''];},
81
82//                onSelect: function (dateText, inst) {
83
84//                    $("#hiddenDate").val(dateText);
85//                    var prm = Sys.WebForms.PageRequestManager.getInstance();
86//                    prm._doPostBack('changedate', dateText);
87//
88
89//                    //PageMethods.SelectDate(inst, ResultMethod);
90//                    //                $.ajax({
91//                    //                    type: "POST",
92//                    //                    url: "/main.aspx/ClearPopupState",
93//                    //                    contentType: "application/json; charset=utf-8",
94//                    //                    dataType: "json",
95//                    //                    async: false,
96//                    //                    success: function (data) { },
97//                    //                    complete: function (data) { },
98//                    //                    error: function (data) { }
99//                    //                });
100//                }
101
102//            })
103//        //		.bind('dateSelected',
104//        //			function (e, selectedDate, $td) {
105//        //			    console.log('You selected ' + selectedDate);
106//        //			})
107//
108//            ;
109//            //alert('hehe');
110
111//            $(".turn-me-into-datepicker").datepicker("setDate", $('#hiddenDate').val());
112//    };
113
114//function ResultMethod(result) {
115
116//}
117
118var notSetTransparentLayer = false;
119
120function pageLoad(sender, args) {
121  //azert hivom meg innen, mert minden esetben frissiteni kell az session timeout-ot
122  InitializeTimer();
123  //Teszteléshez: ShowHideLanguageChooser();
124
125  //if ($('#divSRD[display!=none]').length > 0) {
126  //    var user = $('#user');
127  //    if (user.length > 0)
128  //        user.focus();
129
130  //    var newsDetails = $('#upNewsDetails_upmodal_NewsDetails_divpopup');
131  //    if (newsDetails.length > 0)
132  //        newsDetails.focus();
133
134  //    $('#divSRD').css('display', 'none');
135  //}
136
137  if (!args.get_isPartialLoad()) {
138
139    //  add our handler to the document's
140    //  keydown event
141    $addHandler(document, "keydown", onKeyDown);
142    $addHandler(document, "keyup", onKeyUp);
143    // $addHandler(window, "resize", setBodyHeightToContentHeight);
144
145    //        Sys.Net.WebRequestManager.add_invokingRequest(beginRequestHandler);
146    //        Sys.Net.WebRequestManager.add_completedRequest(endRequestHandler);
147
148    Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(On_InvokeRequest);
149    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(On_CompleteRequest);
150
151    // skin valaszto image
152    SetAriaHiddenAttributeToSkinChooserImages(state);
153    $('#imgSkinChooser').click(ShowHideThemeChooser);
154    $('#imgLanguageChooser').click(ShowHideLanguageChooser);
155    //$('#imgSkinChooser').enterKey(ShowHideThemeChooser);
156
157    $('#imgLanguageChooser').attr("role", "button");
158    $('#imgLanguageChooser').attr("aria-hidden", "false");
159
160    $('#imgSkinChooser').attr("role", "button");
161    $('#imgSkinChooser').attr("aria-hidden", "false");
162
163    $('#imgSkinChooserPartiallySighted').attr("role", "button");
164    $('#imgSkinChooserPartiallySighted').attr("aria-hidden", "false");
165
166    //$('#imgSkinChooserPartiallySighted').click({ skinName: 'PartiallySighted' }, SkinChoose);
167    // $('#imgSkinChooserPartiallySighted').enterKey({ skinName: 'PartiallySighted' }, SkinChoose);
168  }
169
170
171
172  //    $('#cal_monthsTable div').click(function (e) {
173  //        var monthIndex = e.currentTarget['month'];
174  //        //PageMethods.SelectedMonth(monthIndex);
175
176  //        /* var cal = $('#upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar');
177  //        cal._visibleDate = e.currentTarget.date;
178  //        cal.set_selectedDate(e.currentTarget.date);
179  //        cal._switchMonth(e.currentTarget.date);
180  //        cal._blur.post(true);
181  //        cal.raiseDateSelectionChanged();*/
182  //        //$('#upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar')
183  //        __doPostBack('upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar', 'V4018');
184  //    });
185
186  //    $('#upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar').click(function (e) {
187  //    //var tegst = ;
188  //    //$('#' + <%=GetCalendarClientID()%>).click(function (e) {
189  //        var x = e.pageX - $(upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar).position().left - this.offsetLeft;
190  //        var y = e.pageY - $(upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar).position().top - this.offsetTop;
191
192  //        if (x > 56 && 142 > x && y < 20 && y > 5) {
193  //            $('#div_Calendar').attr("class", "div_Calendar_show");
194  //            $('#div_Calendar').removeAttr("style");
195  //        }
196  //    }).mouseenter(function (e) {
197  //        var x = e.pageX - $(upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar).position().left - this.offsetLeft;
198  //        var y = e.pageY - $(upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar).position().top - this.offsetTop;
199
200  //        if (x > 56 && 142 > x && y < 25) {
201  //           // $('#upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar').attr('style', 'pointer');
202  //        }
203  //    }).mouseleave(function (e) {
204  //        if (!(x > 56 && 142 > x && y < 25)) {
205  //           // $('#upBoxes_upCalendar_gdgCalendar_ctl15_calendar_upPanel_calendar').attr('style', 'calendar');
206  //        }
207  //    });
208
209  //    $('#div_Calendar').click(function (e) {
210  //        var x = e.pageX - $(div_Calendar).position().left - this.offsetLeft;
211  //        var y = e.pageY - $(div_Calendar).position().top - this.offsetTop;
212
213  //        $('#div_Calendar').attr('class', 'div_Calendar_hide');
214  //        $('#div_Calendar').attr("style", 'display:none;');
215  // });
216
217  // Web request invoked handler
218  function On_InvokeRequest(sender, eventArgs) {
219    // Display the window
220    if (TimeoutID != null) {
221      window.clearTimeout(TimeoutID);
222      TimeoutID = null;
223      return;
224    }
225
226    //visszaszamlaló alaphelyzetbe állítása
227    if (timerID != null) {
228      window.clearTimeout(timerID);
229      timerID = null;
230    }
231    if (timerID2 != null) {
232      clearInterval(timerID2)
233      timerID2 = null;
234    }
235
236    // folyamtjelző beállítása
237    if ($('#progressalerttype').val() != "progress") {
238      progressalerttypediv = $('#progressalerttype').val();
239    }
240    // Az egyedi folyamatjelző csak akkor jelenik meg, ha searchpanel-ből jön a request. Ha azon kívül, akkor az alapértelmezettre állítjuk.
241    if (progressalerttypediv != 'progress' && typeof (upFilter) != 'undefined') {
242      if ($(eventArgs._postBackElement).closest([upFilter]).length == 0)
243        progressalerttypediv = "progress";
244    }
245    //kivétel
246    if (notSetTransparentLayer == false) {
247      SetTransparentLayer('block');
248      TimeoutID = window.setTimeout('ActivateAlertDiv("' + progressalerttypediv + '", "block")', 500); // csak fel sec mulva jelenjen meg az ablak
249    }
250
251    //ActivateAlertDiv("progress", "block");
252    //alert('On_InvokeRequest');
253  }
254
255  // Web Request complete handler
256  function On_CompleteRequest(executor, eventArgs) {
257    notSetTransparentLayer = false;
258
259    if (eventArgs.get_error() && eventArgs.get_error().name === 'Sys.WebForms.PageRequestManagerServerErrorException') {
260      var errors = eventArgs.get_error();
261      eventArgs.set_errorHandled(true);
262      if (errors.message.search('unknown error') == -1) {
263        PageMethods.GetStringFromJS(1000004/*Hiba történt a művelet végrehajtása közben.*/, function (msg) {
264          alert(msg);
265        });
266      }
267      SetTransparentLayer('none');
268      ActivateAlertDiv(progressalerttypediv, "none");
269    }
270    else if (_modalpanel == null || (_modalpanel != null && (_modalpanel._runCounter > 0 ||
271      (_modalpanel._runCounter == 0 && _modalpanel.id == 'upModalSessionEnd_modal_SessionEnd')))) {
272      SetTransparentLayer('none');
273      ActivateAlertDiv(progressalerttypediv, "none");
274    }
275
276    //InitializeDateChanger();
277
278    try {
279      // Ha h_template-ből jövünk, ki van generálva, különben nincs...:)
280      if (typeof TemplateSuccessmodalPositioner !== 'undefined') {
281        TemplateSuccessmodalPositioner();
282      }
283    }
284    catch (err) { }
285  }
286
287  // setBodyHeightToContentHeight();
288  // Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
289
290  // SDAWebPanel esemenyek inicializalasa
291  var sdawebpanelek = $('div [sdawebpanel]');
292  for (var i = 0; i < sdawebpanelek.length; i++) {
293    if (sdawebpanelek[i].attributes['sdawebpanel'] != null) {
294      var sdawebpanelbehaviorid = sdawebpanelek[i].attributes['sdawebpanel'].value;
295      AddPanelEvents(sdawebpanelbehaviorid);
296    }
297  }
298}
299
300// a legkisebb timeout millisecond-ban
301var secs;
302
303// a secs-et hozzaadva a session vegenek datuma
304var sessionEndDate = null;
305
306var timerID = null;
307var timerRunning = false;
308var delay = 1000;
309
310// A session timeout-ot inicializalja.
311function InitializeTimer() {
312  // kiveszem a szerverbol a session idejet
313  var hfCountDownTime = $get('hfCountDownTime');
314
315  // ha meg a login.aspx-en vagyunk, nincs számlálóra szükség
316  if (hfCountDownTime == null)
317    return;
318
319  secs = hfCountDownTime.value;
320  // az ajaxos frissites miatt kell, mert a nullerteket figyelem egy masik fuggvenyben
321  sessionEndDate = null;
322  sessionEndDate = new Date();
323
324  // kiveszem az aktualis idot, és hozzáadom a sessiontimeout-ot milliseconds-ban
325  var millisecs = sessionEndDate.getTime();
326  millisecs += secs * 1000;
327
328  // a kerekitesek miatt ketto masodperccel kevesebb idot kap a user
329  //if (millisecs > 2000)
330  //  millisecs -= 2000;
331
332  // generalok a ekkor fog lejárni a timeout
333  sessionEndDate = new Date(millisecs);
334
335  // a sessionend előtt 1 perc-el figyelmeztetem a user-t
336  if (timerID != null) {
337    window.clearTimeout(timerID);
338    timerID = null;
339  }
340
341  // ha a visszaszamlalo figyelmezteto modal-t cancel-elem, majd tolok egy postback-et (pl. sorrendezem a gridet),
342  // akkor resetelnem kell a szamlalot
343  if (timerID2 != null) {
344    clearInterval(timerID2)
345    timerID2 = null;
346  }
347  timerID2 = setInterval(CountDown, 1000);
348
349  countdown = secs;
350  CountDown();
351
352  timerID = window.setTimeout("ShowModal()", (secs - 60) * 1000); // 118 - tesztre - 60 - hasznalatra
353  //InitializeDateChanger();
354  //OnLoadNode();
355}
356
357$(window).resize(function () {
358  ResizeSessionEndModal();
359});
360
361function ResizeSessionEndModal() {
362  var winH = $(window).height();
363  var docH = $(document).height();
364  var winW = $(window).width();
365  var top = (winH - 200) / 2;
366  var left = (winW - 530) / 2;
367  var modal = $("#modalpanelAttentionSessionEnd");
368  var modalBackGround = $("#panelSessionEndBackGround");
369
370  $(modal).css({
371    position: 'absolute',
372    /*zIndex: 5000,*/
373    left: left,
374    top: top
375  });
376
377  $(modalBackGround).css({
378    position: 'absolute',
379    /*zIndex: 5000,*/
380    width: winW,
381    height: docH
382  });
383}
384
385
386// megjeleniti a modal-t
387function ShowModal() {
388  //StayAlive();
389  var modal = $get('modalpanelAttentionSessionEnd');
390
391  // ha lejart az ido, akkor kikapcsolom a timeout-ot
392  if (timerID != null) {
393    window.clearTimeout(timerID);
394    timerID = null;
395  }
396
397  if (modal) {
398    ResizeSessionEndModal();
399
400    $("#panelSessionEndBackGround").css({
401      display: 'block',
402      zIndex: 150
403    });
404
405    $("#modalpanelAttentionSessionEnd").css({
406      display: 'block',
407      zIndex: 151,
408      top: $(window).scrollTop() + Math.floor($(window).innerHeight() / 2) - 90
409    });
410
411    if ($("#progress").length > 0 && $("#progress")[0].style.display == 'block') {
412      var ujzIndex = $("#progress")[0].style.zIndex + 1;
413      $("#modalpanelAttentionSessionEnd").css({
414        zIndex: ujzIndex
415      });
416    }
417
418    countdown = 60; //12 - tesztre, 60 - hasznalatra
419  }
420}
421
422function CountDown() {
423  if (countdown == 0) {
424    clearInterval(timerID2)
425    DoLogOut(0);
426  }
427  else {
428    countdown = countdown - 1;
429
430    var secCounter = Math.floor(countdown % 60);
431    var minCounter = Math.floor(countdown / 60);
432    zeroseconds = '';
433    zerominute = '';
434    // lekezelem az egy számjegyű számokat
435    if (secCounter.toString().length == 1) {
436      zeroseconds = '0';
437    }
438    // lekezelem az egy számjegyű számokat
439    if (minCounter.toString().length == 1) {
440      zerominute = '0';
441    }
442
443    var lblCountDown = $get('attentionSessionEnd_lblCountDown');
444    lblCountDown.innerHTML = ' ' + zeroseconds + countdown + ' ';
445    //fenti visszaszamlalo beallitasa
446    $('#upTraining_lblRemainingTime').html(zerominute + minCounter + ':' + zeroseconds + secCounter);
447    $('#upTraining_lblRemainingTime').attr("aria-live", "off");
448    $('#upTraining_lblRemainingTime').attr("role", "timer");
449  }
450}
451
452function DoLogOut(zero) {
453  var logoutlink = 'Login.aspx?timeout=';
454
455  // ha automatikus timeout kilepes van, ami a login-on levo piros uzenet szabályozása miatt kell
456  if (zero == 0) {
457    //Kivettem a timeout jelzésének linkjét, mert ha több fül van megnyitva és egyiken lejár, de a másikon dolgozik akkor hibásan jelenik meg a kiírás.
458    LogOutRedirect('Login.aspx');
459  }
460  else {
461    // ha meg el a session, ki kell lőni, mert a login-ban a kovetkezo bejelentkezes csak masodjara sikerul
462    PageMethods.LogOutFromJS(logoutlink, LogOutRedirect);
463  }
464}
465
466function LogOutRedirect(link) {
467  // kijelentkezek
468  window.location.assign(link);
469}
470
471var zerominute = '';
472var zeroseconds = '';
473var countdown = 60;
474var timerID2 = null;
475
476function DoCloseModalPopup(ok) {
477  //session hosszabbitasa
478  if (ok) {
479    StayAlive();
480    InitializeTimer();
481  }
482
483  $("#panelSessionEndBackGround").css({ display: 'none' });
484  $("#modalpanelAttentionSessionEnd").css({ display: 'none' });
485}
486
487
488// megallitja a szamlalot
489function StopTheClock() {
490  if (timerRunning)
491    window.clearTimeout(timerID);
492  timerRunning = false;
493}
494
495function GetConfirmString() {
496  return PageMethods.GetStringFromJS(4731, DoGetConfirmString);
497}
498
499function DoGetConfirmString(result) {
500  var okay = confirm(result/*1 perc múlva lejár a munkamenete. Az ok gombra kattintva újraindíthatja.*/);
501
502  if (okay == true) {
503    // ha akarja a felhasználó, akkor frissitem a session-t, hogy ne jarjon le
504    StayAlive();
505    showalert = true;
506  }
507  else {
508    // beallitom, hogy az egy percre csak egyszer figyelmeztessen
509    showalert = false;
510  }
511}
512
513// átlátszó, nem kattintható réteg megjelenítése/eltüntetése a progress előtti 0-500ms-ban
514function SetTransparentLayer(disp) {
515  var adiv = $get('transparentprogress');
516  if (adiv != null) {
517    adiv.style.display = disp;
518    adiv.style.zIndex = 10000000;
519    adiv.style.height = getFullClientSize().height.toString() + 'px';
520
521    $get('transparentprogressdiv').style.zIndex = 10000001;
522  }
523}
524
525var showalert = true;
526
527// Display or hide the alert box div
528var TimeoutID = null;
529function ActivateAlertDiv(elem, disp) {
530  if (TimeoutID != null) {
531    window.clearTimeout(TimeoutID);
532    TimeoutID = null;
533  }
534  // ha az ajaxgriden, vagy a searchpanelen van egy prögő cucc, akkor nem rakjuk ki az egész oldalra
535  if ($get("panelSPGridBackGround")) {
536    if ($get("panelSPGridBackGround").style.display == "block" && disp == "block") {
537      return;
538    }
539  }
540  var adiv = $get(elem);
541  adiv.style.display = disp;
542  adiv.style.zIndex = 10000000;
543  adiv.style.position = 'fixed';
544  adiv.style.height = '100vh';
545  adiv.style.width = '100vw';
546
547  var innerDiv;
548  if (elem == 'progress') {
549    innerDiv = $get('imgdiv');
550  } else {
551    innerDiv = $get(elem + 'div');
552    if ($get('lbCustomTextProgress') != null && $get('lbCustomTextProgress').offsetWidth > 0)
553      textWidth = $get('lbCustomTextProgress').offsetWidth;
554  }
555
556  innerDiv.style.zIndex = 10000001;
557  innerDiv.style.position = 'fixed';
558  innerDiv.style.top = '0';
559  innerDiv.style.left = '0';
560  innerDiv.style.height = '100vh';
561  innerDiv.style.width = '100vw';
562  $(innerDiv).css('line-height', '100vh');
563  $(innerDiv).css('align-content', 'center');
564}
565
566function getClientCenterLocation(ctrl) {
567  var ctrlwidth = ctrl.clientWidth;
568  var ctrlheight = ctrl.clientHeight;
569
570  var x = Math.round((getClientBounds().width - ctrlwidth) / 2);
571  var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
572  var foregroundelementheight = ctrl.offsetHeight ? ctrl.offsetHeight : ctrl.scrollHeight;
573  var y = Math.round((getClientBounds().height - foregroundelementheight) / 2);
574
575  return new Sys.UI.Point(x, y + scrollTop);
576}
577
578function getFullClientSize() {
579  var width = getClientBounds().width;
580  var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
581  var height = getClientBounds().height + scrollTop;
582
583  return new Sys.UI.Bounds(0, 0, width, height);
584}
585
586function setOpacity(obj, value) {
587  obj.style.opacity = value / 10;
588  obj.style.filter = 'alpha(opacity=' + value * 10 + ')';
589}
590
591
592// visszaadja az adott lathato kepmeret szelesseget es magassagat (bongeszotol fuggoen)
593function getClientBounds() {
594  /// <summary>
595  /// Gets the width and height of the browser client window (excluding scrollbars)
596  /// </summary>
597  /// <returns type="Sys.UI.Bounds">
598  /// Browser's client width and height
599  /// </returns>
600  var clientWidth;
601  var clientHeight;
602  switch (Sys.Browser.agent) {
603    case Sys.Browser.InternetExplorer:
604      if (document.documentElement && document.documentElement.clientWidth)
605        clientWidth = document.documentElement.clientWidth;
606      else if (document.body)
607        clientWidth = document.body.clientWidth;
608      if (document.documentElement && document.documentElement.clientHeight)
609        clientHeight = document.documentElement.clientHeight;
610      else if (document.body)
611        clientHeight = document.body.clientHeight;
612      break;
613    case Sys.Browser.Safari:
614      clientWidth = window.innerWidth;
615      clientHeight = window.innerHeight;
616      break;
617    case Sys.Browser.Opera:
618      clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
619      clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
620      break;
621    default:  // Sys.Browser.Firefox, etc.
622      clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
623      clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
624      break;
625  }
626  return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);
627}
628
629
630function EndRequestHandler(sender, args) {
631  if (args.get_error() != undefined) {
632    var errorMessage;
633    if (args.get_response().get_statusCode() == '200') {
634      errorMessage = args.get_error().message;
635    }
636    else {
637      // Error occurred somewhere other than the server page.
638      errorMessage = 'An unspecified error occurred. ';
639    }
640    args.set_errorHandled(true);
641    //ToggleAlertDiv('visible');
642    //$get(messageElem).innerHTML = errorMessage;
643  }
644}
645
646function pageUnload(sender, args) {
647  if (typeof ($) != 'undefined') {
648    $("DIV[id$='_backgroundElement']").parent().children().css("display", "none");
649  }
650}
651
652//function setBodyHeightToContentHeight() {
653//    var ContentHeight = document.documentElement.scrollHeight;
654//    if (document.getElementById("tableTop") != null)
655//        ContentHeight = parseInt(document.getElementById("tableTop").clientHeight) + parseInt(document.getElementById("tableContent").clientHeight);
656//    document.body.style.height = Math.max(document.documentElement.clientHeight, ContentHeight) - 22 + "px";
657//}
658
659// nyomtatas megoldasa a print.aspx oldalon
660function ShowPrint(gridClientID, TimeTableParam) {
661  var li = document.getElementById('GridContent'); // a print.aspx oldalon egy DIV elem elérése
662  var tmp = document.getElementById('tmpGridContent');
663  if (gridClientID == 'TimeTable') {
664    li.innerHTML = window.opener.document.getElementById('dvCalMain').innerHTML;
665  }
666  else if (TimeTableParam == 'TimeTableList') {
667    // li.innerHTML = window.opener.document.getElementById(gridClientID).innerHTML;
668  }
669  else {
670    var grid = window.opener.document.getElementById(gridClientID);  // a hívó formról a grid elérése
671    if (grid != null) {
672
673      // mivel firefox/opera nem ismeri az outerHTML-t, ezért a hívó formon lévő grid parent elemének
674      // az innerHTML-jét kell a DIV-be beletenni (biztosítani kell, hogy legyen szülő eleme, aminek csak
675      // egy gyerek control-ja van)
676      tmp.innerHTML = grid.parentNode.innerHTML;
677      RemovePrintLinks(tmp);
678      li.innerHTML = tmp.innerHTML;
679      tmp.parentNode.removeChild(tmp);
680      // a létező linkeket kiszedi a htmlből
681
682    }
683  }
684}
685
686// linkeket kiszedő rekurzív metódus (a nyomtatáshoz kell)
687function RemovePrintLinks(ctrl) {
688  // végigmegy a megadott control összes elemén, és ha van href-je, vagyis link típusú, akkor
689  // kiszedi a link szövegét és ha van, akkor megadja a felette lévő control innerHTML-nek az adott szöveget.
690  for (var i = 0; i < ctrl.childNodes.length; i++) {
691    var childctrl = ctrl.childNodes[i];
692    var nodename = childctrl.nodeName.toUpperCase();
693    if (childctrl.href != null && childctrl.href != '' && childctrl.childNodes.length > 0
694      && childctrl.childNodes[0].nodeName.toUpperCase() != 'IMG') {
695      ctrl.innerHTML = childctrl.innerHTML;
696    }
697    if (childctrl.nodeName.toUpperCase() == 'IMG') {
698      if (ctrl.innerText != null && ctrl.innerText != undefined && ctrl.innerText != '') {
699        ctrl.innerHTML = ctrl.innerText;
700      }
701      else if (ctrl.textContent != null && ctrl.textContent != undefined && ctrl.textContent != '') {
702        ctrl.innerHTML = ctrl.textContent;
703      }
704      else {
705        ctrl.innerHTML = '';
706      }
707    }
708
709    if (childctrl.attributes != null) {
710      if (childctrl.attributes['onclick'] != null
711        && childctrl.attributes['onclick'].nodeValue != null) {
712        childctrl.attributes.removeNamedItem('onclick');
713
714        if (childctrl.className == 'pointer')
715          childctrl.attributes.removeNamedItem('class');
716
717        if (childctrl.className == 'gridSelfLink')
718          childctrl.style.display = 'none';
719      }
720      if (childctrl.attributes['onmouseout'] != null) {
721        childctrl.attributes.removeNamedItem('onmouseout');
722      }
723      if (childctrl.attributes['onmousemove'] != null) {
724        childctrl.attributes.removeNamedItem('onmousemove');
725      }
726      if (childctrl.attributes['onmousedown'] != null) {
727        childctrl.attributes.removeNamedItem('onmousedown');
728      }
729      if (childctrl.attributes['onmouseover'] != null) {
730        childctrl.attributes.removeNamedItem('onmouseover');
731      }
732      if (childctrl.attributes['onmouseup'] != null) {
733        childctrl.attributes.removeNamedItem('onmouseup');
734      }
735      if (childctrl.attributes['onkeyup'] != null) {
736        childctrl.attributes.removeNamedItem('onkeyup');
737      }
738      if (childctrl.attributes['onkeypress'] != null) {
739        childctrl.attributes.removeNamedItem('onkeypress');
740      }
741      if (childctrl.attributes['onkeydown'] != null) {
742        childctrl.attributes.removeNamedItem('onkeydown');
743      }
744    }
745    //nem nyomtatja az overflow-t jól a firefox
746    if (nodename == 'SPAN') {
747      if (childctrl.style != null) {
748        childctrl.style.removeProperty('display');
749      }
750    }
751
752    if (nodename == 'SELECT') {
753      var ertek;
754      for (i = 0; i < childctrl.options.length; i++) {
755        if (childctrl.options[i].selected == true)
756          ertek = childctrl.options[i].text;
757      }
758      // ha combo
759      childctrl.innerHTML = '';
760      var parent = childctrl.parentNode;
761      childctrl.parentNode.removeChild(childctrl);
762      var ertekElement = document.createElement('span');
763      ertekElement.innerHTML = ertek;
764      if (ertek)
765        parent.appendChild(ertekElement);
766      i--;
767    }
768    if (nodename == 'INPUT') {
769      var parent = childctrl.parentNode;
770      if (childctrl.type == 'radio' && (childctrl.parentNode.children != null)) {
771        //a nem kijelölt radio labeljeinek takarítása
772        var labelcontrol = childctrl.parentNode.children[1];
773        childctrl.parentNode.removeChild(childctrl);
774        if (childctrl.checked != true) {
775          parent.removeChild(labelcontrol);
776        }
777      }
778      else
779        childctrl.parentNode.removeChild(childctrl);
780      i--;
781    }
782
783    if (childctrl.childNodes.length > 0) {
784      RemovePrintLinks(childctrl);
785    }
786  }
787}
788
789// linkeket kiszedő rekurzív metódus (a gridhez kell)
790function RemoveGridLinks(gridid, ctrl) {
791  var grid = $get(gridid);
792
793  if (grid == null)
794    return;
795  if (ctrl == null && grid.childNodes.length > 0)
796    ctrl = grid;
797  else if (ctrl == null)
798    return;
799
800  //    // végigmegy a megadott control összes elemén, és ha van href-je, vagyis link típusú, akkor
801  // kiszedi a link szövegét és ha van, akkor megadja a felette lévő control innerHTML-nek az adott szöveget.
802  for (var i = 0; i < ctrl.childNodes.length; i++) {
803    var childctrl = ctrl.childNodes[i];
804    if (childctrl.href != null && childctrl.href != '') {
805      if (ctrl.nodeName == "TD" && ctrl.attributes['onclick'] != null
806        && ctrl.attributes['onclick'].nodeValue != null) {
807        ctrl.innerHTML = childctrl.innerHTML;
808      }
809    }
810    else if (childctrl.isDisabled != ctrl.isDisabled) {
811      ctrl.disabled = childctrl.isDisabled;
812    }
813
814
815    if (childctrl.childNodes.length > 0) {
816      RemoveGridLinks(gridid, childctrl);
817    }
818  }
819}
820
821/* Firefox nyomtatás - linuxon futtatva gond lehet ezzel */
822if (navigator.userAgent.indexOf("Firefox") > -1) {
823  var _emptyTags =
824  {
825    "IMG": true,
826    "BR": true,
827    "INPUT": true,
828    "META": true,
829    "LINK": true,
830    "PARAM": true,
831    "HR": true
832  };
833
834  HTMLElement.prototype.__defineGetter__("outerHTML", function () {
835    var attrs = this.attributes;
836    var str = "<" + this.tagName;
837    for (var i = 0; i < attrs.length; i++)
838      str += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";
839
840    if (_emptyTags[this.tagName])
841      return str + ">";
842
843    return str + ">" + this.innerHTML + "</" + this.tagName + ">";
844  });
845}
846
847
848function getPrintHTML(Header, Data, Footer) {
849  var pp = window.open();
850  //Adding HTML opening tag with <HEAD> … </HEAD> portion
851  pp.document.writeln('<HTML><HEAD><title>Print Preview</title>');
852  pp.document.writeln('<LINK href=App_Themes/Skin_Neptun_Orange/Skin_Neptun_Orange.css type=\"text/css\" rel=\"stylesheet\">');
853  pp.document.writeln('<base target=\"_self\"></HEAD>');
854  //Adding Body Tag
855  pp.document.writeln('<body MS_POSITIONING=\"GridLayout\" bottomMargin=\"0\"');
856  pp.document.writeln(' leftMargin=\"0\" topMargin=\"0\" rightMargin=\"0\">');
857  //Adding form Tag
858  pp.document.writeln('<form method=\"post\">');
859  //Creating two buttons Print and Close within a HTML table
860  pp.document.writeln('<TABLE width=100%><TR><TD></TD></TR><TR><TD align=right>');
861  pp.document.writeln('<INPUT ID=\"PRINT\" type=\"button\" value=\"Print\" ');
862  pp.document.writeln('onclick=\"javascript:location.reload(true);window.print();\">');
863  pp.document.writeln('<INPUT ID=\"CLOSE\" type=\"button\" value=\"Close\" onclick=\"window.close();\">');
864  pp.document.writeln('</TD></TR><TR><TD></TD></TR></TABLE>');
865  //Writing print area of the calling page
866  pp.document.write(Header);
867  pp.document.writeln('<P></P>');
868
869  pp.document.write(Data);
870
871  //Ending Tag of </form>, </body> and </HTML>
872  pp.document.writeln('<P></P>');
873  pp.document.write(Footer);
874  pp.document.writeln('</form></body></HTML>');
875  pp.document.close();
876}
877
878function DisplayInvoice(invoicetype, invoiceid, Func) {
879  location.href = 'common_controls/SaveFileDialog.aspx?Type=' + invoicetype + '&id=' + invoiceid + '&Func=' + Func;
880}
881
882/*************************region Logout**************************************/
883var your_message = "Ön elhagyja a Neptun.Net rendszert!\r\nBiztonsági okokból kérem jelentkezzen ki.\r\nKilépéshez kattintson az 'OK' gombra.";
884function onleave() {
885
886  var leave = confirm(your_message);
887  if (leave) {
888    self.location = 'main.aspx?ctrl=logout'
889    location = self.location;
890    // count++;
891  }
892}
893/*************************endregion Logout**************************************/
894
895function DoValidate() {
896  if (typeof (Page_Validators) != "undefined") {
897    var isvalid = Page_ClientValidate();
898  }
899}
900function ConvertHarmfulCode(ctrl) {
901  // kicserelem a veszelyes karaktereket
902  for (var j = 0; j < ctrl.childNodes.length; j++) {
903    var childctrl = ctrl.childNodes[j];
904
905    if (childctrl.type == "text" || childctrl.type == "textarea") {
906      childctrl.value = childctrl.value.replace(/</g, "&lt;").replace(/>/g, "&gt;");
907    }
908
909    if (childctrl.childNodes.length > 0)
910      ConvertHarmfulCode(childctrl);
911  }
912}
913
914//ValidationGroupra hiv kliens oldali validalast
915//ModalPopup-oknal hivjuk a btn ClientClickre
916function DoValidateGroup(validationGroup) {
917  //overwrites the original Page_ClientValidate
918  Page_InvalidControlToBeFocused = null;
919  if (typeof (Page_Validators) != "undefined") {
920    var i;
921    for (i = 0; i < Page_Validators.length; i++) {
922      // fokuszalas
923      ValidatorValidate(Page_Validators[i], validationGroup, null);
924
925      try {
926        // ha esetleg kilog a kepbol, akkor odascrollozas
927        if (!Page_Validators[i].isvalid && Page_InvalidControlToBeFocused == null) {
928
929          // 200 pixellel lejjebb tolom a hibauzenetet, hogy szemre-alljon
930          var offst = ($(Page_Validators[i]).parent()[0].offsetTop);
931
932          // csak positive ertek legyen, vagy teljesen a window teteje
933          if (offst < 0)
934            offst = 0;
935
936          // csak az elso hibas kontrollra scrollozok fel, ha nincs még képben
937          if ($(window).scrollTop() > offst) {
938            // hogy szemre essen
939            $(window).scrollTop(offst - 150);
940          }
941        }
942      } catch (e) { }
943
944      //                if (Page_Validators[i].validationGroup == validationGroup)
945      //                {
946      //                    ValidatorEnable(Page_Validators[i], true);
947      //                }
948    }
949    ValidatorUpdateIsValid();
950    ValidationSummaryOnSubmit(validationGroup);
951    Page_BlockSubmit = !Page_IsValid;
952    //this is to correct a little bug in ASP
953    if (!Page_IsValid)
954      __defaultFired = false;
955    else
956      ConvertHarmfulCode(document.body);
957    return Page_IsValid;
958  }
959  return true;
960}
961
962function HideModalDialogWithoutValidation(modalid, isBlind) {
963  var x = $find(modalid);
964  if (x != null) {
965    x.hide();
966    submitCount = 0;
967  }
968  if (isBlind != undefined && isBlind != null && isBlind.toLowerCase() == "true")
969    modalBezarasFocus();
970  //return false;
971}
972
973function DefaultBankAccountIsAlready(chkbtnID, Message) {
974  var NodeChkBox = document.getElementById(chkbtnID);
975  if (NodeChkBox.checked == true && DefaultBankAccountIsAlready.Number > 0 && !DefaultBankAccountIsAlready.ThisIsDefault && DefaultBankAccountIsAlready.IsDefault) {
976    return confirm(Message);
977  }
978}
979/*Funkcio Help*/
980function ShowHideFunctionHelp(ctrl) {
981  var x = document.getElementById(ctrl);
982  if (x.style.display == 'block' || x.style.display == '') {
983    x.style.display = 'none';
984
985  }
986  else {
987    x.style.display = 'block';
988    Sys.UI.DomElement.setLocation(x, 270, 200);
989  }
990  return false;
991}
992
993function SetModalZindex(modalId, ZIndex, fn) {
994  var modal = $find(modalId);
995  var modalObject = null;
996  if (modal != null)
997    modalObject = modal._foregroundElement;
998  var Background = $get(modalId + '_backgroundElement');
999  if (modalObject != null) {
1000    modalObject.style.zIndex = ZIndex + 1;
1001    Background.style.zIndex = ZIndex;
1002  }
1003  Sys.Application.remove_load(fn);
1004}
1005
1006var isCtrlVakok = false;
1007var isAltVakok = false;
1008var isShiftVakok = false;
1009var jquerydialogclosed = false;
1010
1011function onKeyDown(e) {
1012  /// <summary> Az onKeyDown esemény hatására le van kezelve, ha talál megjelenített modalpopup-t
1013  /// a felületen, akkor azt bezárja. </summary>
1014  if (e && e.keyCode == Sys.UI.Key.esc) {
1015    // if the key pressed is the escape key, dismiss the dialog
1016    // jquery dialog escape-es becsukásakor jquerydialogclosed beállítódik true-ra.
1017    // Ekkor azért, h a modál ne tűnjön el, itt átugrom a modál becsukást. Viszont következő escape-et
1018    // már úgy kezeli a modál, ahogy eddig.
1019    if (jquerydialogclosed) {
1020      jquerydialogclosed = false;
1021    }
1022    else {
1023      CloseModalPopup(false);
1024      InitializeTimer();
1025      modalElozoFocus.push();
1026
1027      if (modallevel > 0)
1028        if ($('.behaviorupNewsDetails_modal_NewsDetails').length > 0)
1029          if ($('.behaviorupNewsDetails_modal_NewsDetails').is(':visible')) // == display:block
1030            $('.behaviorupNewsDetails_modal_NewsDetails').dialog('close');
1031
1032      return;
1033    }
1034  }
1035
1036  if (e.keyCode == 16)
1037    isShiftVakok = true;
1038  if (e.keyCode == 17)
1039    isCtrlVakok = true;
1040  if (e.keyCode == 18)
1041    isAltVakok = true;
1042  if (isCtrlVakok && (isAltVakok || isShiftVakok) && e.keyCode == 77 && $('.modalBackground:visible').length == 0) // ctrl+alt/shift+m a menühöz
1043    menu1.doMenu(e);
1044
1045  //var $focused = $(':focus');
1046  //if (($focused) == $('#user') || ($focused) == $('#pwd'))
1047
1048  // login oldal miatt
1049  if (e.keyCode == 13)
1050    if ($(document.activeElement).attr('id') == "user" || $(document.activeElement).attr('id') == "pwd") {
1051      TieButton(e, 'btnSubmit');
1052    }
1053}
1054
1055function onKeyUp(e) {
1056  if (e.keyCode == 16)
1057    isShiftVakok = false;
1058  if (e.keyCode == 17)
1059    isCtrlVakok = false;
1060  if (e.keyCode == 18)
1061    isAltVakok = false;
1062}
1063
1064function CloseModalPopup(NeedCloseChildModalPopup) {
1065
1066  /// <summary> Bezárja a modalpopupokat, ha meg vannak jelenítve.
1067  /// Ha egy parent és egy child modal van nyitva, akkor először mindig a childot zárja be és a parentet nem. </summary>
1068  var result = false;
1069  if (!NeedCloseChildModalPopup)
1070    result = CloseModalPopup(true);
1071  if (result)
1072    return;
1073
1074  var componentArray = Sys.Application.getComponents();
1075  for (var i = 0; i < componentArray.length; i++) {
1076    if (Object.getType(componentArray[i]).getName() == 'SDA.Neptun.WebControls.ModalPopupBehavior') {
1077      var modalpopup = componentArray[i];
1078      if (modalpopup._id == "popup_PwdChanger" || !(modalpopup._enableEscapeClose))
1079        continue;
1080      var modalpopupstyle = $get(modalpopup.get_id() + '_backgroundElement').style;
1081      if (NeedCloseChildModalPopup && modalpopupstyle.display == "" && modalpopupstyle.zIndex == 110000) {
1082        modalpopup.hide();
1083        result = true;
1084      }
1085      else if (!NeedCloseChildModalPopup && modalpopupstyle.display == "" && modalpopupstyle.zIndex == 10000) {
1086        modalpopup.hide();
1087      }
1088      else if (!NeedCloseChildModalPopup && modalpopupstyle.display == "" && modalpopupstyle.zIndex >= 200000) {
1089        modalpopup.hide();
1090      }
1091    }
1092  }
1093
1094  return result;
1095}
1096
1097
1098// This function performs a GET Web request
1099// to retrieve  information from the Url specified in
1100// the query string.
1101function GetWebRequest(oWebPanel, oEvent) {
1102  //alert("Performing Get Web request.");
1103  var getpage = 'main.aspx';
1104  if (document.location.search == "")
1105    getpage += '?';
1106  else
1107    getpage += document.location.search + '&';
1108  getpage += 'callback=ajax';
1109  if (oWebPanel.getExpanded() == true) {
1110    if (oWebPanel.getID() == "panelFavorites") {
1111      getpage = getpage + "&favorites=expanded";
1112    }
1113    else if (oWebPanel.getID() == "panelMessages") {
1114      getpage = getpage + "&messages=expanded";
1115    }
1116    else {
1117      getpage = getpage + "&info=expanded";
1118    }
1119  }
1120  else {
1121    if (oWebPanel.getID() == "panelFavorites") {
1122      getpage = getpage + "&favorites=collapsed";
1123    }
1124    else if (oWebPanel.getID() == "panelMessages") {
1125      getpage = getpage + "&messages=collapsed";
1126    }
1127    else {
1128      getpage = getpage + "&info=collapsed";
1129    }
1130  }
1131  // Instantiate the WebRequest object.
1132  var wRequest = new Sys.Net.WebRequest();
1133
1134  // Set the request Url.
1135  wRequest.set_url(getpage);
1136
1137  // Set the request verb.
1138  wRequest.set_httpVerb("GET");
1139
1140  // Set user's context
1141  wRequest.set_userContext("12345");
1142
1143  // Set the web request completed event handler,
1144  // for processing return data.
1145  wRequest.add_completed(OnWebRequestCompleted);
1146
1147
1148  // Clear the results page element.
1149  //displayElement.innerHTML = "";
1150
1151  // Execute the request.
1152  wRequest.invoke();
1153}
1154//siman behiv a szerver oldali kodba es nem fut le a page_load
1155//vegulis egy webservice hivas
1156//Toolscriptmanagerben EnablePageMethod-ot engedelyezni kell a mukodeshez
1157function InvokeServerFunction(oWebPanel, oEvent) {
1158  if (oWebPanel.getExpanded() == true) {
1159    PageMethods.SavePanelState(oWebPanel.getID() + ',expanded', null);
1160  }
1161  else {
1162    PageMethods.SavePanelState(oWebPanel.getID() + ',collapsed', null);
1163  }
1164}
1165
1166function AddPanelEvents(behaviorid) {
1167  var panel = $find(behaviorid);
1168  if (panel) {
1169    panel.add_expandComplete(PanelExpandedCompleted);
1170    panel.add_collapseComplete(PanelCollapsedCompleted);
1171  }
1172}
1173
1174function PanelExpandedCompleted(sender, args) {
1175  PageMethods.SavePanelState(sender._id + ',expanded', null);
1176}
1177
1178function PanelCollapsedCompleted(sender, args) {
1179  PageMethods.SavePanelState(sender._id + ',collapsed', null);
1180}
1181
1182
1183
1184function SetModalZIndex(modalbehaviorid, ZIndex) {
1185  var ModalForeground = $get(modalbehaviorid + '_foregroundElement');
1186  var ModalBackground = $get(modalbehaviorid + '_backgroundElement');
1187  ModalForeground.style.zIndex = ZIndex + 1;
1188  ModalBackground.style.zIndex = ZIndex;
1189}
1190
1191function isMaxLength(txtBox, mlength) {
1192  if (txtBox) {
1193    if (txtBox.getAttribute && txtBox.value.length > mlength)
1194      txtBox.value = txtBox.value.substring(0, mlength);
1195    return (txtBox.value.length <= mlength);
1196  }
1197}
1198
1199var IsPopupVisible = null;
1200
1201//var visibleids = new Array();
1202/*Modalpopupextender Show*/
1203//function OnPopupShow(popupid, modalclientid, kellatmeretezes, behaviourid) {
1204
1205//    // eltuntetem a tooltip-et, ha látszik, hogy feleslegesen már ne legyen látható
1206//    var toolTip = $('#GridTooltip');
1207//    if (toolTip != null) {
1208//        toolTip.html('').css('display', 'none');
1209//    }
1210
1211//    PageMethods.SavePopupState('visible', modalclientid);
1212
1213//    if (Array.contains(visibleids, popupid) == false)
1214//        Array.add(visibleids, popupid);
1215
1216//    if (kellatmeretezes) {
1217//        // csak ha kell atmeretezes
1218//        _modalpanel = $get(modalclientid);
1219
1220//        // modal megjelenitese utan beallitjuk a modal meretet
1221//        SetModalPanelSize();
1222
1223//        _modalpanel._pnlmodal.style.filter = '';
1224//        _modalpanel.style.filter = '';
1225//        _modalpanel._modalpopuptitle.style.filter = '';
1226
1227//        _modalpanel._pnlmodal.style.MozOpacity = '';
1228//        _modalpanel.style.MozOpacity = '';
1229//        _modalpanel._modalpopuptitle.style.MozOpacity = '';
1230//    }
1231//    var popup = $find(behaviourid);
1232//    if (popup != null) {
1233//        if (Array.contains(ModalCollection, _modalpanel) == false) {
1234//            Array.add(ModalCollection, _modalpanel);
1235//        }
1236//        popup.set_ClientState('true');
1237
1238//        popup._layout();
1239//    }
1240
1241//    // popup userctrl nev
1242//    var modalpopuptitle = $('#' + _modalpanel.id + ' .modalpanel_header_caption');
1243//    if (modalpopuptitle) {
1244//        var userctrlcaption = modalpopuptitle.attr('puctrl');
1245
1246//        if (userctrlcaption) {
1247//            // a modalban levo usercontrol idjat kiteszem fentre
1248//            var destination = $('#upTraining_lblPageInfoText');
1249//            if (destination) {
1250//                var divModalUserCtrl = destination.find('#divModalUserCtrl');
1251//                if (divModalUserCtrl.length == 0)
1252//                    destination.html(destination.html() + ' <div id="divModalUserCtrl" style="position:absolute; z-index:10001;"><strong>' + userctrlcaption + '</strong></div>');
1253//                else
1254//                    divModalUserCtrl.text(userctrlcaption);
1255//            }
1256//        }
1257//    }
1258
1259//    ActivateAlertDiv(progressalerttypediv, 'none');
1260//}
1261/*Modalpopupextender Hide*/
1262
1263
1264function OnSaveCollapsiblePanelState() {
1265  PageMethods.SaveCollapsiblePanelState();
1266
1267  var panelBalOldal = $get('panelBalOldal');
1268  if (panelBalOldal) {
1269    var panelBalOldalDiv = panelBalOldal.childNodes[0];
1270    if (panelBalOldalDiv) {
1271      panelBalOldalDiv.style['display'] = 'block';
1272    }
1273  }
1274}
1275
1276var PopupHideCallback;
1277function OnPopupHide(popupid, modalclientid, behaviorid, callback) {
1278  PopupHideCallback = callback;
1279  // ha mentes kell legyen egy modalon, akkor eloszor megkerdezi, hogy becsukhatja-e az ablakot
1280  if (modalisdirty) {
1281    var confirmtext = GetConfirmText(modalclientid);
1282    if (confirmtext != null && !confirm(beforeleavemodalstring + confirmtext)) {
1283      var modal = $find(behaviorid);
1284      if (modal)
1285        modal.show();
1286      return false;
1287    }
1288  }
1289  var popup = $find(behaviorid);
1290  if (popup != null)
1291    popup.set_ClientState('false');
1292  PageMethods.SavePopupState('hidden', modalclientid, OnPopupHideCallBack);
1293  //if (Array.contains(visibleids, popupid) == true)
1294  //    Array.remove(visibleids, popupid);
1295  DoValidateGroup('none');
1296  submitCount = 0;
1297
1298
1299  _modalpanel = $get(modalclientid);
1300  if (_modalpanel) {
1301    _oldboundsarray[_modalpanel.id + '_modalsize'] = null;
1302    _oldboundsarray[_modalpanel.id + '_modallocation'] = null;
1303    _oldboundsarray[_modalpanel.id + '_modalminsize'] = null;
1304    _oldboundsarray[_modalpanel.id + '_gridmagassag'] = null;
1305    _oldboundsarray[_modalpanel.id + '_isfullscreenstate'] = null;
1306    _modalpanel._runCounter = 0;
1307    _modalpanel = null;
1308
1309    Array.removeAt(ModalCollection, ModalCollection.length - 1);
1310  }
1311
1312  // modal popup nev eltuntetese
1313  var divModalUserCtrl = $('#divModalUserCtrl');
1314  if (divModalUserCtrl.length > 0)
1315    divModalUserCtrl.text('');
1316
1317  // eltuntetem a tooltip-et, ha látszik, hogy feleslegesen már ne legyen látható
1318  var toolTip = $('#GridTooltip');
1319  if (toolTip != null) {
1320    toolTip.html('').css('display', 'none');
1321  }
1322}
1323function OnPopupHideCallBack() {
1324  if (PopupHideCallback != undefined)
1325    PopupHideCallback();
1326
1327}
1328//idokozonkent meghivja a megadott
1329//interval millisecundumban
1330var interval;
1331function Timer(functionname, interval) {
1332  interval = window.setInterval(functionname, interval);
1333}
1334function StayAlive() {
1335  //visszahivok, hogy ne járjon le a session
1336  // var prm = Sys.WebForms.PageRequestManager.getInstance();
1337  // prm._doPostBack('hiddensessionend', '');
1338
1339  $.ajax({
1340    type: 'Post',
1341    url: 'service.asmx/StayAlive',
1342    success: function (data) {
1343      InitializeTimer();
1344    }
1345
1346  })
1347}
1348function StopStayAlive() {
1349  window.clearInterval(interval);
1350}
1351
1352/*function DoStayAlive(IsSessionAlive) {
1353if (IsSessionAlive == 'True') {
1354//frissitem a visszaszámlálót, ha a session meg aktiv
1355InitializeTimer();
1356}
1357else {
1358//ha mar nem aktiv a session, akkor kijelentkezek.
1359StopTheClock();
1360location.href = 'Login.aspx?timeout=';
1361}
1362}*/
1363
1364
1365// elmenti a szakdolgozat témára jelentkezések sorrendjét
1366function SaveThesisOrderByStudent(IDs) {
1367  PageMethods.SaveThesisOrderByStudent(IDs);
1368}
1369
1370// elmenti a szakdolgozat témára jelentkezések sorrendjét
1371function SaveErasmusjelentkezesSorrend(IDs) {
1372  PageMethods.SaveErasmusjelentkezesSorrend(IDs);
1373}
1374//elmenti a kollégiumi jelentkezések sorrendjét
1375function SaveKollegiumijelentkezesSorrend(IDs) {
1376  PageMethods.SaveKollegiumijelentkezesSorrend(IDs);
1377}
1378
1379
1380origKozteruletSelectedIndex = 0;
1381function onAddressChange1(value, txtKozteruletID, ddlKozteruletJellegeID, txtHazszamID, txtEpuletID, txtLepcsohazID, txtEmeletID, txtAjtoID) {
1382  var txtKozterulet = $get(txtKozteruletID);
1383  var ddlKozteruletJellege = $get(ddlKozteruletJellegeID);
1384  var txtHazszam = $get(txtHazszamID);
1385  var txtEpulet = $get(txtEpuletID);
1386  var txtLepcsohaz = $get(txtLepcsohazID);
1387  var txtEmelet = $get(txtEmeletID);
1388  var txtAjto = $get(txtAjtoID);
1389
1390  if (txtKozterulet != null)
1391    txtKozterulet.disabled = value;
1392  if (ddlKozteruletJellege != null)
1393    ddlKozteruletJellege.disabled = value;
1394  if (txtHazszam != null)
1395    txtHazszam.disabled = value;
1396  if (txtEpulet != null)
1397    txtEpulet.disabled = value;
1398  if (txtLepcsohaz != null)
1399    txtLepcsohaz.disabled = value;
1400  if (txtEmelet != null)
1401    txtEmelet.disabled = value;
1402  if (txtAjto != null)
1403    txtAjto.disabled = value;
1404
1405  if (value == true) {
1406    txtKozterulet.value = txtKozterulet.defaultValue;
1407    ddlKozteruletJellege.selectedIndex = origKozteruletSelectedIndex;
1408    txtHazszam.value = txtHazszam.defaultValue;
1409    txtEpulet.value = txtEpulet.defaultValue;
1410    txtLepcsohaz.value = txtLepcsohaz.defaultValue;
1411    txtEmelet.value = txtEmelet.defaultValue;
1412    txtAjto.value = txtAjto.defaultValue;
1413  }
1414  else
1415    origKozteruletSelectedIndex = ddlKozteruletJellege.selectedIndex;
1416
1417}
1418
1419function onAddressChange2(value, txtAddressID) {
1420  var txtAddress = $get(txtAddressID);
1421  if (txtAddress != null)
1422    txtAddress.disabled = value;
1423
1424  if (value == true)
1425    txtAddress.value = txtAddress.defaultValue;
1426}
1427
1428function TieButton(event, ButtonToTie) {
1429  if (document.all) event = window.event; // for IE
1430  if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
1431    document.getElementById(ButtonToTie).focus();
1432    return false;
1433  }
1434  else
1435    return false;
1436}
1437
1438function TieMenuDropdownButton(event, ButtonToTie, HiddenName) {
1439  if (document.all) event = window.event; // for IE
1440  if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
1441    document.getElementById(HiddenName).value = this.value;
1442    document.getElementById(ButtonToTie).focus();
1443    return false;
1444  }
1445  else
1446    return false;
1447}
1448
1449// letiltja vagy engedelyezi a validatort a gridnel
1450function SetValidatorInGrid(cmbColumnID, validSearchID) {
1451  var cmbColumn = $get(cmbColumnID);
1452  var validSearch = $get(validSearchID);
1453
1454  if (cmbColumn.value.indexOf('_DNAME') > -1) {
1455    ValidatorEnable(validSearch, true);
1456  }
1457  else {
1458    ValidatorEnable(validSearch, false);
1459  }
1460}
1461
1462// Tovabb lepteti a kovetkezo kontrollra a fokuszt, ha beirt 8 karaktert
1463function BankszamlaszamLeptetes(currctrlid, nextctrlid) {
1464  var currctrl = $get(currctrlid);
1465  var nextctrl = $get(nextctrlid);
1466
1467  if (nextctrl != null && currctrl != null
1468    && currctrl.value.length == 8) {
1469    nextctrl.focus();
1470  }
1471}
1472
1473// Beallitja a TooltipExtendernel a szoveget, ha a szoveg = null, akkor nem jelenik meg
1474function SetTooltip(tooltipclientid, headertext, text) {
1475  var tooltip = $find(tooltipclientid);
1476  var tooltiptext = null;
1477  if (tooltip != null) {
1478    if (text != null) {
1479      tooltiptext = '<div class="tooltip_header">' + headertext + '</div><div class="tooltip_content">' + text + '</div>';
1480    }
1481    tooltip.set_Text(tooltiptext);
1482  }
1483}
1484
1485function SetLinkButtonEnabled(linkbuttonid) {
1486  var lb = document.getElementById(linkbuttonid);
1487  lb.disabled = true;
1488  return false;
1489}
1490
1491// A fajl letoltesehez kell, beregisztralodik az _endRequest esemenybe
1492// letrehoz egy IFRAME-t, ami mukodik AJAX alatt is es a Session-be berakott GUID alapjan
1493// majd a FileDownload.aspx oldalon letolti vagy megjeleniti az adott fajlt
1494function FileDownloadEndRequest(sender, args) {
1495  // Check to be sure this async postback is actually
1496  //   requesting the file download.
1497  if (sender._postBackSettings.sourceElement != undefined && sender._postBackSettings.sourceElement.id.indexOf('download') > -1) {
1498    // Create an IFRAME.
1499    var iframe = document.createElement("iframe");
1500
1501    // Point the IFRAME to FileDownload
1502    iframe.src = "FileDownload.aspx";
1503
1504    // This makes the IFRAME invisible to the user.
1505    iframe.style.display = "none";
1506
1507    // Add the IFRAME to the page.  This will trigger
1508    //   a request to FileDownload now.
1509    document.body.appendChild(iframe);
1510  }
1511}
1512//Addpost megjelenítés
1513var AddPostStateP;
1514var ButtonP;
1515var CtrlP;
1516var HtmlEditorP;
1517var Controlname;
1518//klines oldalról állígatjuk az Addpost állapotát
1519function SetAddPostShowState() {
1520  if (AddPostStateP.value == 'true')
1521    AddPostStateP.value = 'false';
1522  else
1523    AddPostStateP.value = 'true';
1524  ShowAppPost();
1525}
1526//PageLoadnál beállítja a változókat és annak megfelelően megjeleníti
1527function ShowHideAddPost(Button, Ctrl, AddPostState, HtmlEditor, controlname, fn) {
1528  Controlname = controlname;
1529  HtmlEditorP = iged_getById(HtmlEditor);
1530  AddPostStateP = $get(AddPostState);
1531  if (AddPostStateP.value == '')
1532    AddPostStateP.value = 'false';
1533  ButtonP = document.getElementById(Button);
1534  CtrlP = document.getElementById(Ctrl);
1535  ShowAppPost();
1536  Sys.Application.remove_load(fn);
1537}
1538function ShowAppPost() {
1539  if (AddPostStateP.value == 'true') {
1540    ButtonP.style.display = 'none';
1541    CtrlP.style.display = 'block';
1542    if (navigator.userAgent.indexOf("Firefox") > -1) {
1543      SimaulteMD(Controlname);
1544      SimaulteMU(Controlname);
1545    }
1546    HtmlEditorP.focus();
1547  }
1548  else {
1549    ButtonP.style.display = 'block';
1550    CtrlP.style.display = 'none';
1551  }
1552}
1553
1554function SimaulteMD(controlname) {
1555  var btn = $get(controlname);
1556  var evtMD = document.createEvent("MouseEvents");
1557  evtMD.initMouseEvent("mousedown", true, true, window, 0, btn.x + 1, btn.y + 1, btn.x + 1, btn.y + 1, false, false, false, false, 0, null);
1558  btn.dispatchEvent(evtMD);
1559
1560}
1561function SimaulteMU(controlname) {
1562  var btn = $get(controlname);
1563  var evtMU = document.createEvent("MouseEvents");
1564  evtMU.initMouseEvent("mouseup", true, true, window, 0, btn.x + 1, btn.y + 1, btn.x + 1, btn.y + 1, false, false, false, false, 0, null);
1565  btn.dispatchEvent(evtMU);
1566}
1567
1568function newHtmlEdior(HidAddPostNew) {
1569  var hidnew = $get(HidAddPostNew);
1570  hidnew.value = 'true';
1571}
1572function ClearHtmlEditor(HtmlEditor, TextBox, elozmeny) {
1573  var ihtmleditor = iged_getById(HtmlEditor);
1574  var txtbox = $get(TextBox);
1575  var pre = $get(elozmeny);
1576  ihtmleditor.setText('');
1577  txtbox.value = '';
1578  txtbox.removeAttribute('readOnly');
1579  if (pre != null)
1580    pre.style.display = 'none';
1581}
1582// az alábbi kódok a htmltexteditor-nál a vágólapról bemásolt szövegek formázását végzik
1583function edAfterAction(oEditor, actID, oEvent, p4, p5, p6, p7, p8) {
1584  if (actID == 'Paste' || actID == 'PasteHtml') {
1585    oEditor.setText(cleanXhtml(oEditor.getText()));
1586  }
1587}
1588
1589function cleanXhtml(dirty) {
1590  //remove comments
1591  clean = dirty.replace(/<!–/g, '')
1592
1593  //remove blank lines
1594  clean = clean.replace(/<p>(&nbsp;){0,1}<\/p>/ig, '')
1595
1596  //remove whole tags
1597  clean = clean.replace(/<\/?(onmouseover|iframe|noscript|font|span|shape|path|shapetype|stroke|textbox).*?>/ig, '');
1598
1599  //remove some known Word styles
1600  clean = clean.replace(/class=[\'""]{0,1}(MsoNormal)[\'""]{0,1}/ig, '');
1601
1602  //change characters
1603  clean = clean.replace(/[§]/ig, '&bull;');
1604
1605  //remove doctype declarations
1606  clean = clean.replace(/<!DOCTYPE[.]*>/ig, '');
1607
1608  //clean up spacing
1609  clean = clean.replace(/ /ig, ' ');
1610  clean = clean.replace(' >', '>');
1611  clean = clean.replace('> <', '><');
1612  clean = clean.replace(/(&nbsp;){2,}/ig, '&nbsp;');
1613
1614  // torlom a scriptet es az abban levo tartalmat regexel
1615  var expression = /<script\b[^>]*>((.|\r|\n|\t)*?)<\/script>/gi;
1616  clean = clean.replace(expression, '');
1617
1618  // word comment törlése
1619  clean = dirty.replace(/<!--[\s\S]*?-->/g, '');
1620
1621  return clean;
1622}
1623
1624var isEditorCtrl = false;
1625function edKeyDown(oEditor, keyCode, oEvent) {
1626  //this function is only for IE
1627  if (keyCode == 17) {
1628    isEditorCtrl = true;
1629  }
1630  if ((keyCode == 36 || keyCode == 35) && isEditorCtrl) {
1631    var editor = $('#' + oEditor.ID);
1632    var elemek = $(editor).parents("div").find("input[type!='hidden'][disabled!='disabled'], .htmlEditorTextWindow, submit, select, a, #" + oEditor.ID);
1633    var editorIndex = jQuery.inArray(editor[0], elemek);
1634    var kovetkezoIndex = keyCode == 35 ? editorIndex + 1 : editorIndex - 1;
1635    if ($('#' + elemek[kovetkezoIndex].id).hasClass('htmlEditorTextWindow') && keyCode == 35)
1636      kovetkezoIndex += 1;
1637    elemek[kovetkezoIndex].focus();
1638    isEditorCtrl = false;
1639    return;
1640  }
1641
1642  if (!window.event || !window.clipboardData) return;
1643
1644  //pressed 'ctrl' and 'v'
1645  if (window.event.ctrlKey == 1 && keyCode == 86) {
1646    //wait a little bit, then clean the pasted xhtml
1647    window.setTimeout('cleanCurrentEditorXhtml("' + oEditor.ID + '")', 100);
1648    //cleanCurrentEditorXhtml(''+oEditor.ID+'');
1649  }
1650}
1651
1652// tobb bongeszo nem menti el a beirt szoveget, ezert kell ez
1653function WebEditorWorkAround(oEditorClientID) {
1654  var oEditor = iged_getById(oEditorClientID);
1655  if (oEditor) {
1656    var text = oEditor.getText();
1657    oEditor.setText(text);
1658  }
1659}
1660
1661function cleanCurrentEditorXhtml(editorId) {
1662
1663  var oEditor = iged_getById(editorId);
1664
1665  if (oEditor) oEditor.setText(cleanXhtml(oEditor.getText()));
1666
1667}
1668
1669function IgmenuInit(menuId) {
1670  while (ig_menuObject && ig_menuObject.ItemQueue.length > 0) {
1671    ig_menuObject.ItemQueue.pop();
1672  }
1673}
1674
1675var _oEditorID = null;
1676
1677function WebEditorInit(oEditor) {
1678  var htmleditorpics = $('#' + oEditor.ID + ' img');
1679  for (var i = 0; i < htmleditorpics.length; i++) {
1680    htmleditorpics[i].alt = "";
1681  }
1682
1683  $('#' + oEditor.ID).keyup(function (event) {
1684    if (event.keyCode == 17)
1685      isCtrlVakok = false;
1686  });
1687
1688  _oEditorID = oEditor.ID;
1689  PageMethods.GetStringFromJS(6119, AddSegitsegToEditor);
1690}
1691
1692function AddSegitsegToEditor(result) {
1693  $('#' + _oEditorID).find('.htmlEditorTextWindow').parent().append('<div aria-live="polite" style="display: block; position : absolute; left : 10px; top :10px; z-index : -9999" aria-hidden="false">' + result + '</div>');
1694  $('#' + _oEditorID).find('.htmlEditorTextWindow').parent().css('position', 'relative');
1695}
1696
1697var _oEditorOnFocus = null;
1698// felolvasáshoz segítség
1699function WebEditorHelp(oEditor) {
1700  var oEditorSegitseg = $('#' + oEditor.ID).find('.htmlEditorTextWindow').siblings('div[aria-live="polite"]');
1701  if (oEditorSegitseg.length > 0) {
1702    _oEditorOnFocus = oEditorSegitseg[0];
1703    PageMethods.GetStringFromJS(6119, AddSegitsegToEditorOnFocus);
1704  }
1705}
1706
1707function AddSegitsegToEditorOnFocus(result) {
1708  $(_oEditorOnFocus).html(result);
1709}
1710
1711var TimeDiff = 2 * 60 * 60 * 1000; //2óra millisecundumban
1712var tbStartDate;
1713var tbEndDate;
1714function CalculateExamEndDate(tbStartDateID, tbEndDateID, fn) {
1715  if (tbStartDate == null) {
1716    tbStartDate = $('#' + tbStartDateID);
1717  }
1718  if (tbEndDate == null) {
1719    tbEndDate = $('#' + tbEndDateID);
1720  }
1721
1722  /*
1723  if (tbStartDate.val() != "" && tbEndDate.val() != "") {
1724      TimeDiff = tbEndDate.datetimepicker("getDate") - tbStartDate.datetimepicker("getDate");
1725  }
1726  */
1727  $(tbStartDate).change(CalculateExamEndTimeBlur);
1728  Sys.Application.remove_load(fn);
1729}
1730
1731function CalculateExamEndTimeBlur(e) {
1732  var startDate = new Date(tbStartDate.datetimepicker("getDate"));
1733  if (startDate != null) {
1734    var endDate = new Date(startDate);
1735    endDate.setTime(endDate.getTime() + TimeDiff)
1736    tbEndDate.datepicker('setDate', endDate);
1737
1738    /*
1739    $(tbEndDate).change(function (e) {
1740        TimeDiff = tbEndDate.datetimepicker("getDate") - tbStartDate.datetimepicker("getDate");
1741    });
1742    */
1743  }
1744}
1745
1746// GyP - A kapott kontroll-ban valtoztatja a kapott szovegbol a megadott hosszusagu szoveget a
1747// label-re valo kattintasra
1748var full = new Array();
1749function ChangeTitle(ID, fullText, firstNchar) {
1750  var text = $get(fullText).value;
1751  var head1 = $get(ID);
1752  var firschars = text.substring(0, firstNchar);
1753
1754  if (full[ID] == null)
1755    full[ID] = true;
1756
1757  if (full[ID]) {
1758    if (firschars == text)
1759      head1.innerHTML = text;
1760    else {
1761      if (head1.innerHTML.endsWith('...'))
1762        head1.innerHTML = text;
1763      else
1764        head1.innerHTML = firschars + '...';
1765    }
1766
1767    full[ID] = false;
1768  }
1769  else {
1770    if (head1.innerHTML.endsWith('...'))
1771      head1.innerHTML = text;
1772    else
1773      head1.innerHTML = firschars + '...';
1774
1775    full[ID] = true;
1776  }
1777}
1778
1779function MetaEdit(tbId, ddlId, type) {
1780  var tb = $get(tbId);
1781  var ddl = $get(ddlId);
1782
1783  if (type == 'filter') {
1784    tb.value += ddl.value + "(1, /*Itt egy TCS függvényt kell meghívni*/) ";
1785  }
1786  else if (type == 'aggregator') {
1787    tb.value += ddl.value + "( ) ";
1788  }
1789  else
1790    tb.value += ddl.value + " ";
1791}
1792
1793// a dialogban kivalasztott smile-t illeszti be
1794function myDialogClick(imgAlt, webhtmlctrlID, srcImageName) {
1795  var object = document.createElement('SPAN');
1796  //object.innerHTML = '<img alt=' + imgAlt + ' src=' + srcImageName + ' />';
1797  object.innerHTML = '<img src=' + srcImageName + ' />';
1798
1799  if (typeof iged_insNodeAtSel == "function")//Mozilla
1800    iged_insNodeAtSel(object);
1801  else//IE
1802    iged_insText(object.outerHTML);
1803}
1804
1805// That function is called when WebHtmlEditor1 was initialized.
1806function htmleditor_Initialize(oEditor) {
1807  initializeMyDialog();
1808}
1809
1810// GyP - ez a fv. egyenlore nem hasznal semmit a dialog oldal elcsusztato problema ellen (a dialog elso megjelenitese eseten latvanyosan elcsusztatja az oldalt lefele.
1811// Az elso becsukas utan visszaugrik az oldal, es ezutan jol mukodik. Ez az eset elofordul a keresesnel is.) Ezzel meg foglalkozni kellene!!!)
1812
1813// That function is called by WebHtmlEditor1_Initialize in order to
1814// initialize content of custom dialog, which is defined explicitly within aspx
1815var myDialogWasConnected = false;
1816function initializeMyDialog() {
1817  if (myDialogWasConnected)
1818    return;
1819  myDialogWasConnected = true;
1820  //----------------
1821  // Find reference to html-element container for MyDialogID.
1822  // That value was set to ToolbarDialogButton.Dialog.DialogContentID
1823  var dialog = document.getElementById("MyDialogID");
1824  if (!dialog)
1825    return;
1826  //----------------
1827  // Find reference to html-element content for MyDialog.
1828  // The html element with that id was created within aspx.
1829  var content = document.getElementById("kollab_posts_kollab_addpost1_MyDialogContentID");
1830  //----------------
1831  // Remove MyDialogContentID from its temporary container (body of asxp-page)
1832  // and insert it into MyDialogID container, which is used by WebHtmlEditor.
1833  content.parentNode.removeChild(content);
1834  dialog.appendChild(content);
1835  //----------------
1836  // Undo initial hidden state.
1837  content.style.display = "";
1838  content.style.visibility = "visible";
1839}
1840
1841function showWait(fuFileUploadID, UPID) {
1842  if ($get(fuFileUploadID).value.length > 0) {
1843    $get(UPID).style.display = 'block';
1844  }
1845}
1846
1847function ShowTroubleShootingWindow() {
1848  var wnd = window.open('troubleshooting.aspx', 'troubleshooting', '', 'new_Win');
1849
1850  if (wnd == null) {
1851    location.href = 'troubleshooting.aspx';
1852  }
1853}
1854
1855function trim(str) {
1856  str = str.replace(/^\s+/, '');
1857  for (var i = str.length - 1; i >= 0; i--) {
1858    if (/\S/.test(str.charAt(i))) {
1859      str = str.substring(0, i + 1);
1860      break;
1861    }
1862  }
1863  return str;
1864}
1865
1866// **************BEGIN ******* SDAWeekTimeChooser javascriptje* **********************
1867
1868function SetDateFromControls(chkEnablePar, cmbDayPar, wdeTimePar, mEditValPar, mEditTime) {
1869  var chkEnabled = $get(chkEnablePar);
1870  var cmbDay = $get(cmbDayPar);
1871  var wdeTime = $get(wdeTimePar);
1872  var mEditVal = $get(mEditValPar);
1873  var mEditTime = $find(mEditTime);
1874
1875  if (chkEnabled.checked) {
1876    cmbDay.disabled = false;
1877    wdeTime.disabled = false;
1878    ValidatorEnable(mEditVal, true);
1879  }
1880  else {
1881    cmbDay.disabled = true;
1882    wdeTime.disabled = true;
1883    ValidatorEnable(mEditVal, false);
1884  }
1885}
1886// *************END******** SDAWeekTimeChooser javascriptje* **********************
1887
1888function ShowHideEmaterialRow(chkGeneral, trEmaterial) {
1889
1890  var chk = $get(chkGeneral);
1891  var emateiralrow = $get(trEmaterial);
1892
1893  if (chk.checked) {
1894    emateiralrow.style.display = 'table-row';
1895  }
1896  else {
1897    emateiralrow.style.display = 'none';
1898  }
1899
1900
1901  return false;
1902}
1903var state = true;
1904var state2 = true;
1905
1906/* a tema valaszto megjeleniteseert es az elonezeti kep megjeleniteseert felel */
1907function ShowHideThemeChooser() {
1908
1909  if ($('.skinchooserimgcollapsed')[0] != null) {
1910    $('.skinchooserimg').width("20px");
1911    $('.skinchooserimg').animate({ height: "0px" }, 300);
1912    $('.skinchooserimg').animate({ height: "20px" }, 150);
1913    $('.skinchooserimgcollapsed').toggleClass("skinchooserimgcollapsed skinchooserimgexpanded", 300);
1914  }
1915  else {
1916    $('.skinchooserimgexpanded').toggleClass("skinchooserimgexpanded skinchooserimgcollapsed", 300);
1917  }
1918
1919  state = !state;
1920  SetAriaHiddenAttributeToSkinChooserImages(state);
1921
1922  var skinchooserimg_blue = $('.skinchooserimg_blue');
1923  var skinchooserimg_green = $('.skinchooserimg_green');
1924  var skinchooserimg_pink = $('.skinchooserimg_pink');
1925  var skinchooserimg_orange = $('.skinchooserimg_orange');
1926  var skinchooserimg_teacher = $('.skinchooserimg_teacher');
1927  var skinchooserimg_purple = $('.skinchooserimg_purple');
1928  var skinchooserimg_szte = $('.skinchooserimg_szte');
1929
1930  setSkinImageUrl();
1931
1932  skinchooserimg_blue.bind('mouseover', { skinName: 'Blue' }, showSkinPreview);
1933  skinchooserimg_green.bind('mouseover', { skinName: 'Green' }, showSkinPreview);
1934  skinchooserimg_pink.bind('mouseover', { skinName: 'Pink' }, showSkinPreview);
1935  skinchooserimg_orange.bind('mouseover', { skinName: 'Orange' }, showSkinPreview);
1936  skinchooserimg_teacher.bind('mouseover', { skinName: 'Teacher' }, showSkinPreview);
1937  skinchooserimg_purple.bind('mouseover', { skinName: 'Purple' }, showSkinPreview);
1938  skinchooserimg_szte.bind('mouseover', { skinName: 'SZTE' }, showSkinPreview);
1939
1940  skinchooserimg_blue.bind('mouseout', { skinName: 'Blue' }, hideSkinPreview);
1941  skinchooserimg_green.bind('mouseout', { skinName: 'Green' }, hideSkinPreview);
1942  skinchooserimg_pink.bind('mouseout', { skinName: 'Pink' }, hideSkinPreview);
1943  skinchooserimg_orange.bind('mouseout', { skinName: 'Orange' }, hideSkinPreview);
1944  skinchooserimg_teacher.bind('mouseout', { skinName: 'Teacher' }, hideSkinPreview);
1945  skinchooserimg_purple.bind('mouseout', { skinName: 'Purple' }, hideSkinPreview);
1946  skinchooserimg_szte.bind('mouseout', { skinName: 'SZTE' }, hideSkinPreview);
1947}
1948
1949function SetAriaHiddenAttributeToSkinChooserImages(value) {
1950  var skinchooserimg_blue = $('.skinchooserimg_blue');
1951  var skinchooserimg_green = $('.skinchooserimg_green');
1952  var skinchooserimg_pink = $('.skinchooserimg_pink');
1953  var skinchooserimg_orange = $('.skinchooserimg_orange');
1954  var skinchooserimg_teacher = $('.skinchooserimg_teacher');
1955  var skinchooserimg_purple = $('.skinchooserimg_purple');
1956  var skinchooserimg_szte = $('.skinchooserimg_szte');
1957
1958  skinchooserimg_blue.attr('aria-hidden', value);
1959  skinchooserimg_green.attr('aria-hidden', value);
1960  skinchooserimg_pink.attr('aria-hidden', value);
1961  skinchooserimg_orange.attr('aria-hidden', value);
1962  skinchooserimg_teacher.attr('aria-hidden', value);
1963  skinchooserimg_purple.attr('aria-hidden', value);
1964  skinchooserimg_szte.attr('aria-hidden', value);
1965}
1966
1967function SetAriaHiddenAttributeToLanguageChooserImages(value) {
1968  $('#divLang input').each(function () {
1969    $(this).attr('aria-hidden', value);
1970  });
1971}
1972
1973/* beállítja a skin képeket, amikor kinyitja a téma választót */
1974function setSkinImageUrl() {
1975  var skinimgdiv = $('.skinsmallimage');
1976
1977  // blue
1978  var skinimgBlue = skinimgdiv.find('#imageBlue');
1979  skinimgBlue.attr('src', 'App_Themes/New_Common_Images/skin_blue_thumb.png');
1980  // blue
1981  var skinimgBlue = skinimgdiv.find('#imageGreen');
1982  skinimgBlue.attr('src', 'App_Themes/New_Common_Images/skin_green_thumb.png');
1983  // blue
1984  var skinimgBlue = skinimgdiv.find('#imagePink');
1985  skinimgBlue.attr('src', 'App_Themes/New_Common_Images/skin_pink_thumb.png');
1986  // blue
1987  var skinimgBlue = skinimgdiv.find('#imagePurple');
1988  skinimgBlue.attr('src', 'App_Themes/New_Common_Images/skin_city_thumb.png');
1989  // blue
1990  var skinimgBlue = skinimgdiv.find('#imageOrange');
1991  skinimgBlue.attr('src', 'App_Themes/New_Common_Images/skin_orange_thumb.png');
1992  // blue
1993  var skinimgBlue = skinimgdiv.find('#imageTeacher');
1994  skinimgBlue.attr('src', 'App_Themes/New_Common_Images/skin_classic_thumb.png');
1995  // szte
1996  var skinimgBlue = skinimgdiv.find('#imageSZTE');
1997  skinimgBlue.attr('src', 'App_Themes/New_Common_Images/skin_szte_thumb.png');
1998}
1999
2000/* téma választónál az előnézeti kép megjelenítése */
2001function showSkinPreview(event) {
2002
2003  var skinName = event.data.skinName;
2004  var skinimgdiv = $('.skinsmallimage');
2005  var skinimg = skinimgdiv.find('#image' + skinName);
2006
2007  skinimgdiv.show();
2008  skinimg.show();
2009}
2010
2011/* téma választónál az előnézeti kép eltüntetése */
2012function hideSkinPreview(event) {
2013  var skinName = event.data.skinName;
2014  var skinimgdiv = $('.skinsmallimage');
2015  var skinimg = skinimgdiv.find('#image' + skinName);
2016
2017  skinimgdiv.hide();
2018  skinimg.hide();
2019}
2020
2021/* téma választásnál */
2022function SkinChoose(skin_name) {
2023  var href = location.href;
2024
2025  // ha nincs egy parameter sem az href-ben
2026  if (href.indexOf('?') == -1) {
2027    dochangeSkin(href + '?skinname=' + skin_name, skin_name);
2028  }
2029  else if (href.indexOf('skinname') > -1) { // ha volt mar skin valasztva, azaz van az href-ben skinname parameter
2030    var hrefarray = href.split('?')[1].split('&');
2031    var hrefresult = href.split('?')[0];
2032
2033    // vegigmegyek a letezo parametereken es osszefuzom azokat
2034    for (var i = 0; i < hrefarray.length; i++) {
2035      if (hrefarray[i].indexOf('skinname') == -1) {
2036        if (i > 0) { // a tobbi parametert &-el fuzom az href-hez
2037          hrefresult += '&' + hrefarray[i];
2038        }
2039        else { // az elso parametert kerdojellel fuzom az href-hez
2040          hrefresult += '?' + hrefarray[i];
2041        }
2042      }
2043    }
2044
2045    // ha nincs mas parameter, akkor ?-el fuzom a href-hez
2046    if (hrefresult.indexOf('?') == -1) {
2047      //alert('2');
2048      dochangeSkin(hrefresult + '?skinname=' + skin_name, skin_name);
2049    }
2050    else // ha van mas parameter, akkor &-el fuzom a tobbi parameterhez
2051    {
2052      //alert('3');
2053      //location.href = hrefresult + '&skinname=' + skin_name;
2054      dochangeSkin(hrefresult + '&skinname=' + skin_name, skin_name);
2055
2056    }
2057  }
2058  else // ha van valamilyen mas parameter, akkor hozzafuzom a temat
2059  {
2060    //alert(href + '&skinname=' + skin_name);
2061    dochangeSkin(href + '&skinname=' + skin_name, skin_name);
2062  }
2063}
2064
2065/***************language chooser begin *****************/
2066
2067function ShowHideLanguageChooser() {
2068  if ($('.langchooserimgcollapsed')[0] != null) {
2069    $('.languagechooserbutton').width("30px");
2070    $('.languagechooserbutton').animate({ height: "0px" }, 300);
2071    $('.languagechooserbutton').animate({ height: "18px" }, 150);
2072    $('.langchooserimgcollapsed').toggleClass("langchooserimgcollapsed langchooserimgexpanded", 300);
2073  }
2074  else {
2075    $('.langchooserimgexpanded').toggleClass("langchooserimgexpanded langchooserimgcollapsed", 300);
2076  }
2077
2078  state2 = !state2;
2079  SetAriaHiddenAttributeToLanguageChooserImages(state2);
2080}
2081
2082/***************language chooser end *****************/
2083
2084function getRSSInfo(query, apiKey) {
2085  $.ajax({
2086    type: "GET",
2087    contentType: "application/json;charset=utf-8",
2088    dataType: "json",
2089    data: null,
2090    url: "http://integra/wire/?controlCode=" + query + "&top=3&sdakey=" + apiKey + "&$format=json",
2091    success: function (result) {
2092      $("#myTemplate").tmpl(result.feed.Items).appendTo("#newsListRoot");
2093    }
2094  });
2095}
2096
2097/*azért került bele, hogy a modal ne veszítse el a focust*/
2098var lastFocusedControlId = "";
2099function focusHandler(e) {
2100  document.activeElement = e.originalTarget;
2101}
2102
2103function appInit() {
2104  if (typeof (window.addEventListener) !== "undefined") {
2105    window.addEventListener("focus", focusHandler, true);
2106
2107    window.addEventListener("paste", function (e) {
2108      try {
2109        if (e.target.id.startsWith('tPassword')) {
2110          var pastedText = undefined;
2111          if (window.clipboardData && window.clipboardData.getData) { // IE
2112            pastedText = window.clipboardData.getData('Text');
2113          } else if (e.clipboardData && e.clipboardData.getData) {
2114            pastedText = e.clipboardData.getData('text/plain');
2115          }
2116
2117          var tBox = $('#' + e.target.id);
2118          var hBox = tBox.nextUntil('td', '.passwordhidden');
2119          var hCh = tBox.nextUntil('td', "input[id^='hChkShowPassword']");
2120
2121          // ha latszik a jelszo
2122          if (hCh.val() == "1") {
2123            setTimeout(function () {
2124              hBox.val($('#' + e.target.id).val());
2125              //console.log($('#' + e.target.id).val());
2126            }, 100);
2127          }
2128          else {
2129            //console.error('nem latszik a jelszo');
2130            CancelPress(e);
2131
2132            // ha az egesz ki van jelolve
2133            if ($('#' + e.target.id).val().length ==
2134              $('#' + e.target.id)[0].selectionEnd - $('#' + e.target.id)[0].selectionStart) {
2135              // atirom, ha az egész ki van jelölve
2136              var lngth = pastedText.length;
2137              var ps = '';
2138              for (i = 0; i < lngth; i++) {
2139                ps += '*';
2140              }
2141
2142              e.target.value = ps;
2143
2144              // mentem kesleltetes nelkul, mert csak az egesz paste-elheto
2145              hBox.val(pastedText);
2146            }
2147
2148            return;
2149          }
2150        }
2151        // ha az a textbox + nincs megjelenítve a jelszó
2152        else if (e.target.id.endsWith('_txtUniPassword')) {
2153          var pastedText = undefined;
2154          if (window.clipboardData && window.clipboardData.getData) { // IE
2155            pastedText = window.clipboardData.getData('Text');
2156          } else if (e.clipboardData && e.clipboardData.getData) {
2157            pastedText = e.clipboardData.getData('text/plain');
2158          }
2159
2160          var $chkShowUniPassword = $("#" + $("#" + e.target.id).attr("chkinputid"));
2161          var $hUniPassword = $("#" + $("#" + e.target.id).attr("hiddeninputid"));
2162
2163          // ha meg van jelenitve
2164          if ($chkShowUniPassword.is(':checked')) {
2165            //console.log("paste - not checked - " + $('#o_exam_modify_txtUniPassword')[0].selectionStart + " - " +$('#o_exam_modify_txtUniPassword')[0].selectionEnd);
2166
2167            // csak kesleltetve kapom meg a paste-elt value-t
2168            setTimeout(function () {
2169              $hUniPassword.val($('#' + e.target.id).val());
2170              //console.log($('#' + e.target.id).val());
2171            }, 100);
2172          }
2173          else { // ha nincs
2174            CancelPress(e);
2175
2176            // ha az egesz ki van jelolve
2177            if ($('#' + e.target.id).val().length ==
2178              $('#' + e.target.id)[0].selectionEnd - $('#' + e.target.id)[0].selectionStart) {
2179              // atirom, ha az egész ki van jelölve
2180              var lngth = pastedText.length;
2181              var ps = '';
2182              for (i = 0; i < lngth; i++) {
2183                ps += '*';
2184              }
2185
2186              e.target.value = ps;
2187
2188              // mentem kesleltetes nelkul, mert csak az egesz paste-elheto
2189              $hUniPassword.val(pastedText);
2190            }
2191            else {
2192              //console.log("paste - cancelled");
2193              CancelPress(e);
2194            }
2195
2196            return false;
2197          }
2198        }
2199      }
2200      catch (err) { }
2201    });
2202  }
2203
2204  Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler);
2205  Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoadedHandler);
2206  BrowserDetect.init();
2207
2208}
2209
2210function pageLoadingHandler(sender, args) {
2211  if (document.activeElement != null)
2212    lastFocusedControlId = typeof (document.activeElement) === "undefined" ? "" : document.activeElement.id;
2213}
2214
2215function focusControl(targetControl) {
2216  if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
2217    var focusTarget = targetControl;
2218    if (focusTarget && (typeof (focusTarget.contentEditable) !== "undefined")) {
2219      oldContentEditableSetting = focusTarget.contentEditable;
2220      focusTarget.contentEditable = false;
2221    }
2222    else {
2223      focusTarget = null;
2224    }
2225    if (targetControl.visible) {
2226      targetControl.focus();
2227    }
2228
2229    if (focusTarget) {
2230      focusTarget.contentEditable = oldContentEditableSetting;
2231    }
2232  }
2233  else {
2234    if (targetControl.visible) {
2235      targetControl.focus();
2236    }
2237  }
2238}
2239
2240function pageLoadedHandler(sender, args) {
2241  if (typeof (lastFocusedControlId) !== "undefined" && lastFocusedControlId != "") {
2242    var newFocused = $get(lastFocusedControlId);
2243    if (newFocused) {
2244      focusControl(newFocused);
2245    }
2246  }
2247}
2248
2249function ShowLeftBoxes(sender) {
2250
2251  var item = $get('upBoxes_leftbox')
2252  var visible = true;
2253  if (item.style.display != 'none') {
2254    item.style.display = 'none';
2255    sender.className = 'OpenLeftBox';
2256    visible = false;
2257    PageMethods.GetStringFromJS(4917, SetTitle);
2258  }
2259  else {
2260    item.style.display = '';
2261
2262    sender.className = 'CloseLeftBox';
2263    PageMethods.GetStringFromJS(4916, SetTitle);
2264  }
2265
2266  PageMethods.SaveLeftBoxState(visible);
2267
2268}
2269function ShowHeader(sender) {
2270
2271  var item = $get('panHeader');
2272  var changeproject = $('#span_changeproject');
2273  var visible = true;
2274  if (item.style.display != 'none') {
2275    item.style.display = 'none';
2276    sender.className = 'OpenHeader';
2277    visible = false;
2278    PageMethods.GetStringFromJS(4987, SetHeaderTitle);
2279
2280    changeproject.show();
2281  }
2282  else {
2283    item.style.display = '';
2284
2285    sender.className = 'CloseHeader';
2286    PageMethods.GetStringFromJS(4986, SetHeaderTitle);
2287
2288    changeproject.hide();
2289  }
2290
2291  PageMethods.SaveHeaderState(visible);
2292
2293}
2294function SetHeaderTitle(result) {
2295  $get('panCloseHeader').setAttribute("title", result);
2296}
2297function SetTitle(result) {
2298  $get('upBoxes_CloseLeftBoxTD').setAttribute("title", result);
2299}
2300
2301jQuery.fn.countdown = function (options) {
2302  /**
2303  * app init
2304  */
2305  if (!options) options = '()';
2306  if (jQuery(this).length == 0) return false;
2307  var obj = this;
2308
2309  /**
2310  * break out and execute callback (if any)
2311  */
2312  if (options.seconds < 0 || options.seconds == 'undefined') {
2313    if (options.callback) eval(options.callback);
2314    return null;
2315  }
2316
2317  var secCounter = Math.floor(options.seconds % 60);
2318  var minCounter = Math.floor(options.seconds / 60);
2319  /**
2320  * recursive countdown
2321  */
2322  window.setTimeout(
2323    function () {
2324      jQuery(obj).html(String(minCounter + ' : ' + secCounter));
2325      --options.seconds;
2326      jQuery(obj).countdown(options);
2327    }
2328    , 1000
2329  );
2330
2331  /**
2332  * return null
2333  */
2334  return this;
2335}
2336
2337//check refresh
2338function Unload() {
2339  CloseModalPopup(true);
2340  PageMethods.ClearPopupState();
2341}
2342
2343//var childWindow;
2344function SetModalChild(child) {
2345  //if (childWindow == undefined)
2346  //var childWindow = child;
2347  //childWindow.registerID = 'unipollOpen_' + Math.round(Math.random() * 254 + 1).toString();
2348
2349  //if ($(childWindow) != undefined) {
2350  //        $(child).bind('beforeunload', function (e) {
2351  //            test();
2352  //        });
2353  //childWindow.opener = self;
2354
2355  /********************************************/
2356  //        $(childWindow).bind({
2357  //            beforeunload: function () {
2358  //                test();
2359  //                //childWindow = undefined;
2360  //                //                $.ajaxSetup({ cache: false });
2361  //                //$(this).unbind('beforeunload');
2362  //            }
2363  //        });
2364  /********************************************/
2365  // $(childWindow).bind('mouseup', function () { test(); });
2366  /********************************************/
2367  //}
2368
2369  //return false;
2370
2371  //    $(window).bind('unload', function (e) {
2372  //        test();
2373  //    });
2374}
2375
2376function closeautomodal() {
2377  // test();
2378}
2379
2380function test() {
2381  //if ($(".modaldetail_table") != null)
2382  //$(".modaldetail_table").css("border", "3px solid red");
2383
2384
2385  var red = Math.round(Math.random() * 254 + 1);
2386  var green = Math.round(Math.random() * 254 + 1);
2387  var blue = Math.round(Math.random() * 254 + 1);
2388  var color = 'rgb(' + red + ',' + green + ',' + blue + ')';
2389  //var reverse = 'rgb(' + (255 - red) + ',' + (255 - green) + ',' + (255 - blue) + ')';
2390
2391  //    $('p#rnumber4').css('background', color)
2392  //               .css('color', reverse)
2393  //               .fadeTo('slow', '0.35')
2394  //               .fadeTo('slow', 1.0);
2395
2396
2397  if ($(".captiontable") != null)
2398    $(".captiontable").css("background", color);
2399
2400
2401
2402  //alert('hehe');
2403}
2404
2405// ARIA Felolvasáshoz
2406var modalElozoFocus = new Array();
2407var modalAktualisFocusIndex = -1;
2408
2409function modalTitleLoad(modalTitleID) {
2410  if (jQuery.inArray(modalTitleID, modalElozoFocus) < 0) {
2411    modalAktualisFocusIndex = modalAktualisFocusIndex + 1;
2412    modalElozoFocus[modalAktualisFocusIndex] = modalTitleID;
2413  }
2414}
2415
2416function modalFelolvasas(modalTitleId, gombId, Id) {
2417  var modalTitle = document.getElementById(modalTitleId);
2418  if (modalTitle != null) {
2419    modalTitle.style.display = "none";
2420    modalTitle.style.display = "block";
2421    if (modalElozoFocus[modalAktualisFocusIndex] != Id) {
2422      modalAktualisFocusIndex = modalAktualisFocusIndex + 1;
2423      modalElozoFocus[modalAktualisFocusIndex] = Id;
2424    }
2425  }
2426  var gomb = $get(gombId);
2427  if (gomb != null)
2428    gomb.focus();
2429  else
2430    $(modalTitle).next().focus();
2431}
2432
2433function modalBezarasFocus() {
2434  while (true) {
2435    var modalElozoFocusTorles = modalElozoFocus[modalAktualisFocusIndex];
2436    modalElozoFocus = jQuery.grep(modalElozoFocus, function (value) {
2437      return value != modalElozoFocusTorles;
2438    });
2439    modalAktualisFocusIndex = modalAktualisFocusIndex - 1;
2440    if (modalAktualisFocusIndex >= 0) {
2441      var modalUjFocus = $get(modalElozoFocus[modalAktualisFocusIndex]);
2442      if (modalUjFocus != null && modalUjFocus != 'undefine') {
2443        try {
2444          modalUjFocus.focus();
2445        }
2446        catch (err) { }
2447        break;
2448      }
2449    }
2450    else {
2451      break;
2452    }
2453  }
2454}
2455
2456var dcTitle = "";
2457var dcDescription = "";
2458var dcOkText = "";
2459var dcCancelText = "";
2460var dcBtnUniqueID = "";
2461var dcEvent = null;
2462
2463// notext: a confirm nem gombjának felirata
2464// plusjavascriptforcancel: cancel gombhoz rendelt javascript
2465// plusjavascriptforok: ok gombhoz rendelt javascript
2466// ezeket egyenlőre csak abban az esetben használjuk, ha 3 gomb van
2467function DialogConfirmation(title, description, okText, cancelText, btnUniqueID, imagename, okTextForAlert, e, noText, plusjavascriptforcancel, plusjavascriptforok) {
2468  if (e != null && e != undefined)
2469    CancelEvent(e);
2470  // ez azért kell, mert az evalban egy olyan CancelEvent van, ahol nem e-t, hanem event-et vár
2471  // ha ez nincs itt, akkor mozillában elszáll
2472
2473  // ez azért kell, mert a "function createModal"-ban is felül van írva, ami erre hatással van, ezért itt is felül kell írni
2474  $.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
2475    _title: function (titl) {
2476      if (title.length == 0)
2477        titl.html('&nbsp;');
2478      else
2479        titl.html(title);
2480    }
2481  }));
2482
2483  var event = e;
2484  if (okTextForAlert != "") {
2485    $("<div title=\"" + title + "\" id=\"confirm\"><img src=\"App_Themes/Common_Images/" + imagename + "\" /><p>" + description + "</p></div>").dialog({
2486      autoOpen: true,
2487      modal: true,
2488      resizable: false,
2489      width: 500,
2490      height: 180,
2491      dialogClass: 'dialog_confirm44',
2492      open: function (event, ui) {
2493        $("div.ui-dialog-buttons").on('keydown', function (event) {
2494          if (event.keyCode == $.ui.keyCode.ESCAPE) {
2495            $("div.ui-dialog-buttons").off('keydown');
2496            jquerydialogclosed = true;
2497          }
2498        });
2499
2500
2501      },
2502      close: function (ev, ui) {
2503        $(this).remove();
2504      },
2505      buttons: [
2506        {
2507          text: okTextForAlert,
2508          click: function () {
2509            $(document).off('keydown');
2510            $(this).dialog("close");
2511          }
2512        }
2513      ]
2514    });
2515  }
2516  else if (noText != undefined && noText != '') {
2517    $("<div title=\"" + title + "\" id=\"confirm\"><img src=\"App_Themes/Common_Images/" + imagename + "\" /><p>" + description + "</p></div>").dialog({
2518      autoOpen: true,
2519      modal: true,
2520      resizable: false,
2521      width: 500,
2522      height: 160,
2523      //zIndex: 10002,
2524      dialogClass: 'dialog_confirm44',
2525      open: function (event, ui) {
2526        $("div.ui-dialog-buttons").on('keydown', function (event) {
2527          if (event.keyCode == $.ui.keyCode.ESCAPE) {
2528            $("div.ui-dialog-buttons").off('keydown');
2529            jquerydialogclosed = true;
2530          }
2531        });
2532
2533      },
2534      close: function (ev, ui) {
2535        $(this).remove();
2536      },
2537      buttons: [
2538        {
2539          text: okText,
2540          click: function () {
2541            $(document).off('keydown');
2542            $(this).dialog("close");
2543            if (plusjavascriptforok != undefined && plusjavascriptforok.length > 0) {
2544              eval(plusjavascriptforok);
2545            }
2546            else {
2547              // Eddig csak dropdownlistnél kell visszatérési érték
2548              __doPostBack(btnUniqueID, 'true:' + cmbOldValue);
2549            }
2550          }
2551        },
2552        {
2553          text: noText,
2554          click: function () {
2555            $(document).off('keydown');
2556            $(this).dialog("close");
2557            __doPostBack(btnUniqueID, 'false');
2558          }
2559        },
2560        {
2561          text: cancelText,
2562          click: function () {
2563            $(document).off('keydown');
2564            $(this).dialog("close");
2565            if (plusjavascriptforcancel != undefined && plusjavascriptforcancel.length > 0)
2566              eval(plusjavascriptforcancel);
2567            return false;
2568          }
2569        }
2570      ]
2571    });
2572    $(".ui-widget-overlay").last().addClass('dialog_confirm4');
2573  }
2574  else {
2575    $("<div title=\"" + title + "\" id=\"confirm\"><img src=\"App_Themes/Common_Images/" + imagename + "\" /><p>" + description + "</p></div>").dialog({
2576      autoOpen: true,
2577      modal: true,
2578      resizable: false,
2579      width: 500,
2580      height: 160,
2581      dialogClass: 'dialog_confirm44',
2582      open: function (event, ui) {
2583        $("div.ui-dialog-buttons").on('keydown', function (event) {
2584          if (event.keyCode == $.ui.keyCode.ESCAPE) {
2585            $("div.ui-dialog-buttons").off('keydown');
2586            jquerydialogclosed = true;
2587          }
2588        });
2589      },
2590      close: function (ev, ui) {
2591        $(this).remove();
2592      },
2593      buttons: [
2594        {
2595          text: okText,
2596          click: function () {
2597            $(document).off('keydown');
2598            $(this).dialog("close");
2599            __doPostBack(btnUniqueID, 'true');
2600          }
2601        },
2602        {
2603          text: cancelText,
2604          click: function () {
2605            $(document).off('keydown');
2606            $(this).dialog("close");
2607            return false;
2608          }
2609        }
2610      ]
2611    });
2612  }
2613  return false;
2614}
2615// DropDownList korábbi értéke
2616var cmbOldValue = -1;
2617
2618// Visszaállítja a cmb kiválaszott értékét az előzőre
2619function returnOldValueforCmb(cmbUniqueId) {
2620  $('#' + cmbUniqueId).prop('selectedIndex', cmbOldValue);
2621}
2622
2623// Keresünk egy gombot a modalon
2624// pl.: cmb-hez kell, hogy lefusson a mentés gomb kliens oldali eseménye
2625//function serachButtononModal(modalclinetid, commandname, attributum) {
2626//    var ezazattributum = "" + attributum;
2627//    var result = $('#' + modalclinetid).parent().parent().parent().find('input[commandname="' + commandname + '"]').attr(ezazattributum);
2628//    return result;
2629//}
2630
2631function serachButtononModal(n, t, i) {
2632  //alert($("input[commandname='" + t + "']").last().attr("" + i));
2633  return "try{event=e;}catch(e){}" + $("input[commandname='" + t + "']").last().attr("" + i);
2634  //alert($("#" + n).first('.ui-dialog').first('input[commandname="' + t + '"]').attr(r));
2635  //return $("#" + n).parent().parent().parent().find('input[commandname="' + t + '"]').attr(r)
2636}
2637
2638// Visszaadja egy cmb kiválasztott értékét
2639function cmbSelectedValue(id) {
2640  return $('#' + id).prop('selectedIndex');
2641}
2642
2643// Változott-e a jhtmlarea szövege
2644var jhtmlAreaChangedText = false;
2645
2646function CancelEvent(e) {
2647  //event = e;
2648  if (e != null && e != undefined) {
2649    e.returnValue = false;
2650    e.cancelBubble = true;
2651    if (e.preventDefault) { e.preventDefault(); }
2652    if (e.stopPropagation) { e.stopPropagation(); }
2653    return false;
2654  }
2655}
2656
2657// DialogConfirmation hívás esemény előtti server behívással
2658function DialogConfirmationWithOnBeforeHandler(title, description, okText, cancelText, btnUniqueID, handlerType, paramString, e) {
2659  CancelEvent(e);
2660  // mentjük a dialoghoz szükséges paramétereket
2661  dcTitle = title;
2662  dcDescription = description;
2663  dcOkText = okText;
2664  dcCancelText = cancelText;
2665  dcBtnUniqueID = btnUniqueID;
2666  dcEvent = e;
2667
2668  var paramArray = paramString.split(',');
2669
2670  if (handlerType == "KervenyMellekletFileNameExistance") {
2671    var kervenyId = paramArray[0];
2672    var fileUploadClientID = paramArray[1];
2673    var fileName = $('#' + fileUploadClientID).val().split('\\').pop();
2674    PageMethods.IsExistKervenyMellekletFileName(kervenyId, fileName, OnPageMethodAnswer);
2675  }
2676}
2677
2678function OnPageMethodAnswer(result) {
2679  if (result == 'true')
2680    DialogConfirmation(dcTitle, dcDescription, dcOkText, dcCancelText, dcBtnUniqueID, "mini_help.png", '', dcEvent);
2681  else
2682    __doPostBack(dcBtnUniqueID, null);
2683}
2684
2685var txtRecipients = "";         //Címzettek
2686var lblWarning = "";            //Figyelmeztető szöveg
2687
2688var warningString = "";          //Figyelmeztető szöveg
2689
2690//Tíltandó kontrollok
2691var txtsubjectID = "";           //Tárgy mező
2692var jqDatePickerID = "";         //Dátumválasztó
2693var htmlEditorID = "";           //Üzenet szövegének HTML szerkesztője
2694var signatureID = "";            //Üzenet aláírásának HTML editora
2695var sendButtonID = "";           //Elküldés gomb
2696var addDocumentButtonID = "";    //Dokumentum hozzáadása gomb
2697var newDocumentButtonID = "";    //Új dokumentum feltöltése gomb
2698var modalPopUpID = "";
2699
2700var disableControls;            //Kell-e tiltani a kontrolokat
2701
2702function onMessageRecipientChange(txtNeptunCodesID, lblWarningID, PageClientID, _txtsubjectID, _jqDatePickerID, _htmlEditorID, _signatureID, _sendButtonID, _addDocumentButtonID, _newDocumentButtonID, _modalPopUpID) {
2703  txtRecipients = txtNeptunCodesID;
2704  lblWarning = lblWarningID;
2705  txtsubjectID = _txtsubjectID;
2706  jqDatePickerID = _jqDatePickerID;
2707  htmlEditorID = _htmlEditorID;
2708  signatureID = _signatureID;
2709  sendButtonID = _sendButtonID;
2710  addDocumentButtonID = _addDocumentButtonID;
2711  newDocumentButtonID = _newDocumentButtonID;
2712  modalPopUpID = _modalPopUpID;
2713
2714  var neptunCodesvalue = '';
2715
2716  var $jqNeptunCodes = $get(txtNeptunCodesID);
2717  if ($jqNeptunCodes)
2718    neptunCodesvalue = $jqNeptunCodes.value;
2719
2720  PageMethods.CheckMessageRecivingUserPermission(neptunCodesvalue, PageClientID, checkRecipientC
2720allBack);
2721}
2722function checkRecipientCallBack(result) {
2723  if (result != '') {
2724    if (result == 7268) {
2725      disableControls = false;
2726    }
2727    else {
2728      disableControls = true;
2729    }
2730
2731    PageMethods.GetStringFromJS(result, SetRecipientWarning);
2732  }
2733  else {
2734    ResetRecipientWarning('');
2735  }
2736}
2737
2738function SetWarningString(result) {
2739  warningString = result;
2740}
2741function SetRecipientWarning(result) {
2742  if (disableControls === false) {
2743    if ($('#' + txtsubjectID).attr('disabled') == 'disabled') {
2744      ResetRecipientWarning('');
2745    }
2746  }
2747  $('#' + lblWarning).text(result);
2748
2749  if (disableControls) {
2750    $('#' + txtsubjectID).attr('title', result).attr('disabled', 'disabled').removeClass('requiredTxb');
2751    $('#' + jqDatePickerID).attr('title', result).attr('disabled', 'disabled');
2752    $('#' + htmlEditorID).attr('title', result);
2753    $('#' + signatureID).attr('title', result);
2754
2755    CKEDITOR.instances[htmlEditorID].setReadOnly(true);
2756    CKEDITOR.instances[signatureID].setReadOnly(true);
2757
2758    $('[id$=' + sendButtonID + ']').attr('title', result).attr('disabled', 'disabled').addClass('ui-state-disabled');
2759    $('[id$=' + addDocumentButtonID + ']').attr('title', result).attr('disabled', 'disabled').addClass('ui-state-disabled');
2760    $('[id$=' + newDocumentButtonID + ']').attr('title', result).attr('disabled', 'disabled').addClass('ui-state-disabled');
2761  }
2762}
2763function ResetRecipientWarning(result) {
2764  $('#' + lblWarning).text(result);
2765
2766  $('#' + txtsubjectID).removeAttr('tooltipText', result).removeAttr('disabled').addClass('requiredTxb');
2767  $('#' + jqDatePickerID).removeAttr('tooltipText', result).removeAttr('disabled');
2768  $('#' + htmlEditorID).removeAttr('tooltipText', result);
2769  $('#' + signatureID).removeAttr('tooltipText', result);
2770
2771  CKEDITOR.instances[htmlEditorID].setReadOnly(false);
2772  CKEDITOR.instances[signatureID].setReadOnly(false);
2773
2774  $('[id$=' + sendButtonID + ']').removeAttr('tooltipText', result).removeAttr('disabled').removeClass('ui-state-disabled');
2775  $('[id$=' + addDocumentButtonID + ']').removeAttr('tooltipText', result).removeAttr('disabled').removeClass('ui-state-disabled');
2776  $('[id$=' + newDocumentButtonID + ']').removeAttr('tooltipText', result).removeAttr('disabled').removeClass('ui-state-disabled');
2777}
2778/*--------------------------------------------------------*/
2779
2780function reorderItems(things, parent) {
2781  for (var i = 1; i <= $(things).length; i++) {
2782    $(things).each(function () {
2783      var x = parseInt($(this).find('input').val(), 10);
2784      if (x === i) {
2785        $(this).appendTo(parent);
2786      }
2787    });
2788  }
2789}
2790
2791function OnDormitorySaveClick(uniqueid, sortid, e) {
2792  reorderItems('.sortable_container_div > div', '.sortable_container_div');
2793  CancelEvent(e);
2794  var sortedids = $('#' + sortid).sortable('toArray').join(',');
2795  __doPostBack(uniqueid, sortedids);
2796}
2797
2798function OnDormitorySaveClickScroll() {
2799  setTimeout(function () {
2800    $(this).scrollTop(9999999);
2801  }, 5);
2802}
2803
2804function OnDormitorySaveClick2(uniqueid, sortid, e) {
2805
2806  // CancelEvent(e);
2807  var sortedids = $('#' + sortid).sortable('toArray').join(',');
2808  $("#" + uniqueid).val(sortedids);
2809  //__doPostBack(uniqueid, sortedids);
2810}
2811
2812// true : validálás
2813// false : tab váltás
2814var fromValidatorcall = null;
2815var behavid = null;
2816//var eltolasegyszer = true;
2817//var arrayEltoltak = [];//new Array();
2818function selectedtabforvalidator(validateostabchange, modalpopupbehaviorid, innen, activetabindex) {
2819  if (validateostabchange == true) {
2820    fromValidatorcall = innen;
2821    //ajax__tab_active, visibility: visible; ajax__tab_panel
2822    // Tabon
2823    //var tabonvane = $('.' + modalpopupbehaviorid).find('.ajax__tab_panel:visible');
2824    //if (tabonvane.length > 0) {
2825    //    if ($('.' + modalpopupbehaviorid).find('.ajax__tab_panel:visible').find($('.ajax__validatorcallout_')).parent().length > 0) {
2826    //        $('.ajax__validatorcallout_').show();
2827    //        behavid = modalpopupbehaviorid;
2828    //    }
2829    //    var a = $('.' + modalpopupbehaviorid).find('.ajax__tab_panel:visible').find($('.ajax__validatorcallout_'));
2830    //    a.appendTo($('.' + modalpopupbehaviorid).parent());
2831    //    //pozicio frissites hack
2832    //    if (a.length > 0)
2833    //        a[0]._behaviors[0].set_y(-1);
2834    //}
2835    //else {
2836    //    if ($('.' + modalpopupbehaviorid).find($('.ajax__validatorcallout_')).parent().length > 0) {
2837    //        $('.ajax__validatorcallout_').show();
2838    //        behavid = modalpopupbehaviorid;
2839    //    }
2840    //    var a = $('.' + modalpopupbehaviorid).find($('.ajax__validatorcallout_'));
2841    //    a.appendTo($('.' + modalpopupbehaviorid).parent());
2842    //    //pozicio frissites hack
2843    //    if (a.length > 0)
2844    //        a[0]._behaviors[0].set_y(-1);
2845    //}
2846  }
2847  else {
2848    if (fromValidatorcall != null && behavid != null) {
2849      ($('.' + behavid).parent().find($('.ajax__validatorcallout_'))).appendTo($(fromValidatorcall));
2850    }
2851    ($('.' + behavid).find($('.ajax__validatorcallout_'))).hide();
2852    if (fromValidatorcall != null && behavid != null) {
2853      fromValidatorcall = null;
2854      behavid = null;
2855    }
2856  }
2857}
2858
2859var iconX = iconY = 0;
2860var StringResID = null;
2861var RoleRequestInfo = null;
2862function editLabelShowIcon(sender, fromIcon, hiddenID) {
2863  if (fromIcon == false) {
2864    $('#upEditLabelIcon_editLabelIcon').children().css('display', 'block');
2865    iconX = $(sender).offset().left + $(sender).width() - 1 - $(document).scrollLeft();
2866    iconY = $(sender).offset().top - $(sender).scrollTop() - $(document).scrollTop()/* - $(sender).height()*/;
2867    $('#upEditLabelIcon_editLabelIcon').css({ left: iconX, top: iconY });
2868    if (iconX + $('.editLabelIcon').width() > $(document).width()) {
2869      $('#upEditLabelIcon_editLabelIcon').css({ left: '', right: 0 });
2870    }
2871    StringResID = $(sender).attr('stringResID');
2872    RoleRequestInfo = $(sender).attr('rolerequestinfo');
2873    if (StringResID == null) {
2874      $('#upEditLabelIcon_lbtnEditLabel').css('display', 'none');
2875      $('#spanNotEdit').css('display', 'block');
2876    }
2877    else {
2878      $('#upEditLabelIcon_lbtnEditLabel').css('display', 'block');
2879      $('#spanNotEdit').css('display', 'none');
2880    }
2881    if (RoleRequestInfo == null) {
2882      $('#upEditLabelIcon_lbtnRoleRequest').css('display', 'none');
2883      $('#spanNotRequest').css('display', 'block');
2884    }
2885    else {
2886      $('#upEditLabelIcon_lbtnRoleRequest').css('display', 'block');
2887      $('#spanNotRequest').css('display', 'none');
2888    }
2889  }
2890  $('#upEditLabelIcon_editLabelIcon').css({ display: 'block' });
2891}
2892
2893function getAttributeForEditLabelModal(attrib, hiddenID) {
2894  if (attrib === 'stringResID')
2895    $('#' + hiddenID).val(StringResID);
2896  else if (attrib === 'rolerequestinfo')
2897    $('#' + hiddenID).val(RoleRequestInfo);
2898}
2899
2900function editLabelHideIcon(sender) {
2901  $('#upEditLabelIcon_editLabelIcon').css({ right: '', display: 'none' });
2902}
2903
2904function multiselectReturnValues(sender) {
2905  return $('#' + sender).multiselect("getChecked").map(function () { return this.value }).get().join(',');
2906}
2907
2908//BrowserDetect.init();
2909
2910var BrowserDetect = {
2911  init: function () {
2912    this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
2913    this.version = this.searchVersion(navigator.userAgent)
2914      || this.searchVersion(navigator.appVersion)
2915      || "an unknown version";
2916    this.OS = this.searchString(this.dataOS) || "an unknown OS";
2917  },
2918  searchString: function (data) {
2919    for (var i = 0; i < data.length; i++) {
2920      var dataString = data[i].string;
2921      var dataProp = data[i].prop;
2922      this.versionSearchString = data[i].versionSearch || data[i].identity;
2923      if (dataString) {
2924        // IE eseteben a 11-est maskepp kell azonositani
2925        if (data[i].subString == 'MSIE') {
2926          var trident = !!dataString.match(/Trident\/7.0/);
2927          var net = !!dataString.match(/.NET4.0E/);
2928          if (trident && net) // ha IE 11
2929            return data[i].identity;
2930        }
2931
2932        if (dataString.indexOf(data[i].subString) != -1)
2933          return data[i].identity;
2934
2935      }
2936      else if (dataProp)
2937        return data[i].identity;
2938    }
2939  },
2940  searchVersion: function (dataString) {
2941    var index = dataString.indexOf(this.versionSearchString);
2942    if (this.versionSearchString == 'MSIE') {
2943      var trident = !!dataString.match(/Trident\/7.0/);
2944      var net = !!dataString.match(/.NET4.0E/);
2945      if (trident && net) {   // ha IE 11
2946        index = dataString.indexOf('rv');
2947        return parseFloat(dataString.substring(index + 2 + 1));
2948      }
2949    }
2950
2951    if (index == -1) return;
2952    return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
2953  },
2954  dataBrowser: [
2955    {
2956      string: navigator.userAgent,
2957      subString: "Chrome",
2958      identity: "Chrome"
2959    },
2960    {
2961      string: navigator.userAgent,
2962      subString: "OmniWeb",
2963      versionSearch: "OmniWeb/",
2964      identity: "OmniWeb"
2965    },
2966    {
2967      string: navigator.vendor,
2968      subString: "Apple",
2969      identity: "Safari",
2970      versionSearch: "Version"
2971    },
2972    {
2973      prop: window.opera,
2974      identity: "Opera",
2975      versionSearch: "Version"
2976    },
2977    {
2978      string: navigator.vendor,
2979      subString: "iCab",
2980      identity: "iCab"
2981    },
2982    {
2983      string: navigator.vendor,
2984      subString: "KDE",
2985      identity: "Konqueror"
2986    },
2987    {
2988      string: navigator.userAgent,
2989      subString: "Firefox",
2990      identity: "Firefox"
2991    },
2992    {
2993      string: navigator.vendor,
2994      subString: "Camino",
2995      identity: "Camino"
2996    },
2997    {		// for newer Netscapes (6+)
2998      string: navigator.userAgent,
2999      subString: "Netscape",
3000      identity: "Netscape"
3001    },
3002    {
3003      string: navigator.userAgent,
3004      subString: "MSIE",
3005      identity: "Explorer",
3006      versionSearch: "MSIE"
3007    },
3008    {
3009      string: navigator.userAgent,
3010      subString: "Gecko",
3011      identity: "Mozilla",
3012      versionSearch: "rv"
3013    },
3014    { 		// for older Netscapes (4-)
3015      string: navigator.userAgent,
3016      subString: "Mozilla",
3017      identity: "Netscape",
3018      versionSearch: "Mozilla"
3019    }
3020  ],
3021  dataOS: [
3022    {
3023      string: navigator.platform,
3024      subString: "Win",
3025      identity: "Windows"
3026    },
3027    {
3028      string: navigator.platform,
3029      subString: "Mac",
3030      identity: "Mac"
3031    },
3032    {
3033      string: navigator.userAgent,
3034      subString: "iPhone",
3035      identity: "iPhone/iPod"
3036    },
3037    {
3038      string: navigator.platform,
3039      subString: "Linux",
3040      identity: "Linux"
3041    }
3042  ]
3043
3044};
3045
3046/*--------------------------------------------------------*/
3047
3048
3049
3050Sys.Application.add_init(appInit);
3051
3052/*Scrollnál ott maradtak elemek ez tünteti el őket hisz ekkor már nem ír bele (pl. autocomplete)*/
3053$(window).scroll(function () {
3054  $(".ui-autocomplete").css("display", "none");
3055});
3056
3057
3058
3059
3060// kikenyszerítem a szinkron behivást, ezért a postback csak a session torlese utan fog lefutni
3061//$().ready(function () {
3062//    $(window).on('beforeunload', function () {
3063
3064//        //        var cucc = '';
3065//        //        $.ajax({
3066//        //            type: "POST",
3067//        //            url: "/main.aspx/ClearPopupState",
3068//        //            contentType: "application/json; charset=utf-8",
3069//        //            dataType: "json",
3070//        //            async: false,
3071//        //            success: function (data) { },
3072//        //            complete: function (data) { },
3073//        //            error: function (data) { }
3074//        //        });
3075//    });
3076//});
3077/*
3078function onPostBack() {
3079var y = generateRandomSequence();
3080//var hdnGuid = document.getElementById("hdnGuid");
3081//hdnGuid.value = y;
3082//$("#uF5_hdnGuid").val(y);
3083$("#hdnGuid").attr('value', y);
3084
3085$.ajax({
3086type: "POST",
3087url: "/main.aspx/CreateNewGuid",
3088contentType: "application/json; charset=utf-8",
3089dataType: "json",
3090async: false,
3091success: function (data) { },
3092complete: function (data) { },
3093error: function (data) { }
3094});
3095}
3096
3097function generateRandomSequence() {
3098var g = "";
3099for (var i = 0; i < 32; i++)
3100g += Math.floor(Math.random() * 0xF).toString(0xF)
3101return g;
3102}
3103*/
3104
3105function SetFocusOnIframe(index) {
3106  //window.setTimeout('$(".ui-widget-overlay").last().first("iframe")[0].contentWindow.focus()', 30);
3107
3108  //if (index = 1)
3109  //window.setTimeout('$(".ui-widget-overlay").last().first(".jHtmlArea").first("#iframe")[0].contentWindow.focus()', 50);
3110
3111  //    if (index = 0)
3112  //      window.setTimeout('$(""iframe"")[0].contentWindow.focus()', 30);
3113}
3114
3115function SetFocusOnComlbo(cmbClientID) {
3116
3117  $('#' + cmbClientID).mousedown(function () {
3118    this.focus();
3119  });
3120
3121}
3122
3123/* Látássérültek kollégiumi jelentkezéséhez sorrendezés*/
3124function LatasserultSorrendezes() {
3125  getInitialOrder('.sortable_container_div');
3126
3127  $('.sortable_container_div input[type="number"]').focus(function () {
3128    $(this).select();
3129  }).change(function () {
3130    updateAllNumbers($(this), '.sortable_container_div input');
3131  }).keyup(function () {
3132    updateAllNumbers($(this), '.sortable_container_div input');
3133  });
3134}
3135function getInitialOrder(obj) {
3136  var num = 1;
3137  var inputok = $(obj).find('input[type="number"]');
3138  $(inputok).each(function () {
3139
3140    $(this).val(num).attr('data-initial-value', num);
3141    num++;
3142  });
3143  $(obj).find('input[type="number"]').attr('max', num - 1); //give it an html5 max attr based on num of objects
3144}
3145
3146function updateAllNumbers(currObj, targets) {
3147  var delta = currObj.val() - currObj.attr('data-initial-value'), //if positive, the object went down in order. If negative, it went up.
3148    c = parseInt(currObj.val(), 10), //value just entered by user
3149    cI = parseInt(currObj.attr('data-initial-value'), 10), //original object val before change
3150    top = $(targets).length;
3151
3152  if (c > top) {
3153    currObj.val(top);
3154  } else if (c < 1) {
3155    currObj.val(1);
3156  }
3157
3158  $(targets).not($(currObj)).each(function () {
3159    var v = parseInt($(this).val(), 10);
3160
3161    if (v >= c && v < cI && delta < 0) {
3162      $(this).val(v + 1);
3163    } else if (v <= c && v > cI && delta > 0) {
3164      $(this).val(v - 1);
3165    }
3166  }).promise().done(function () {
3167
3168    $(targets).each(function () {
3169      if ($(this).val() !== "") {
3170        $(this).attr('data-initial-value', $(this).val());
3171      }
3172    });
3173  });
3174}
3175/*-----------------------------------------------------------------------*/
3176
3177function UsefullClickCounter(clientid, value) {
3178  $('#' + clientid).val(value);
3179}
3180
3181function OrarendTervezoMozgatas(clientid) {
3182  $('#' + clientid).draggable({
3183    handle: 'h2',
3184    containment: 'document'
3185  });
3186}
3187
3188function dochangeLanguage(index, lcid) {
3189  var prm = Sys.WebForms.PageRequestManager.getInstance();
3190  var param = 'btnLang_' + index;
3191  prm._doPostBack(param, lcid);
3192}
3193
3194function dochangeSkin(href, skin_name) {
3195  var prm = Sys.WebForms.PageRequestManager.getInstance();
3196  var param = 'btnSkin_';
3197  prm._doPostBack(param, skin_name);
3198}
3199
3200function langmouseout(btnID, percent) {
3201  $('#' + btnID).css({
3202    'opacity': '0.' + percent,//'0.65',
3203    'filter': 'alpha(opacity=' + percent + ')',
3204    '-moz-opacity': '0.' + percent//'0.65'
3205  });
3206}
3207
3208function langmouseover(btnID) {
3209  $('#' + btnID).css({
3210    'opacity': '1',
3211    'filter': 'alpha(opacity=100)',
3212    '-moz-opacity': '1'
3213  });
3214}
3215
3216function RedirectToCash(tabID) {
3217  var prm = Sys.WebForms.PageRequestManager.getInstance();
3218  var param = 'tabIndex_' + tabID;
3219  prm._doPostBack(param, tabID);
3220}
3221
3222var oSecondJudgementModalScrollTop = null;
3223function oSecondJudgementModalScroll() {
3224  setTimeout(function () {
3225    if (oSecondJudgementModalScrollTop) {
3226      $('#upFunction_o_second_judgement_upModal_upmodalIdoszakAdatok_divpopup').scrollTop(oSecondJudgementModalScrollTop);
3227      oSecondJudgementModalScrollTop = null;
3228    }
3229  }, 10);
3230}
3231
3232var oFirstJudgementModalScrollTop = null;
3233function oFirstJudgementModalScroll() {
3234  setTimeout(function () {
3235    if (oFirstJudgementModalScrollTop) {
3236      $('#upFunction_o_first_judgement_upModal_upmodalIdoszakAdatok_divpopup').scrollTop(oFirstJudgementModalScrollTop);
3237      oFirstJudgementModalScrollTop = null;
3238    }
3239  }, 10);
3240}
3241
3242
3243function Megosztas(egyiktextboxid, masiktextboxid, osszeg) {
3244  $('#' + egyiktextboxid).focusout(function () {
3245    if ($('#' + egyiktextboxid).val().length > 0) {
3246      if (($('#' + egyiktextboxid).val() < osszeg) && $('#' + egyiktextboxid).val() > 0) {
3247        $('#' + masiktextboxid).val(osszeg - $('#' + egyiktextboxid).val());
3248      }
3249      else {
3250        $('#' + masiktextboxid).val('0');
3251      }
3252    }
3253  });
3254  $('#' + masiktextboxid).focusout(function () {
3255
3256    if ($('#' + masiktextboxid).val().length > 0) {
3257      if ($('#' + masiktextboxid).val() < osszeg) {
3258        $('#' + egyiktextboxid).val(osszeg - $('#' + masiktextboxid).val());
3259      }
3260      else {
3261        $('#' + egyiktextboxid).val('0');
3262      }
3263    }
3264  });
3265}
3266
3267function base64EncodeUnicode(str) {
3268  // First we escape the string using encodeURIComponent to get the UTF-8 encoding of the characters,
3269  // then we convert the percent encodings into raw bytes, and finally feed it to btoa() function.
3270  utf8Bytes = encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
3271    return String.fromCharCode('0x' + p1);
3272  });
3273
3274  return btoa(utf8Bytes);
3275}
3276
3277function ManageStartEndDateChecksAtOWebTasksRooms(
3278  pageUniqueId, taskIntervalChanged,
3279  startDateClientId, endDateClientId,
3280  gridRoomsClientId, button1Text,
3281  button2Text, isNewTask
3282) {
3283  let isStartDateFocusOutTriggered = false;
3284  let isEndDateFocusOutTriggered = false;
3285  let originalStartDate = null;
3286  let originalEndDate = null;
3287  const gridRoomsClientIdForCallbacks = gridRoomsClientId;
3288
3289  // Függvény, amivel megvárjuk az értékek betöltését,
3290  // datepicker update miatt kell késleltelsé, hogy az inputtext feltöltve legyen, mivel nincs konkrét eseménykezelő
3291  // a versenyhezet kilővi ezt a js scriptet, üres maradna így sosem jönnek hívás
3292  function waitForFieldValues(startDateClientId, endDateClientId, callback) {
3293    const startDate = $(`#${startDateClientId} input.requiredTxb`).val();
3294    const endDate = $(`#${endDateClientId} input.requiredTxb`).val();
3295
3296    if (startDate && endDate) {
3297      callback(startDate, endDate);
3298    } else {
3299      setTimeout(() => {
3300        waitForFieldValues(startDateClientId, endDateClientId, callback);
3301      }, 100);
3302    }
3303  }
3304
3305  // Figyelmeztető modal generálása
3306  function showConfirmationModal(startDate, endDate) {
3307    $('#confirmDelUiReservationsModal').dialog({
3308      resizable: false,
3309      modal: true,
3310      height: 200,
3311      width: 650,
3312      closeOnEscape: false,
3313      buttons: {
3314        [button1Text]: function () {
3315          __doPostBack(pageUniqueId, taskIntervalChanged);
3316          isStartDateFocusOutTriggered = false;
3317          isEndDateFocusOutTriggered = false;
3318          $(this).dialog('destroy');
3319        },
3320        [button2Text]: function () {
3321          // Eredeti dátumok visszaállítása globális változókból, ha "Mégse" gombra kattint, ne vesszel el az adat
3322          $('#' + startDateClientId + ' input.requiredTxb').val(originalStartDate);
3323          $('#' + endDateClientId + ' input.requiredTxb').val(originalEndDate);
3324          isStartDateFocusOutTriggered = false;
3325          isEndDateFocusOutTriggered = false;
3326          $(this).dialog('destroy');
3327        },
3328      },
3329      create: function () {
3330        $(this).closest('.ui-dialog').css('z-index', '1050');
3331        //kikapcsolom a X gombot
3332        $(".ui-dialog-titlebar-close", $(this).parent()).hide();
3333      },
3334    });
3335  }
3336
3337  //ha új enittás kiírásánal originalstartdate valójában egy currentdatetime, az enddate meg üres (feltéve ha így van az adott oldalon beállítva)
3338  // => így az új entitás irányból mindaddig nincs "valós" startdate/endate páros, amíg üres a kiválasztott termek száma
3339  function handleFocusOut(isStartDate) {
3340    const startDate = $('#' + startDateClientId + ' input.requiredTxb').val();
3341    const endDate = $('#' + endDateClientId + ' input.requiredTxb').val();
3342    const isGridRoomTableEmpty =
3343      $("#" + gridRoomsClientIdForCallbacks + "_bodytable tbody tr.NoMatch").length > 0;
3344
3345    if (isNewTask === true && isGridRoomTableEmpty) {
3346      if (isStartDate) {
3347        originalStartDate = startDate;
3348      } else {
3349        originalEndDate = endDate;
3350      }
3351    }
3352    //ha történt változás, akkor feldobjuk neki a figyelmeztető modalt
3353    if ((startDate !== originalStartDate || endDate !== originalEndDate) && !isGridRoomTableEmpty) {
3354      showConfirmationModal(startDate, endDate);
3355    } else {
3356      isStartDateFocusOutTriggered = false;
3357      isEndDateFocusOutTriggered = false;
3358    }
3359  }
3360
3361  // Elsőként megvárjuk, amíg az inputok értékei betöltődnek
3362  waitForFieldValues(startDateClientId, endDateClientId, (startDate, endDate) => {
3363
3364    //Legelső érvényes akciós esetén feltöltjük az elemeket
3365    originalStartDate = startDate;
3366    originalEndDate = endDate;
3367
3368    // Start és EndDate focus eseményeit csak akkor futtatjuk meg ha már lefutott a updatetime, ezért van késleltetés,
3369    // ha nem így tennék akkor az óra pörögne a gomb hatására
3370    $('#' + startDateClientId).on('focusout change', function () {
3371      if (isStartDateFocusOutTriggered) return;
3372      isStartDateFocusOutTriggered = true;
3373      setTimeout(() => {
3374        handleFocusOut(true);
3375      }, 100);
3376    });
3377
3378    $('#' + endDateClientId).on('focusout change', function () {
3379      if (isEndDateFocusOutTriggered) return;
3380      isEndDateFocusOutTriggered = true;
3381      setTimeout(() => {
3382        handleFocusOut(false);
3383      }, 100);
3384    });
3385  });
3386}

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.