/**
*
*/
function openEmoDialog()
{
	$("#hdialog").dialog('open');
}
/**
*
*/
function moreBlogs(ourl)
{
	$("#mr-more-loading").show();

	var url = "http://" + location.host + "/" + ourl + "?vmode=ajax&p=" + (blogCurPage+1) + "&secret=" + secret;
	$.get(url, null, function(data){
		if( data != 'false' )
		{
			if( data == 'END-OF-DATA' )
			{
				var docs = '<div><p class="small">แสดงข้อมูลหมดแล้ว...</p></div>';
				$('#mr-more').before(docs);
				$('#mr-more').hide();
			}
			else
			{
				blogCurPage = blogCurPage + 1;
				$('#mr-more').before(data);

				$("div").find(".entry").hover(
					function()
					{
						$(this).addClass("entry-hover");
						$("#" + $(this).attr("id") + "-fn").show();
					}, 
					function(){
						$(this).removeClass("entry-hover");
						$("#" + $(this).attr("id") + "-fn").hide();
					}
				);

				$("p").find("a.fl").click(function(){
					var __id = $(this).attr("id").substr(3);
					$("#img-" + __id + "").attr("src", "/imgs/indicator.gif");
					var url = "http://" + location.host + "/ajax/content.php?id=" + __id + "&secret=" + secret;
					$.get(url, null, function(data){
						if( data != "false" )
						{
							$("#img-" + __id + "").attr("src", "http://s1.pics66.com/m/" + data + "");
							imgArr[__id] = data;
						}
						else
						{
							alert("เกิดข้อผิดพลาดบางประการ... กรุณา reload หน้านี้ใหม่แล้วลองอีกทีค่ะ...");
						}
					});
					$(this).hide();
					$("#fs-" + __id + "").show();
					$("#ic-" + __id + "").removeClass("img-small");
					$("#e-desc-" + __id + "").removeClass("desc");
					$("#e-desc-" + __id + "").addClass("desc-x");
				});

				$("p").find("a.fs").click(function()
				{
					var __id = $(this).attr("id").substr(3);
					
					var url = "http://" + location.host + "/ajax/content.php?id=" + __id + "&secret=" + secret;
					$.get(url, null, function(data){
						if( data != "false" )
						{
							$("#img-" + __id + "").attr("src", "http://s1.pics66.com/s/" + data + "");
							imgArr[__id] = data;
						}
						else
						{
							alert("เกิดข้อผิดพลาดบางประการ... กรุณา reload หน้านี้ใหม่แล้วลองอีกทีค่ะ...");
						}
					});
					
					$(this).hide();
					$("#fl-" + __id + "").show();
					$("#ic-" + __id + "").addClass("img-small");
					$("#e-desc-" + __id + "").removeClass("desc-x");
					$("#e-desc-" + __id + "").addClass("desc");
				});

				// var __curMemberId = 1000;
				$("p").find("a.fn-cmt").click(function(){
					var __id = $(this).attr("id").substr(4);
					$("#cmt-textbox-" + __id).hide();
					$("#cmt-fr-" + __id).show();
					$("#cmt-msg-" + __id).focus();
					$("#cmt-share-" + __id).hide();
					fetchCmt(__id, 1, $("#cmt-flag-" + __id).val());
				});
				
				$("div").find("input.cmt-btn").click(function(){
					var __id = $(this).attr("id").substr(15);
					var msg = $("#cmt-msg-" + __id).val();
					if( msg )
					{
						var __meta = $("#cmt-meta-" + __id).val();

						var url = "http://" + location.host + "/ajax/comment.php" ;
						$.post(url, { secret: "2d77737c9abc5393b21fb7140d068ef5", id: __id, meta: __meta, text: msg },
						function(res){
						if( res == "true" )
						{
						$("#cmt-msg-" + __id).val("");
						fetchCmt(__id, 1, $("#cmt-flag-" + __id).val());
						}
						else
						{
						alert("เกิดข้อผิดพลาดบางประการ กรุณา Reload หน้านี้ใหม่ แล้วลองอีกทีค่ะ...(ข้อมูลทางเทคนิคของข้อผิดพลาด : " + res + ")");
						}
						});
					}
				});
				$("p").find("a.fn-share").click(function(){
					var __id = $(this).attr("id").substr(6);
					$("#cmt-share-" + __id).toggle();
				});
			}

			$("#mr-more-loading").hide();
		}
	});
}
