contentview_ImagePreview.js 18.7 KB
Newer Older
1 2 3

//名前空間用のオブジェクトを用意する
var CONTENTVIEW_IMAGEPREVIEW = {};
4 5

/*==========================================*/
6 7 8 9 10 11 12
CONTENTVIEW_IMAGEPREVIEW.refreshSlideShowValue = function(){
	CONTENTVIEW_IMAGEPREVIEW.slideshowImgFrom = 0;
	CONTENTVIEW_IMAGEPREVIEW.slideshowImgTo = 4;
	CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection = [];
	CONTENTVIEW_IMAGEPREVIEW.slideshowClickFlg = false;
	CONTENTVIEW_IMAGEPREVIEW.slideshowInitFlg = true;
	CONTENTVIEW_IMAGEPREVIEW.slideshowSelectedIndex = 0;
Vo Duc Thang committed
13
    //0: next - 1: prev
14 15 16 17 18
	CONTENTVIEW_IMAGEPREVIEW.slideshowControlToggleFlg = 0;
	//CONTENTVIEW_IMAGEPREVIEW.totalRecord;
	CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex = 0;
	CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex = 4;
	CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex = 0;
19 20 21 22
};


//Show Image Preview
23 24
CONTENTVIEW_IMAGEPREVIEW.showImagePreview = function(targetId, imgList) {
	CONTENTVIEW_IMAGEPREVIEW.refreshSlideShowValue();
25 26
    //Check if imageList is not null
    if (imgList != null && imgList != 'undefined' && imgList.length > 0) {
27
    	CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection = CONTENTVIEW_IMAGEPREVIEW.setImageSource(imgList);
28 29
        //Check if targetId is not null
        if (targetId != null && targetId != 'undefined') {
30
            if (CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection.length == 1) {
31 32
                targetId.html('');
                targetId.append('<div id="slideWrapper">'
Vo Duc Thang committed
33
                + '</div>');
34 35

                var mainImg = $('#slideWrapper');
Vo Duc Thang committed
36
                //START FIXCSS
37

38
                var cssObj = { 'background-image': 'url(' + CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection[0].thumbnail + ')',
39 40
                    'background-repeat': 'no-repeat',
                    'background-size': 'contain',
Vo Duc Thang committed
41
                    'background-position': 'center'
42
                };
Vo Duc Thang committed
43 44 45
                mainImg.addClass('imagePreview-one');
                //END FIXCSS

46 47 48 49 50 51

                mainImg.css(cssObj);

                mainImg.parent().css('padding-top', '0px');

            } else {
52 53 54 55
            	CONTENTVIEW_IMAGEPREVIEW.renderSlideShowBackground(targetId);
            	CONTENTVIEW_IMAGEPREVIEW.renderSelectImage();
            	CONTENTVIEW_IMAGEPREVIEW.renderMainImage(0);
                CONTENTVIEW_IMAGEPREVIEW.handleImagePreviewEvent();
56 57 58 59
            }
        }
    }
    else {
60
    	CONTENTVIEW_IMAGEPREVIEW.renderSlideShowBackground(targetId);
61 62 63
        $('.main-control').css('visibility', 'hidden');
        $('.slideshow-control').css('visibility', 'hidden');
    }
64
    CONTENTVIEW_IMAGEPREVIEW.optimizeSizeImagePreview();
65 66 67
};

//Set image source for slide show
68
CONTENTVIEW_IMAGEPREVIEW.setImageSource = function(source){
Vo Duc Thang committed
69 70 71 72 73 74 75 76
    var oldSource = source;
    var newSource = [];
    
    for(var nIndex = 0; nIndex < oldSource.length; nIndex++){
        newSource.push({index : nIndex, image : oldSource[nIndex], thumbnail : oldSource[nIndex]});
    }
    
    return newSource;
77 78 79
};

//render background to show image preview
80
CONTENTVIEW_IMAGEPREVIEW.renderSlideShowBackground = function(targetId){
Vo Duc Thang committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    var targetDiv = targetId;
    targetDiv.html('');
    targetDiv.append('<div id="slideWrapper">'
    +'  <div class="gallery-image" id="gallery-image">'
    +'      <div class="main-control" id="main-control-prev"> </div>'
    +'      <div id="main-img" id="mainThumbnail"><div class="mainThumbnail"></div></div>'
    +'      <div class="main-control" id="main-control-next"> </div>'
    +'  </div>'
    +'  <div class="gallery-thumb">'
    +'      <div id="control-prev" class="slideshow-control"><img src="././img/arrow-left.gif"></div>'
    +'      <div id="selector-img">'
    +'      </div>'
    +'      <div id="control-next" class="slideshow-control"><img src="././img/arrow-right.gif"></div>'
    +'  </div>'
    +'</div>'   
    );

    $(window).resize(function () {

100
    	CONTENTVIEW_IMAGEPREVIEW.optimizeSizeImagePreview();
Vo Duc Thang committed
101 102
    });

103
    //CONTENTVIEW_IMAGEPREVIEW.handleImagePreviewEvent();
104
};
105 106

