﻿function signNewsletter() {
	$.ajax({
		type:"POST",
		url:"ajax_sign_newsletter.php",
		data:$("#newsletter_sign_form").serialize(),		
		dataType:"json",
		success:function(response, textStatus, XMLHttpRequest) {					
			$('#newsletter_info').html(response.message);			
			if (response.error) {
				$('#newsletter_info').attr('class', 'error');
			} else {
				$('#newsletter_info').attr('class', 'ok');
				$('input[name=user_email]').val('');
			}			
		}
	});
}

function btnChange(obj, pic) {
	$(obj).attr('src', pic);
}

function nyitZar(arrow, set_height) {
	if (set_height == null) set_height = 150;
	var inner = $(arrow).parent().prev().children();
	var inner_txt = inner.children('.txt');
	var inner_txt_height = inner_txt.height();	
	
	if ($(arrow).hasClass('arrow_down')) {
		inner.animate({
		"height": inner_txt_height
		}, 500, function() {
			$(arrow).removeClass().toggleClass('arrow_up');
		});	
	} else {
		inner.animate({
		"height": set_height
		}, 500, function() {
			$(arrow).removeClass().toggleClass('arrow_down');
		});			
	}
}

function removeAjaxLoading(that) {
	$(".ajax_loading").hide();
	$(that).show();
	$(that).attr('disabled', '');
}

function createAjaxLoading(that) {	
	$(that).attr('disabled', 'disabled');
	$("body").append('<div class="ajax_loading"></div>');
	var pos = $(that).offset();
	$(".ajax_loading").css({"left":pos.left, "top":pos.top});
	$(that).hide();
}
