contentview_InitObjects.js 27.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835

/// <reference path="../common/js/jquery-ui-1.8.23.custom.min.js" />

/// <reference path="../common/js/common.js" />

/// <reference path="contentview_VarDef.js" />

/// <reference path="contentview_CallApi.js" />

/// <reference path="contentview_GetData.js" />


/* init Image memo */
function initImageMemo() {
    if (ClientData.IsDisplayMemo() == true) {
        //change class
        $('#imgmemo').removeClass();
        $('#imgmemo').addClass('memoDisplay_hover');

    } else {
        //change class
        $('#imgmemo').removeClass();
        $('#imgmemo').addClass('memoDisplay');
    }
};

/* init Image add memo */
function initImageAddMemo() {
    if (ClientData.IsAddingMemo() == true) {
        //change class
        $('#imgaddmemo').removeClass();
        $('#imgaddmemo').addClass('memoAdd_hover');

    } else {
        //change class
        $('#imgaddmemo').removeClass();
        $('#imgaddmemo').addClass('memoAdd');

    }
};

/*check display marking?? */
function initDisplayMarking() {
    if (ClientData.IsDisplayMarking() == true) {
        // change class
        $('#imgmarking').removeClass();
        $('#imgmarking').addClass('marking_hover');

        if (ClientData.IsAddingMarking() == true) {
            if (ClientData.IsHideToolbar() == false) {
                ShowMarking();
            }

            disableAllControl();
        } 
        else {
            
            //change image		
            if(ClientData.serviceOpt_marking() == 'Y'){
                $('#imgmarkingtoolbar').removeClass();
                $('#imgmarkingtoolbar').addClass('markingToolbar');
            }	
        }
    } 
    else {
        $("#dlgMarking").hide();

        // change class
        $('#imgmarking').removeClass();
        $('#imgmarking').addClass('marking');

        $('#draw_canvas').css('display', 'none');

        //change image      
        if(ClientData.serviceOpt_marking() == 'Y'){
            $('#imgmarkingtoolbar').removeClass();
            $('#imgmarkingtoolbar').addClass('markingToolbar');
        }   

    }
};


/* init Image bookmark */
function initImageBookmark() {
    if (isExistBookmark() == -1) {
        //change class
        $('#imgbookmark').removeClass();
        $('#imgbookmark').addClass('bmAdd_off');

    } else {
        //change class
        $('#imgbookmark').removeClass();
        $('#imgbookmark').addClass('bmAdd');
    }
};


/* init flag marking, memo when init page */
function initFlagDisplay() {
    ClientData.IsDisplayMemo(false);
    ClientData.IsAddingMemo(false);
    if (ClientData.userOpt_makingDsp() == "1") {
        ClientData.IsDisplayMarking(true);
    } else {
        ClientData.IsDisplayMarking(false);
    }
    ClientData.IsAddingMarking(false);
};


/* set size bot toolbar for ipad */
function initDisplayToolbarDevice() {
    if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
        $('.transition').css('padding', '4px 0 0 0');
        $('.sizing').css('padding', '4px 0 0 2px');
        $('.toolbar').css('margin', '0 0 0 0');
    }
};

