var showBlog=0;
function showBlogContent(){
	//alert("aaa");
	if(showBlog==0){
		$("#id_blog_header_left").html("<img src=\"images/blog/heva_nagy.jpg\" alt=\"\" border=\"0\"/>");
		$("#id_blog_header_left").css('height','690');
		$("#id_blog_header_right_text").hide();
		$("#id_blog_header_right_text_2").show();
		$("#id_blog_text_close").show();
		showBlog=1;
	}else{
		$("#id_blog_header_left").html("<img src=\"images/blog/heva_kicsi.jpg\" alt=\"\" border=\"0\"/>");
		$("#id_blog_header_right_text_2").hide();
		$("#id_blog_text_close").hide();
		$("#id_blog_header_left").css('height','146');
		$("#id_blog_header_right_text").show();
		showBlog=0;
	}
}

function openDialog(id){
//	alert(id);
	$("#blog_dialog_popup_"+id).dialog({
		autoOpen: false,
		height: 500,
		width: 700,
		modal: true,
		stack: true,
		resizable:false,
		draggable:false
	});
	$("#blog_dialog_popup_"+id).removeClass("blog_dialog_popup");
	$("#blog_dialog_popup_"+id).dialog('open');
	//$(".ui-dialog").aqFloater({attach: 'nw', duration: 1000, opacity: 1});

}

function sendMessage(id){
	var formOk=true;
	var cimzett=$("#id_cimzett_name_"+id).val();
	var felado=$("#id_felado_name_"+id).val();
	var uzenet=$("#id_uzenet_"+id).val();
	
	$("#id_popup_error_cimzett_"+id).html("");
	$("#id_popup_error_felado_"+id).html("");
	
	if(cimzett.length ==0){
		$("#id_popup_error_cimzett_"+id).html("A mező kitöltése kötelező!");
		formOk=false;
	}
	if(!validateEmail(cimzett) && cimzett.length>0){
		$("#id_popup_error_cimzett_"+id).html("Hibás e-mail cím!");
		formOk=false;
	}
	if(felado.length ==0){
		$("#id_popup_error_felado_"+id).html("A mező kitöltése kötelező!");
		formOk=false;
	}
	if(!validateEmail(felado) && felado.length>0){
		$("#id_popup_error_felado_"+id).html("Hibás e-mail cím!");
		formOk=false;
	}

	//alert(formOk);
	if(formOk){
		$.ajax({
			type: "POST",
			url: "blog_send_message.php",
			data: "cmd=send&blogId="+id+"&cimzett="+cimzett+"&felado="+felado+"&uzenet="+uzenet,
			success: function(msg){
				$("#blog_dialog_popup_"+id).dialog('close');
				if(msg==1)
					alert("Sikeres üzenetküldés!");
				else if(msg==2)
					alert("Sikertelen e-mail küldés, kérem próbálja újra!");
				else if(msg==0)
					alert("Sikertelen üzenetküldés!");
				
			}
		});
	}
}

