function pop_login() {
	$("#overlay").css("height", $(document).height());
	$("#overlay").css("opacity", "0.5").show();
	$("body").append('<div class="pop_login"><div class="text">Hibás e-mail cím vagy jelszó!</div></div>');
	$(".pop_login").css("left", ($(document).width()/2)-126).click(function() {
	    $(this).remove();
	    $("#overlay").hide();
	});
}

function pop_order() {
	$("#overlay").css("height", $(document).height());
	$("#overlay").css("opacity", "0.5").show();
	$("body").append('<div class="pop_login"><div class="text">A rendeléshez minden adatra szükség van!</div></div>');
	$(".pop_login").css("left", ($(document).width()/2)-126).click(function() {
	    $(this).remove();
	    $("#overlay").hide();
	});
}

﻿$(document).ready(function() {
	$("input").attr("autocomplete","off");

	$(".login_box .login").click(function() {
		if($(".login_box .drop").css("display") == 'none') {
			$(".login_box .drop").show();
			$(".login_box").removeClass("close").addClass("open");
		} else {
			$(".login_box .drop").hide();
			$(".login_box").removeClass("open").addClass("close");
		}
		$(this).blur();
	});
	
	$(".login_username").click(function() {
		if($(this).val() == 'E-mail cím') $(this).val('');
	});
	
	$(".login_username").blur(function() {
		if($(this).val() == '') $(this).val('E-mail cím');
	});

	$(".login_password").click(function() {
		if($(this).val() == '*****') $(this).val('');
	});

	$(".login_password").blur(function() {
		if($(this).val() == '') $(this).val('*****');
	});
	
	$("#header .top .login_box .logoff, #header .top .login_box .registration, #header .top .login_box .help").click(function() {
		window.location = $(this).find("a").attr("href");
	});
	
	$("#header .bottom .menu .item").click(function() {
		if($(this).hasClass("vital")) {
			window.location = 'http://www.vitalhirek.hu';
		} else {
			window.location = $(this).find("a").attr("href");
		}
	});
	
	$("#data .data_left .feedbacks .item .name").click(function() {
		if($(this).parent().find(".text").css("display") != 'block') {
			$(this).parent().find(".text, .page").stop();
			
			$("#data .data_left .feedbacks .item .text").each(function() {
				if($(this).css("display") == 'block') {
					//alert('A');
					$(this).parent().find(".text, .page").animate({
						height: 1
					}, 350, 'swing', function() {
						$(this).parent().find(".text, .page").hide().height('auto');
					});
				}
			});

			var h = $(this).parent().find(".text").height()+14;
			$(this).parent().find(".text").height(1).animate({
				height: h
			}, 350, 'swing', function() {
				var h = $(this).parent().find(".page").height();
				$(this).parent().find(".page").height(1).animate({
					height: h
				}, 100, 'swing');
			});
		}
	});
	
	if($("#data .data_left .feedbacks .item").size() != 0) $("#data .data_left .feedbacks .item:first").find(".page, .text").show();
	
	$("#data .data_right .box .data .inner.promo").parent().height($("#data .data_right .box .inner").height()+24+($("#data .data_right .box .controll").height()-4)+$("#data .data_right .promo_data").height()+10);
	
	$("#data .data_right .box .controll .item").click(function() {
		if(!$(this).hasClass("act")) {
			$("#data .data_right .box .controll .item.act").removeClass("act");
			var t = $(this).find(".sign").html();
			
			$("#data .data_right .box .controll .item").each(function(i) {
				if($(this).find(".sign").html() == t) {
					$(this).addClass("act");
					$("#data .data_right .box .idata .act .pic").html($("#data .data_right .box .idata .trunk .item:eq(" + i + ") .pic").html());
					$("#data .data_right .promo_data").html($("#data .data_right .box .idata .trunk .item:eq(" + i + ") .text").html());
					$("#data .data_right .box .data .inner.promo").parent().height($("#data .data_right .box .inner").height()+24+($("#data .data_right .box .controll").height()-4)+$("#data .data_right .promo_data").height()+10);
				}
			});
		}
	});
	
	$("#data .data_right .box .products .item .overlay").click(function() {
	    window.location = $(this).parent().find("a").attr("href");
	});
	
	$(".overlay.link").click(function() {
	    window.location = $(this).parent().find("a").attr("href");
	});
	
	$(".tabs .item").click(function() {
	    if(!$(this).hasClass("active")) {
		$(".tabs .item.active").removeClass("active").find(".left, .right").remove();
		$(this).addClass("active").append('<div class="left"></div><div class="right"></div>');
		$(".tab.active").removeClass("active");
		$("." + $(this).attr("id")).addClass("active");
	    }
	});
	
	$(".checkbox_off").live('click', function() {
	    $(this).removeClass("checkbox_off").addClass("checkbox_on").attr("src", "/images/checkbox_on.png");
	    $(this).parent().find("input").val(1);
	});
	
	$(".checkbox_on").live('click', function() {
	    $(this).removeClass("checkbox_on").addClass("checkbox_off").attr("src", "/images/checkbox_off.png");
	    $(this).parent().find("input").val(0);
	});
	
	$(".reg_ok").click(function() {
	    if($("input[name='agree']").val() == 0) alert('A folytatáshoz el kell fogadni a jogi nyilatkozatot!');
	    else $("#reg").submit();
	});
	
	$("#data .data_right .box .inner .idata .act").live('click', function() {
	    window.location = $(this).parent().find("a").attr("href");
	});

	$(".login_button").click(function() {
	    ajax_cmd('login', $(".login_username").val(), $(".login_password").val());
	});
	
	$(".login_username, .login_password").keypress(function (e) {
    	    if(e.which == 13) ajax_cmd('login', $(".login_username").val(), $(".login_password").val());
	});
	
	$("select[name='order_type']").change(function() {
	    if($(this).val() == 2) {
		$(".ship").show();
	    } else {
		$(".ship").hide();
	    }
	});
	
	$(".order_end").click(function() {
	    if($("input[name='order_name']").val() == '' || $("input[name='order_name']").val() == ' ' || $("input[name='order_address']").val() == '' || $("select[name='order_type']").val() == 'null') {
		pop_order();
	    } else if($("select[name='order_type']").val() == 2) {
		if($("input[name='ship_name']").val() == '' || $("input[name='ship_address']").val() == '') {
		    pop_order();
		} else {
		    $("#order").submit();
		}
	    } else {
		$("#order").submit();
	    }
	});
});