//START : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
function setLoadingSize(){
    var width = $(window).width() / 2;
    var objWidth = $('#divImageLoading').width() /2 ;
    var result = width - objWidth;

    $('#divImageLoading').css('left', result);    
};
//END : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
function initPage() {
    //START : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
    setLoadingSize();
    //END : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
    $('#divImageLoading').css('display', 'block');

    /* init footer toolbar */
    $('#footer_toolbar_2').hide();
    $('#footer_toolbar_1').show();

    /* init pos bottom toolbar*/
    initDisplayToolbarDevice();  

    // Lock screen
    //LockScreen();
   
    StartTimerUpdateLog();

    /* set start log */
    SetStartLog(contentID);

    /* get info of content */
    //Start Function: No.12
    if(contentType == ContentTypeKeys.Type_Image){
        getContentInfoTypeImage();
    }
    else if(contentType == ContentTypeKeys.Type_NoFile){
        //Start Function: No.4 - Editor : Long - Date: 08/20/2013
        getPageTransitionConfig();
        //End Function : No.4 - Editor : Long - Date : 08/20/2013
        
        //Start Function: No.12 - Editor : Long - Date: 08/28/2013
        getJsonContentInfoTyeNone();
        //Start Function: No.12 - Editor : Long - Date: 08/28/2013
    }
    else{
        getJsonContentInfo();
        
        //Start Function: No.4 - Editor : Long - Date: 08/20/2013
        getPageTransitionConfig();
        //End Function : No.4 - Editor : Long - Date : 08/20/2013
    }
    //End Function: No.12
    
    initializeViewerComponent('wrapper');

    /* handle display tooltip */
    handleTooltip();

    /* set text dialog confirm of audio */
    createTextConfirmAudio();

    /* handle toolbar */
    $('#control_screen').click(handleDisplayToolbar);
    $('#control_screen_2').click(handleDisplayToolbar);

    /* bookmark Page */
    $('#imgbookmark').click(bookmarkPage);
    $('#listbookmark').click(showListBookMark);
    $('#divListBookmark li').live('click', clickBookmark);

    /* close bookmark dialog */
    //$("#bookmarkClosing").live('click',closeBookmarkBox);


    //Start Function : No.12
    if(contentType == ContentTypeKeys.Type_PDF){
        /* page index */
        $('#listindex').click(showListPageIndex);
        $('#divSearchResult li').live('click', clickSearchDetail);
    
        /* copy text */
        $('#copytext').click(showCopyText);
        /* close copy text dialog */
        $("#copyTextClosing").click(closeCopyTextBox);
    }
    

    /*event click next page button */
    $('#nextpage').click(nextPage_click);
    $('#button_next_canvas').click(nextPage_click);
    /*event click prev page button */
    $('#prevpage').click(prevPage_click);
    $('#button_pre_canvas').click(prevPage_click);
    /*event click fist page button */
    $('#firstpage').click(firstPage_click);
    /*event click last page button */
    $('#lastpage').click(lastPage_click);

    $("#imgBack").click(imgBack_click);
    $("#imgHome").click(imgHome_click);
    $("#btn_show_memo").click(showEditMemo);
    $("#btn_copy_memo").click(copyMemo);
    $('#memoClosing').click(closePopUpCopyMemo);
    $('#liAddMemo').click(click_liAddMemo);
    $('#liCopyMemo').click(click_liCopyMemo);
    $('#liDeleteMemo').click(click_liDeleteMemo);

    //Start Function: No.12
    if(contentType == ContentTypeKeys.Type_PDF){
        /*event search*/
        showListSearchResult();
    }
    //End Function: No.12
    
    /* zoom event */
    $('#zoomin').click(zoomIn);
    $('#zoomout').click(zoomOut);
    $('#zoomfit').click(screenFit);

    /* event memo */
    $('#imgmemo').click(handleMemo);
    $('#imgaddmemo').click(handleAddMemo);

    /* event marking */
    $('#imgmarking').click(imgmarking_click);
    $('#imgmarkingtoolbar').click(handleDrawCanvas);

    /*draw canvas*/
    drawOnCanvas();

    /*init flag */
    initFlagDisplay();

    sizingScreen();

    /* move image check marking*/
    $('#divCheckExistMarking').css('top', '70px');
    $('#divCheckExistMarking').hide();

    /* disable controls */
    isLoadingObject = true;
    disableAllControl();

    /* window resize event */
    $(window).resize(function () {  
                                        
        //Start : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
        setViewportForWin8();
        //End : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
        
        sizingScreen();     
        /* close dialog popuptext */
        closeDialogResize();
        //START : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
        setLoadingSize();
        //END : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
    });

    $(document).ajaxComplete(function () {

        /*Init Page */
        nAjaxLoad++;
        if (nAjaxLoad == 8) {

            /* handle from bookmark page */
            //handleFromBookMarkPage();	
            /* check move content */
            if (ClientData.bookmark_pageNo()) {
                handleFromBookMarkPage();
            } else if (ClientData.common_prePageNo()) {
                /* handle from jump content */
                handleFromJumpContent();
            } else if (ClientData.IsJumpBack() == true) {
                /* handle back */
                oldContent_Back();
            } else {
                if (getPageIndex() == 0) {
                    //START TRB00069
                    //START TRB00069
                        if(isHasPageBGM()){
                            isPendingContentBGM = true;   
                        }                       
                        //END TRB00069
                    //END TRB00069
                    getContent().setPageImages(totalPage, pageImages)
					 				.setPageObjects(pageObjects)
					 				.setUpPage(0);
	 									 									 				
                    //START : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM
                    createPageBGM();
                    //END : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM  
                                          
                    //Start Function: No.12 - Editor : Long - Summary : Render next page
                    //Get next                                                        
                    if(totalPage > 1){
                        getNextPageObjectsByPageIndex(pageObjectsData, getPageIndex() + 1);
                    
                        //Render next page
                        renderNextPage();
                    }

                    
                    //End Function: No.12 - Editor : Long - Summary : Render next page

                    /* set pageTitle*/
                    if (dataPageTitle[0]) {
                        if (dataPageTitle[0] != '') {
                            document.title = contentName + '_' + dataPageTitle[0] + ' | ' + i18nText('sysAppTitle');
                        } else {
                            document.title = contentName + ' | ' + i18nText('sysAppTitle');
                        }
                    } else {
                        document.title = contentName + ' | ' + i18nText('sysAppTitle');
                    }

                    /* handle slider bar */
                    handleSliderBar();
                }
            }

            /* window resize event */
            $(window).resize(function () {    
                //START : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image           
                setLoadingSize();
                //END : TRB00034 - DATE : 09/11/2013 - Editor : Long  - Summary : Fix for center loading image
                if (isTouchDevice() == true) {
                    if (avwUserEnvObj.os == "android") {
                        var tempRatio = document.documentElement.clientWidth / window.innerWidth;
                        if (tempRatio <= 1) {
                            // Adjust position for toolbar and footer bar
                            var top = window.innerHeight - $("#footer_toolbar_1").height();
                            $("#wrapper").css("width", window.innerWidth);
                            $("#wrapper").css("height", window.innerHeight);
                            $("#footer_toolbar_1").css("top", top + "px");
                            $("#footer_toolbar_2").css("top", top + "px");
                        }
                        else {
                            var top = $(window).height() - $("#footer_toolbar_1").height();
                            $("#wrapper").css("width", $(window).width());
                            $("#wrapper").css("height", $(window).height());
                            $("#footer_toolbar_1").css("top", top + "px");
                            $("#footer_toolbar_2").css("top", top + "px");
                        }
                    }
                }

                resizeScreen();
                isChangeSizeScreen = false;

                /* change position dialog */
                changePosDialog();

                /* close dialog popuptext */
                closeDialogResize();                

            });

            /* check status button */
            checkExistNextPrePage();

            /*init Image Bookmark */
            initImageBookmark();

            $('#lblSlider').text('/ ' + totalPage);
            /* memo */
            initImageMemo();
            initImageAddMemo();

            /* init image had draw */
            initDisplayMarking();

            /* check status */
            checkStatusImageMarking();

            trackTransforms(context_main);

            //nAjaxLoad = 0;	

            if (isTouchDevice() == true) {
                if (avwUserEnvObj.os == "android") {
                    standardRatio = document.documentElement.clientWidth / window.innerWidth;
                    startDetectZoom({ time: 500,
                        callbackFunction: function (oldRatio, newRatio, oldW, oldH, newW, newH) {
                            currentRatio = newRatio;

                        }
                    });
                    var top = window.innerHeight - $("#footer_toolbar_1").height();
                    $("#wrapper").css("width", window.innerWidth);
                    $("#wrapper").css("height", window.innerHeight);
                    $("#footer_toolbar_1").css("top", top + "px");
                    $("#footer_toolbar_2").css("top", top + "px");
                    sizingScreen();
                }
            }
            
            //Start : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
            setViewportForWin8();
            //End : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
        }     
        //START TRB00048 - EDITOR : Long - Date : 09/18/2013 - Summary :    
        else if(nAjaxLoad == 4){
        //END TRB00048 - EDITOR : Long - Date : 09/18/2013 - Summary :  
           if(contentType == ContentTypeKeys.Type_NoFile){
                /* handle from bookmark page */
                //handleFromBookMarkPage(); 
                /* check move content */
                if (ClientData.bookmark_pageNo()) {
    
                    handleFromBookMarkPage();
    
                } else if (ClientData.common_prePageNo()) {
                    /* handle from jump content */
                    handleFromJumpContent();
                } else if (ClientData.IsJumpBack() == true) {
                    /* handle back */
                    oldContent_Back();
                } else {
                    if (getPageIndex() == 0) {
                        
                        //START TRB00069
                        if(isHasPageBGM()){
                            isPendingContentBGM = true;   
                        }                       
                        //END TRB00069
                        
                        getContent().setPageImages(totalPage, pageImages)
                                        .setPageObjects(pageObjects)
                                        .setUpPage(0);
                         //START : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM                        
                         createPageBGM();
                        //END : TRB00028 - Editor: Long - Date: 09/10/2013 - Summary : Fix For Page BGM  
                           
                        //Start Function: No.12 - Editor : Long - Summary : Render next page
                        //Get next
                        
                        if(totalPage > 1){
                            getNextPageObjectsByPageIndex(pageObjectsData, getPageIndex() + 1);
                        
                            //Render next page
                            renderNextPage();
                        }
    
                        
                        //End Function: No.12 - Editor : Long - Summary : Render next page
    
                        /* set pageTitle*/
                        if (dataPageTitle[0]) {
                            if (dataPageTitle[0] != '') {
                                document.title = contentName + '_' + dataPageTitle[0] + ' | ' + i18nText('sysAppTitle');
                            } else {
                                document.title = contentName + ' | ' + i18nText('sysAppTitle');
                            }
                        } else {
                            document.title = contentName + ' | ' + i18nText('sysAppTitle');
                        }
    
                        /* handle slider bar */
                        handleSliderBar();
                    }
                }
    
                /* window resize event */
                $(window).resize(function () {               
    
                    if (isTouchDevice() == true) {
                        if (avwUserEnvObj.os == "android") {
                            var tempRatio = document.documentElement.clientWidth / window.innerWidth;
                            if (tempRatio <= 1) {
                                // Adjust position for toolbar and footer bar
                                var top = window.innerHeight - $("#footer_toolbar_1").height();
                                $("#wrapper").css("width", window.innerWidth);
                                $("#wrapper").css("height", window.innerHeight);
                                $("#footer_toolbar_1").css("top", top + "px");
                                $("#footer_toolbar_2").css("top", top + "px");
                            }
                            else {
                                var top = $(window).height() - $("#footer_toolbar_1").height();
                                $("#wrapper").css("width", $(window).width());
                                $("#wrapper").css("height", $(window).height());
                                $("#footer_toolbar_1").css("top", top + "px");
                                $("#footer_toolbar_2").css("top", top + "px");
                            }
                        }
                    }
    
                    resizeScreen();
                    isChangeSizeScreen = false;
    
                    /* change position dialog */
                    changePosDialog();
    
                    /* close dialog popuptext */
                    closeDialogResize();                
    
                });
    
                /* check status button */
                checkExistNextPrePage();
    
                /*init Image Bookmark */
                initImageBookmark();
    
                $('#lblSlider').text('/ ' + totalPage);
                /* memo */
                initImageMemo();
                initImageAddMemo();
    
                /* init image had draw */
                initDisplayMarking();
    
                /* check status */
                checkStatusImageMarking();
    
                trackTransforms(context_main);
    
                //nAjaxLoad = 0;    
    
                if (isTouchDevice() == true) {
                    if (avwUserEnvObj.os == "android") {
                        standardRatio = document.documentElement.clientWidth / window.innerWidth;
                        startDetectZoom({ time: 500,
                            callbackFunction: function (oldRatio, newRatio, oldW, oldH, newW, newH) {
                                currentRatio = newRatio;
    
                            }
                        });
                        var top = window.innerHeight - $("#footer_toolbar_1").height();
                        $("#wrapper").css("width", window.innerWidth);
                        $("#wrapper").css("height", window.innerHeight);
                        $("#footer_toolbar_1").css("top", top + "px");
                        $("#footer_toolbar_2").css("top", top + "px");
                        sizingScreen();
                    }
                }
                
                //Start : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
                setViewportForWin8();
                //End : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
            }
        }

    });
};

