PageSourceSearch

https://zhudayu522.com/Scripts/ContentPagingControl.js

js zhudayu522.com collected 2026-10-07 11:16:25 UTC 52,449 bytes, 1,709 lines download raw bytes

1var contentPagingControlSerial = 1;
2var contentSerial = 1;
3var baseMoveUnit = 10;
4var decreaseRate = 10;
5var hasSetContentPagingResizeEventHandler = false;
6var rootPath = "/";
7var lastOverItemFloatingContentTime = new Date();
8var lastOverItemFloatingContenGeneralBlockItemId = null;
9var lastClickGeneralBlockItem = null;
10var collapseLastExpandedGeneralBlockItem = true;
11var lastClickGeneralBlockItemNameElement = null;
12var firstMoveDuration = "";
13
14
15if (typeof (pageControls) == "undefined") {
16    pageControls = new Array();
17}
18
19
20function GetPageControlById(pageControlId) {
21    var pageControl = null;
22    var i;
23
24    for (i = 0; i < pageControls.length; i++) {
25        if (pageControls[i].Id == pageControlId) {
26            pageControl = pageControls[i];
27            break;
28        }
29    }
30
31    return pageControl;
32}
33
34
35function GetPageControlByElementId(pageElementId) {
36    var pageControl = null;
37    var i;
38
39    for (i = 0; i < pageControls.length; i++) {
40
41        if (
42            (pageControls[i].pagingElement != null)
43            &&
44            (pageControls[i].pagingElement.id == pageElementId)
45        ) 
46        {
47            pageControl = pageControls[i];
48            break;
49        }
50    }
51
52    return pageControl;
53}
54
55
56function ContentPagingControl(controlId) {
57    this.contentElement = null;
58    this.pagingElement = null;
59    this.paggerElement = null;
60    this.currPageIndex = 0;
61    this.pageCount = 0;
62    this.contentElementWidth = 0;
63    this.pagingElementWidth = 0;
64    this.pagingElementHeight = 0;
65    this.ShowPaging = true;
66    this.ShowAnchor = true;
67    this.SlideShow = false;
68    this.PagingUnit = "Page"; //Page , Item
69    this.Duration = 5000;
70    this.Durations = new Array();
71    this.LastMoveTime = new Date();
72    this.isTouchMoving = false;
73    this.Visible = false;
74    this.lastResizeTime = new Date();
75    this.paggerElementTop = -1;
76    this.ItemCount = -1;
77    this.RecordPerPage = -1;
78    this.MoveToFirstDirectly = false;
79    this.IsMouseHover = false;
80    this.IsMarqueeContent = false;
81    this.HoverStop = false;
82
83    if (controlId != null) {
84        this.Id = controlId;
85    }
86    else {
87        this.Id = "ContentPagingControl_" + contentPagingControlSerial++;
88    }
89
90
91    this.LastMoveTime = this.LastMoveTime.setDate(this.LastMoveTime.getDate() - 1);
92
93    this.previousAnchorElement = null;
94    this.previousAnchorElementId = this.Id + "_PrevAnchor";
95    this.paggerElementId = this.Id + "_Pagger";
96
97    this.nextAnchorElement = null;
98    this.nextAnchorElementId = this.Id + "_NextAnchor";
99
100    pageControls.push(this);
101
102    this.SetPaggerElementPosition = ContentPagingControl_SetPaggerElementPosition;
103    this.Attach = ContentPagingControl_Attach;
104    this.Hide = ContentPagingControl_Hide;
105    this.ResetAnchorVisibility = ContentPagingControl_ResetAnchorVisibility;
106    this.GetMousePosition = ContentPagingControl_GetMousePosition;
107    this.InsidePagingElement = ContentPagingControl_InsidePagingElement;
108    this.MoveToPage = ContentPagingControl_MoveToPage;
109    this.MoveToPageEvent = null;
110
111    this.BeforeMoveToPage = null;
112    this.AfterMoveToPage = null;
113    this.Initialize = null;
114
115    this.OnResize = ContentPagingControl_OnResize;
116    this.CalcPageCount = ContentPagingControl_CalcPageCount;
117}
118
119
120function AttachContentPagingElement(pagingControlId, pagingElementId, contentElementId) {
121    var pagingElemen;
122    var contentElement;
123    var pagingControl;
124
125
126    pagingElement = document.getElementById(pagingElementId);
127    contentElement = document.getElementById(contentElementId);
128
129
130    if (pagingElement.clientWidth == 0 || GetContentElementWidth(contentElement) == 0) {       
131        setTimeout(
132        "AttachContentPagingElement('" + pagingControlId + "','" + pagingElementId + "','" + contentElementId + "')", 500);
133        return;
134    }
135    else {
136        pagingControl = GetPageControlById(pagingControlId);
137        pagingControl.Attach(pagingElementId, contentElementId);
138    }
139
140    this.Visible = true;
141}
142
143
144
145function ContentPagingControl_Attach(pagingElementId, contentElementId) {
146    var prevAnchorElementHtml = "";
147    var nextAnchorElementHtml = "";
148    var pagerElementHtml = "";
149    var controlId;
150    var movePageUnit = "Page";
151    var pagingElementWidth, contentElementWidth;
152    var tokens;
153    var duration = this.Duration;
154    var i;
155 
156
157    this.pagingElement = document.getElementById(pagingElementId);
158
159
160    tokens = this.pagingElement.parentElement.className.split(" ")
161
162    if (tokens.length > 0) {
163        className = tokens[tokens.length - 1];
164
165        if (window[className + "Initialize"] != null) {
166            this.Initialize = window[className + "Initialize"];
167        }
168
169
170        if (window[className + "BeforeMoveToPage"] != null) {
171            this.BeforeMoveToPage = window[className + "BeforeMoveToPage"];
172        }
173        if (window[className + "AfterMoveToPage"] != null) {
174            this.AfterMoveToPage = window[className + "AfterMoveToPage"];
175        }
176    }
177
178    if (this.pagingElement.getAttribute("paging_unit") != null) {
179        pagingUnit = this.pagingElement.getAttribute("paging_unit") + "";
180        this.PagingUnit = pagingUnit;
181    }
182
183    if (this.pagingElement.getAttribute("slide_show") != null) {
184        if (this.pagingElement.getAttribute("slide_show").toLowerCase() == "true") {
185            this.SlideShow = true;
186        }
187    }
188
189    if (this.pagingElement.getAttribute("hover_stop") != null) {
190        if (this.pagingElement.getAttribute("hover_stop").toLowerCase() == "true") {
191            this.HoverStop = true;
192        }
193    }
194     
195
196    if (this.pagingElement.getAttribute("duration") != null) {
197        this.Duration = parseInt(this.pagingElement.getAttribute("duration"));
198    }
199
200    if (this.pagingElement.getAttribute("move_to_first_directly") != null) {
201        if (this.pagingElement.getAttribute("move_to_first_directly").toLowerCase() == "true") {
202            this.MoveToFirstDirectly = true;
203        }
204    }
205
206    if (this.pagingElement.getAttribute("is_marquee_content") != null) {
207        if (this.pagingElement.getAttribute("is_marquee_content").toLowerCase() == "true") {
208            this.IsMarqueeContent = true;
209        }
210    }
211
212    if (this.pagingElement.getAttribute("durations") != null) {
213        tokens = this.pagingElement.getAttribute("durations").split(",");
214        for (i = 0; i < tokens.length; i++) {
215            this.Durations.push(parseInt(tokens[i]));
216        }
217    }
218
219    if (this.pagingElement.getAttribute("record_per_page") != null) {
220        this.RecordPerPage = parseInt(this.pagingElement.getAttribute("record_per_page"));
221    }
222
223    if (this.PagingUnit == "Item") {
224        if (this.pagingElement.getAttribute("item_count") == null) {
225            this.ItemCount = this.pagingElement.children[0].children.length;
226        }
227        else {
228            this.ItemCount = new Number(this.pagingElement.getAttribute("item_count"));
229        }
230    }
231
232    //Common.js
233    AttachTouchEvent(this.pagingElement);
234    
235    if (this.pagingElement.addEventListener != null) {
236        this.pagingElement.addEventListener("touchmove", ContentPagingControl_TouchMove);
237        this.pagingElement.addEventListener("touchend", ContentPagingControl_TouchEnd);
238    }
239
240    if (contentElementId == null) {
241        this.contentElement = this.pagingElement.children[0];
242    }
243    else if (typeof (contentElementId) == "object") {
244        this.contentElement = contentElementId;
245    }
246    else {
247        this.contentElement = document.getElementById(contentElementId);
248    }
249
250    if (this.contentElement.id == null || this.contentElement.id == "") {
251        this.contentElement.setAttribute("id", "Content_" + contentSerial++);
252    }
253
254    if (this.pagingElement.clientWidth == 0 || GetContentElementWidth(this.contentElement) == 0) {
255        setTimeout(
256        "AttachContentPagingElement('" + this.Id + "','" + pagingElementId + "','" + this.contentElement.id + "')", 30);
257        return;
258    }
259
260    this.pagingElement.style.overflow = "hidden";
261
262    this.contentElement.style.position = "relative";
263    this.contentElement.style.left = "0px";
264
265    if (this.pagingElement.clientWidth > 0) {
266        this.pagingElementWidth = this.pagingElement.clientWidth;
267    }
268    else {
269        this.pagingElementWidth = parseInt(this.pagingElement.style.width.replace("px", ""));
270    }
271
272    if (GetContentElementWidth(this.contentElement) > 0) {
273        this.contentElementWidth = GetContentElementWidth(this.contentElement);
274    }
275    else {
276        this.contentElementWidth = parseInt(this.contentElement.style.width.replace("px", ""));
277    }
278
279    this.pagingElementHeight = this.pagingElement.clientHeight;
280
281    //if (this.ItemCount > 0) {
282    //    this.pageCount = this.ItemCount;
283    //}
284
285    if (this.pageCount == 0) {
286        if (this.pagingElementWidth > 0) {
287            this.CalcPageCount();
288        }
289        else {
290            this.pageCount = 0;
291        }
292    }
293
294
295    if (this.ShowAnchor) {
296        prevAnchorElementHtml =
297        "<img src='" + rootPath + "/Image/prev.png' style='visibility:hidden1;position:absolute;top:-1000px;' " +
298        "  id='" + this.Id + "_PrevAnchor' " +
299        "  onclick=MoveToPreviousContentPage('" + this.Id + "') " +
300        " >";
301
302        nextAnchorElementHtml =
303        "<img src='" + rootPath + "/Image/next.png' style='visibility:hidden1;position:absolute;top:-1000px;' " +
304        "  id='" + this.Id + "_NextAnchor' " +
305        "  onclick=MoveToNextContentPage('" + this.Id + "') " +
306       " >";
307
308
309        this.pagingElement.insertAdjacentHTML("BeforeEnd", prevAnchorElementHtml);
310        this.pagingElement.insertAdjacentHTML("BeforeEnd", nextAnchorElementHtml);
311    }
312
313    this.previousAnchorElement = document.getElementById(this.previousAnchorElementId);
314    this.nextAnchorElement = document.getElementById(this.nextAnchorElementId);
315
316    if (this.ShowPaging) {
317    
318        if (document.getElementById(this.Id + "_Pagger") == null) {
319            pagerElementHtml = "<table cellspacing='0' celllpadding='0' style='left:0px;position:absolute;visibility:hidden;z-index:2000' id='" + this.Id + "_Pagger'><tr>";
320            for (i = 0; i < this.pageCount; i++) {
321                pagerElementHtml += "<td><div id='" + this.Id + "_PageIndex_" + i + "' href='javascript:void(0)' onclick=\"MoveToContentPage('" + this.Id + "'," + i + ")\" ";
322
323                if (i == 0) {
324                    pagerElementHtml += " class='FocusContentPageIndex'  ";
325                }
326                else {
327                    pagerElementHtml += " class='ContentPageIndex'  ";
328                }
329
330                pagerElementHtml +=
331         "  onmouseover=\"OverContentPageIndex('" + this.Id + "'," + i + ")\" onmouseout=\"OutContentPageIndex('" + this.Id + "'," + i + ")\" >" + (i + 1) + "</div></td>";
332            }
333            pagerElementHtml += "</tr></table>";
334
335
336            document.body.insertAdjacentHTML("BeforeEnd", pagerElementHtml);
337        }
338    }
339
340    //this.pagingElement.style.height = "1000px"
341    //this.pagingElement.style.width = "1000px"
342
343    controlId = this.Id;
344
345    if (typeof (window.addEventListener) != "undefined") {
346
347        this.pagingElement.addEventListener("mouseover", function () { OverContentPaging(controlId); });
348        this.pagingElement.addEventListener("mouseout", function () { OutContentPaging(controlId); });
349    }
350    else {
351        this.pagingElement.attachEvent("onmouseover", function () { OverContentPaging(controlId); });
352        this.pagingElement.attachEvent("onmouseout", function () { OutContentPaging(controlId); });
353    }
354
355
356    if (this.SlideShow == true && this.pageCount > 1) {
357        if (this.Durations.length > 0) {
358            duration = this.Durations[0];
359        }
360        else {
361            duration = this.Duration;
362        }
363       
364        setTimeout("SlideShowPageContent('" + controlId + "')", duration);
365    }
366
367
368    if (this.Initialize != null) {
369        this.Initialize(this.pagingElement);
370    }
371}
372
373
374function ContentPagingControl_SetPaggerElementPosition(x, y) {
375
376    this.paggerElement = document.getElementById(this.Id + "_Pagger");
377    this.paggerElementTop = y;
378
379    this.paggerElement.style.left = x + "px";
380    this.paggerElement.style.top = y + "px";
381}
382
383
384function ContentPagingControl_TouchMove(e) {
385    var pagingControl;
386    var pagingElement;
387    var touchStartX;
388    var touchMoveX;
389    var tableElement;
390    var touchStartLeft;
391    var touchStartPagingElementX;
392
393 
394    pagingElement = e.currentTarget;
395 
396    pagingControl = GetPageControlByElementId(pagingElement.id);
397    
398
399    pagingControl.isTouchMoving = true;
400
401    touchStartLeft = pagingElement.getAttribute("TouchStartLeft");
402
403    if (touchStartLeft == null) {
404
405        touchStartLeft = pagingElement.children[0].style.left;
406
407        pagingElement.setAttribute("TouchStartLeft", touchStartLeft);
408    }
409     
410    touchStartPagingElementX = parseInt(touchStartLeft.replace("px", ""));
411
412    pagingElement.setAttribute("isTouchMoving", true);
413
414
415    touchStartX = parseInt(pagingElement.getAttribute("TouchStartX"));
416    touchMoveX = parseInt(pagingElement.getAttribute("TouchMoveX"));
417
418    tableElement = pagingElement.children[0];
419
420    tableElement.style.transitionProperty = "";
421    tableElement.style.webkitTransitionProperty = "";
422    tableElement.style.mozTransitionProperty = "";
423    tableElement.style.msTransitionProperty = "";
424    tableElement.style.oTransitionProperty = "";
425
426    tableElement.style.transitionDuration = "0s";
427    tableElement.style.webkitTransitionDuration = "0s";
428    tableElement.style.mozTransitionDuration = "0s";
429    tableElement.style.msTransitionDuration = "0s";
430    tableElement.style.oTransitionDuration = "0s";
431
432
433    tableElement.style.left = (touchStartPagingElementX + (touchMoveX - touchStartX)) + "px";
434
435} 
436
437
438function ContentPagingControl_TouchEnd(e) {
439    var pagingElement;
440    var pagingControl;
441    var touchStartX;
442    var touchMoveX;
443    var touchEndX;
444    var tableElement;
445    var pagingControl;
446    var diffX;
447
448    pagingElement = e.currentTarget;
449    pagingElement.removeAttribute("TouchStartLeft");
450
451    pagingControl = GetPageControlByElementId(pagingElement.id);
452    pagingControl.isTouchMoving = false;
453
454    touchStartX = parseInt(pagingElement.getAttribute("TouchStartX"));
455    touchEndX = e.changedTouches[0].screenX;
456
457    touchMoveX = parseInt(pagingElement.getAttribute("TouchMoveX"));
458
459    if (pagingElement.getAttribute("TouchStartX") == null || pagingElement.getAttribute("TouchStartX") == "") {
460        return;
461    }
462
463    if (pagingElement.getAttribute("TouchMoveX") == null || pagingElement.getAttribute("TouchMoveX") == "")    {
464        return;
465    }
466
467    diffX = Math.abs(touchMoveX - touchStartX);
468    
469    if (Math.abs(touchStartX - touchEndX) <= 10) {
470        return;
471    }
472
473    pagingControl = GetPageControlByElementId(pagingElement.id);
474
475 
476    if (diffX > pagingElement.clientWidth / 3 || diffX > 200) {
477 
478        if (touchMoveX < touchStartX) //往左滑動
479        {
480
481            if (pagingControl.currPageIndex < pagingControl.pageCount - 1) {
482                MoveToContentPage(pagingControl.Id, pagingControl.currPageIndex + 1);
483            }
484            else {
485                MoveToContentPage(pagingControl.Id, pagingControl.currPageIndex);
486            }
487        }
488        else //往右
489        {
490            if (pagingControl.currPageIndex > 0) {
491                MoveToContentPage(pagingControl.Id, pagingControl.currPageIndex - 1);
492            }
493            else {
494                MoveToContentPage(pagingControl.Id, pagingControl.currPageIndex);
495            }
496        }
497    }
498    else { 
499        MoveToContentPage(pagingControl.Id, pagingControl.currPageIndex);
500    }
501}
502
503
504function OverContentPageIndex(id, index) {
505    var contentPagingControl;
506    var pageIndexElement;
507
508    contentPagingControl = GetPageControlById(id);
509    if (contentPagingControl == null) {
510        return;
511    }
512
513
514    pageIndexElement = document.getElementById(id + "_PageIndex_" + index);
515    pageIndexElement.className = "OverContentPageIndex";
516}
517
518
519function OutContentPageIndex(id, index) {
520    var contentPagingControl;
521    var pageIndexElement;
522
523    contentPagingControl = GetPageControlById(id);
524    if (contentPagingControl == null) {
525        return;
526    }
527
528    pageIndexElement = document.getElementById(id + "_PageIndex_" + index);
529    if (contentPagingControl.currPageIndex == index) {
530        pageIndexElement.className = "FocusContentPageIndex";
531    }
532    else {
533        pageIndexElement.className = "ContentPageIndex";
534    }
535}
536
537function OverContentPaging(id) {
538    var contentPagingControl;
539
540    contentPagingControl = GetPageControlById(id);
541    if (contentPagingControl == null) {
542        return;
543    }
544
545    contentPagingControl.IsMouseHover = true;
546
547    contentPagingControl.ResetAnchorVisibility();
548}
549
550function OutContentPaging(id) {
551    var contentPagingControl;
552
553    contentPagingControl = GetPageControlById(id);
554
555    contentPagingControl.IsMouseHover = false;
556
557    contentPagingControl.ResetAnchorVisibility();
558}
559
560
561function MoveToPreviousContentPage(id) {
562    var contentPagingControl;
563
564    contentPagingControl = GetPageControlById(id);
565
566    if (contentPagingControl.currPageIndex > 0) {
567        contentPagingControl.MoveToPage(contentPagingControl.currPageIndex - 1)
568    }
569}
570
571
572
573function MoveToNextContentPage(id) {
574    var contentPagingControl;
575    
576    contentPagingControl = GetPageControlById(id);
577
578    if (contentPagingControl.currPageIndex < contentPagingControl.pageCount - 1) {
579        contentPagingControl.MoveToPage(contentPagingControl.currPageIndex + 1)
580    }
581}
582
583function MoveToContentPage(id, index) {
584    var contentPagingControl;
585
586    contentPagingControl = GetPageControlById(id);
587
588    contentPagingControl.MoveToPage(index)
589}
590
591
592function OnClickContentPageIndex(contentPageIndexElement, id, index) {
593    var parentElement;
594    var focusElements;
595
596    parentElement = contentPageIndexElement.parentElement;
597
598    focusElements = parentElement.getElementsByClassName("FocusContentPageIndex");
599
600    if (focusElements.length > 0) {
601        if (focusElements[0] != contentPageIndexElement) {
602            focusElements[0].classList.remove("FocusContentPageIndex");
603        }
604    }
605
606    if (!contentPageIndexElement.classList.contains("FocusContentPageIndex")) {
607        contentPageIndexElement.classList.add("FocusContentPageIndex");
608    }
609
610    MoveToContentPage(id, index);
611}
612
613
614
615function SetContentPagingControlPosition(contentPagingControlId) {
616    var contentPagingControl;
617
618
619    if (document.readyState != "complete" && document.readyState != "interactive") {
620        setTimeout("SetContentPagingControlPosition('" + contentPagingControlId + "')", 200);
621        return;
622    }
623
624
625    contentPagingControl = GetPageControlById(contentPagingControlId);
626    contentPagingControl.paggerElement = document.getElementById(contentPagingControl.Id + "_Pagger");
627    if (contentPagingControl.paggerElement == null && contentPagingControl.ShowPaging == true) {
628        setTimeout("SetContentPagingControlPosition('" + contentPagingControlId + "')", 200);
629        return;
630    }
631
632
633    contentPagingControl.previousAnchorElement =
634    document.getElementById(contentPagingControl.previousAnchorElementId);
635
636    contentPagingControl.nextAnchorElement =
637    document.getElementById(contentPagingControl.nextAnchorElementId);
638
639    contentPagingControl.paggerElement =
640    document.getElementById(contentPagingControl.paggerElementId);
641
642    /*
643    if (contentPagingControl.previousAnchorElement != null) {
644     
645    contentPagingControl.previousAnchorElement.style.left =
646    GetClientLeft(contentPagingControl.pagingElement) + "px";
647
648    contentPagingControl.previousAnchorElement.style.top =
649    (
650    GetClientTop(contentPagingControl.pagingElement) +
651    contentPagingControl.pagingElementHeight / 2
652    - contentPagingControl.previousAnchorElement.clientHeight / 2
653    ) + "px";
654    }
655
656    if (contentPagingControl.nextAnchorElement != null) 
657    {
658    contentPagingControl.nextAnchorElement.style.left =
659    (
660    GetClientLeft(contentPagingControl.pagingElement) +
661    (contentPagingControl.pagingElement.clientWidth - contentPagingControl.nextAnchorElement.clientWidth)
662    ) + "px";
663
664    contentPagingControl.nextAnchorElement.style.top =
665    (
666    GetClientTop(contentPagingControl.pagingElement) +
667    contentPagingControl.pagingElementHeight / 2
668    - contentPagingControl.nextAnchorElement.clientHeight / 2
669    ) + "px";
670    }
671
672    */
673
674    if (contentPagingControl.paggerElement != null) {
675        contentPagingControl.paggerElement.style.left =
676        (10 + GetClientLeft(contentPagingControl.pagingElement)) + "px";
677
678        if (contentPagingControl.paggerElementTop < 0) {
679            contentPagingControl.paggerElement.style.top =
680        (
681            GetClientTop(contentPagingControl.pagingElement) +
682            contentPagingControl.pagingElement.clientHeight
683            - contentPagingControl.paggerElement.offsetHeight + 2
684        ) + "px";
685
686        }
687        else {
688            contentPagingControl.paggerElement.style.top =
689            contentPagingControl.paggerElementTop + "px";
690        }
691
692
693        contentPagingControl.paggerElement.style.visibility = "visible";
694        contentPagingControl.paggerElement.style.display = "";
695    }
696
697    contentPagingControl.ResetAnchorVisibility();
698
699    if (!hasSetContentPagingResizeEventHandler && typeof (resizeEventHandlers) != "undefined") {
700        resizeEventHandlers.push(OnContentPagingControlResize);
701        hasSetContentPagingResizeEventHandler = true;
702    }
703}
704
705function ContentPagingControl_OnResize() {
706    var targetX = 0;
707    var pageIndexElement;
708
709
710    if (this.pagingElement != null) {
711        this.pagingElementWidth = this.pagingElement.clientWidth;
712
713        this.contentElementWidth = GetContentElementWidth(this.contentElement);
714        this.pagingElementHeight = this.pagingElement.clientHeight
715
716        this.lastResizeTime = new Date();
717
718        this.CalcPageCount();
719 
720        if (this.currPageIndex >= this.pageCount) {
721            this.currPageIndex = this.pageCount - 1;
722        }
723
724
725        if (this.PagingUnit == "Item") {
726            targetX = -(this.currPageIndex * this.contentElementWidth / this.Item
726Count);
727        }
728        else {
729            targetX = -(this.currPageIndex * this.pagingElementWidth);
730        }
731
732
733        this.contentElement.style.left = targetX + "px";
734
735        this.ResetAnchorVisibility();
736    }
737}
738
739
740function ContentPagingControl_MoveToPage(pageIndex, moveDirectly) {
741    var targetX = 0;
742    var pageIndexElement;
743    var pagingUnitWidth = 0;
744    var moveUnit;
745    var isIE;
746    var lastPageIndex = -1;
747
748    if (this.contentElement.getAttribute("is_moving") == "true") {
749        return;
750    }
751
752    lastPageIndex = this.currPageIndex;
753
754    this.pagingElementWidth = this.pagingElement.clientWidth;
755    this.contentElementWidth = GetContentElementWidth(this.contentElement);
756    this.pagingElementHeight = this.pagingElement.clientHeight
757
758    isIE = IsIE();
759
760    if (this.PagingUnit == "Item") {
761        if (pageIndex > this.contentElement.children.length - 1) {
762            return;
763        }
764        targetX = -this.contentElement.children[pageIndex].offsetLeft;
765    }
766    else {
767        targetX = -(pageIndex * this.pagingElementWidth);
768    }
769
770
771    if (this.BeforeMoveToPage != null) {
772        this.BeforeMoveToPage(pageIndex, this.pagingElement, this);
773    }
774
775    if (moveUnit != null) {
776        baseMoveUnit = moveUnit;
777    }
778
779    dateTimeText = ConverDateTimeToText(new Date());
780
781    this.contentElement.setAttribute("last_move_time", dateTimeText);
782    this.contentElement.setAttribute("PagingControlId", this.Id);
783
784    if (this.contentElement.style.left == "") {
785        startX = 0;
786    }
787    else {
788        startX = this.contentElement.style.left.replace("px", "");
789    }
790
791    offset = Math.abs(startX - targetX);
792
793
794    if (this.PagingUnit == "Page") {
795        pagingUnitWidth = this.pagingElementWidth;
796    }
797    else {
798        pagingUnitWidth = this.contentElementWidth / this.ItemCount;
799    }
800
801    
802    if (Math.abs(offset) > 5000) {
803        baseMoveUnit = Math.round(Math.abs(offset) / 10);
804        decreaseRate = 5;
805    } else if (pagingUnitWidth > 600) {
806        baseMoveUnit = 30;
807        decreaseRate = 5;
808    }
809    else if (pagingUnitWidth > 300) {
810        baseMoveUnit = 20;
811        decreaseRate = 5;
812    }
813    else {
814        baseMoveUnit = 10;
815        decreaseRate = 5;
816    }
817
818    //moveUnit = baseMoveUnit * offset / this.pagingElement.clientWidth;
819    moveUnit = baseMoveUnit;
820
821    this.contentElement.setAttribute("move_unit", moveUnit);
822
823    if (this.contentElement.id == null || this.contentElement.id == "") {
824        this.contentElement.setAttribute("id", "Content_" + contentPagingControlSerial++)
825    }
826
827
828    if (moveDirectly == true) {
829        this.contentElement.style.left = targetX + "px";
830
831        this.contentElement.style.transitionDuration = "0s";
832        this.contentElement.style.webkitTransitionDuration = "0s";
833        this.contentElement.style.mozTransitionDuration = "0s";
834        this.contentElement.style.msTransitionDuration = "0s";
835        this.contentElement.style.oTransitionDuration = "0s";
836    }
837    else {
838        this.contentElement.style.transitionProperty = "left";
839        this.contentElement.style.webkitTransitionProperty = "left";
840        this.contentElement.style.mozTransitionProperty = "left";
841        this.contentElement.style.msTransitionProperty = "left";
842        this.contentElement.style.oTransitionProperty = "left";
843
844        if (Math.abs(offset) > 1000) {
845            /*
846            this.contentElement.style.transitionDuration = "0.5s";
847            this.contentElement.style.webkitTransitionDuration = "0.5s";
848            this.contentElement.style.mozTransitionDuration = "0.5s";
849            this.contentElement.style.msTransitionDuration = "0.5s";
850            this.contentElement.style.oTransitionDuration = "0.5s";
851            */
852            if( typeof(marqueeItemMoveTransitionDuration) == "undefined" )
853            {
854                marqueeItemMoveTransitionDuration = "0.5s";
855            }
856            this.contentElement.style.transitionDuration = marqueeItemMoveTransitionDuration;
857            this.contentElement.style.webkitTransitionDuration = marqueeItemMoveTransitionDuration;
858            this.contentElement.style.mozTransitionDuration = marqueeItemMoveTransitionDuration;
859            this.contentElement.style.msTransitionDuration = marqueeItemMoveTransitionDuration;
860            this.contentElement.style.oTransitionDuration = marqueeItemMoveTransitionDuration;
861        }
862        else {
863            /*
864            this.contentElement.style.transitionDuration = "0.3s";
865            this.contentElement.style.webkitTransitionDuration = "0.3s";
866            this.contentElement.style.mozTransitionDuration = "0.3s";
867            this.contentElement.style.msTransitionDuration = "0.3s";
868            this.contentElement.style.oTransitionDuration = "0.3s";
869            */
870            if( typeof(marqueeItemMoveTransitionDuration) == "undefined" )
871            {
872                marqueeItemMoveTransitionDuration = "0.3s";
873            }
874            this.contentElement.style.transitionDuration = marqueeItemMoveTransitionDuration;
875            this.contentElement.style.webkitTransitionDuration = marqueeItemMoveTransitionDuration;
876            this.contentElement.style.mozTransitionDuration = marqueeItemMoveTransitionDuration;
877            this.contentElement.style.msTransitionDuration = marqueeItemMoveTransitionDuration;
878            this.contentElement.style.oTransitionDuration = marqueeItemMoveTransitionDuration;
879        }
880
881        //以目前的 CSS Style 移動作法 , 必須先把 currPageIndex 設定好
882        this.currPageIndex = pageIndex;
883        MovePagingContentElement(this.contentElement.id, targetX);
884
885 
886    }
887
888
889
890    pageIndexElement = document.getElementById(this.Id + "_PageIndex_" + this.currPageIndex);
891
892    this.currPageIndex = pageIndex
893
894    if (pageIndexElement == null && this.ShowPaging == true) {
895        SetContentPagingControlPosition(this.Id);
896        return;
897    }
898
899    pageIndexElement = document.getElementById(this.Id + "_PageIndex_" + lastPageIndex);
900    if (pageIndexElement != null) {
901        pageIndexElement.className = "ContentPageIndex";
902    }
903
904    pageIndexElement = document.getElementById(this.Id + "_PageIndex_" + this.currPageIndex);
905    if (pageIndexElement != null) {
906        pageIndexElement.className = "ContentPageIndex FocusContentPageIndex";
907    }
908
909    this.LastMoveTime = new Date();
910
911    this.ResetAnchorVisibility();
912
913    if (this.AfterMoveToPage != null) {
914        this.AfterMoveToPage(pageIndex, this.pagingElementHeight, this);
915    }
916}
917
918
919function ContentPagingControl_Hide() {
920    if (this.paggerElement != null) {
921        this.paggerElement.style.display = "none";
922    }
923    this.Visible = false;
924}
925
926function ContentPagingControl_CalcPageCount() {
927    var result;
928    var recordPerPage;
929    var itemElementWidth;
930
931    if (this.PagingUnit == "Page") {
932        result = this.contentElementWidth / this.pagingElementWidth;
933
934        if (result % 1 < 0.01) {
935            this.pageCount = Math.round(result);
936        }
937        else {
938            this.pageCount = Math.ceil(result);
939        }
940    }
941    else {
942        this.pageCount = this.contentElement.children.length;
943
944        if (this.contentElement.children.length > 0 && this.RecordPerPage < 0) {
945            itemElementWidth = this.contentElement.children[0].clientWidth;
946
947
948            if (itemElementWidth > 0) {
949                result = this.pagingElementWidth / itemElementWidth;
950            }
951
952            if (result % 1 < 0.01) {
953                recordPerPage = Math.round(result);
954            }
955            else {
956                recordPerPage = Math.ceil(result);
957            }
958
959            if ((this.pageCount - recordPerPage + 1) > 0) {
960                this.pageCount = this.pageCount - recordPerPage + 1;
961            }
962
963
964        }
965    }
966
967    return this.pageCount;
968}
969
970function ContentPagingControl_ResetAnchorVisibility() {
971    var mouse;
972    var contentX;
973    var index;
974    var contentPa
975    var className;
976
977    if (!this.Visible) {
978        return;
979    }
980
981    this.pagingElementWidth = this.pagingElement.clientWidth;
982
983    this.contentElementWidth = GetContentElementWidth(this.contentElement);
984    this.pagingElementHeight = this.pagingElement.clientHeight;
985
986
987    this.CalcPageCount();
988
989    if (typeof (event) == "undefined" || event == null) {
990        mouse = new MouseInfo();
991        mouse.X = -1;
992    }
993    else {
994        mouse = this.GetMousePosition();
995    }
996
997
998    contentX = mouse.X - GetClientLeft(this.pagingElement);
999
1000    if (this.previousAnchorElement == null) {
1001        return;
1002    }
1003
1004
1005    if (
1006        this.pagingElement.style.display != "none"
1007    ) {
1008        this.previousAnchorElement.style.visibility = "visible";
1009        this.previousAnchorElement.style.display = "";
1010
1011        this.nextAnchorElement.style.visibility = "visible";
1012        this.nextAnchorElement.style.display = "";
1013
1014
1015        if (this.paggerElement != null) {
1016            this.paggerElement.style.visibility = "visible";
1017        }
1018
1019        /*
1020        if (contentX < this.pagingElementWidth / 2) {
1021
1022        SetPagingAnchorElementClassName(this.previousAnchorElement, "ActiveAnchor");
1023
1024        SetPagingAnchorElementClassName(this.nextAnchorElement, "InActiveAnchor");
1025        }
1026        else {
1027        SetPagingAnchorElementClassName(this.previousAnchorElement, "InActiveAnchor");
1028
1029        SetPagingAnchorElementClassName(this.nextAnchorElement, "ActiveAnchor");
1030        }
1031        */
1032
1033
1034        if (this.currPageIndex == 0) {
1035            SetPagingAnchorElementClassName(this.previousAnchorElement, "InActiveAnchor");
1036        }
1037        else {
1038            SetPagingAnchorElementClassName(this.previousAnchorElement, "ActiveAnchor");
1039        }
1040
1041        if (this.currPageIndex >= this.pageCount - 1) {
1042            SetPagingAnchorElementClassName(this.nextAnchorElement, "InActiveAnchor");
1043        }
1044        else {
1045            SetPagingAnchorElementClassName(this.nextAnchorElement, "ActiveAnchor");
1046        }
1047
1048    }
1049    else {
1050        //this.previousAnchorElement.style.display = "none";
1051        //this.nextAnchorElement.style.display = "none";
1052    }
1053}
1054
1055
1056function SetPagingAnchorElementClassName(anchorElement, newClassName) {
1057    var activeAnchorRegex = /\s*ActiveAnchor/;
1058    var inActiveAnchorRegex = /\s*InActiveAnchor/;
1059    var className;
1060
1061
1062    className = anchorElement.className + "";
1063
1064    if (newClassName == "ActiveAnchor") {
1065        className = anchorElement.className;
1066        className = className.replace(inActiveAnchorRegex, "");
1067        if (className.indexOf("ActiveAnchor") < 0) {
1068            className += " " + newClassName;
1069            anchorElement.className = className;
1070        }
1071    }
1072    else {
1073        className = anchorElement.className;
1074        if (className.indexOf("InActiveAnchor") < 0) {
1075            className = className.replace(activeAnchorRegex, "");
1076            className += " " + newClassName;
1077            anchorElement.className = className;
1078        }
1079    }
1080}
1081
1082function GetContentElementWidth(contentElement) {
1083    var contentElementWidth = 0;
1084    var i;
1085
1086    if (contentElement.tagName == "TABLE") {
1087        contentElementWidth = contentElement.clientWidth;
1088    }
1089    else {
1090        for (i = 0; i < contentElement.children.length; i++) {
1091            contentElementWidth += contentElement.children[i].clientWidth;
1092        }
1093    }
1094
1095    return contentElementWidth;
1096}
1097
1098
1099//判斷是否在 PagingElement 區域內
1100function ContentPagingControl_InsidePagingElement(x, y) {
1101    var inside = false;
1102    var insideX = false, insideY = false;
1103    var pagingElementX;
1104    var pagingElementY;
1105
1106
1107    pagingElementX = GetClientLeft(this.pagingElement);
1108    pagingElementY = GetClientTop(this.pagingElement);
1109
1110    if (
1111            (pagingElementX <= x)
1112            &&
1113            (
1114                x <= (pagingElementX + this.pagingElementWidth)
1115            )
1116        ) {
1117        insideX = true;
1118    }
1119
1120    if (
1121            (pagingElementY <= y)
1122            &&
1123            (
1124                y <= (pagingElementY + this.pagingElementHeight)
1125            )
1126        ) {
1127
1128        insideY = true;
1129    }
1130
1131    if (insideX && insideY) {
1132        inside = true;
1133    }
1134
1135    return inside;
1136} //end function ContentPagingControl_InsidePagingElement(contentPanelLayout,x, y)
1137
1138
1139function ContentPagingControl_GetMousePosition() {
1140    var isIe = false;
1141    var mouse = new MouseInfo();
1142    var mouseX, mouseY;
1143
1144
1145    isIe = IsIE();
1146
1147    if (!isIe) {
1148        document.captureEvents(Event.MOUSEMOVE);
1149        document.captureEvents(Event.MOUSEDOWN);
1150        mouseX = event.pageX;
1151        mouseY = event.pageY
1152    }
1153    else {
1154        mouseX = event.clientX + document.body.scrollLeft;
1155        mouseY = event.clientY +
1156                 ((document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop);
1157    }
1158
1159    mouse.X = mouseX;
1160    mouse.Y = mouseY;
1161
1162    return mouse;
1163}
1164
1165
1166
1167function MovePagingContentElement(contentElementId, targetX) {
1168    var contentElement;
1169    var pagingElement;
1170    var moveUnit;
1171    var dateTimeText;
1172    var x;
1173    var i;
1174
1175
1176    contentElement = document.getElementById(contentElementId);
1177
1178    targetX = Math.round(targetX);
1179
1180    if (contentElement.style.left == "") {
1181        x = 0;
1182    }
1183    else {
1184        x = parseInt(contentElement.style.left.replace("px", ""));
1185    }
1186
1187
1188    if (x != targetX) {
1189        contentElement.style.left = targetX + "px";
1190
1191        pagingControlId = contentElement.getAttribute("PagingControlId");
1192        pagingControl = GetPageControlById(pagingControlId);
1193
1194      
1195        if (pagingControl.MoveToPageEvent != null) {
1196            pagingControl.MoveToPageEvent(pagingControl.currPageIndex);
1197        }
1198        /*
1199        contentElement.setAttribute("is_moving", "true");
1200
1201        if (Math.abs(x - targetX) < 50) {
1202            moveUnit = Math.round(Math.abs(x - targetX) / decreaseRate);
1203            if (moveUnit <= 2) {
1204                moveUnit = 2;
1205            }
1206        }
1207        else {
1208            moveUnit = parseInt(contentElement.getAttribute("move_unit") + "");
1209        }
1210
1211        if (x < targetX) {
1212            if (x + moveUnit < targetX) {
1213                x += moveUnit;
1214            }
1215            else {
1216                x = targetX;
1217            }
1218        }
1219        else {
1220            if (x - moveUnit > targetX) {
1221                x -= moveUnit;
1222            }
1223            else {
1224                x = targetX;
1225            }
1226        }
1227
1228        if (x == targetX) {
1229            dateTimeText = ConverDateTimeToText(new Date());
1230            contentElement.setAttribute("last_move_time", dateTimeText);
1231        }
1232
1233         contentElement.style.left = x + "px";
1234         setTimeout("MovePagingContentElement('" + contentElementId + "', " + targetX + ")", 10);
1235         */
1236    }
1237    else {
1238        contentElement.setAttribute("is_moving", "false");
1239        pagingControlId = contentElement.getAttribute("PagingControlId");
1240        if (pagingControlId == null) {
1241            return;
1242        }
1243        pagingControl = GetPageControlById(pagingControlId);
1244
1245        if (pagingControl.MoveToPageEvent != null) {
1246            pagingControl.MoveToPageEvent(pagingControl.currPageIndex);
1247        }
1248    }
1249
1250
1251  
1252}
1253
1254
1255function SlideShowPageContent(contentPagingControlId) {
1256    var currTime = new Date();
1257    var contentPagingControl;
1258    var duration = 1100;
1259    var currDate = new Date();
1260    var lastPageIndex = 0;
1261
1262
1263    contentPagingControl = GetPageControlById(contentPagingControlId);
1264
1265    if (!contentPagingControl.isTouchMoving
1266        &&
1267        ((currDate - contentPagingControl.lastResizeTime) > 1000)
1268        &&
1269        (
1270            (contentPagingControl.HoverStop == false) ||
1271            (contentPagingControl.IsMouseHover == false)
1272        )
1273     ) 
1274     {
1275
1276        if (contentPagingControl.Durations.length > 0) {
1277            duration = contentPagingControl.Durations[(contentPagingControl.currPageIndex + 1) % contentPagingControl.pageCount];
1278        }
1279        else {
1280            duration = contentPagingControl.Duration;
1281        }
1282
1283        if ( (currTime - contentPagingControl.LastMoveTime) >= 1000 ) 
1284        {
1285            lastPageIndex = contentPagingControl.currPageIndex;
1286
1287            if (contentPagingControl.currPageIndex < contentPagingControl.pageCount - 1) {
1288                contentPagingControl.MoveToPage(contentPagingControl.currPageIndex + 1);
1289            }
1290            else {
1291                if (contentPagingControl.MoveToFirstDirectly) {
1292                    contentPagingControl.MoveToPage(0, true);
1293                }
1294                else {
1295                    contentPagingControl.MoveToPage(0, false);
1296                }
1297            }
1298        }
1299        else {
1300            //too Fast , do nothing , Wait one more second
1301            duration = 1000;
1302        }
1303    }
1304 
1305    if (contentPagingControl.IsMarqueeContent && contentPagingControl.currPageIndex == 0) {
1306 
1307        setTimeout("SlideShowPageContent('" + contentPagingControlId + "')", 0);
1308    }
1309    else {
1310        setTimeout("SlideShowPageContent('" + contentPagingControlId + "')", duration);
1311    }
1312    
1313}
1314
1315
1316function OverGeneralBlockItem(itemElement) {
1317    var elements;
1318    var newClassName;
1319    var i;
1320 
1321
1322    elements = itemElement.getElementsByClassName("ItemFloatingContent");
1323
1324    for (i = 0; i < elements.length; i++) {
1325        if (elements[i].classList.contains("InActiveItemFloatingContent")) {
1326            elements[i].classList.remove("InActiveItemFloatingContent");
1327        }
1328
1329        if (!elements[i].classList.contains("ActiveItemFloatingContent")) {
1330            elements[i].classList.add("ActiveItemFloatingContent");
1331        }
1332
1333        /*
1334        newClassName = elements[i].className;
1335        newClassName = newClassName.replace(" InActiveItemFloatingContent", "");
1336        newClassName += " ActiveItemFloatingContent";
1337
1338        elements[i].className = newClassName;
1339        */
1340    }
1341}
1342
1343
1344function OutGeneralBlockItem(itemElement) {
1345
1346    var itemElementId;
1347
1348    itemElementId = itemElement.id;
1349
1350
1351    if (itemElementId == "") {
1352        RealOutGeneralBlockItem(itemElement);
1353    }
1354    else {
1355        setTimeout("TryOutGeneralBlockItem('" + itemElementId + "')", 1);
1356    }
1357    
1358}
1359
1360
1361function TryOutGeneralBlockItem(itemElementId) {
1362    var elements;
1363    var newClassName;
1364    var i;
1365
1366    itemElement = document.getElementById(itemElementId);
1367
1368
1369    if (
1370        (lastOverItemFloatingContenGeneralBlockItemId != itemElementId) 
1371        ||
1372        (
1373           (new Date() - lastOverItemFloatingContentTime) > 10
1374        )
1375    ) {
1376        RealOutGeneralBlockItem(itemElement);
1377    }
1378
1379}
1380
1381function RealOutGeneralBlockItem(itemElement) {
1382    var elements;
1383    var newClassName;
1384    var generalBlockItemFloatingContentId;
1385    var generalBlockItemFloatingContentElement;
1386    var i;
1387
1388
1389    generalBlockItemFloatingContentId = itemElement.getAttribute("FloatingContentId");
1390 
1391    generalBlockItemFloatingContentElement = document.getElementById(generalBlockItemFloatingContentId);
1392
1393    
1394    if (generalBlockItemFloatingContentElement != null) {
1395         
1396        if (
1397            generalBlockItemFloatingContentElement.className.indexOf("InActiveItemFloatingContent") >= 0
1398        ) 
1399        {
1400            return;
1401        }
1402
1403
1404        if (generalBlockItemFloatingContentElement.classList.contains("ActiveItemFloatingContent")) {
1405            generalBlockItemFloatingContentElement.classList.remove("ActiveItemFloatingContent")
1406        }
1407
1408        if (!generalBlockItemFloatingContentElement.classList.contains("InActiveItemFloatingContent")) {
1409            generalBlockItemFloatingContentElement.classList.add("InActiveItemFloatingContent")
1410        }
1411
1412        /*
1413        newClassName = generalBlockItemFloatingContentElement.className;
1414        newClassName = newClassName.replace(" ActiveItemFloatingContent", "");
1415        newClassName += " InActiveItemFloatingContent";
1416
1417        generalBlockItemFloatingContentElement.className = newClassName;
1418        */
1419    }
1420
1421    elements = itemElement.getElementsByClassName("ItemFloatingContent");
1422
1423    for (i = 0; i < elements.length; i++) {
1424
1425        if (elements[i].classList.contains("ActiveItemFloatingContent")) {
1426            elements[i].classList.remove("ActiveItemFloatingContent")
1427        }
1428
1429        if (!elements[i].classList.contains("InActiveItemFloatingContent")) {
1430            elements[i].classList.add("InActiveItemFloatingContent")
1431        }
1432
1433        /*
1434        newClassName = elements[i].className;
1435        newClassName = newClassName.replace(" ActiveItemFloatingContent", "");
1436        newClassName += " InActiveItemFloatingContent";
1437
1438        elements[i].className = newClassName;
1439        */
1440    }
1441}
1442
1443
1444function OverItemFloatingContent(itemFloatingContentElmenet) {
1445    var generalBlockItemId;
1446
1447    generalBlockItemId = itemFloatingContentElmenet.getAttribute("GeneralBlockItemId");
1448   
1449    lastOverItemFloatingContentTime = new Date();
1450    lastOverItemFloatingContenGeneralBlockItemId = generalBlockItemId;
1451}
1452
1453
1454function OutItemFloatingContent(itemFloatingContentElmenet) {
1455    var generalBlockItemId;
1456    var generalBlockItemElement;
1457
1458    generalBlockItemId = itemFloatingContentElmenet.getAttribute("GeneralBlockItemId");
1459    
1460    generalBlockItemElement = document.getElementById(generalBlockItemId);
1461    //不穩定 , 太容易被呼叫到
1462//    if (generalBlockItemElement != null) {
1463//        RealOutGeneralBlockItem(generalBlockItemElement);
1464//    }  
1465}
1466 
1467
1468function ClickGeneralBlockItem(itemElement) {
1469    var newClassName;
1470    var generalBlockElement;
1471    var generalBlockElement;
1472    var insideItemDescription = false;
1473    var isExpandableContent = true;
1474    var element;
1475
1476
1477    newClassName = itemElement.className;
1478  
1479    generalBlockElement = itemElement;
1480
1481    if (typeof (HideAllFloatingWindows) != "undefined") {
1482        HideAllFloatingWindows();
1483        setTimeout("ShowAllFloatingWindows()", 3000);
1484    }
1485
1486    while (!generalBlockElement.classList.contains("GeneralBlock")) {
1487        if (generalBlockElement.classList.contains("ExpandableContent")) {
1488            isExpandableContent = true;
1489        }
1490        generalBlockElement = generalBlockElement.parentElement;
1491    }
1492
1493    if (typeof (event) != "undefined" && event != null && event.srcElement != null) {
1494        element = event.srcElement;
1495
1496        while (element.classList != null && !element.classList.contains("GeneralBlock")) {
1497            if (element.classList!=null && element.classList.contains("ItemDescription")) {
1498                insideItemDescription = true;
1499                break;
1500            }
1501            element = element.parentElement;
1502        }
1503    }
1504
1505    if (isExpandableContent && insideItemDescription) {
1506        return;
1507    }
1508
1509    itemNameElement = generalBlockElement.querySelector(".ItemName");
1510
1511    if (
1512        !itemElement.classList.contains("ActiveGeneralBlockItem")
1513    ) {
1514        itemElement.classList.remove("InActiveGeneralBlockItem");
1515        itemElement.classList.add("ActiveGeneralBloc
1515kItem");
1516    }
1517    else {
1518        itemElement.classList.remove("ActiveGeneralBlockItem");
1519        itemElement.classList.add("InActiveGeneralBlockItem");
1520    }
1521
1522    if (lastClickGeneralBlockItem != null && lastClickGeneralBlockItem != itemElement) {
1523        if (collapseLastExpandedGeneralBlockItem) {
1524            lastClickGeneralBlockItem.classList.remove("FocusGeneralBlockItem");
1525            itemDescriptionElement = GetGeneralBlockItemDescriptionElement(lastClickGeneralBlockItem);
1526            
1527            if( itemDescriptionElement != null )
1528            {
1529	            if (itemDescriptionElement.style.removeProperty) {
1530	                itemDescriptionElement.style.removeProperty("max-height");
1531	            }
1532	            else {
1533	                itemDescriptionElement.style.removeAttribute("maxHeight");
1534	            }
1535            }
1536        }
1537    }
1538    
1539    if( 
1540        itemElement == lastClickGeneralBlockItem 
1541        && 
1542        itemElement.classList.contains("FocusGeneralBlockItem")
1543    )
1544    {
1545
1546            itemDescriptionElement = GetGeneralBlockItemDescriptionElement(itemElement);
1547
1548            if (itemDescriptionElement != null) {
1549                if (itemDescriptionElement.style.removeProperty) {
1550                    itemDescriptionElement.style.removeProperty("max-height");
1551                }
1552                else {
1553                    itemDescriptionElement.style.removeAttribute("maxHeight");
1554                }
1555            }
1556
1557            itemElement.classList.remove("FocusGeneralBlockItem");
1558
1559            lastClickGeneralBlockItem = null;
1560 
1561    		return;
1562    }
1563	else if (!itemElement.classList.contains("FocusGeneralBlockItem")) {
1564        itemElement.classList.add("FocusGeneralBlockItem");
1565    }
1566
1567    lastClickGeneralBlockItem = itemElement;
1568
1569    if (itemNameElement != null && generalBlockElement.classList.contains("ExpandableContent")) {
1570        if (!insideItemDescription) {
1571            setTimeout("CheckGeneralBlockItemDescriptionHeight()", 400);
1572            setTimeout("CheckGeneralBlockItemNameVisibleArea()", 600);
1573
1574            setTimeout("CheckGeneralBlockItemDescriptionHeight()", 1000);
1575            setTimeout("CheckGeneralBlockItemNameVisibleArea()", 1200);
1576        }
1577    }
1578
1579
1580    if(window["TryLoadImageDataSource"] != null)
1581    {
1582        setTimeout(TryLoadImageDataSource, 4000);
1583    }
1584}
1585
1586
1587function CheckGeneralBlockItemNameVisibleArea() {
1588    if (lastClickGeneralBlockItem != null) {
1589        if (!IsInVisibleArea(lastClickGeneralBlockItem)) {
1590            $('html, body').animate({
1591                scrollTop: GetClientTop(lastClickGeneralBlockItem)
1592            }, 500);
1593
1594        }
1595    }
1596}
1597
1598function GetGeneralBlockItemDescriptionElement(itemElement) {
1599    var divElement;
1600    var itemDescriptionElement = null;
1601    var i;
1602
1603    divElement = itemElement.children[0];
1604    if (divElement != null) {
1605        for (i = 0; i < divElement.children.length; i++) {
1606            if (
1607                divElement.children[i].classList != null &&
1608                divElement.children[i].classList.contains("ItemDescription")
1609            ) {
1610                itemDescriptionElement = divElement.children[i];
1611                break;
1612            }
1613        }
1614    }
1615
1616    return itemDescriptionElement;
1617}
1618
1619
1620function CheckGeneralBlockItemDescriptionHeight() {
1621    var divElement;
1622    var itemDescriptionElement = null;
1623    var lastChildIndex;
1624    var lastChildBottomOffset;
1625    var newMaxHeight = 0;
1626    var i;
1627
1628
1629    divElement = lastClickGeneralBlockItem.children[0];
1630
1631    for (i = 0; i < divElement.children.length; i++) 
1632    {
1633        if (divElement.children[i].classList.contains("ItemDescription"))
1634        {
1635            itemDescriptionElement = divElement.children[i];
1636            break;
1637        }
1638    }
1639
1640    if(itemDescriptionElement != null) {
1641
1642        lastChildIndex = itemDescriptionElement.children.length - 1;
1643        maxHeight = (window.getComputedStyle(itemDescriptionElement).maxHeight + "").replace("px", "");
1644        maxHeight = parseInt(maxHeight);
1645
1646        if (lastChildIndex >= 0) {
1647            lastChildBottomOffset = 
1648                itemDescriptionElement.children[lastChildIndex].offsetTop +
1649                itemDescriptionElement.children[lastChildIndex].offsetHeight;
1650
1651            
1652            if (maxHeight < lastChildBottomOffset) {
1653                newMaxHeight = lastChildBottomOffset + 100;
1654               
1655                if (itemDescriptionElement.style.setProperty) {
1656                    itemDescriptionElement.style.setProperty("max-height", newMaxHeight + "px", "important");
1657                } 
1658                else {
1659                    itemDescriptionElement.style.setAttribute("maxHeight", newMaxHeight + "px", "important");
1660                }
1661            }
1662        }
1663    }
1664}//end function CheckGeneralBlockItemDescriptionHeight() {
1665
1666
1667function ResetAllContentPagingPosition() {
1668    var i;
1669
1670    for (i = 0; i < pageControls.length; i++) {
1671        SetContentPagingControlPosition(pageControls[i].Id);
1672    }
1673}
1674
1675function OnContentPagingControlResize() {
1676    var i;
1677
1678    for (i = 0; i < pageControls.length; i++) {
1679        pageControls[i].OnResize();
1680    }
1681}
1682
1683function MouseInfo() {
1684    this.X = 0;
1685    this.Y = 0;
1686}
1687
1688function ConverDateTimeToText(dateTimeObj) {
1689    var dateTimeText;
1690
1691    dateTimeText = dateTimeObj.toString("yyyy/MM/dd HH:mm:ss.sss");
1692
1693    return dateTimeText;
1694}
1695
1696function TryAddOnContentPagingControlResize() {
1697
1698    if (!hasSetContentPagingResizeEventHandler) {
1699        if (typeof (resizeEventHandlers) != "undefined") {
1700            resizeEventHandlers.push(OnContentPagingControlResize);
1701            hasSetContentPagingResizeEventHandler = true;
1702        }
1703        else {
1704            setTimeout("TryAddOnContentPagingControlResize()", 300);
1705        }
1706    }
1707}
1708
1709TryAddOnContentPagingControlResize();

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.