CONTENTVIEW_IMAGEPREVIEW.optimizeSizeImagePreview = function() {
107 108 109
    var maxW = "798";
    var ratio = 1.566;
    var maxH = maxW / ratio;
Masaru Abe committed
110 111 112
    
    var canvas = document.getElementById('main');
    
Masaru Abe committed
113
    if(ClientData.isStreamingMode() || CONTENTVIEW_GENERAL.avwUserEnvObj.isMobile()){
Masaru Abe committed
114 115 116 117 118 119 120 121 122 123
        if( canvas.width < maxW ){
        	maxW = canvas.width * 0.9;
        	maxH = maxW / ratio;
        }
    }
    
    $("#dialog").css('width', maxW + 'px');
    $("#dialog").css('height', maxH + 'px');
    
    /*
124 125 126 127 128 129 130 131 132 133 134 135 136 137
    if ($("#dialog").width() < maxW || $("#dialog").height() < maxH) {
        if ($("#dialog").width() < maxW) {
            $("#dialog").css('width', maxW + 'px');
            $("#dialog").css('height', maxH + 'px');
        }
        if ($("#dialog").height() < maxH) {
            $("#dialog").css('height', maxH + 'px');
            $("#dialog").css('width', maxW + 'px');
        }
    }
    else {
        $("#dialog").css('width', maxW + 'px');
        $("#dialog").css('height', maxH + 'px');
    }
Masaru Abe committed
138
    */
139 140 141 142
    $("#dialog").center();
};

//render select image
143
CONTENTVIEW_IMAGEPREVIEW.renderSelectImage = function(){
Vo Duc Thang committed
144 145
    var selectImg = $('#selector-img');
    
146 147
    $.each(CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection, function(i, image){
        if(CONTENTVIEW_IMAGEPREVIEW.slideshowImgFrom <= i && i <= CONTENTVIEW_IMAGEPREVIEW.slideshowImgTo){
Vo Duc Thang committed
148 149 150 151 152 153
            selectImg.append('<div class="thumbnail" imageId="'+ image.index +'" style="display:block; background-image : url('+image.thumbnail+')"></div>');
        }
        else{
            selectImg.append('<div class="thumbnail" imageId="'+ image.index +'" style="display:none; background-image : url('+image.thumbnail+')"></div>');
        }
    });
154 155 156
};

//Handle Image Preview Event
157
CONTENTVIEW_IMAGEPREVIEW.handleImagePreviewEvent = function(){
Vo Duc Thang committed
158
    
159 160
    $('#control-next').click(CONTENTVIEW_IMAGEPREVIEW.imageSelectNextFunction);
    $('#control-prev').click(CONTENTVIEW_IMAGEPREVIEW.imageSelectPrevFunction);
Vo Duc Thang committed
161
    
162 163
    $('#main-control-next').click(CONTENTVIEW_IMAGEPREVIEW.imageMainSelectNextFunction);
    $('#main-control-prev').click(CONTENTVIEW_IMAGEPREVIEW.imageMainSelectPrevFunction);
Vo Duc Thang committed
164
    
165 166 167
    $('.thumbnail').click(CONTENTVIEW_IMAGEPREVIEW.selectImgClickFunction);
    $('.thumbnail').mouseenter(CONTENTVIEW_IMAGEPREVIEW.selectImgMouseEnterFunction);
    $('.thumbnail').mouseleave(CONTENTVIEW_IMAGEPREVIEW.selectImgMouseLeaveFunction);
Vo Duc Thang committed
168 169 170
    
    $('.main-control').css('opacity','0');
    
171 172
    $('#main-control-next').mouseleave(CONTENTVIEW_IMAGEPREVIEW.mainControlNextMouseLeaveFunction);
    $('#main-control-prev').mouseleave(CONTENTVIEW_IMAGEPREVIEW.mainControlPrevMouseLeaveFunction);
Vo Duc Thang committed
173
    
Masaru Abe committed
174 175 176 177 178 179
    if (COMMON.isTouchDevice()) {
    	//タッチ操作が背後のメインコンテンツに伝わるのを防止
    	$('#slideWrapper').on("touchmove", function(e) {
    		e.preventDefault();
    	});
    } else {
180 181 182
        //$('.main-control').mouseenter(CONTENTVIEW_IMAGEPREVIEW.mainControlMouseEnterFunction);
        $('#main-control-next').mouseenter(CONTENTVIEW_IMAGEPREVIEW.mainControlNextMouseEnterFunction);
        $('#main-control-prev').mouseenter(CONTENTVIEW_IMAGEPREVIEW.mainControlPrevMouseEnterFunction);
Vo Duc Thang committed
183 184 185 186
    }
    
    //$('.thumbnail:first').css('box-shadow','0px 7px 7px #555');
    $('.thumbnail:first').addClass('activeThumb');
187
    CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
188 189
};