//START TRB00069
function isHasPageBGM(){
         
    var iResult = false;
    getPageObjectsByPageIndex(pageObjectsData, 0);
    for (var nIndex = 0; nIndex < pageObjects.length; nIndex++) {
        if (pageObjects[nIndex].mediaType == '3' && pageObjects[nIndex].playType == '2') {
            iResult = true;
            break;
        }
    }
    
    return iResult;  
};

//END TRB00069

function initPageMediaAndHtmlType(){
    
    //$('#divImageLoading').css('display', 'block');

    /* init footer toolbar */
    $('#footer_toolbar_2').hide();
    $('#footer_toolbar_1').show();

    /* init pos bottom toolbar*/
    initDisplayToolbarDevice();

    // Lock screen
    LockScreen();
    
    //START TRB00094 - Editor : Long - Date : 09/26/2013 - Summary : Setting log   
    StartTimerUpdateLog();

    /* set start log */
    SetStartLog(contentID); 
    //END TRB00094 - Editor : Long - Date : 09/26/2013 - Summary : Setting log
    
    //enable SpecifyControl
    enableSpecifyControl();
    
    //Display overlay dialog for specify content type
    displayOverlayForSpecifyContentType();
    
    handleSliderBar();
    $('#lblSlider').text('/ ' + 1);
    
    if (avwUserEnvObj.os != "android") {
        $("#slider_page").slider("option", "disabled", true);
    }

    disable('#txtSearch', '#txtSlider');
};

