/* -- detail/open_detail - open/close ---------- */

$(document).ready(function(){

	var d = $(".detail");
	var od = $(".open_detail");
	var odfs = od.find("span:first");

/* -- open -- */

	d.click(function(){
		d.each(function(){ 					/* minden csukott ".details" kinyitása */
			if($(this).is(":hidden")){
				$(this).show();
			}
		});
		od.each(function(){ 				/* minden nyitott ".open_detail" becsukása */
			if($(this).is(":visible")){
				$(this).hide();
			}
		});
		if($(this).next().is(":hidden")){
			$(this).next().show("slow"); 	/* az aktuális ".open_detail" kinyítása */
			$(this).hide(); 				/* az aktuális ".detail" becsukása */

		}
	});

/* -- close -- */

	odfs.click(function(){					/* alaphelyzet előállítása a nyitottra kattintással */
		odfs.each(function(){
			var op = $(this).parents(".open_detail");
			if(op.is(":visible")){
				op.hide();
				op.prev().show();
			}
		});
	});

/* -- simple toggle -- */

	$("a").click(function(){
		var r = $(this).attr("rel");
		if(r){
			$("DIV#"+r).toggle();
		}
	});
});