190
CONTENTVIEW_IMAGEPREVIEW.mainControlNextMouseEnterFunction = function(){
Vo Duc Thang committed
191
    $(this).css('opacity','0.5');
192 193
};

194
CONTENTVIEW_IMAGEPREVIEW.mainControlNextMouseLeaveFunction = function(){
Vo Duc Thang committed
195
    $(this).css('opacity','0');
196 197
};

198
CONTENTVIEW_IMAGEPREVIEW.mainControlPrevMouseEnterFunction = function(){
Vo Duc Thang committed
199
    $(this).css('opacity','0.5');
200 201
};

202
CONTENTVIEW_IMAGEPREVIEW.mainControlPrevMouseLeaveFunction = function(){
Vo Duc Thang committed
203
    $(this).css('opacity','0');
204 205 206
};

//Image Preview next icon function
207
CONTENTVIEW_IMAGEPREVIEW.imageSelectNextFunction = function(){
208

209 210
    if(CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex < CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection.length - 1){
        $('#selector-img div:eq('+CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex+')').animate({width: 'hide'},
Vo Duc Thang committed
211
            {step: function(now, fx){                                       
212
                        $('#selector-img div:eq('+CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex+')').animate({width: 'show'});                       
Vo Duc Thang committed
213 214 215 216
                }
            }
        );
        
217 218 219
        CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex = CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex + 1;
        CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex = CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex + 1;
        CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
Vo Duc Thang committed
220
    }
221 222 223
};

//Image preview prev icon function
224 225
CONTENTVIEW_IMAGEPREVIEW.imageSelectPrevFunction = function(){
    var fixedIndex = CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex - 1;
Vo Duc Thang committed
226
    
227
    if(CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex > 0){
Vo Duc Thang committed
228 229
        
        $('#selector-img div:eq('+fixedIndex+')').animate({width: 'show'});
230 231 232 233
        $('#selector-img div:eq('+CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex+')').animate({width:'hide'});
        CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex = CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex - 1;
        CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex = CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex - 1;
        CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
Vo Duc Thang committed
234
    }
235 236 237 238

};

//Main Image next icon function
239
CONTENTVIEW_IMAGEPREVIEW.imageMainSelectNextFunction = function() {
240

Masaru Abe committed
241
    if (COMMON.isTouchDevice() == true) {
242 243 244 245
        $('#main-control-next').css('opacity', '0.5');
    }


246 247 248
    if (CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction == false) {
    	CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction = true;
        var fixedIndex = eval(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex) + 1;
249

250
        if (CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex < CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection.length - 1) {
251
            $('#main-img div').animate(
Vo Duc Thang committed
252 253 254 255 256
            { "left": "-=100%" },
            {
                /*duration: "slow",*/
                complete: function () {
                    $('#main-img div').hide();
257
                    CONTENTVIEW_IMAGEPREVIEW.renderMainImage(fixedIndex);
Vo Duc Thang committed
258 259
                    $('#main-img div').css('left', '+=300%');
                    $('#main-img div').show();
260
                    $('<img/>').attr('src', CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection[fixedIndex].thumbnail).load(function () {
Vo Duc Thang committed
261 262
                        $('#main-img div').animate({ left: '0%' });
                    });
263 264 265
                    CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex = eval(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex) + 1;
                    CONTENTVIEW_IMAGEPREVIEW.syncImageMainWithSelectImage();
                    CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
Vo Duc Thang committed
266 267 268
                }
            }
        );
269 270 271 272 273
        }
    }
};

