/**
 * @author Nima Nekoui
 */

function switchImage(element){

    var elmtNum = ($(element).id).charAt(6) + ($(element).id).charAt(7);

	if(elmtNum != openImage) {
		$('image-' + openImage).hide();
		$('image-' + elmtNum).show();
		$('thumb-' + openImage).className='imageOff'
		
		openImage = elmtNum;
	}
}


var positionLeft = 0;
var positionUp = 0;
var maxPositionLeft = 0;
var maxPositionUp = 0;

function nextSetCollections(){
    if (positionLeft > -maxPositionLeft) {
        new Effect.MoveBy("collectionsImages", 0, -300, {
            duration: 1.0,
            afterFinish: function(){
                positionLeft = positionLeft - 300;
            },
            queue: {
                position: 'end',
                scope: 'images',
                limit: 1
            }
        });
        new Effect.MoveBy("collectionsText", 0, -300, {
            duration: 1.0,
            queue: {
                position: 'end',
                scope: 'text',
                limit: 1
            }
        });
    }
}

function previousSetCollections(){
    if (positionLeft <= -300) {
        new Effect.MoveBy("collectionsImages", 0, 300, {
            duration: 1.0,
            afterFinish: function(){
                positionLeft = positionLeft + 300;
            },
            queue: {
                position: 'end',
                scope: 'images',
                limit: 1
            }
        });
        new Effect.MoveBy("collectionsText", 0, 300, {
            duration: 1.0,
            queue: {
                position: 'end',
                scope: 'text',
                limit: 1
            }
        });
    }
}

function nextSetEditorialThumbs(){
    if (positionLeft > -maxPositionLeft) {
        new Effect.MoveBy("editorialThumbsImages", 0, -370, {
            duration: 1.0,
            afterFinish: function(){
                positionLeft = positionLeft - 370;
            },
            queue: {
                position: 'end',
                scope: 'images',
                limit: 1
            }
        });
    }
}

function previousSetEditorialThumbs(){
    if (positionLeft <= -370) {
        new Effect.MoveBy("editorialThumbsImages", 0, 370, {
            duration: 1.0,
            afterFinish: function(){
                positionLeft = positionLeft + 370;
            },
            queue: {
                position: 'end',
                scope: 'images',
                limit: 1
            }
        });
    }
}


