function addRemoveAjaxLayer() {
	if ($("#ajax-layer").length == 0) {
		$("body").append('<div id="ajax-layer">&nbsp;</div>');
	} else {
		$("#ajax-layer").remove();
	}
}

$(document).ready(function(){
	
	// Inputnak hover-re, focus-ra és kitöltésre class-t ad
	$('input.text, textarea.text, select').hover(function() {
		$(this).toggleClass('input_hover');
	});
	$('input.text, textarea.text, select').focus(function() {
		$(this).addClass('input_focus');
	});
	$('input.text, textarea.text, select').blur(function() {
		$(this).removeClass('input_focus');
		if ($(this).val() != "") {
			$(this).addClass('input_filled');
		} else {
			$(this).removeClass('input_filled');
		}
	});
	$(".box_gyik").find("a").each(function() {
		$(this).toggle(function() {
			$(this).addClass("opened");
			$(this).next().css("display", "block");
			return false;
		}, function() {
			$(this).removeClass("opened");
			$(this).next().css("display", "none");
			return false;
		});
	});
	$(".scroll-pane").find("li").each(function() {
		$(this).find("label").click(function() {
			if ( !$(this).find('input').attr("checked") ) {
				if ( "source_0" != $(this).find('input').attr("id") ) {
					$("#source_0").attr("checked", false);
				}
			}
			if ($(this).find("span").hasClass("jNiceChecked")) {
				$(this).parent().addClass("active");
			} else {
				$(this).parent().removeClass("active");
			}
		});
		$(".jNiceCheckbox").click(function() {
			alert("valamiclassclick");
			if ($(this).hasClass("jNiceChecked")) {
				$(this).parent().parent().parent().addClass("active");
			} else {
				$(this).parent().parent().parent().removeClass("active");
			}
		});
	});
	setTimeout('addImgCheckMagic()', 1000 );
});

function uncheckAllSource( input ) {
	if ( true == $(input).attr("checked") ) {
		$("#source_0").attr("checked", false);
	}
}

function addImgCheckMagic () {
	$(".scroll-pane").find("li").each(function() {
		$(this).find('img').click(function() {
			if ( !$(this).parents('.jquery-checkbox').hasClass("jquery-checkbox-checked") ) {
				$("#source_0").attr("checked", false);
			}
		});
	});
}

