var documentPeel_index = 0;
var documentShowHomeTransition = function()
{
	jQuery(".pageflip .front")
		.animate({ //Animate and expand the image and the msg_block (Width + height)
			width: '100px',
			height: '132px'
		}, 1000);
	jQuery(".pageflip .front") //On hover out, go back to original size 50x50
			.animate({
				width: '50px',
				height: '50px'
			}, 220);
};

var documentAlternate = function ()
{
    jQuery('.pageflip').eq(documentPeel_index).fadeOut(500, function () {
        documentPeel_index = ( documentPeel_index + 1 ) % jQuery('.pageflip').size();
        jQuery('.pageflip').eq(documentPeel_index).fadeIn(500);
    });
};

jQuery(document).ready(function()
{
        var interval = 0;
	if ( jQuery('.pageflip a').size() > 0 ) {
		setInterval( documentShowHomeTransition, 1500 );
                interval = setInterval( documentAlternate, 3000);
	}
        jQuery('.pageflip').hover(function() {
            clearInterval(interval);
        },
        function() {
            interval = setInterval( documentAlternate, 3000);
        });
        
});
