function CityGlow() { 
	$('#FooterGlow').animate({ opacity: '0.2'}, 2000, function() {}).animate({ opacity: '0.6'}, 1000, function() {});
}

$(document).ready(function(){
	
	/*========================= REGISTER BUTTON ======================*/
	
	$('#menu-item-75 a').attr('id', 'RegisterNow');
	
	/*========================= TWITTER FEED =========================*/
	
	$(".tweet").tweet({
        username: "sustainableos",
        join_text: "auto",
        avatar_size: 32,
        count: 1,
        loading_text: "loading..."
    });

	/*========================= SPIN AND GLOW ========================*/

	setInterval(function(){
		$('#Spinner').animate({ rotate: '+=15deg' }, 5000, 'linear');
	}, 0);
	
	setInterval(function(){ 
		CityGlow(); 
	}, 0);
	
	/*======================= HOMEPAGE - SPEAKERS ======================*/
	
	$('#HomeSpeakersList li').hoverIntent(function() { 
		$(this).children('.speaker_info').fadeIn(500).css('cursor', 'pointer'); 
	}, function() { 
		$(this).children('.speaker_info').fadeOut(200); 
	}); 
	
	$('#HomeSpeakersList').isotope({ layoutMode : 'fitRows' });
	
	/*========================= PROGRAM ==========================*/
	
	$('#Topics li:nth-child(1)').css('border-top', '1px solid #b0b4b4'); 
	$('#Topics li:nth-child(2)').css('border-top', '1px solid #b0b4b4'); 
	$('#Agenda ul li:nth-child(2n)').addClass('alt'); 
	
	$('#Agenda a.agenda_date').click(function() { 
		if($(this).parent('li').hasClass('open')) { 
			$(this).parent('li').children('ul').slideUp(400, 'linear', function() { 
				$(this).parent('li').removeClass('open'); 
			}); 
		} else { 
			$(this).parent('li').children('ul').slideDown(600, 'easeInOutQuad', function() { 
				$(this).parent('li').addClass('open'); 
			});
		}; 
		return false; 
	}); 
	
	/*================== ABOUT - TESTIMONIALS ===================*/
	
	$('.page-template-about-php #AboutTestimonials div.testimonial:nth-child(3n + 1)').css('clear', 'both'); 
	$('#AboutTestimonials div.testimonial:nth-child(1)').css('padding-top', '0px').css('border-top', '0px'); 
	$('#AboutTestimonials div.testimonial:nth-child(2)').css('padding-top', '0px').css('border-top', '0px'); 
	$('#AboutTestimonials div.testimonial:nth-child(3)').css('padding-top', '0px').css('border-top', '0px'); 
	
	/*==================== SPEAKERS PAGE ============================*/
	
	$('#Panelists li').hover(function() { 
		$(this).children('.panelist').fadeIn(500); 
	}, function() { 
		$(this).children('.panelist').fadeOut(200); 
	});
	
	$('.trig').click(function() { 
		$('.jqmWindow').css('top', $(window).scrollTop() + 100); 
	}); 
	
	/*======================= REGISTER PAGE ==========================*/
	
	$('#FormModal').jqm({ overlay: 80, toTop: true, trigger: '.form_modal' }); 
	$('.form_modal').click(function() { 
		$('html, body').animate({ scrollTop: 0 }, 0); 
	}); 
	
	/*=========================== BLOG ==============================*/
	
	$('#RecentPosts li:nth-child(1)').css('border-top', '1px solid #43586c'); 
	$('#RecentPosts li:nth-child(2)').css('border-top', '1px solid #43586c'); 
	
	/*====================== VERTICAL ALIGN HACKS =====================*/
	
	$('#RecentPosts li a span, #Topics li h3, #HomepageBlog li span').each(function() { 
		var spanht = $(this).height(); 
		var newmarg = parseInt((70 - spanht)/2); 
		$(this).css('margin-top', newmarg)
	}); 
	
	/*======================== 480px screen width ===================*/
	
	if($(window).width() <= 480) {
		$('#MainNav li:nth-child(7)').css('border-bottom', '0px'); 
		$('#MainNav li:nth-child(8)').css('border-bottom', '0px'); 
	}
	
});

$(window).resize(function() { 
	if($(window).width() <= 480) { 
		$('#MainNav li:nth-child(7), #MainNav li:nth-child(8)').css('border-bottom', '0px'); 
	}
}); 
