var names=new Array("gareth","dustin","donnie","nick","fred","jono");
var item = 0;
var nameInterval = 0;
jQuery(function($) {	
	//FOR CONTACT
	name();
	nameInterval = setInterval('name()', 500);
	
	$('.name_container').hover(function() {
		clearInterval( nameInterval );
	}, function() {
		nameInterval = setInterval('name()', 500);
	});
	
	$('.thumb img').hover(function() {
	        $(this).stop().animate({ marginTop : '-20px' }, 300, 'swing');
	    }, function() {
	        $(this).stop().animate({ marginTop : '0' }, 300, 'swing');
	    });


		
	onInfiniteScroll();
	
	$(window).resize(function() {
		$("#content-holder").css('margin-left', ($('#container').width()-$('.masonryWrap').width())/2);	
	});
	


});

function onInfiniteScroll() {
	/*
$('li.grid_info').hover(function() {
	        $(this).children('p').stop().animate({ opacity : '.2' }, 300, 'swing');
			$(this).children('span.grid_info').stop().animate({ opacity : '1' }, 300, 'swing');
	    }, function() {
	        $(this).children('p').stop().animate({ opacity : '1' }, 300, 'swing');
			$(this).children('span.grid_info').stop().animate({ opacity : '0' }, 300, 'swing');
	    });

*/	    
	if($.browser.msie){
		$('.grid_info').stop().animate({ opacity : '0' }, 300, 'swing');
	}
		
	$('.grid_info').hover(function() {
		$(this).parent('.grid_item').children('p').stop().animate({ opacity : '.2' }, 300, 'swing');
		$(this).stop().animate({ opacity : '1' }, 300, 'swing');
	}, function() {
		$(this).parent('.grid_item').children('p').stop().animate({ opacity : '1' }, 300, 'swing');
		$(this).stop().animate({ opacity : '0' }, 300, 'swing');
	});    
	
	
	$('.mason').masonry();
	
	if($.browser.msie == false){	
		$("img").lazyload({ 
	    	effect : "fadeIn" 
		});
	}
	$("#content-holder").css('margin-left', ($('#container').width()-$('.masonryWrap').width())/2);	
}

function name() {
	
	if( item < 5) {
		item++;
	} else {
		item = 0;
	}

	$("#name").text(names[item]);

}