//Main Image prev icon function
274
CONTENTVIEW_IMAGEPREVIEW.imageMainSelectPrevFunction = function() {
Masaru Abe committed
275
    if (COMMON.isTouchDevice() == true) {
276 277 278
        $('#main-control-prev').css('opacity', '0.5');
    }

279 280 281
    if (CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction == false) {
    	CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction = true;
        var fixedIndex = eval(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex) - 1;
282

283
        if (CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex > 0) {
284
            $('#main-img div').animate(
Vo Duc Thang committed
285 286 287 288 289
            { "left": "+=100%" },
            {
                duration: "medium",
                complete: function () {
                    $('#main-img div').hide();
290
                    CONTENTVIEW_IMAGEPREVIEW.renderMainImage(fixedIndex);
Vo Duc Thang committed
291 292
                    $('#main-img div').css('left', '-=300%');
                    $('#main-img div').show();
293
                    $('<img/>').attr('src', CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection[fixedIndex].thumbnail).load(function () {
Vo Duc Thang committed
294 295
                        $('#main-img div').animate({ left: '0%' });
                    });
296 297 298
                    CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex = eval(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex) - 1;
                    CONTENTVIEW_IMAGEPREVIEW.syncImageMainWithSelectImage();
                    CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
Vo Duc Thang committed
299 300 301
                }
            }
        );
302 303 304 305 306 307

        }
    }
};

//Selector Image click function
308 309 310
CONTENTVIEW_IMAGEPREVIEW.selectImgClickFunction = function() {
    if (CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction == false) {
    	CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction = true;
311 312
        var imgIndex = $(this).attr('imageId');

313
        if (imgIndex > CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex) {
314
            $('#main-img div').animate(
Vo Duc Thang committed
315 316 317 318 319
            { "left": "-=100%" },
            {
                duration: "medium",
                complete: function () {
                    $('#main-img div').css('display', 'none');
320
                    CONTENTVIEW_IMAGEPREVIEW.renderMainImage(imgIndex);
Vo Duc Thang committed
321 322
                    $('#main-img div').css('left', '+=300%');
                    $('#main-img div').css('display', 'block');
323
                    $('<img/>').attr('src', CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection[imgIndex].thumbnail).load(function () {
Vo Duc Thang committed
324 325 326
                        $('#main-img div').animate({ left: '0%' });
                    });

327 328
                    CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex = imgIndex;
                    CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
Vo Duc Thang committed
329 330 331
                }
            }
        );
332
        }
333
        else if (imgIndex < CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex) {
334
            $('#main-img div').animate(
Vo Duc Thang committed
335 336 337 338 339
            { "left": "+=100%" },
            {
                duration: "medium",
                complete: function () {
                    $('#main-img div').css('display', 'none');
340
                    CONTENTVIEW_IMAGEPREVIEW.renderMainImage(imgIndex);
Vo Duc Thang committed
341 342
                    $('#main-img div').css('left', '-=300%');
                    $('#main-img div').css('display', 'block');
343
                    $('<img/>').attr('src', CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection[imgIndex].thumbnail).load(function () {
Vo Duc Thang committed
344 345
                        $('#main-img div').animate({ left: '0%' });
                    });
346 347
                    CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex = imgIndex;
                    CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
Vo Duc Thang committed
348 349 350
                }
            }
        );
351 352
        }
        else {
353 354 355
        	CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction = false;
            CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex = imgIndex;
            CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton();
356 357 358 359 360 361
        }

        //$('.thumbnail').css('box-shadow', '');
        $('.thumbnail').removeClass('activeThumb');
        //$(this).css('box-shadow', '0px 7px 7px #555');
        $(this).addClass('activeThumb');
362
        CONTENTVIEW_IMAGEPREVIEW.slideshowClickFlg = true;
363 364 365 366
    }
};

//Render Main Image
367
CONTENTVIEW_IMAGEPREVIEW.renderMainImage = function(i) {
368
    
Vo Duc Thang committed
369
    var mainImg = $('#main-img div');
370
    mainImg.css('background-image', 'url(' + CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection[i].thumbnail + ')');
Vo Duc Thang committed
371

372
    CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction = false;
Masaru Abe committed
373
    if (COMMON.isTouchDevice() == true) {
Vo Duc Thang committed
374 375 376
        $('#main-control-next').css('opacity', '0');
        $('#main-control-prev').css('opacity', '0');
    }
377 378
};

379 380
CONTENTVIEW_IMAGEPREVIEW.selectImgMouseLeaveFunction = function(){
    if(!CONTENTVIEW_IMAGEPREVIEW.slideshowClickFlg){
Vo Duc Thang committed
381 382
        //$('this').css('box-shadow','');
        $('this').removeClass('activeThumb');
383
        CONTENTVIEW_IMAGEPREVIEW.slideshowClickFlg = false;
Vo Duc Thang committed
384 385
    }
    else{
386
        //CONTENTVIEW_IMAGEPREVIEW.slideshowClickFlg = false;
Vo Duc Thang committed
387
    }
388 389
};

