$(document).ready( function() {

    current = 0;
    count = 0;
    
    
	$('#mjcwalk').ready( function() {
            w = setInterval(walk , 800);
        });
        
	
	
	$('#contact').click( function() {
		
		$('#mjcwalk').flip({
			direction:'tb',
			content: '<div id="contact_form"><p>Contact Form to come</p></div>',
			color: 'red'
		});
	});
});

function walk() {
    width = 500;
    next = width + current;
    current = next;
    count++;
    
    $('#mjcwalk').css( "background-position", "-" + next + "px 0").fadeIn('slow')
    if(count > 4) {
        clearInterval(w);
        $('#mjcscreen').css( 'display','block');
        $('#mjcscreen').sprite( {fps: 1, no_of_frames: 4} ).active();
    }
}
