$(document).ready(function(){
	
	$('#mainNav li').not('.active').hover(function() { 
		$(this).children('a').css('color', '#912A12');
	}, function() { 
		$(this).children('a').css('color', '#A6978B');
	});
	
	$('#mainNav li').hover(function() { 
		$(this).children('div.subNavShell').show(); 
	}, function() { 
		$(this).children('div.subNavShell').hide(); 
	});
	
	$('.subNav li.last').css('background-image', 'none');
	$('.subNav li.last').css('padding-bottom', '10px');
	
	// cycle
	
	$('#slideContainer div:first img').hide(); 
	$('#slideContainer a.video_overlay').hide(); 
	$('#slideContainer div:first img').fadeIn(1000, function() { 
		$('#slideContainer').before('<div id="slidePager">').cycle({ 
			timeout: 5000, 
			pager: '#slidePager'
		});
		$('#slideContainer a.video_overlay').show(); 
		$('#slideContainer').css('background-image', 'none');
	}); 
	
	
	//margins and floats
	
	$('#communities ul li:last').css('text-align', 'right');
	$('#homepage-blog ul li:last').css('margin-right', '0px');
	$('ul.community li:nth-child(2)').css('text-align', 'right');
	$('.block-donate ul li:nth-child(3)').css('margin-top', '0px'); 
	$('.block-donate ul li:nth-child(2)').css('margin-bottom', '12px'); 
	$('.submenu li:last').css('border-bottom', '0px');
	$('.team li:nth-child(4n)').css('margin-right', '0px');
	$('.board li:nth-child(4n)').css('margin-right', '0px');
	$('.program-links li:nth-child(4n)').css('margin-right', '0px');
	
	// input fields 
	
	$('.mailing-list').focus(function() { 
		$(this).val(""); 
	}); 
	$('.blog-search').focus(function() { 
		$(this).css('background-image', 'none'); 
	});

	// modals 
	
	$('div.homeslides-modal').jqm({trigger: 'a.trigger-home-modal'}).css('top', $(window).scrollTop() + 65);
	
	// twitter thing 
		
	$('#twitter_update_list a [style*="font-size: 85%;"]').addClass('new'); 
	
	$('#twitter_update_list a').each(function() {
	    if($(this).attr('style') == 'font-size:85%') {
	       	$(this).addClass('twitter-date'); 
	    }
	});
		
	
	$('form.ccoptin input.mailing-list-submit').click(function () {
		$('iframe#email-frame').delay(500).fadeIn(500); 
		$('div#email-signup').jqm().jqmShow({overlay: 70});
		$('html,body').animate({scrollTop: 0}, 500);
	});

});