390
CONTENTVIEW_IMAGEPREVIEW.selectImgMouseEnterFunction = function(){
Vo Duc Thang committed
391 392 393 394 395
    
    //$('.thumbnail').css('box-shadow','');
    $('.thumbnail').removeClass('activeThumb');
    //$(this).css('box-shadow','0px 7px 7px #555');
    $(this).addClass('activeThumb');
396 397 398
};

//Main control mouse leave function
399
CONTENTVIEW_IMAGEPREVIEW.mainControlMouseLeaveFunction = function(){   
Vo Duc Thang committed
400
    $('.main-control').css('opacity','0');
401 402 403
};

//Main control mouse enter function
404
CONTENTVIEW_IMAGEPREVIEW.mainControlMouseEnterFunction = function(){
Vo Duc Thang committed
405
    $('.main-control').css('opacity','0.5');
406 407 408
};

//Sync Main Image with select Image
409 410
CONTENTVIEW_IMAGEPREVIEW.syncImageMainWithSelectImage = function(){
    var thumbImg = $('.thumbnail[imageId="'+ CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex +'"]'); 
Vo Duc Thang committed
411 412

    if(thumbImg.is(':hidden')){
413 414
        if(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex > CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex){
        	CONTENTVIEW_IMAGEPREVIEW.imageSelectNextFunction();
Vo Duc Thang committed
415
        }
416 417
        else if(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex < CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex){
        	CONTENTVIEW_IMAGEPREVIEW.imageSelectPrevFunction();
Vo Duc Thang committed
418 419 420 421 422 423 424
        }
    }
    
    //$('.thumbnail').css('box-shadow','');
    $('.thumbnail').removeClass('activeThumb');
    //thumbImg.css('box-shadow','0px 7px 7px #555');
    thumbImg.addClass('activeThumb');
425 426 427
};

//Handle display button control
428
CONTENTVIEW_IMAGEPREVIEW.handleDispNextPrevButton = function(){
Vo Duc Thang committed
429
    
430
    if(CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex > 0){      
Vo Duc Thang committed
431 432 433 434 435 436
        $('#control-prev').css('visibility','visible');
    }
    else{
        $('#control-prev').css('visibility','hidden');
    }
    
437
    if(CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex < (eval(CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection.length) - 1)){ 
Vo Duc Thang committed
438 439 440 441 442 443
        $('#control-next').css('visibility','visible');
    }
    else{
        $('#control-next').css('visibility','hidden');
    }
    
444
    if(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex > 0){     
Vo Duc Thang committed
445 446 447 448 449 450
        $('#main-control-prev').css('visibility','visible');
    }
    else{
        $('#main-control-prev').css('visibility','hidden');
    }
    
451
    if(CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex < (eval(CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection.length) - 1)){
Vo Duc Thang committed
452 453 454 455 456
        $('#main-control-next').css('visibility','visible');
    }
    else{
        $('#main-control-next').css('visibility','hidden');
    }
457 458
};

459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
$(function () {
	//CONTENTVIEW_IMAGEPREVIEW.ready();
});

CONTENTVIEW_IMAGEPREVIEW.ready = function(){
	/*====Variable====*/
	CONTENTVIEW_IMAGEPREVIEW.slideshowImgFrom = 0;
	CONTENTVIEW_IMAGEPREVIEW.slideshowImgTo = 4;
	CONTENTVIEW_IMAGEPREVIEW.slideshowImageCollection = [];
	CONTENTVIEW_IMAGEPREVIEW.slideshowClickFlg = false;
	CONTENTVIEW_IMAGEPREVIEW.slideshowInitFlg = true; //未使用
	CONTENTVIEW_IMAGEPREVIEW.slideshowSelectedIndex = 0; //未使用
	//0: next - 1: prev
	CONTENTVIEW_IMAGEPREVIEW.slideshowControlToggleFlg = 0; //未使用
	//CONTENTVIEW_IMAGEPREVIEW.totalRecord; //未使用
	CONTENTVIEW_IMAGEPREVIEW.slideshowSelectFirstIndex = 0;
	CONTENTVIEW_IMAGEPREVIEW.slideshowSelectLastIndex = 4;
	CONTENTVIEW_IMAGEPREVIEW.slideshowMainCurrIndex = 0;
	CONTENTVIEW_IMAGEPREVIEW.slideshow_isTransaction = false;
};