$(document).ready( function() {
	
	/*$('.accordion').accordion({ 
		header: 'h2', 
		active: ".active", 
		alwaysOpen: true, 
		animated: "easeslide", 
		clearStyle: true, 
		autoHeight: false 
	});*/
	
	
/* simple accordion */
	if($("#promo").html() != '') $("#promo a").media({width: 380, height: 258});
	$(".accordion h2:first").addClass("active");
	$(".accordion div.wrapper").each( function(){
			$(this).css("height", $(this).height()+"px");
		}
	);
	$("#secCont .accordion div.wrapper:gt(0)").hide();
	$("#tertCont .accordion div.wrapper:gt(0)").hide();
	
	$(".sendSomething h2:first").removeClass("active");
	$(".sendSomething div.wrapper").hide();
	
	$(".accordion h2").click(function(){
		$(this)
			.next("div")
			.slideToggle('slow')
			.siblings("div:visible")
			.slideUp("slow");
		$(this)
			.toggleClass("active");
		$(this)
			.siblings("h2").removeClass("active");
	});
	
	$("h3.topicList a.newTopic").click(function(){
			$(this).toggleClass("active").blur();
			$(this).parent().next().slideToggle("slow");
			return false;
		}
	)
	$("h3.commentList a.newComment").click(function(){
			$(this).toggleClass("active").blur();
			$(this).parent().next().slideToggle("slow");
			return false;
		}
	)
	
	$("#iSendMessage a").click(function() {
	    $(this).toggleClass("active").blur();
	    $(this).parent().next().slideToggle("slow");
	    if(!$(this).hasClass("active")) {
		$(this).parent().parent().animate({
		    height: $(this).parent().parent().height()-120
		});
	    } else {
		$(this).parent().parent().animate({
		    height: $(this).parent().parent().height()+120
		});
	    }
	    return false;
	});
	
	$("#next1").click(function() {
	    if($("#regnick").val() == '') var error = 1;
	    else if($("#regemail").val() == '') var error = 1;
	    else if($("#regpass").val() == '') var error = 1;
	    else if($("#regpass2").val() == '') var error = 1;
	    if(error) alert('A csillaggal jelölt mezõk kitöltése kötelezõ!');
	    else {
		if($("#regpass").val() != $("#regpass2").val()) alert('A két jelszó nem egyezik meg!');
		else $("#registration").submit();
	    }
	});

	$("#next2").click(function() {
	    $("#registration").submit();
	});
	
	$(".gal").lightBox();
	
	$("#logo").click(function() {
	    window.location = '/';
	});
	
	$(".sendSomething").find(".sbmt").click(function() {
	    var error;
	    $(this).parent().parent().find("input,textarea").each(function() {
		if($(this).val() == '') error = 1;
	    });
	    if(error == 1) {
		alert('Töltsd ki az összes mezõt az elküldéshez!');
	        return false;
	    }
	});
	
	$("#header #author .bg").css("opacity", 0.5);
	
	$("input[type='text']").attr("autocomplete","off");
	
})
