$(document).ready(function(){

    $('#box').fadeIn('slow');


    /*
     * Fancybox
     *
     */
    jQuery('a.lightbox').fancybox({
        'titlePosition' : 'inside',
        'overlayColor' : '#AAA',
        'overlayOpacity' : '0.5',
        'hideOnContentClick' : 'true',
        'speedIn' : '100',
        'speedOut' : '100',
        'transitionIn' : 'fade',
        'transitionOut' : 'elastic',
    });


    /*
     * Flyer Modal
     *
     */
    if (true != $.session("showFlyer")) {
        $('#fyler').reveal({
             animationspeed: 900
        });
        setSession('showFlyer', true);
    }
    

    /*
     * Rightbox toggle
     *
     */
	if ('hide' == $.session("hideRightColumn")) {
		hideRightColumn();
		expandContent({'speedDrop':1, 'speedExpand':1});
	}

	$('#toggleRight').click(function() {
		expandContent({'speedDrop':500, 'speedExpand':300});
		
		if($("#toggleRight").hasClass('toggleShowRight')) {
			hideRightColumn();
			setSession('hideRightColumn', 'hide');
		} else {
			showRightColumn();
			setSession('hideRightColumn', 'show');
		}
		
	});

});

function hideRightColumn() {
	$("#toggleRight").removeClass('toggleShowRight');
	$("#toggleRight").addClass('toggleHideRight');
}

function showRightColumn() {
	$("#toggleRight").removeClass('toggleHideRight');
	$("#toggleRight").addClass('toggleShowRight');
}

function expandContent(options) {
	//var dropOptions = {direction: 'right'};
	//$("#right").toggle('drop', dropOptions, options.speedDrop);
	$("#right").toggle(options.speedExpand);
	$('#content').toggleClass("expandContent", options.speedExpand);
}

function setSession($key, $value) {
	$.session($key, $value);
}
