(function($){

	$(document).ready(function(){

		/*-----------------------------------------------------
			JavaScript for the iVillage - Entertainent Landing
		-----------------------------------------------------*/

		// Add read more links to content list
		var article, article_a, article_link, article_name, last_para;
		$('#content-list > li').each(function(){
			article = $(this);
			article_a = $('h3 > a',this);
			article_link = article_a.attr('href');
			article_name = article_a.attr('name');
			article.find('div.desc > p:last')
				.append(' <a href="'+ article_link +'" name="' + article_name + '" class="more-link-simple">Read More</a>')
		});

		// Custom category bubble? Center and display
		var custom_title = $('h2.title-category');
		if(custom_title.length){
			$('.bubble-custom-btm',custom_title).centerHoriz();
			$('.bubble-custom-btm',custom_title).removeClass('hide');
		}

		// Bind category filter
		$('#filter-cat').change(function(e){
			var selected = $(this).children().filter(':selected');
			if(selected.val() != '#'){
				$(this).attr('disabled','disabled');
				document.location.href = '/'+ selected.attr('name') +'/1-a-t-' + selected.val();
			}
		});

		// For IE6
		if(msie6){

			// Fix photo credits
			$(window).load(function(){
				$('div.img p.credit').each(function(){
					$(this).css('width',$(this).parent().find('img').width());
				});
			});
		}
	
	});

})(jQuery);