$(window).load(function() {

	/* fancybox settings */
	$("a.group").fancybox({
		'speedIn'		:	300, 
		'speedOut'		:	300, 
		'overlayShow'	:	true,
		'titlePosition'	:	'outside',
		'autoScale'		:	'false'
	});

	$("a.iframe").fancybox({
		'type'			: 	'iframe',
		'height'		:	'80%',
		'width'			:	'80%'
	});

    $('#content.categoryPage .listArticles li:nth-child(even)').css({marginRight: 0});
    $('.singleArticle .listArticles li:nth-child(even)').css({marginRight: 0});

	// hide bg image on narrow displays
	if($(window).width() < 1450) {
		$('#bgTexts').css({background: 'transparent'});
	}

	/************************/
	/*	.newsItem heights	*/
	/************************/
	
	$(".newsItem").each(function() {
		
		// over 0px and below 100px
		if ($(this).height() >= "0" && $(this).height() < "100") {
			$(this).css({minHeight: '100px'});
		}
		
		// over 100px and below 200px
		else if ($(this).height() >= "100" && $(this).height() < "200") {
			$(this).css({minHeight: '200px'});
		}
		
		// over 200px and below 300px
		else if ($(this).height() >= "200" && $(this).height() < "300") {
			$(this).css({minHeight: '300px'});
		}
		
		// over 300px and below 400px
		else if ($(this).height() >= "300" && $(this).height() < "400") {
			$(this).css({minHeight: '300px'});
		}
		
		// over 400px and below 500px
		else if ($(this).height() >= "400" && $(this).height() < "500") {
			$(this).css({minHeight: '500px'});
		}
		
		// over 500px and below 600px
		else if ($(this).height() >= "500" && $(this).height() < "600") {
			$(this).css({minHeight: '600px'});
			//$(this).css({borderTop: '10px solid red'});
		}
		
		// over 600px and below 700px
		else if ($(this).height() >= "600" && $(this).height() < "700") {
			$(this).css({minHeight: '700px'});
			//$(this).css({borderTop: '10px solid purple'});
		}
		
		// over 700px and below 800px
		else if ($(this).height() >= "700" && $(this).height() < "800") {
			$(this).css({minHeight: '800px'});
			//$(this).css({borderTop: '10px solid orange'});
		}
		
		// over 800px and below 900px
		else if ($(this).height() >= "800" && $(this).height() < "900") {
			$(this).css({minHeight: '900px'});
			//$(this).css({borderTop: '10px solid blue'});
		}
		
		// over 900px and below 1000px
		else if ($(this).height() >= "900" && $(this).height() < "1000") {
			$(this).css({minHeight: '1000px'});
			//$(this).css({borderTop: '10px solid black'});
		}
		
		// over 1000px and below 1100px
		else if ($(this).height() >= "1000" && $(this).height() < "1100") {
			$(this).css({minHeight: '1100px'});
			//$(this).css({borderTop: '10px solid yellow'});
		}
		
		// over 1100px and below 1200px
		else if ($(this).height() >= "1100" && $(this).height() < "1200") {
			$(this).css({minHeight: '1200px'});
			//$(this).css({borderTop: '10px solid navy'});

		}
		
		else {
			//$(this).css({borderTop: '10px dotted red'})
		}
	});
	
	/****************************/
	/*	/eof .newsItem heights	*/
	/****************************/


});

function likeArticle(aid) {
	
	$.ajax({
		type:		'POST',
		url:		'/misc/ajax.php',
		data:		'do=likeArticle&do-aid=' + aid,
		success:	function(data) {
			$('.categoryPage span#txtLikeCount-' + aid).html(data);
			$('.singleArticle span#txtLikeCount-' + aid).html(data);
			$('.listArticles span#txtLikeCount-' + aid).html(data);
		}
	});	
}

