/* Author:

*/

function twitter_animate() {

	var li_first = $('.twitter li').first();
	var li_first_height = li_first.height();

	li_first.animate({'margin-top':'-'+(li_first_height+20)+'px'}, 3000, function() {
		$(this).appendTo($(this).parent());
		$(this).css('margin-top','0');
	});	
}

$(document).ready(function() {
						   
	setInterval(twitter_animate,3000);

	$('.left-main').masonry({
		  itemSelector: '.box',
		  columnWidth: 145,
		  gutterWidth: 18
	});
	
	$('#trans-small').cycle({ 
		next:   '.next2-small', 
		prev:   '.prev2-small',
		timeout: 0
	});
	
	$('#trans-medium').cycle({ 
		next:   '.next2-medium', 
		prev:   '.prev2-medium',
		timeout: 0
	});
	
	/* Menu accordian */
	
	//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
	$('.accordionButton').click(function() {

		//REMOVE THE ON CLASS FROM ALL BUTTONS
		$('.width-1-body').removeClass('on');
		  
		//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
		$('.accordionContent').slideUp('normal');
   
		//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
		if($(this).next().is(':hidden') == true) {
			
			//ADD THE ON CLASS TO THE BUTTON
			$(this).children('.width-1-body').addClass('on');
			  
			//OPEN THE SLIDE
			$(this).next().slideDown('normal');
		 } 
		  
	 });
	
	$('.accordionButton').css( 'cursor', 'pointer' );

 
	//HIDE THE DIVS ON PAGE LOAD	
	$(".accordionContent").hide();


});









