$(document).ready(function() {
	// crossbrowser placeholder minden inputon
	$("input").placeholder();
	
	// főoldali slider
	$("#slider").codaSlider();
	
	// beúszó kapcsolat link
	$("#contactbar").hover(function() {
		$("#contactbar").animate({ right: "-1px" }, 300);
	}, function() {
		$("#contactbar").animate({ right: "-200px" }, 300);
	});
	
	// külső linkek új ablakban nyitása
	$("a[href*='http://']:not([href*='"+location.hostname+"']),[href*='https://']:not([href*='"+location.hostname+"'])").attr("target", "_blank").attr("title", "Új ablakban nyílik").addClass("external");
	
	// login box 
	$(".login-toggler").click(function() {
		$("#login-box").toggle();
	});
	
	// felső dropdown menü	
	$("#menubar a.subtop").hover(function() {
		var menuwidth = $(this).width() + 20 + "px";
		var leftpos = $(this).position().left + 5 + "px";
		$(this).next(".submenu").css("left", leftpos).css("width", menuwidth);
		$(this).next(".submenu").fadeIn();
	}, function() {
		$(this).next(".submenu").hide();
	});
	
	$("#menubar .submenu").hover(function() {
		$(this).show();
	}, function() {
		$(this).hide();
	});
	
	// bal oldali dropdown menü
	$("#left .toggler").click(function() {
		$(this).next(".submenu").toggle();
	});
	
	var url = window.location.href;
	var friendly = url.substring(url.lastIndexOf("/")+1);
	$(".item-"+friendly).closest(".submenu").show();
});

$(window).load(function() {	
	$("#news").masonry({
		itemSelector: "article",
		gutterWidth: 55
	});
});
