var idprefix = "szolg_", duration = 75;
var bgcolors = [ "#00c6f0", "#cec500", "#ff9e00", "#00e162" ];

function szolg_over(e) {
	try {
		var ids = "#" + idprefix + (e.data.id + 1);
		$(ids + " h2").css({ "background-image" : "url(/img/arrow_alpha.png)" });
		$(ids).animate({ width: (100 - (bgcolors.length - e.data.id - 1) * 2) + "%", backgroundColor: bgcolors[e.data.id] }, duration );
		$(ids + " *").animate({ color: "white" }, duration );
	} catch (e) {}
}

function szolg_out(e) {
	try {
		var ids = "#" + idprefix + (e.data.id + 1);
		$(ids).animate({ width: (86 + e.data.id * 2) + "%", backgroundColor: "white" }, duration );
		$(ids + " h2 a," + ids + " ul li").animate({ color: bgcolors[e.data.id] }, duration, function() {
			$(ids + " h2").css({ "background-image" : "url(/img/content_h_" + (e.data.id + 1) + ".gif)" });
		});
		$(ids + " ul li span").animate({ color: "#8e8d8d" }, duration );
	} catch (e) {}
}

$(document).ready(function() {
	$(".szolg").each(function (i) {
		if (this.id.indexOf(idprefix) > -1) {
			var id = parseInt(this.id.substring(idprefix.length));
			$("#" + idprefix + id).bind('mouseenter', { id: id - 1 }, szolg_over).bind('mouseleave', { id: id - 1 }, szolg_out).click(function () { 
				window.location = $("#" + idprefix + id + " h2 a").attr("href");
			});
		}
	});
	$("a.zoom").fancybox({
		'zoomSpeedIn'		:	200,
		'zoomSpeedOut'		:	200,
		padding: 2
	});
});