$(function(){
	var auto_hover = true;
	var id = 1;
	var interval;
	
	$("#featurednewsindex li").hover(function(){
		id = $(this).attr("id").replace("firstnews_li_", "");
		$(".firstnews").hide();
		$(".firstnews_li").removeClass("hover");
		$(this).addClass("hover");
		$("#firstnews_"+id).show();
	});
	$("#featurednewsindex li:first").hover();
	
	$("#featurednews").mouseleave(function(){
		auto_hover = true;
		interval = setInterval(function(){
			if (auto_hover) {
				id++; if (id>4) id = 1;
				$(".firstnews").hide();
				$(".firstnews_li").removeClass("hover");
				$("#firstnews_li_"+id).addClass("hover");
				$("#firstnews_"+id).show();
			}
		}, 5000);
	});
	$("#featurednews").mouseleave();
	$("#featurednews").mouseenter(function(){
		auto_hover = false;
		clearInterval(interval);
	});
	
	
	// Üzenet a szerkesztőknek
	$('.message-link').click(function(event) {
		popup('/message.php', '360', '330', false);
	});
});

function popup(url_address,window_width,window_height,scroll) {
	x = (screen.availWidth-window_width)/2;
  y = (screen.availHeight-window_height)/2;
	p = 'width='+window_width+',height='+window_height+',Left='+x+',Top='+y+',screenX='+x+',screenY='+y;
	if(scroll=="no") p += ',scrollbars=no';
	else p += ',scrollbars=yes';
  FromWindow = window.open(url_address, 'NewWindow', p);
	FromWindow.focus();
	return FromWindow;
}

function nemures(id){
	var x = $("#"+id);
	return (x.val() != '');
}
