var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;


function newsToTop() {

	current_headline = 0;
	$("div.headline:eq(" + old_headline + ")").animate({top: 205},"slow", function() {
		$(this).css('top','210px');
	});
	$("div.headline:eq(" + current_headline + ")").css('top','-210px');
	$("div.headline:eq(" + current_headline + ")").show().animate({top: 5},"slow");
	old_headline = current_headline;

}

function newsUp() {

	current_headline = (old_headline + 1) % headline_count;
	$("div.headline:eq(" + old_headline + ")").animate({top: -205},"slow", function() {
		$(this).css('top','210px');
	});
	$("div.headline:eq(" + current_headline + ")").show().animate({top: 5},"slow");
	old_headline = current_headline;

}

function newsDown() {

	current_headline = (old_headline - 1 < 0 ? headline_count-1 : old_headline - 1) % headline_count;
	$("div.headline:eq(" + old_headline + ")").animate({top: 205},"slow", function() {
		$(this).css('top','210px');
	});
	$("div.headline:eq(" + current_headline + ")").css('top','-210px');
	$("div.headline:eq(" + current_headline + ")").show().animate({top: 5},"slow");
	old_headline = current_headline;

}


var actualFontSize = 0;
var fontSizes = Array(14, 16, 18, 20);

function changeFontSize() {
	if(actualFontSize > fontSizes.length-2)
	actualFontSize = 0;
	else
	actualFontSize++;

	$(".tartalom_left").css("font-size", fontSizes[actualFontSize]+"px");

}


function createCookie(name,value) {
	document.cookie = name+"="+value+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


// EPV

// function EPVrefreshData() {
	// var refreshId = setInterval(function() {
		// $("#epv_ajax_loader").show();
		// $('#epv_data').load('/template/epv2009/index.php', {}, function() {
			// $("#epv_ajax_loader").hide();
		// });
		
	// }, 60000);
// }


// / EPV



$(document).ready(function(){
	headline_count = $("div.headline").size();
	$("div.headline:eq("+current_headline+")").css('top','5px');

	
	hirdMenny = jQuery(".right_box_item").length - 1;
	hirdetesForgo();
	
	//EPVrefreshData();
});

var hirdI = -1;
var hirTitleHeight = 40;
var hirHeight = 256;
var hirdValtSeb = 4000;
var hirdAnimSeb = 500;
var hirdMenny = 0;

function hirdetesForgo() {
	
	hirdI++;
	if( hirdI > hirdMenny ) hirdI = 0;
	
	jQuery("#right_title_scroller").animate({
		top: -(hirdI * hirTitleHeight) + "px"
	}, hirdAnimSeb);
	
	jQuery("#right_box_scroller").animate({
		top: -(hirdI * hirHeight) + "px"
	}, hirdAnimSeb);
	
	setTimeout("hirdetesForgo()", hirdValtSeb)
	
}