//Start: Function: No.4 - Editor : Long - Date : 08/09/2013 - Summary : Create next and previous canvas
/* Initialize PageViewer Component */
function initializeViewerComponent(viewId) {

    /* add some tags we need.*/
    $('#' + viewId).prepend(
        '<div id="canvasWrapper">' +
        '<canvas id="mainPre"></canvas>' +
        '<canvas id="main"></canvas>' +
        '<canvas id="mainNext"></canvas>' +
        '<div id="playvideo"></div>' +
        '</div>' +
        '<canvas id="offscreenPre"></canvas>' +
        '<canvas id="offscreen"></canvas>' +
        '<canvas id="offscreenNext"></canvas>' +
        '<canvas id="draw_canvas"></canvas>' +
        '<canvas id="marker_canvas"></canvas>' +
        '<div id="playaudio" style="width:0px; height:0px;"></div>' +
        '<div id="playaudiopage" style="width:0px; height:0px;"></div>' +
        '<div id="playaudioallpage" style="width:0px; height:0px;"></div>' +
        '<div id="text"></div>'
        );

    

    /* apply css style */
    $('#canvasWrapper').css(
        {
            'position': 'absolute',
            'height' : '100%',
            'width' : '100%',
            'left': '0px'
            
        }
    );
    
    //Start : Function : No.20 - Editor : Le Long - Date: 27/08/2013 - Summary : For performing on ipad. On Android 4.1.x do not use overflow : hidden in parent canvas
                                                                            //to avoid draw duplicate canvas bug. 
    
    if(avwUserEnvObj.os == 'ipad'){
        $('#wrapper').css('overflow', 'hidden');
    }
    
    //End: Function : No.20 - Editor : Le Long - Date: 27/08/2013 - Summary : For performing on ipad. On Android 4.1.x do not use overflow : hidden in parent canvas
                                                                            //to avoid draw duplicate canvas bug. 
      
    $('#main').css(
        {
            'position': 'absolute',
            'top': marginY + 'px',
            'left': marginX + 'px',
            'box-shadow': '3px 3px 14px #333',
            'border-radius': '4px',
            'z-index' : '0'
            
        }
    );  
    
    
    if(animateType == animateTypeKeys.Type_Slide){
        $('#mainNext').css(
            {
    
                'position': 'absolute',
                'top': marginY + 'px',
                'left': marginX + 'px',
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
        $('#mainPre').css(
            {
    
                'position': 'absolute',
                'top': marginY + 'px',
                'left': marginX + 'px',
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
    }
    else{
        $('#mainNext').css(
            {
    
                'position': 'absolute',
                'top': marginY + 'px',
                'left': marginX + 'px',
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
        $('#mainPre').css(
            {
    
                'position': 'absolute',
                'top': marginY + 'px',
                'left': marginX + 'px',
                'box-shadow': '3px 3px 14px #333',
                'border-radius': '4px',
                'display': 'none',
                'z-index' : '0'
            }
        );
    }
    
    $('#offscreen').css(
        {
            'visibility': 'hidden',
            'display': 'none'
        }
    );
     $('#offscreenPre').css(
        {
            'visibility': 'hidden',
            'display': 'none'
        }
    );
     $('#offscreenNext').css(
        {
            'visibility': 'hidden',
            'display': 'none'
        }
    );

    $('#marker_canvas').css(
        {
            'display': 'none',
            'position': 'absolute',
            'cursor': 'default',
            'z-index' : '0'

        }
    );

    $('#draw_canvas').css(
        {
            'display': 'none',
            'position': 'absolute',
            'cursor': 'default',
            'z-index' : '0'
        }
    );

    $('#playvideo').css(
        {
            'position': 'absolute',
            'top': marginY + 'px',
            'left': marginX + 'px',
            'z-index': 0
        }
    );

    //set default event
    setDefaultEvent();

    /*init canvas value */
    canvas_marker = document.getElementById('marker_canvas');
    context_marker = canvas_marker.getContext('2d');
    canvas_draw = document.getElementById('draw_canvas');
    context_draw = canvas_draw.getContext('2d');
    canvas_main = document.getElementById('main');
    context_main = canvas_main.getContext('2d');
    canvas_offscreen = document.getElementById('offscreen');
    context_offscreen = canvas_offscreen.getContext('2d');
};
//End: Function: No.4 - Editor : Long - Date : 08/09/2013 - Summary : Create next and previous canvas

/* init image if exist marking in page */
function initImageCheckMarking() {
    /* set draw image if exist */
    var dataMarking = ClientData.MarkingData();

    var isExistMarking = false;
    
    //Start Function: No.12 - Editor : Long
    
    var tempPageNo = 0;
    if(contentType == ContentTypeKeys.Type_Image)
    {
        tempPageNo = 1;
    }
    else{
        tempPageNo = changePageIndex(getPageIndex());
    }
    //End Function: No.12 - Editor : Long
    
    
    for (var nIndex = 0; nIndex < dataMarking.length; nIndex++) {
        if (dataMarking[nIndex].contentid == contentID
		&& dataMarking[nIndex].pageNo == tempPageNo) {
            isExistMarking = true;
            break;
        }
    }

    /* init image display or not */
    if (ClientData.IsAddingMarking() == true) {
        $('#divCheckExistMarking').hide();
    } else {
        if (isExistMarking == true) {
            $('#divCheckExistMarking').show();
        } else {
            $('#divCheckExistMarking').hide();
        }
    }
};