
function thumbnailPopUp(){

    var thumbs = $('.thumbs');
    
    var imgWidth = thumbs.find('img').width();
    var imgHeight = thumbs.find('img').height();
    var xScale = 190;
    var yScale = 190;
    
    var offsetLeft = (xScale / 100 * imgWidth) / 2 * -1;
    var offsetTop = (yScale / 100 * imgHeight) / 1.75 * -1;
    
    
    thumbs.find("dd").hover(function(){
        $(this).css({
            'z-index': '10'
        }); /*Add a higher z-index value so this image stays on top*/
        $(this).find('img').stop().animate({
            marginTop: offsetTop + 'px', /* The next 4 lines will vertically align this image */
            marginLeft: offsetLeft + 'px',
            top: '50%',
            left: '50%',
            width: xScale / 100 * imgWidth + 'px',
            height: yScale / 100 * imgHeight + 'px'
        }, 400, 'easeOutBack', function(){
			$(this).addClass("hover");
		});
    }, function(){
        $(this).css({
            'z-index': '1'
        }); /* Set z-index back to 1 */
        $(this).find('img').removeClass("hover").stop().animate({
            marginTop: '0', /* Set alignment back to default */
            marginLeft: '0',
            top: '0',
            left: '0',
            width: imgWidth + 'px', /* Set width back to default */
            height: imgHeight + 'px'
        }, 400, 'easeOutBack');
    });
}

// language toggle
function langToggle(url){
    url = url || window.location;
    url = url.toString();
    var language = url.match('/en/');
    if (language != null) {
        url = url.replace('/en/', "/fr/");
    }
    else {
        url = url.replace('/fr/', "/en/");
    };
    window.location = url;
};


$(document).ready(function(){
    // init thumbnail pop up
    thumbnailPopUp();
    
	// toggle language
    $('.langToggle').click(function(){
        langToggle(window.location);
        return false;
    });
});
