﻿var currentRep = 0;
$(function () {
	$(".comments-content").hide();
	$("#showComments").click(function () {
		$(".comments-content").slideToggle(200);
		return false;
	});

	$(".box-article-button-down").click(function () {
		if (currentRep < $(".box-articles-scrollwindow ul li").length - 1) {
			currentRep++;
			scrollRep();
		}
		return false;
	});
	$(".box-article-button-up").click(function () {
		if (currentRep > 0) {
			currentRep--;
			scrollRep();
		}
		return false;
	}).hide();
	$(".article-content img").each(function () {
		if ($(this).css('float') == 'left') $(this).css("margin-right", "10px");
		if ($(this).css('float') == 'right') $(this).css("margin-left", "10px");
	});
	Cufon.replace('h1.newsheading');
	Cufon.replace('h1.article-heading.feature');
});
function scrollRep() {
	if (currentRep == $(".box-articles-scrollwindow ul li").length - 1) {
		$(".box-article-button-down").hide();
	}
	else {
		$(".box-article-button-down").show();
	}
	if (currentRep == 0) {
		$(".box-article-button-up").hide();
	}
	else {
		$(".box-article-button-up").show();
	}
	liPos = $(".box-articles-scrollwindow ul li").eq(currentRep).offset().top - $(".box-articles-scrollwindow ul").offset().top;
	$(".box-articles-scrollwindow ul").animate({
		top: -liPos + "px"
	}, 500);
}
